@centreon/ui 24.4.51 → 24.4.53
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/InputField/Select/Autocomplete/Multi/index.tsx +4 -2
- package/src/InputField/Select/Autocomplete/index.tsx +2 -1
- package/src/PopoverMenu/index.tsx +6 -5
- package/src/components/DataTable/Item/DataTableItem.tsx +9 -28
- package/src/components/List/Item/ListItem.tsx +3 -3
package/package.json
CHANGED
|
@@ -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,6 @@ const PopoverMenu = ({
|
|
|
52
54
|
getPopoverData,
|
|
53
55
|
popperProps
|
|
54
56
|
}: Props): JSX.Element => {
|
|
55
|
-
const theme = useTheme();
|
|
56
57
|
const { classes, cx } = useStyles();
|
|
57
58
|
const [anchorEl, setAnchorEl] = useState<HTMLElement | undefined>();
|
|
58
59
|
const isOpen = Boolean(anchorEl);
|
|
@@ -105,9 +106,9 @@ const PopoverMenu = ({
|
|
|
105
106
|
<Popper
|
|
106
107
|
open
|
|
107
108
|
anchorEl={anchorEl}
|
|
109
|
+
className={classes.popover}
|
|
108
110
|
nonce={undefined}
|
|
109
111
|
placement={popperPlacement}
|
|
110
|
-
style={{ zIndex: theme.zIndex.tooltip }}
|
|
111
112
|
onResize={(): undefined => undefined}
|
|
112
113
|
onResizeCapture={(): undefined => undefined}
|
|
113
114
|
{...popperProps}
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
} from '@mui/icons-material';
|
|
15
15
|
|
|
16
16
|
import { IconButton } from '../../Button';
|
|
17
|
-
import { ConfirmationTooltip } from '../../Tooltip/ConfirmationTooltip';
|
|
18
17
|
|
|
19
18
|
import { useStyles } from './DataTableItem.styles';
|
|
20
19
|
|
|
@@ -22,13 +21,6 @@ export interface DataTableItemProps {
|
|
|
22
21
|
description?: string;
|
|
23
22
|
hasActions?: boolean;
|
|
24
23
|
hasCardAction?: boolean;
|
|
25
|
-
labelsDelete?: {
|
|
26
|
-
cancel: string;
|
|
27
|
-
confirm: {
|
|
28
|
-
label: string;
|
|
29
|
-
secondaryLabel?: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
24
|
onClick?: () => void;
|
|
33
25
|
onDelete?: () => void;
|
|
34
26
|
onEdit?: () => void;
|
|
@@ -46,8 +38,7 @@ const DataTableItem = forwardRef(
|
|
|
46
38
|
onClick,
|
|
47
39
|
onEdit,
|
|
48
40
|
onDelete,
|
|
49
|
-
onEditAccessRights
|
|
50
|
-
labelsDelete
|
|
41
|
+
onEditAccessRights
|
|
51
42
|
}: DataTableItemProps,
|
|
52
43
|
ref
|
|
53
44
|
): ReactElement => {
|
|
@@ -76,24 +67,14 @@ const DataTableItem = forwardRef(
|
|
|
76
67
|
{hasActions && (
|
|
77
68
|
<MuiCardActions>
|
|
78
69
|
<span>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
aria-label="delete"
|
|
88
|
-
data-testid="delete"
|
|
89
|
-
icon={<DeleteIcon />}
|
|
90
|
-
size="small"
|
|
91
|
-
variant="ghost"
|
|
92
|
-
onClick={toggleTooltip}
|
|
93
|
-
/>
|
|
94
|
-
)}
|
|
95
|
-
</ConfirmationTooltip>
|
|
96
|
-
)}
|
|
70
|
+
<IconButton
|
|
71
|
+
aria-label="delete"
|
|
72
|
+
data-testid="delete"
|
|
73
|
+
icon={<DeleteIcon />}
|
|
74
|
+
size="small"
|
|
75
|
+
variant="ghost"
|
|
76
|
+
onClick={onDelete}
|
|
77
|
+
/>
|
|
97
78
|
</span>
|
|
98
79
|
<span>
|
|
99
80
|
<IconButton
|
|
@@ -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
|
|
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();
|