@centreon/ui 26.7.0 → 26.7.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "26.7.0",
3
+ "version": "26.7.1",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -278,7 +278,6 @@ const ResponsiveBarChart = ({
278
278
  placement="top"
279
279
  >
280
280
  <div className={classes.tooltipChildren}>
281
- {/* @ts-expect-error - suppressing pre-existing type mismatch */}
282
281
  <ChartSvgWrapper
283
282
  allUnits={allUnits}
284
283
  axis={axis}
@@ -317,7 +317,6 @@ const Chart = ({
317
317
  tooltip={tooltip}
318
318
  >
319
319
  <div className={classes.tooltipChildren}>
320
- {/* @ts-expect-error - suppressing pre-existing type mismatch */}
321
320
  <ChartSvgWrapper
322
321
  allUnits={allUnits}
323
322
  axis={axis}
@@ -8,6 +8,8 @@ import type { Thresholds } from '../common/models';
8
8
 
9
9
  type AnimatedStyles = { endAngle: number; opacity: number; startAngle: number };
10
10
 
11
+ const AnimatedPath = animated('path');
12
+
11
13
  const fromLeaveTransition = ({
12
14
  endAngle
13
15
  }: {
@@ -63,7 +65,7 @@ const AnimatedPie = <Datum,>({
63
65
 
64
66
  return transitions((props, arc, { key }) => (
65
67
  <g key={key}>
66
- <animated.path
68
+ <AnimatedPath
67
69
  d={to([props.startAngle, props.endAngle], (startAngle, endAngle) =>
68
70
  path({
69
71
  ...arc,
@@ -20,6 +20,8 @@ import type { SingleBarProps } from './models';
20
20
  import { barHeights, lineMargins } from './ThresholdLine';
21
21
  import Thresholds, { groupMargin } from './Thresholds';
22
22
 
23
+ const AnimatedRect = animated('rect');
24
+
23
25
  interface Props extends SingleBarProps {
24
26
  height: number;
25
27
  width: number;
@@ -176,7 +178,7 @@ const ResponsiveSingleBar = ({
176
178
  <title>single bar</title>
177
179
  <Group.Group>
178
180
  {text}
179
- <animated.rect
181
+ <AnimatedRect
180
182
  data-testid={`${latestMetricData}-bar-${barColor}`}
181
183
  fill={barColor}
182
184
  height={realBarHeight}
@@ -1,7 +1,7 @@
1
1
  import { Group } from '@visx/visx';
2
2
  import type { ScaleBand, ScaleLinear, ScaleTime } from 'd3-scale';
3
3
  import { equals } from 'ramda';
4
- import type { MutableRefObject, ReactElement } from 'react';
4
+ import type { MutableRefObject, ReactElement, ReactNode } from 'react';
5
5
 
6
6
  import { margin } from '../../Chart/common';
7
7
  import type { ChartAxis } from '../../Chart/models';
@@ -15,7 +15,7 @@ interface Props {
15
15
  allUnits: Array<string>;
16
16
  axis?: ChartAxis;
17
17
  base?: number;
18
- children: JSX.Element;
18
+ children: ReactNode;
19
19
  displayedLines: Array<Line>;
20
20
  graphHeight: number;
21
21
  graphWidth: number;
@@ -343,19 +343,14 @@ const getTimeSeriesForLines = ({
343
343
  return map(
344
344
  ({ timeTick, ...metricsValue }): TimeValue => ({
345
345
  ...reduce(
346
- (acc, metric_id): Omit<TimeValue, 'timePick'> => {
347
- return {
348
- ...acc,
349
- [metric_id]:
350
- invert &&
351
- metricsValue[metric_id] &&
352
- gt(metricsValue[metric_id], 0)
353
- ? negate(metricsValue[metric_id])
354
- : metricsValue[metric_id]
355
- };
356
- },
357
- // @ts-expect-error - suppressing pre-existing type mismatch
358
- {},
346
+ (acc, metric_id): Omit<TimeValue, 'timePick'> => ({
347
+ ...acc,
348
+ [metric_id]:
349
+ invert && metricsValue[metric_id] && gt(metricsValue[metric_id], 0)
350
+ ? negate(metricsValue[metric_id])
351
+ : metricsValue[metric_id]
352
+ }),
353
+ {} as Omit<TimeValue, 'timePick'>,
359
354
  metrics
360
355
  ),
361
356
  timeTick
@@ -3,7 +3,16 @@ import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft';
3
3
  import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight';
4
4
  import LastPageIcon from '@mui/icons-material/LastPage';
5
5
  import IconButton from '@mui/material/IconButton';
6
- import type { TablePaginationActionsProps } from '@mui/material/TablePagination/TablePaginationActions';
6
+
7
+ type TablePaginationActionsProps = {
8
+ count: number;
9
+ onPageChange: (
10
+ event: React.MouseEvent<HTMLButtonElement> | null,
11
+ page: number
12
+ ) => void;
13
+ page: number;
14
+ rowsPerPage: number;
15
+ };
7
16
 
8
17
  import { useTranslation } from 'react-i18next';
9
18
 
@@ -48,7 +48,7 @@ const SelectActionListingHeaderCell = ({
48
48
  icon={<ArrowDropDownIcon />}
49
49
  title={labelPredefinedRowsSelectionMenu}
50
50
  >
51
- {(props): JSX.Element => (
51
+ {(props: { close?: () => void } | undefined): JSX.Element => (
52
52
  <PredefinedSelectionList
53
53
  close={props?.close ?? ((): void => undefined)}
54
54
  onSelectRowsWithCondition={onSelectRowsWithCondition}
@@ -38,16 +38,16 @@ export interface UseFetchQueryProps<T> {
38
38
  useLongCache?: boolean;
39
39
  }
40
40
 
41
- export interface PrefetchPageParams {
42
- getPrefetchQueryKey: (page: number) => QueryKey;
43
- page: number;
44
- }
45
-
46
41
  export interface PrefetchQueryParams {
47
42
  endpointParams?: PrefetchEndpointParams;
48
43
  queryKey: QueryKey;
49
44
  }
50
45
 
46
+ export interface PrefetchPageParams {
47
+ getPrefetchQueryKey: (page: number) => QueryKey;
48
+ page: number;
49
+ }
50
+
51
51
  export type UseFetchQueryState<T> = {
52
52
  data?: T;
53
53
  error: Omit<ResponseError, 'isError'> | null;
@@ -82,7 +82,11 @@ const useFetchQuery = <T extends object>({
82
82
 
83
83
  const { showErrorMessage } = useSnackbar();
84
84
 
85
- const isCypressTest = equals(window.Cypress?.testingType, 'component');
85
+ const isCypressTest = equals(
86
+ (window as Window & { Cypress?: { testingType: string } }).Cypress
87
+ ?.testingType,
88
+ 'component'
89
+ );
86
90
 
87
91
  const cacheOptions =
88
92
  !isCypressTest && useLongCache ? { gcTime: 60 * 1000 } : {};
@@ -10,9 +10,6 @@ export const useTabsStyles = makeStyles()((theme) => ({
10
10
  minWidth: 0,
11
11
  padding: theme.spacing(0.5, 0)
12
12
  },
13
- tabPanel: {
14
- padding: theme.spacing(1, 0, 0)
15
- },
16
13
  tabs: {
17
14
  minHeight: theme.spacing(4.5)
18
15
  }
@@ -1,22 +1,12 @@
1
1
  import { TabPanel as MuiTabPanel } from '@mui/lab';
2
2
 
3
- import { useTabsStyles } from './Tab.styles';
4
-
5
3
  type Props = {
6
4
  children: JSX.Element;
7
5
  value: string;
8
6
  };
9
7
 
10
- export const TabPanel = ({ children, value }: Props): JSX.Element => {
11
- const { classes } = useTabsStyles();
12
-
13
- return (
14
- <MuiTabPanel
15
- className={classes.tabPanel}
16
- data-tabPanel={value}
17
- value={value}
18
- >
19
- {children}
20
- </MuiTabPanel>
21
- );
22
- };
8
+ export const TabPanel = ({ children, value }: Props): JSX.Element => (
9
+ <MuiTabPanel className="p-0 pt-2" data-tabPanel={value} value={value}>
10
+ {children}
11
+ </MuiTabPanel>
12
+ );