@centreon/ui 24.10.11 → 24.11.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/Form/Form.tsx +1 -0
- package/src/Graph/Chart/Chart.tsx +7 -1
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +2 -2
- package/src/Graph/Chart/InteractiveComponents/index.tsx +10 -2
- package/src/Graph/Chart/helpers/index.ts +5 -5
- package/src/Graph/Chart/index.tsx +6 -0
- package/src/components/Zoom/Zoom.tsx +2 -2
- package/src/components/Zoom/ZoomContent.tsx +2 -2
- package/src/components/index.ts +1 -0
package/package.json
CHANGED
package/src/Form/Form.tsx
CHANGED
|
@@ -56,6 +56,10 @@ interface Props extends LineChartProps {
|
|
|
56
56
|
shapeLines?: GlobalAreaLines;
|
|
57
57
|
thresholdUnit?: string;
|
|
58
58
|
thresholds?: ThresholdsModel;
|
|
59
|
+
transformMatrix?: {
|
|
60
|
+
fx?: (pointX: number) => number;
|
|
61
|
+
fy?: (pointY: number) => number;
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
const filterLines = (lines: Array<Line>, displayThreshold): Array<Line> => {
|
|
@@ -98,7 +102,8 @@ const Chart = ({
|
|
|
98
102
|
thresholds,
|
|
99
103
|
thresholdUnit,
|
|
100
104
|
limitLegend,
|
|
101
|
-
skipIntersectionObserver
|
|
105
|
+
skipIntersectionObserver,
|
|
106
|
+
transformMatrix
|
|
102
107
|
}: Props): JSX.Element => {
|
|
103
108
|
const { classes } = useChartStyles();
|
|
104
109
|
|
|
@@ -320,6 +325,7 @@ const Chart = ({
|
|
|
320
325
|
graphInterval
|
|
321
326
|
}}
|
|
322
327
|
zoomData={{ ...zoomPreview }}
|
|
328
|
+
transformMatrix={transformMatrix}
|
|
323
329
|
/>
|
|
324
330
|
{thresholds?.enabled && (
|
|
325
331
|
<Thresholds
|
|
@@ -58,10 +58,10 @@ const useTickGraph = ({
|
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
const mousePositionTimeTick = mousePosition
|
|
61
|
-
? getTimeValue({ timeSeries, x: mousePosition[0], xScale })
|
|
61
|
+
? getTimeValue({ timeSeries, x: mousePosition[0], xScale })?.timeTick
|
|
62
62
|
: 0;
|
|
63
63
|
const timeTickValue = mousePosition
|
|
64
|
-
? new Date(mousePositionTimeTick)
|
|
64
|
+
? new Date(mousePositionTimeTick || 0)
|
|
65
65
|
: null;
|
|
66
66
|
|
|
67
67
|
setTickAxisBottom(timeTickValue);
|
|
@@ -76,13 +76,18 @@ interface Props {
|
|
|
76
76
|
commonData: CommonData;
|
|
77
77
|
timeShiftZonesData: TimeShiftZonesData;
|
|
78
78
|
zoomData: ZoomPreviewModel;
|
|
79
|
+
transformMatrix?: {
|
|
80
|
+
fx?: (pointX: number) => number;
|
|
81
|
+
fy?: (pointY: number) => number;
|
|
82
|
+
}
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
const InteractionWithGraph = ({
|
|
82
86
|
zoomData,
|
|
83
87
|
commonData,
|
|
84
88
|
annotationData,
|
|
85
|
-
timeShiftZonesData
|
|
89
|
+
timeShiftZonesData,
|
|
90
|
+
transformMatrix
|
|
86
91
|
}: Props): JSX.Element => {
|
|
87
92
|
const { classes } = useStyles();
|
|
88
93
|
|
|
@@ -127,7 +132,10 @@ const InteractionWithGraph = ({
|
|
|
127
132
|
if (!mousePoint) {
|
|
128
133
|
return;
|
|
129
134
|
}
|
|
130
|
-
updateMousePosition([
|
|
135
|
+
updateMousePosition([
|
|
136
|
+
transformMatrix?.fx?.(mousePoint.x) ?? mousePoint.x,
|
|
137
|
+
transformMatrix?.fy?.(mousePoint.y) ?? mousePoint.y
|
|
138
|
+
]);
|
|
131
139
|
};
|
|
132
140
|
|
|
133
141
|
const mouseDown = (event): void => {
|
|
@@ -2,15 +2,15 @@ import dayjs from 'dayjs';
|
|
|
2
2
|
import durationPlugin from 'dayjs/plugin/duration';
|
|
3
3
|
import { gt, gte, isEmpty, isNil, prop, propEq, reject, sortBy } from 'ramda';
|
|
4
4
|
|
|
5
|
-
import { LineChartData } from '../../common/models';
|
|
5
|
+
import type { LineChartData } from '../../common/models';
|
|
6
6
|
import {
|
|
7
7
|
getLineData,
|
|
8
8
|
getTimeSeries,
|
|
9
9
|
getTimeValue
|
|
10
10
|
} from '../../common/timeSeries';
|
|
11
|
-
import { LinesData } from '../BasicComponents/Lines/models';
|
|
11
|
+
import type { LinesData } from '../BasicComponents/Lines/models';
|
|
12
12
|
import { dateFormat, timeFormat } from '../common';
|
|
13
|
-
import { GetDate, GraphInterval } from '../models';
|
|
13
|
+
import type { GetDate, GraphInterval } from '../models';
|
|
14
14
|
|
|
15
15
|
dayjs.extend(durationPlugin);
|
|
16
16
|
|
|
@@ -56,11 +56,11 @@ export const displayArea = (data: unknown): boolean =>
|
|
|
56
56
|
!isEmpty(data) && !isNil(data);
|
|
57
57
|
|
|
58
58
|
export const getDate = ({ positionX, xScale, timeSeries }: GetDate): Date => {
|
|
59
|
-
const
|
|
59
|
+
const timeValue = getTimeValue({
|
|
60
60
|
timeSeries,
|
|
61
61
|
x: positionX,
|
|
62
62
|
xScale
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
return new Date(timeTick);
|
|
65
|
+
return new Date(timeValue?.timeTick || 0);
|
|
66
66
|
};
|
|
@@ -34,6 +34,10 @@ interface Props extends Partial<LineChartProps> {
|
|
|
34
34
|
thresholds?: Thresholds;
|
|
35
35
|
getRef?: (ref: MutableRefObject<HTMLDivElement | null>) => void;
|
|
36
36
|
containerStyle?: string;
|
|
37
|
+
transformMatrix?: {
|
|
38
|
+
fx?: (pointX: number) => number;
|
|
39
|
+
fy?: (pointY: number) => number;
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
const WrapperChart = ({
|
|
@@ -65,6 +69,7 @@ const WrapperChart = ({
|
|
|
65
69
|
thresholdUnit,
|
|
66
70
|
limitLegend,
|
|
67
71
|
getRef,
|
|
72
|
+
transformMatrix,
|
|
68
73
|
...rest
|
|
69
74
|
}: Props): JSX.Element | null => {
|
|
70
75
|
const { classes, cx } = useChartStyles();
|
|
@@ -121,6 +126,7 @@ const WrapperChart = ({
|
|
|
121
126
|
width={width ?? responsiveWidth}
|
|
122
127
|
zoomPreview={zoomPreview}
|
|
123
128
|
skipIntersectionObserver={rest.skipIntersectionObserver}
|
|
129
|
+
transformMatrix={transformMatrix}
|
|
124
130
|
/>
|
|
125
131
|
);
|
|
126
132
|
}}
|
|
@@ -3,10 +3,10 @@ import { Zoom as VisxZoom } from '@visx/zoom';
|
|
|
3
3
|
import { ParentSize } from '../..';
|
|
4
4
|
|
|
5
5
|
import ZoomContent from './ZoomContent';
|
|
6
|
-
import { MinimapPosition } from './models';
|
|
6
|
+
import type { MinimapPosition } from './models';
|
|
7
7
|
|
|
8
8
|
export interface ZoomProps {
|
|
9
|
-
children: JSX.Element | (({ width, height }) => JSX.Element);
|
|
9
|
+
children: JSX.Element | (({ width, height, transformMatrix }) => JSX.Element);
|
|
10
10
|
id?: number | string;
|
|
11
11
|
minimapPosition?: MinimapPosition;
|
|
12
12
|
scaleMax?: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { RectClipPath } from '@visx/clip-path';
|
|
4
|
-
import { ProvidedZoom } from '@visx/zoom/lib/types';
|
|
4
|
+
import type { ProvidedZoom } from '@visx/zoom/lib/types';
|
|
5
5
|
|
|
6
6
|
import ZoomInIcon from '@mui/icons-material/Add';
|
|
7
7
|
import ZoomOutIcon from '@mui/icons-material/Remove';
|
|
@@ -12,7 +12,7 @@ import { IconButton } from '../Button';
|
|
|
12
12
|
import Minimap from './Minimap';
|
|
13
13
|
import { useZoomStyles } from './Zoom.styles';
|
|
14
14
|
import { minimapScale, radius } from './constants';
|
|
15
|
-
import { ChildrenProps, MinimapPosition, ZoomState } from './models';
|
|
15
|
+
import type { ChildrenProps, MinimapPosition, ZoomState } from './models';
|
|
16
16
|
import { useZoom } from './useZoom';
|
|
17
17
|
|
|
18
18
|
export interface Props {
|
package/src/components/index.ts
CHANGED
|
@@ -12,5 +12,6 @@ export * from './Avatar';
|
|
|
12
12
|
export * from './CollapsibleItem';
|
|
13
13
|
export * from './Inputs';
|
|
14
14
|
export { default as Zoom } from './Zoom/Zoom';
|
|
15
|
+
export type { ZoomState } from './Zoom/models';
|
|
15
16
|
export * from './Tabs';
|
|
16
17
|
export { default as CopyCommand } from './CopyCommand/CopyCommand';
|