@centreon/ui 23.10.22 → 23.10.23
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/Dashboard/Dashboard.styles.ts +62 -60
- package/src/Dashboard/Grid.tsx +1 -1
- package/src/Dashboard/Item.tsx +9 -6
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/DataTable/Item/DataTableItem.tsx +2 -0
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Modal/ModalActions.tsx +4 -2
package/package.json
CHANGED
|
@@ -2,67 +2,69 @@ import { makeStyles } from 'tss-react/mui';
|
|
|
2
2
|
|
|
3
3
|
import { alpha } from '@mui/material';
|
|
4
4
|
|
|
5
|
-
export const useDashboardLayoutStyles = makeStyles()(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
5
|
+
export const useDashboardLayoutStyles = makeStyles<boolean>()(
|
|
6
|
+
(theme, isStatic: boolean) => ({
|
|
7
|
+
container: {
|
|
8
|
+
'& .react-grid-item': {
|
|
9
|
+
borderRadius: theme.shape.borderRadius,
|
|
10
|
+
transition: theme.transitions.create('all', {
|
|
11
|
+
delay: 0,
|
|
12
|
+
duration: 100,
|
|
13
|
+
easing: theme.transitions.easing.easeOut
|
|
14
|
+
})
|
|
15
|
+
},
|
|
16
|
+
'& .react-grid-item.react-draggable-dragging': {
|
|
17
|
+
boxShadow: theme.shadows[3]
|
|
18
|
+
},
|
|
19
|
+
'& .react-grid-item.react-grid-placeholder': {
|
|
20
|
+
backgroundColor: alpha(theme.palette.primary.main, 0.7)
|
|
21
|
+
},
|
|
22
|
+
'& .react-grid-item.resizing': {
|
|
23
|
+
boxShadow: theme.shadows[3]
|
|
24
|
+
},
|
|
25
|
+
'& .react-resizable-handle': {
|
|
26
|
+
backgroundColor: theme.palette.action.focus,
|
|
27
|
+
backgroundImage: 'none',
|
|
28
|
+
borderRadius: theme.shape.borderRadius,
|
|
29
|
+
display: isStatic ? 'none' : 'block',
|
|
30
|
+
opacity: 0,
|
|
31
|
+
position: 'absolute'
|
|
32
|
+
},
|
|
33
|
+
'& .react-resizable-handle.react-resizable-handle-e': {
|
|
34
|
+
cursor: 'ew-resize',
|
|
35
|
+
height: `calc(100% - ${theme.spacing(3)})`,
|
|
36
|
+
marginTop: 0,
|
|
37
|
+
right: 0,
|
|
38
|
+
top: 0,
|
|
39
|
+
transform: 'rotate(0deg)',
|
|
40
|
+
width: theme.spacing(1)
|
|
41
|
+
},
|
|
42
|
+
'& .react-resizable-handle.react-resizable-handle-s': {
|
|
43
|
+
bottom: 0,
|
|
44
|
+
cursor: 'ns-resize',
|
|
45
|
+
height: theme.spacing(1),
|
|
46
|
+
left: 0,
|
|
47
|
+
marginLeft: 0,
|
|
48
|
+
transform: 'rotate(0deg)',
|
|
49
|
+
width: `calc(100% - ${theme.spacing(3)})`
|
|
50
|
+
},
|
|
51
|
+
'& .react-resizable-handle.react-resizable-handle-se': {
|
|
52
|
+
bottom: 0,
|
|
53
|
+
cursor: 'nwse-resize',
|
|
54
|
+
height: theme.spacing(2),
|
|
55
|
+
right: 0,
|
|
56
|
+
transform: 'rotate(0deg)',
|
|
57
|
+
width: theme.spacing(2)
|
|
58
|
+
},
|
|
59
|
+
'& .react-resizable-handle::after': {
|
|
60
|
+
content: 'none'
|
|
61
|
+
},
|
|
62
|
+
'& .react-resizable-handle:hover': {
|
|
63
|
+
opacity: 1
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
+
})
|
|
67
|
+
);
|
|
66
68
|
|
|
67
69
|
export const useDashboardItemStyles = makeStyles()((theme) => ({
|
|
68
70
|
widgetContainer: {
|
package/src/Dashboard/Grid.tsx
CHANGED
package/src/Dashboard/Item.tsx
CHANGED
|
@@ -18,7 +18,7 @@ interface DashboardItemProps {
|
|
|
18
18
|
children: ReactElement;
|
|
19
19
|
className?: string;
|
|
20
20
|
header?: ReactElement;
|
|
21
|
-
|
|
21
|
+
id: string;
|
|
22
22
|
onMouseDown?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
23
23
|
onMouseUp?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
24
24
|
onTouchEnd?: (e) => void;
|
|
@@ -29,13 +29,13 @@ const Item = forwardRef(
|
|
|
29
29
|
(
|
|
30
30
|
{
|
|
31
31
|
children,
|
|
32
|
-
key,
|
|
33
32
|
style,
|
|
34
33
|
className,
|
|
35
34
|
header,
|
|
36
35
|
onMouseDown,
|
|
37
36
|
onMouseUp,
|
|
38
|
-
onTouchEnd
|
|
37
|
+
onTouchEnd,
|
|
38
|
+
id
|
|
39
39
|
}: DashboardItemProps,
|
|
40
40
|
ref: ForwardedRef<HTMLDivElement>
|
|
41
41
|
): ReactElement => {
|
|
@@ -55,14 +55,17 @@ const Item = forwardRef(
|
|
|
55
55
|
Component: (
|
|
56
56
|
<div
|
|
57
57
|
className={className}
|
|
58
|
-
key={key}
|
|
59
58
|
ref={ref}
|
|
60
59
|
style={style}
|
|
61
60
|
{...cardContainerListeners}
|
|
62
61
|
>
|
|
63
62
|
<Card className={classes.widgetContainer}>
|
|
64
63
|
{header && (
|
|
65
|
-
<div
|
|
64
|
+
<div
|
|
65
|
+
{...listeners}
|
|
66
|
+
className={classes.widgetHeader}
|
|
67
|
+
data-testid={`${id}_move_panel`}
|
|
68
|
+
>
|
|
66
69
|
{header}
|
|
67
70
|
</div>
|
|
68
71
|
)}
|
|
@@ -70,7 +73,7 @@ const Item = forwardRef(
|
|
|
70
73
|
</Card>
|
|
71
74
|
</div>
|
|
72
75
|
),
|
|
73
|
-
memoProps: [
|
|
76
|
+
memoProps: [style, className, header]
|
|
74
77
|
});
|
|
75
78
|
}
|
|
76
79
|
);
|
|
@@ -59,6 +59,7 @@ const DataTableItem = forwardRef(
|
|
|
59
59
|
<MuiCardActions>
|
|
60
60
|
<IconButton
|
|
61
61
|
aria-label="edit"
|
|
62
|
+
data-testid="edit"
|
|
62
63
|
icon={<EditIcon />}
|
|
63
64
|
size="small"
|
|
64
65
|
variant="primary"
|
|
@@ -66,6 +67,7 @@ const DataTableItem = forwardRef(
|
|
|
66
67
|
/>
|
|
67
68
|
<IconButton
|
|
68
69
|
aria-label="delete"
|
|
70
|
+
data-testid="delete"
|
|
69
71
|
icon={<DeleteIcon />}
|
|
70
72
|
size="small"
|
|
71
73
|
variant="ghost"
|
|
@@ -31,7 +31,8 @@ const ModalActions = ({
|
|
|
31
31
|
{children || (
|
|
32
32
|
<>
|
|
33
33
|
<Button
|
|
34
|
-
aria-label=
|
|
34
|
+
aria-label={labels?.cancel}
|
|
35
|
+
data-testid="cancel"
|
|
35
36
|
size="small"
|
|
36
37
|
variant="secondary"
|
|
37
38
|
onClick={() => onCancel?.()}
|
|
@@ -39,7 +40,8 @@ const ModalActions = ({
|
|
|
39
40
|
{labels?.cancel}
|
|
40
41
|
</Button>
|
|
41
42
|
<Button
|
|
42
|
-
aria-label=
|
|
43
|
+
aria-label={labels?.confirm}
|
|
44
|
+
data-testid="confirm"
|
|
43
45
|
isDanger={isDanger}
|
|
44
46
|
size="small"
|
|
45
47
|
type="submit"
|