@centreon/ui 24.7.11 → 24.8.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": "24.7.11",
3
+ "version": "24.8.1",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useMemo } from 'react';
2
2
 
3
3
  import { FormikValues, useFormikContext } from 'formik';
4
- import { equals, isEmpty, path, split } from 'ramda';
4
+ import { equals, isEmpty, path, propEq, reject, split } from 'ramda';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import {
@@ -102,9 +102,21 @@ const ConnectedAutocomplete = ({
102
102
  [isMultiple]
103
103
  );
104
104
 
105
+ const deleteItem = (_, option): void => {
106
+ const newValue = reject(propEq(option.id, 'id'), value);
107
+
108
+ setFieldValue(fieldName, newValue);
109
+ };
110
+
111
+ const chipProps = connectedAutocomplete && {
112
+ color: connectedAutocomplete?.chipColor || 'default',
113
+ onDelete: deleteItem
114
+ };
115
+
105
116
  return useMemoComponent({
106
117
  Component: (
107
118
  <AutocompleteField
119
+ chipProps={chipProps}
108
120
  dataTestId={dataTestId}
109
121
  disableClearable={false}
110
122
  disableSortedOptions={disableSortedOptions}
@@ -46,6 +46,7 @@ export interface InputProps {
46
46
  };
47
47
  connectedAutocomplete?: {
48
48
  additionalConditionParameters: Array<ConditionsSearchParameter>;
49
+ chipColor?: string;
49
50
  endpoint?: string;
50
51
  filterKey?: string;
51
52
  getRenderedOptionText?: (option) => string | JSX.Element;
@@ -12,4 +12,6 @@ export { PieChart } from './PieChart';
12
12
  export * from './Tree';
13
13
  export type { LineChartData } from './common/models';
14
14
  export * from './common/timeSeries';
15
+ export type { Metric } from './common/timeSeries/models';
15
16
  export * from './LineChart/models';
17
+ export * from './PieChart/models';
@@ -107,8 +107,7 @@ const MemoListingActionBar = ({
107
107
  widthToMoveTablePagination = 550,
108
108
  actionsBarMemoProps = [],
109
109
  viewerModeConfiguration,
110
- listingVariant,
111
- visualizationActions
110
+ listingVariant
112
111
  }: Props): JSX.Element => {
113
112
  const marginWidthTableListing = 30;
114
113
  const { classes, cx } = useStyles({
@@ -137,7 +136,6 @@ const MemoListingActionBar = ({
137
136
  <div className={classes.actions}>
138
137
  <div>{actions}</div>
139
138
  </div>
140
- {visualizationActions && <div>{visualizationActions}</div>}
141
139
  <div className={classes.subContainer}>
142
140
  {!isEmpty(viewerModeConfiguration) &&
143
141
  !isNil(viewerModeConfiguration) && (
@@ -225,7 +223,6 @@ const MemoListingActionBar = ({
225
223
  ),
226
224
  columnConfiguration,
227
225
  customPaginationClassName,
228
- visualizationActions,
229
226
  ...actionsBarMemoProps
230
227
  ]
231
228
  });
@@ -248,8 +245,7 @@ const ListingActionBar = ({
248
245
  widthToMoveTablePagination,
249
246
  customPaginationClassName,
250
247
  listingVariant,
251
- viewerModeConfiguration,
252
- visualizationActions
248
+ viewerModeConfiguration
253
249
  }: Props): JSX.Element | null => {
254
250
  if (
255
251
  not(paginated) &&
@@ -273,7 +269,6 @@ const ListingActionBar = ({
273
269
  paginated={paginated}
274
270
  totalRows={totalRows}
275
271
  viewerModeConfiguration={viewerModeConfiguration}
276
- visualizationActions={visualizationActions}
277
272
  widthToMoveTablePagination={widthToMoveTablePagination}
278
273
  onLimitChange={onLimitChange}
279
274
  onPaginate={onPaginate}
@@ -131,7 +131,6 @@ export interface Props<TRow> {
131
131
  };
132
132
  totalRows?: number;
133
133
  viewerModeConfiguration?: ViewerModeConfiguration;
134
- visualizationActions?: JSX.Element;
135
134
  widthToMoveTablePagination?: number;
136
135
  }
137
136
 
@@ -145,7 +144,6 @@ const Listing = <TRow extends { id: RowId; internalListingParentId?: RowId }>({
145
144
  customListingComponent,
146
145
  displayCustomListing,
147
146
  limit = 10,
148
- visualizationActions,
149
147
  columns,
150
148
  columnConfiguration = defaultColumnConfiguration,
151
149
  customPaginationClassName,
@@ -529,7 +527,6 @@ const Listing = <TRow extends { id: RowId; internalListingParentId?: RowId }>({
529
527
  paginated={paginated}
530
528
  totalRows={totalRows}
531
529
  viewerModeConfiguration={viewerModeConfiguration}
532
- visualizationActions={visualizationActions}
533
530
  widthToMoveTablePagination={widthToMoveTablePagination}
534
531
  onLimitChange={changeLimit}
535
532
  onPaginate={onPaginate}
@@ -10,8 +10,8 @@ type Props = {
10
10
  children: ReactElement | Array<ReactElement>;
11
11
  className?: string;
12
12
  deleteButtonHidden?: boolean;
13
- labelDelete: string;
14
- onDeleteItem: () => void;
13
+ labelDelete?: string;
14
+ onDeleteItem?: () => void;
15
15
  };
16
16
 
17
17
  export const Item = ({
@@ -16,8 +16,8 @@ export type Props = {
16
16
  addbuttonDisabled?: boolean;
17
17
  children: Array<ReactElement>;
18
18
  displayItemsAsLinked?: boolean;
19
- labelAdd: string;
20
- onAddItem: () => void;
19
+ labelAdd?: string;
20
+ onAddItem?: () => void;
21
21
  secondaryLabel?: string;
22
22
  };
23
23
 
@@ -35,8 +35,8 @@ const useStyles = makeStyles<{
35
35
  transition: theme.transitions.create('left')
36
36
  },
37
37
  '&[data-size="large"] .MuiDialog-paper': {
38
- maxWidth: '604px',
39
- width: '604px'
38
+ maxWidth: '704px',
39
+ width: '704px'
40
40
  },
41
41
  '&[data-size="medium"] .MuiDialog-paper': {
42
42
  width: '520px'