@centreon/ui 24.4.1-MON-34407-implement-the-status-chart-widget.9 → 24.4.1-MON-37085-fix-fullscreen.0
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/Graph/BarStack/ResponsiveBarStack.tsx +5 -6
- package/src/Graph/BarStack/models.ts +0 -1
- package/src/Graph/PieChart/ResponsivePie.tsx +2 -4
- package/src/Graph/PieChart/models.ts +0 -1
- package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +23 -2
- package/src/utils/useFullscreen/useFullscreenListener.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@centreon/ui",
|
|
3
|
-
"version": "24.4.1-MON-
|
|
3
|
+
"version": "24.4.1-MON-37085-fix-fullscreen.0",
|
|
4
4
|
"description": "Centreon UI Components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
|
|
@@ -12,7 +12,7 @@ import { Tooltip } from '../../components';
|
|
|
12
12
|
import { LegendProps } from '../Legend/models';
|
|
13
13
|
import { Legend as LegendComponent } from '../Legend';
|
|
14
14
|
import { getValueByUnit } from '../common/utils';
|
|
15
|
-
import { labelNoDataFound
|
|
15
|
+
import { labelNoDataFound } from '../translatedLabels';
|
|
16
16
|
|
|
17
17
|
import { BarStackProps } from './models';
|
|
18
18
|
import { useBarStackStyles } from './BarStack.styles';
|
|
@@ -35,8 +35,7 @@ const BarStack = ({
|
|
|
35
35
|
unit = 'number',
|
|
36
36
|
displayValues,
|
|
37
37
|
variant = 'vertical',
|
|
38
|
-
legendDirection = 'column'
|
|
39
|
-
labelNoDataFound = defaultlabelNoDataFound
|
|
38
|
+
legendDirection = 'column'
|
|
40
39
|
}: BarStackProps & { height: number; width: number }): JSX.Element => {
|
|
41
40
|
const { t } = useTranslation();
|
|
42
41
|
const { classes } = useBarStackStyles();
|
|
@@ -91,7 +90,7 @@ const BarStack = ({
|
|
|
91
90
|
>
|
|
92
91
|
{title && (
|
|
93
92
|
<div className={classes.title} data-testid="Title" ref={titleRef}>
|
|
94
|
-
{`${numeral(total).format('0a').toUpperCase()} `} {
|
|
93
|
+
{`${numeral(total).format('0a').toUpperCase()} `} {title}
|
|
95
94
|
</div>
|
|
96
95
|
)}
|
|
97
96
|
<div
|
|
@@ -145,9 +144,8 @@ const BarStack = ({
|
|
|
145
144
|
isVerticalBar ? 'right-start' : 'bottom-start'
|
|
146
145
|
}
|
|
147
146
|
>
|
|
148
|
-
<g data-testid={bar.key}
|
|
147
|
+
<g data-testid={bar.key}>
|
|
149
148
|
<rect
|
|
150
|
-
cursor="pointer"
|
|
151
149
|
fill={bar.color}
|
|
152
150
|
height={
|
|
153
151
|
isVerticalBar ? bar.height - 1 : bar.height
|
|
@@ -157,6 +155,7 @@ const BarStack = ({
|
|
|
157
155
|
width={isVerticalBar ? bar.width : bar.width - 1}
|
|
158
156
|
x={bar.x}
|
|
159
157
|
y={bar.y}
|
|
158
|
+
onClick={onClick}
|
|
160
159
|
/>
|
|
161
160
|
{displayValues &&
|
|
162
161
|
bar.height > 10 &&
|
|
@@ -13,7 +13,7 @@ import { Tooltip } from '../../components';
|
|
|
13
13
|
import { Legend as LegendComponent } from '../Legend';
|
|
14
14
|
import { LegendProps } from '../Legend/models';
|
|
15
15
|
import { getValueByUnit } from '../common/utils';
|
|
16
|
-
import { labelNoDataFound
|
|
16
|
+
import { labelNoDataFound } from '../translatedLabels';
|
|
17
17
|
|
|
18
18
|
import { PieProps } from './models';
|
|
19
19
|
import { usePieStyles } from './PieChart.styles';
|
|
@@ -54,8 +54,7 @@ const ResponsivePie = ({
|
|
|
54
54
|
onArcClick,
|
|
55
55
|
displayValues,
|
|
56
56
|
TooltipContent,
|
|
57
|
-
legendDirection = 'column'
|
|
58
|
-
labelNoDataFound = defaultlabelNoDataFound
|
|
57
|
+
legendDirection = 'column'
|
|
59
58
|
}: PieProps & { height: number; width: number }): JSX.Element => {
|
|
60
59
|
const { t } = useTranslation();
|
|
61
60
|
const theme = useTheme();
|
|
@@ -179,7 +178,6 @@ const ResponsivePie = ({
|
|
|
179
178
|
>
|
|
180
179
|
<g data-testid={arc.data.label} onClick={onClick}>
|
|
181
180
|
<path
|
|
182
|
-
cursor="pointer"
|
|
183
181
|
d={pie.path(arc) as string}
|
|
184
182
|
fill={arc.data.color}
|
|
185
183
|
/>
|
|
@@ -22,6 +22,8 @@ const ChildComponent = (): JSX.Element => {
|
|
|
22
22
|
<Button onClick={() => toggleFullscreen(document.body)}>
|
|
23
23
|
{isFullscreenActivated ? labelExitFullscreen : labelEnterFullscreen}
|
|
24
24
|
</Button>
|
|
25
|
+
<input id="input" />
|
|
26
|
+
<textarea id="textarea" />
|
|
25
27
|
</div>
|
|
26
28
|
);
|
|
27
29
|
};
|
|
@@ -94,16 +96,35 @@ describe('Fullscreen', () => {
|
|
|
94
96
|
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
95
97
|
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
96
98
|
|
|
97
|
-
cy.get('#test').realPress(['
|
|
99
|
+
cy.get('#test').realPress(['F']);
|
|
98
100
|
|
|
99
101
|
cy.get('#test')
|
|
100
102
|
.should('have.attr', 'data-fullscreenActivated', 'true')
|
|
101
103
|
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
102
104
|
|
|
103
|
-
cy.get('#test').realPress(['
|
|
105
|
+
cy.get('#test').realPress(['F']);
|
|
104
106
|
|
|
105
107
|
cy.get('#test')
|
|
106
108
|
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
107
109
|
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
108
110
|
});
|
|
111
|
+
|
|
112
|
+
['input', 'textarea'].forEach((tag) => {
|
|
113
|
+
it(`cannot toggle fullscreen feature using the shortcut when ${tag === 'input' ? 'an' : 'a'} ${tag} is focused`, () => {
|
|
114
|
+
initialize();
|
|
115
|
+
|
|
116
|
+
cy.get('#test')
|
|
117
|
+
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
118
|
+
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
119
|
+
|
|
120
|
+
cy.get(`#${tag}`).focus();
|
|
121
|
+
|
|
122
|
+
cy.get('#test').realPress(['F']);
|
|
123
|
+
|
|
124
|
+
cy.get('#test')
|
|
125
|
+
.should('have.attr', 'data-fullscreenActivated', 'false')
|
|
126
|
+
.should('have.attr', 'data-fullscreenEnabled', 'true');
|
|
127
|
+
cy.get(`#${tag}`).should('have.value', 'F');
|
|
128
|
+
});
|
|
129
|
+
});
|
|
109
130
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
import { equals } from 'ramda';
|
|
3
|
+
import { equals, includes } from 'ramda';
|
|
4
4
|
import { useSearchParams } from 'react-router-dom';
|
|
5
5
|
|
|
6
6
|
import { useDeepCompare } from '../useMemoComponent';
|
|
@@ -16,7 +16,10 @@ export const useFullscreenListener = (): boolean => {
|
|
|
16
16
|
useFullscreen();
|
|
17
17
|
|
|
18
18
|
const toggle = (event: KeyboardEvent): void => {
|
|
19
|
-
if (
|
|
19
|
+
if (
|
|
20
|
+
includes(document.activeElement?.tagName, ['INPUT', 'TEXTAREA']) ||
|
|
21
|
+
!equals(event.code, 'KeyF')
|
|
22
|
+
) {
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
22
25
|
|