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

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-34407-implement-the-status-chart-widget.1",
3
+ "version": "24.4.1-MON-24235-Filter-App-token.24",
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 as defaultlabelNoDataFound } from '../translatedLabels';
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()} `} {t(title)}
93
+ {`${numeral(total).format('0a').toUpperCase()} `} {title}
95
94
  </div>
96
95
  )}
97
96
  <div
@@ -147,7 +146,6 @@ const BarStack = ({
147
146
  >
148
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
@@ -10,7 +10,6 @@ export type BarStackProps = {
10
10
  data: Array<BarType>;
11
11
  displayLegend?: boolean;
12
12
  displayValues?: boolean;
13
- labelNoDataFound?: string;
14
13
  legendDirection?: 'row' | 'column';
15
14
  onSingleBarClick?: (barData) => void;
16
15
  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 as defaultlabelNoDataFound } from '../translatedLabels';
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
  />
@@ -11,7 +11,6 @@ export interface PieProps {
11
11
  displayLegend?: boolean;
12
12
  displayValues?: boolean;
13
13
  innerRadius?: number;
14
- labelNoDataFound?: string;
15
14
  legendDirection?: 'row' | 'column';
16
15
  onArcClick?: (ardata) => void;
17
16
  title?: string;
@@ -1,4 +1,4 @@
1
- import { includes, map, prop, reject } from 'ramda';
1
+ import { includes, map, prop, reject, sortBy, toLower, compose } from 'ramda';
2
2
  import { makeStyles } from 'tss-react/mui';
3
3
 
4
4
  import { Chip, ChipProps, Tooltip } from '@mui/material';
@@ -85,9 +85,11 @@ const MultiAutocompleteField = ({
85
85
  return includes(id, valueIds);
86
86
  };
87
87
 
88
+ const sortByName = sortBy(compose(toLower, prop(optionProperty)));
89
+
88
90
  const autocompleteOptions = disableSortedOptions
89
91
  ? options
90
- : [...values, ...reject(isOptionSelected, options)];
92
+ : sortByName([...values, ...reject(isOptionSelected, options)]);
91
93
 
92
94
  return (
93
95
  <Autocomplete
@@ -222,7 +222,8 @@ const AutocompleteField = React.forwardRef(
222
222
  ...params.inputProps,
223
223
  'aria-label': label,
224
224
  'data-testid': dataTestId || label,
225
- id: getNormalizedId(label || '')
225
+ id: getNormalizedId(label || ''),
226
+ ...autocompleteProps?.inputProps
226
227
  }}
227
228
  label={label}
228
229
  placeholder={isNil(placeholder) ? t(searchLabel) : placeholder}
@@ -6,14 +6,16 @@ import {
6
6
  ClickAwayListener,
7
7
  Paper,
8
8
  Popper,
9
- PopperPlacementType,
10
- useTheme
9
+ PopperPlacementType
11
10
  } from '@mui/material';
12
11
  import { PopperProps } from '@mui/material/Popper';
13
12
 
14
13
  import { IconButton } from '..';
15
14
 
16
- const useStyles = makeStyles()(() => ({
15
+ const useStyles = makeStyles()((theme) => ({
16
+ popover: {
17
+ zIndex: theme.zIndex.tooltip
18
+ },
17
19
  popoverIconButton: {
18
20
  padding: 0,
19
21
  width: '100%'
@@ -52,7 +54,7 @@ const PopoverMenu = ({
52
54
  getPopoverData,
53
55
  popperProps
54
56
  }: Props): JSX.Element => {
55
- const theme = useTheme();
57
+ // const theme = useTheme();
56
58
  const { classes, cx } = useStyles();
57
59
  const [anchorEl, setAnchorEl] = useState<HTMLElement | undefined>();
58
60
  const isOpen = Boolean(anchorEl);
@@ -105,9 +107,9 @@ const PopoverMenu = ({
105
107
  <Popper
106
108
  open
107
109
  anchorEl={anchorEl}
110
+ className={classes.popover}
108
111
  nonce={undefined}
109
112
  placement={popperPlacement}
110
- style={{ zIndex: theme.zIndex.tooltip }}
111
113
  onResize={(): undefined => undefined}
112
114
  onResizeCapture={(): undefined => undefined}
113
115
  {...popperProps}
@@ -1,10 +1,10 @@
1
1
  import { ForwardedRef, forwardRef, ReactElement, ReactNode } from 'react';
2
2
 
3
- import { ListItem as MuiListItem } from '@mui/material';
3
+ import { ListItemProps, ListItem as MuiListItem } from '@mui/material';
4
4
 
5
5
  import { useStyles } from './ListItem.styles';
6
6
 
7
- type ListItemProps = {
7
+ type Props = {
8
8
  action?: ReactElement;
9
9
  children: ReactNode | Array<ReactNode>;
10
10
  className?: string;
@@ -12,7 +12,7 @@ type ListItemProps = {
12
12
 
13
13
  export const ListItem = forwardRef(
14
14
  (
15
- { action, children, className, ...attr }: ListItemProps,
15
+ { action, children, className, ...attr }: Props & ListItemProps,
16
16
  ref?: ForwardedRef<HTMLLIElement>
17
17
  ) => {
18
18
  const { classes, cx } = useStyles();