@centreon/ui 23.10.45 → 23.10.46
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/package.json +1 -1
- package/src/ActionsList/index.tsx +12 -3
- package/src/Dashboard/Dashboard.styles.ts +4 -2
- package/src/Dashboard/Item.tsx +12 -3
- package/src/components/DataTable/EmptyState/DataTableEmptyState.tsx +2 -2
- package/src/components/Modal/Modal.styles.ts +4 -0
- package/src/components/Modal/Modal.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
/* eslint-disable react/no-array-index-key */
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
|
|
3
4
|
import { makeStyles } from 'tss-react/mui';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { equals } from 'ramda';
|
|
5
7
|
|
|
6
8
|
import {
|
|
7
9
|
SvgIconProps,
|
|
8
10
|
MenuList,
|
|
9
11
|
MenuItem,
|
|
10
12
|
ListItemText,
|
|
11
|
-
ListItemIcon
|
|
13
|
+
ListItemIcon,
|
|
14
|
+
Divider
|
|
12
15
|
} from '@mui/material';
|
|
13
16
|
|
|
14
17
|
interface ActionsType {
|
|
@@ -18,7 +21,7 @@ interface ActionsType {
|
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
interface Props {
|
|
21
|
-
actions: Array<ActionsType>;
|
|
24
|
+
actions: Array<ActionsType | 'divider'>;
|
|
22
25
|
className?: string;
|
|
23
26
|
}
|
|
24
27
|
|
|
@@ -34,7 +37,13 @@ const ActionsList = ({ className, actions }: Props): JSX.Element => {
|
|
|
34
37
|
|
|
35
38
|
return (
|
|
36
39
|
<MenuList className={cx(classes.list, className)}>
|
|
37
|
-
{actions?.map((
|
|
40
|
+
{actions?.map((action, idx) => {
|
|
41
|
+
if (equals(action, 'divider')) {
|
|
42
|
+
return <Divider key={`divider_${idx}`} />;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const { label, Icon, onClick } = action as ActionsType;
|
|
46
|
+
|
|
38
47
|
return (
|
|
39
48
|
<MenuItem aria-label={label} key={label} onClick={onClick}>
|
|
40
49
|
<ListItemIcon>
|
|
@@ -72,8 +72,7 @@ export const useDashboardItemStyles = makeStyles()((theme) => ({
|
|
|
72
72
|
width: '100%'
|
|
73
73
|
},
|
|
74
74
|
widgetContent: {
|
|
75
|
-
height: '100%'
|
|
76
|
-
padding: theme.spacing(1, 2)
|
|
75
|
+
height: '100%'
|
|
77
76
|
},
|
|
78
77
|
widgetHeader: {
|
|
79
78
|
'&:hover': {
|
|
@@ -81,5 +80,8 @@ export const useDashboardItemStyles = makeStyles()((theme) => ({
|
|
|
81
80
|
},
|
|
82
81
|
cursor: 'move',
|
|
83
82
|
padding: theme.spacing(0.5, 2)
|
|
83
|
+
},
|
|
84
|
+
widgetPadding: {
|
|
85
|
+
padding: theme.spacing(1, 2)
|
|
84
86
|
}
|
|
85
87
|
}));
|
package/src/Dashboard/Item.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import { useDashboardItemStyles } from './Dashboard.styles';
|
|
|
17
17
|
interface DashboardItemProps {
|
|
18
18
|
children: ReactElement;
|
|
19
19
|
className?: string;
|
|
20
|
+
disablePadding?: boolean;
|
|
20
21
|
header?: ReactElement;
|
|
21
22
|
id: string;
|
|
22
23
|
onMouseDown?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
@@ -35,11 +36,12 @@ const Item = forwardRef(
|
|
|
35
36
|
onMouseDown,
|
|
36
37
|
onMouseUp,
|
|
37
38
|
onTouchEnd,
|
|
38
|
-
id
|
|
39
|
+
id,
|
|
40
|
+
disablePadding = false
|
|
39
41
|
}: DashboardItemProps,
|
|
40
42
|
ref: ForwardedRef<HTMLDivElement>
|
|
41
43
|
): ReactElement => {
|
|
42
|
-
const { classes } = useDashboardItemStyles();
|
|
44
|
+
const { classes, cx } = useDashboardItemStyles();
|
|
43
45
|
|
|
44
46
|
const hasHeader = !isNil(header);
|
|
45
47
|
|
|
@@ -69,7 +71,14 @@ const Item = forwardRef(
|
|
|
69
71
|
{header}
|
|
70
72
|
</div>
|
|
71
73
|
)}
|
|
72
|
-
<div
|
|
74
|
+
<div
|
|
75
|
+
className={cx(
|
|
76
|
+
classes.widgetContent,
|
|
77
|
+
!disablePadding && classes.widgetPadding
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</div>
|
|
73
82
|
</Card>
|
|
74
83
|
</div>
|
|
75
84
|
),
|
|
@@ -12,7 +12,7 @@ import { useStyles } from './DataTableEmptyState.styles';
|
|
|
12
12
|
type ListEmptyStateProps = {
|
|
13
13
|
canCreate?: boolean;
|
|
14
14
|
labels: {
|
|
15
|
-
actions
|
|
15
|
+
actions?: {
|
|
16
16
|
create: string;
|
|
17
17
|
};
|
|
18
18
|
title: string;
|
|
@@ -42,7 +42,7 @@ const DataTableEmptyState = ({
|
|
|
42
42
|
iconVariant="start"
|
|
43
43
|
onClick={() => onCreate?.()}
|
|
44
44
|
>
|
|
45
|
-
{t(labels.actions
|
|
45
|
+
{t(labels.actions?.create || '')}
|
|
46
46
|
</Button>
|
|
47
47
|
)}
|
|
48
48
|
</div>
|