@centreon/ui 24.4.1-MON-24235-Filter-App-token.26 → 24.4.1-MON-34407-implement-the-status-chart-widget.2

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": "24.4.1-MON-24235-Filter-App-token.26",
3
+ "version": "24.4.1-MON-34407-implement-the-status-chart-widget.2",
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 } from '../translatedLabels';
15
+ import { labelNoDataFound as defaultlabelNoDataFound } from '../translatedLabels';
16
16
 
17
17
  import { BarStackProps } from './models';
18
18
  import { useBarStackStyles } from './BarStack.styles';
@@ -35,7 +35,8 @@ const BarStack = ({
35
35
  unit = 'number',
36
36
  displayValues,
37
37
  variant = 'vertical',
38
- legendDirection = 'column'
38
+ legendDirection = 'column',
39
+ labelNoDataFound = defaultlabelNoDataFound
39
40
  }: BarStackProps & { height: number; width: number }): JSX.Element => {
40
41
  const { t } = useTranslation();
41
42
  const { classes } = useBarStackStyles();
@@ -90,7 +91,7 @@ const BarStack = ({
90
91
  >
91
92
  {title && (
92
93
  <div className={classes.title} data-testid="Title" ref={titleRef}>
93
- {`${numeral(total).format('0a').toUpperCase()} `} {title}
94
+ {`${numeral(total).format('0a').toUpperCase()} `} {t(title)}
94
95
  </div>
95
96
  )}
96
97
  <div
@@ -144,8 +145,9 @@ const BarStack = ({
144
145
  isVerticalBar ? 'right-start' : 'bottom-start'
145
146
  }
146
147
  >
147
- <g data-testid={bar.key}>
148
+ <g data-testid={bar.key} onClick={onClick}>
148
149
  <rect
150
+ cursor="pointer"
149
151
  fill={bar.color}
150
152
  height={
151
153
  isVerticalBar ? bar.height - 1 : bar.height
@@ -155,7 +157,6 @@ const BarStack = ({
155
157
  width={isVerticalBar ? bar.width : bar.width - 1}
156
158
  x={bar.x}
157
159
  y={bar.y}
158
- onClick={onClick}
159
160
  />
160
161
  {displayValues &&
161
162
  bar.height > 10 &&
@@ -10,6 +10,7 @@ export type BarStackProps = {
10
10
  data: Array<BarType>;
11
11
  displayLegend?: boolean;
12
12
  displayValues?: boolean;
13
+ labelNoDataFound?: string;
13
14
  legendDirection?: 'row' | 'column';
14
15
  onSingleBarClick?: (barData) => void;
15
16
  size?: number;
@@ -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 } from '../translatedLabels';
16
+ import { labelNoDataFound as defaultlabelNoDataFound } from '../translatedLabels';
17
17
 
18
18
  import { PieProps } from './models';
19
19
  import { usePieStyles } from './PieChart.styles';
@@ -54,7 +54,8 @@ const ResponsivePie = ({
54
54
  onArcClick,
55
55
  displayValues,
56
56
  TooltipContent,
57
- legendDirection = 'column'
57
+ legendDirection = 'column',
58
+ labelNoDataFound = defaultlabelNoDataFound
58
59
  }: PieProps & { height: number; width: number }): JSX.Element => {
59
60
  const { t } = useTranslation();
60
61
  const theme = useTheme();
@@ -178,6 +179,7 @@ const ResponsivePie = ({
178
179
  >
179
180
  <g data-testid={arc.data.label} onClick={onClick}>
180
181
  <path
182
+ cursor="pointer"
181
183
  d={pie.path(arc) as string}
182
184
  fill={arc.data.color}
183
185
  />
@@ -11,6 +11,7 @@ export interface PieProps {
11
11
  displayLegend?: boolean;
12
12
  displayValues?: boolean;
13
13
  innerRadius?: number;
14
+ labelNoDataFound?: string;
14
15
  legendDirection?: 'row' | 'column';
15
16
  onArcClick?: (ardata) => void;
16
17
  title?: string;
@@ -1,4 +1,4 @@
1
- import { includes, map, prop, reject, sortBy, toLower, compose } from 'ramda';
1
+ import { includes, map, prop, reject } from 'ramda';
2
2
  import { makeStyles } from 'tss-react/mui';
3
3
 
4
4
  import { Chip, ChipProps, Tooltip } from '@mui/material';
@@ -85,11 +85,9 @@ const MultiAutocompleteField = ({
85
85
  return includes(id, valueIds);
86
86
  };
87
87
 
88
- const sortByName = sortBy(compose(toLower, prop(optionProperty)));
89
-
90
88
  const autocompleteOptions = disableSortedOptions
91
89
  ? options
92
- : sortByName([...values, ...reject(isOptionSelected, options)]);
90
+ : [...values, ...reject(isOptionSelected, options)];
93
91
 
94
92
  return (
95
93
  <Autocomplete
@@ -222,8 +222,7 @@ const AutocompleteField = React.forwardRef(
222
222
  ...params.inputProps,
223
223
  'aria-label': label,
224
224
  'data-testid': dataTestId || label,
225
- id: getNormalizedId(label || ''),
226
- ...autocompleteProps?.inputProps
225
+ id: getNormalizedId(label || '')
227
226
  }}
228
227
  label={label}
229
228
  placeholder={isNil(placeholder) ? t(searchLabel) : placeholder}
@@ -6,16 +6,14 @@ import {
6
6
  ClickAwayListener,
7
7
  Paper,
8
8
  Popper,
9
- PopperPlacementType
9
+ PopperPlacementType,
10
+ useTheme
10
11
  } from '@mui/material';
11
12
  import { PopperProps } from '@mui/material/Popper';
12
13
 
13
14
  import { IconButton } from '..';
14
15
 
15
- const useStyles = makeStyles()((theme) => ({
16
- popover: {
17
- zIndex: theme.zIndex.tooltip
18
- },
16
+ const useStyles = makeStyles()(() => ({
19
17
  popoverIconButton: {
20
18
  padding: 0,
21
19
  width: '100%'
@@ -54,7 +52,7 @@ const PopoverMenu = ({
54
52
  getPopoverData,
55
53
  popperProps
56
54
  }: Props): JSX.Element => {
57
- // const theme = useTheme();
55
+ const theme = useTheme();
58
56
  const { classes, cx } = useStyles();
59
57
  const [anchorEl, setAnchorEl] = useState<HTMLElement | undefined>();
60
58
  const isOpen = Boolean(anchorEl);
@@ -107,9 +105,9 @@ const PopoverMenu = ({
107
105
  <Popper
108
106
  open
109
107
  anchorEl={anchorEl}
110
- className={classes.popover}
111
108
  nonce={undefined}
112
109
  placement={popperPlacement}
110
+ style={{ zIndex: theme.zIndex.tooltip }}
113
111
  onResize={(): undefined => undefined}
114
112
  onResizeCapture={(): undefined => undefined}
115
113
  {...popperProps}
@@ -1,10 +1,10 @@
1
1
  import { ForwardedRef, forwardRef, ReactElement, ReactNode } from 'react';
2
2
 
3
- import { ListItemProps, ListItem as MuiListItem } from '@mui/material';
3
+ import { ListItem as MuiListItem } from '@mui/material';
4
4
 
5
5
  import { useStyles } from './ListItem.styles';
6
6
 
7
- type Props = {
7
+ type ListItemProps = {
8
8
  action?: ReactElement;
9
9
  children: ReactNode | Array<ReactNode>;
10
10
  className?: string;
@@ -12,7 +12,7 @@ type Props = {
12
12
 
13
13
  export const ListItem = forwardRef(
14
14
  (
15
- { action, children, className, ...attr }: Props & ListItemProps,
15
+ { action, children, className, ...attr }: ListItemProps,
16
16
  ref?: ForwardedRef<HTMLLIElement>
17
17
  ) => {
18
18
  const { classes, cx } = useStyles();