@applica-software-guru/react-admin 1.0.47 → 1.0.52
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/bitbucket-pipelines.yml +2 -1
- package/dist/components/MainCard.d.ts +70 -1
- package/dist/components/MainCard.d.ts.map +1 -1
- package/dist/components/ra-lists/Datagrid.d.ts +19 -6
- package/dist/components/ra-lists/Datagrid.d.ts.map +1 -1
- package/dist/components/ra-lists/Empty.d.ts +42 -17
- package/dist/components/ra-lists/Empty.d.ts.map +1 -1
- package/dist/components/ra-lists/List.d.ts +8 -6
- package/dist/components/ra-lists/List.d.ts.map +1 -1
- package/dist/components/ra-lists/index.d.ts +1 -1
- package/dist/components/ra-lists/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/react-admin.cjs.js +42 -42
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +5 -3
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +42 -42
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/{MainCard.jsx → MainCard.tsx} +74 -3
- package/src/components/ra-lists/{Datagrid.jsx → Datagrid.tsx} +14 -3
- package/src/components/ra-lists/{Empty.jsx → Empty.tsx} +31 -2
- package/src/components/ra-lists/{List.jsx → List.tsx} +3 -2
- package/src/index.jsx +1 -0
- /package/src/components/ra-lists/{index.jsx → index.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Card, CardContent, CardHeader, Divider, Typography } from '@mui/material';
|
|
2
|
-
import { lighten, useTheme } from '@mui/material/styles';
|
|
2
|
+
import { SxProps, lighten, useTheme } from '@mui/material/styles';
|
|
3
3
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { forwardRef } from 'react';
|
|
@@ -9,6 +9,74 @@ const headerSX = {
|
|
|
9
9
|
'& .MuiCardHeader-action': { m: '0px auto', alignSelf: 'center' }
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
export type MainCardProps = {
|
|
13
|
+
/**
|
|
14
|
+
* Indicates if the card must be rendered with a border.
|
|
15
|
+
*/
|
|
16
|
+
border?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates if the card must be rendered with a box shadow.
|
|
19
|
+
*/
|
|
20
|
+
boxShadow?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The content of the card.
|
|
23
|
+
*/
|
|
24
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
25
|
+
/**
|
|
26
|
+
* The subheader of the card.
|
|
27
|
+
*/
|
|
28
|
+
subheader?: React.ReactNode | string;
|
|
29
|
+
/**
|
|
30
|
+
* Indicates if the card must be rendered with a content.
|
|
31
|
+
*/
|
|
32
|
+
content?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The class name of the content.
|
|
35
|
+
*/
|
|
36
|
+
contentClass?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The style of the content.
|
|
39
|
+
*/
|
|
40
|
+
contentSX?: SxProps | any;
|
|
41
|
+
/**
|
|
42
|
+
* Indicates if the title of the card must be rendered with a dark color.
|
|
43
|
+
*/
|
|
44
|
+
darkTitle?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Indicates if the card must be rendered with a divider.
|
|
47
|
+
*/
|
|
48
|
+
divider?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The elevation of the card.
|
|
51
|
+
*/
|
|
52
|
+
elevation?: number;
|
|
53
|
+
/**
|
|
54
|
+
* The secondary content of the card.
|
|
55
|
+
*/
|
|
56
|
+
secondary?: React.ReactNode | string | object;
|
|
57
|
+
/**
|
|
58
|
+
* The shadow of the card.
|
|
59
|
+
* @example '0px 0px 0px 0px rgba(0,0,0,0.2)'
|
|
60
|
+
*/
|
|
61
|
+
shadow?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The style of the card.
|
|
64
|
+
*/
|
|
65
|
+
sx?: SxProps | any;
|
|
66
|
+
/**
|
|
67
|
+
* The title of the card.
|
|
68
|
+
*/
|
|
69
|
+
title?: React.ReactNode | string | object;
|
|
70
|
+
/**
|
|
71
|
+
* Indicates if the card must be rendered as a modal.
|
|
72
|
+
*/
|
|
73
|
+
modal?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The color of the card.
|
|
76
|
+
*/
|
|
77
|
+
color?: 'default' | 'primary' | 'secondary';
|
|
78
|
+
};
|
|
79
|
+
|
|
12
80
|
const MainCard = forwardRef(
|
|
13
81
|
(
|
|
14
82
|
{
|
|
@@ -28,14 +96,15 @@ const MainCard = forwardRef(
|
|
|
28
96
|
modal = false,
|
|
29
97
|
color = 'default',
|
|
30
98
|
...others
|
|
31
|
-
},
|
|
99
|
+
}: MainCardProps,
|
|
32
100
|
ref
|
|
33
101
|
) => {
|
|
34
|
-
const theme = useTheme();
|
|
102
|
+
const theme = useTheme() as any;
|
|
35
103
|
boxShadow = theme.palette.mode === 'dark' ? boxShadow || true : boxShadow;
|
|
36
104
|
return (
|
|
37
105
|
<Card
|
|
38
106
|
elevation={elevation || 0}
|
|
107
|
+
// @ts-ignore
|
|
39
108
|
ref={ref}
|
|
40
109
|
{...others}
|
|
41
110
|
sx={{
|
|
@@ -69,6 +138,7 @@ const MainCard = forwardRef(
|
|
|
69
138
|
}}
|
|
70
139
|
>
|
|
71
140
|
{!darkTitle && title && (
|
|
141
|
+
/** @ts-ignore */
|
|
72
142
|
<CardHeader
|
|
73
143
|
sx={headerSX}
|
|
74
144
|
titleTypographyProps={{ variant: 'subtitle1' }}
|
|
@@ -77,6 +147,7 @@ const MainCard = forwardRef(
|
|
|
77
147
|
subheader={subheader}
|
|
78
148
|
/>
|
|
79
149
|
)}
|
|
150
|
+
{/** @ts-ignore */}
|
|
80
151
|
{darkTitle && title && <CardHeader sx={headerSX} title={<Typography variant="h4">{title}</Typography>} action={secondary} />}
|
|
81
152
|
{title && divider && <Divider />}
|
|
82
153
|
{content && <CardContent sx={contentSX}>{children}</CardContent>}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Datagrid as RaDatagrid } from 'react-admin';
|
|
1
|
+
import { DatagridProps, Datagrid as RaDatagrid } from 'react-admin';
|
|
2
|
+
|
|
2
3
|
import { styled } from '@mui/material/styles';
|
|
3
4
|
|
|
4
5
|
const ApplicaStyledDatagrid = styled(RaDatagrid, {
|
|
5
|
-
name: '
|
|
6
|
+
name: 'ApplicaDatagrid',
|
|
6
7
|
slot: 'root'
|
|
7
8
|
})(() => ({
|
|
8
9
|
// Resolve an issue related to the visualization of the bulk actions toolbar.
|
|
@@ -29,7 +30,17 @@ const ApplicaStyledDatagrid = styled(RaDatagrid, {
|
|
|
29
30
|
}
|
|
30
31
|
}));
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
/**
|
|
34
|
+
* This component is a wrapper of the React-Admin Datagrid component.
|
|
35
|
+
* It is used to customize the Datagrid component.
|
|
36
|
+
* It is used by the List component.
|
|
37
|
+
* It is not meant to be used directly.
|
|
38
|
+
* Thsi version is designed by Applica for Mantis and expose few overrides on css styles based on this theme.
|
|
39
|
+
*
|
|
40
|
+
* @param {DatagridProps} props
|
|
41
|
+
* @returns {JSX.Element}
|
|
42
|
+
*/
|
|
43
|
+
const Datagrid = (props: DatagridProps): JSX.Element => <ApplicaStyledDatagrid {...props} />;
|
|
33
44
|
|
|
34
45
|
Datagrid.propTypes = {
|
|
35
46
|
...RaDatagrid.propTypes
|
|
@@ -8,11 +8,40 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { Typography } from '@mui/material';
|
|
9
9
|
import { styled } from '@mui/material/styles';
|
|
10
10
|
|
|
11
|
+
export type EmptyProps = {
|
|
12
|
+
/**
|
|
13
|
+
* The actions of the empty page.
|
|
14
|
+
*
|
|
15
|
+
* @example <Button label="Refresh" onClick={refresh} />
|
|
16
|
+
* @example <Button label="Add" onClick={add} />
|
|
17
|
+
* @example <Button label="Export" onClick={export} />
|
|
18
|
+
* @example <Button label="Import" onClick={import} />
|
|
19
|
+
**/
|
|
20
|
+
actions?: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* The class name of the empty page.
|
|
23
|
+
*
|
|
24
|
+
* @example 'my-custom-empty'
|
|
25
|
+
* @example 'my-custom-empty my-custom-empty--full-width'
|
|
26
|
+
**/
|
|
27
|
+
className?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
11
30
|
const StyledToolbar = styled('div')(({ theme }) => ({
|
|
12
31
|
padding: theme.spacing(2)
|
|
13
32
|
}));
|
|
14
33
|
|
|
15
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The Empty component is used to display a message when the list is empty.
|
|
36
|
+
* This component can be used only inside a List component.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <List empty={<Empty actions={<Button label="Add" onClick={add} />} />} />
|
|
40
|
+
*
|
|
41
|
+
* @param {EmptyProps}
|
|
42
|
+
* @returns {JSX.Element}
|
|
43
|
+
*/
|
|
44
|
+
const Empty = ({ actions, className, ...props }: EmptyProps): JSX.Element => {
|
|
16
45
|
const { hasCreate } = useResourceDefinition(props);
|
|
17
46
|
const resource = useResourceContext(props);
|
|
18
47
|
|
|
@@ -50,7 +79,7 @@ const Empty = ({ actions, className, ...props }) => {
|
|
|
50
79
|
);
|
|
51
80
|
};
|
|
52
81
|
|
|
53
|
-
const PREFIX = '
|
|
82
|
+
const PREFIX = 'ApplicaEmpty';
|
|
54
83
|
|
|
55
84
|
export const EmptyClasses = {
|
|
56
85
|
message: `${PREFIX}-message`,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ListProps, List as RaList } from 'react-admin';
|
|
2
|
+
|
|
1
3
|
import MainCard from '../MainCard';
|
|
2
|
-
import { List as RaList } from 'react-admin';
|
|
3
4
|
import { styled } from '@mui/system';
|
|
4
5
|
|
|
5
6
|
const ApplicaStyledList = styled(RaList, {
|
|
@@ -63,7 +64,7 @@ const ApplicaStyledList = styled(RaList, {
|
|
|
63
64
|
}
|
|
64
65
|
}));
|
|
65
66
|
|
|
66
|
-
const List = (props) => {
|
|
67
|
+
const List = (props: ListProps): JSX.Element => {
|
|
67
68
|
return (
|
|
68
69
|
<MainCard content={false}>
|
|
69
70
|
<ApplicaStyledList {...RaList.defaultProps} {...props} />
|
package/src/index.jsx
CHANGED
|
File without changes
|