@centreon/ui 26.5.8 → 26.5.10
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 +3 -1
- package/src/@types/globals.d.ts +21 -0
- package/src/Colors/index.tsx +1 -1
- package/src/Dashboard/Item.tsx +3 -3
- package/src/Dialog/Duplicate/index.tsx +1 -1
- package/src/FileDropZone/useDropzone.test.ts +18 -15
- package/src/Form/Inputs/Checkbox.tsx +6 -3
- package/src/Form/Inputs/CheckboxGroup.tsx +8 -8
- package/src/Form/Inputs/ConnectedAutocomplete.tsx +9 -3
- package/src/Form/Inputs/FieldsTable/FieldsTable.tsx +1 -1
- package/src/Form/Inputs/File.tsx +3 -1
- package/src/Form/Inputs/Grid.tsx +1 -1
- package/src/Form/Inputs/List/List.tsx +8 -7
- package/src/Form/Inputs/List/useList.ts +12 -6
- package/src/Form/Inputs/Radio.tsx +7 -1
- package/src/Form/Inputs/Text.tsx +1 -1
- package/src/Form/Inputs/index.tsx +7 -2
- package/src/Form/storiesData.tsx +5 -2
- package/src/Graph/BarChart/Bar.tsx +2 -2
- package/src/Graph/BarChart/BarChart.tsx +2 -0
- package/src/Graph/BarChart/BarGroup.tsx +3 -0
- package/src/Graph/BarChart/BarStack.tsx +1 -0
- package/src/Graph/BarChart/MemoizedGroup.tsx +3 -1
- package/src/Graph/BarChart/ResponsiveBarChart.tsx +5 -0
- package/src/Graph/BarChart/Tooltip/BarChartTooltip.tsx +4 -0
- package/src/Graph/BarStack/Graph.tsx +3 -0
- package/src/Graph/Chart/BasicComponents/Lines/RegularLines/index.tsx +4 -1
- package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +7 -1
- package/src/Graph/Chart/BasicComponents/Lines/Threshold/BasicThreshold.tsx +1 -0
- package/src/Graph/Chart/BasicComponents/Lines/index.tsx +11 -1
- package/src/Graph/Chart/Chart.tsx +9 -0
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +2 -0
- package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +2 -0
- package/src/Graph/Chart/InteractiveComponents/Annotations/annotationsAtoms.ts +5 -0
- package/src/Graph/Chart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +3 -0
- package/src/Graph/Chart/Legend/LegendHeader.tsx +1 -0
- package/src/Graph/Chart/Legend/index.tsx +6 -1
- package/src/Graph/Chart/useChartData.ts +6 -0
- package/src/Graph/Gauge/AnimatedPie.tsx +3 -0
- package/src/Graph/Gauge/PieData.tsx +5 -0
- package/src/Graph/Gauge/ResponsiveGauge.tsx +2 -0
- package/src/Graph/Gauge/Thresholds.tsx +1 -0
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +1 -0
- package/src/Graph/SingleBar/ResponsiveSingleBar.tsx +2 -0
- package/src/Graph/Timeline/ResponsiveTimeline.tsx +1 -0
- package/src/Graph/Tree/Links.tsx +1 -0
- package/src/Graph/Tree/Tree.tsx +1 -0
- package/src/Graph/Tree/stories/datas.ts +2 -0
- package/src/Graph/common/Axes/index.tsx +3 -3
- package/src/Graph/common/BaseChart/BaseChart.tsx +3 -0
- package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +1 -0
- package/src/Graph/common/BaseChart/Header/models.ts +1 -0
- package/src/Graph/common/timeSeries/index.test.ts +17 -1
- package/src/Graph/common/timeSeries/index.ts +12 -0
- package/src/Graph/common/utils.ts +6 -2
- package/src/InputField/Number/Number.tsx +10 -4
- package/src/InputField/Search/PersistentTooltip.tsx +6 -5
- package/src/InputField/Select/Autocomplete/Connected/Single.tsx +3 -1
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +5 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +4 -5
- package/src/InputField/Select/Autocomplete/Draggable/index.tsx +4 -5
- package/src/InputField/Select/Autocomplete/Multi/Listbox.tsx +16 -1
- package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +44 -30
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +1 -0
- package/src/InputField/Select/Autocomplete/index.tsx +7 -1
- package/src/InputField/Select/IconPopover/index.tsx +0 -3
- package/src/InputField/Select/Option.tsx +6 -1
- package/src/InputField/Select/index.tsx +3 -3
- package/src/InputField/Text/index.tsx +11 -3
- package/src/InputField/Text/useAutoSize.ts +2 -2
- package/src/Listing/ActionBar/index.tsx +2 -3
- package/src/Listing/Cell/index.tsx +24 -22
- package/src/Listing/Header/Cell/ListingHeaderCell.styles.ts +7 -0
- package/src/Listing/Header/ListingHeader.tsx +2 -2
- package/src/Listing/Header/_internals/PredefinedSelectionList.tsx +3 -3
- package/src/Listing/index.tsx +29 -34
- package/src/Listing/useStyleTable.ts +1 -1
- package/src/Module/index.tsx +3 -3
- package/src/MultiSelectEntries/index.tsx +1 -1
- package/src/Pagination/Pagination.tsx +1 -1
- package/src/ParentSize/ParentSize.tsx +2 -1
- package/src/PopoverMenu/index.tsx +1 -7
- package/src/RichTextEditor/ContentEditable.tsx +2 -0
- package/src/RichTextEditor/RichTextEditor.tsx +1 -0
- package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +1 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +1 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +2 -0
- package/src/Snackbar/index.tsx +3 -1
- package/src/SortableItems/Item.tsx +8 -7
- package/src/SortableItems/index.tsx +1 -1
- package/src/ThemeProvider/index.tsx +5 -3
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +3 -2
- package/src/TimePeriods/SelectedTimePeriod.tsx +1 -1
- package/src/TimePeriods/timePeriodsAtoms.ts +1 -1
- package/src/TimePeriods/useSortTimePeriods.ts +1 -1
- package/src/Typography/Subtitle.tsx +3 -1
- package/src/Typography/story.utils.tsx +3 -2
- package/src/Wizard/ActionsBar.tsx +2 -2
- package/src/api/QueryProvider.tsx +1 -2
- package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +4 -2
- package/src/api/useGraphQuery/index.ts +4 -2
- package/src/api/useMutationQuery/index.ts +11 -7
- package/src/api/useMutationQuery/useOptimisticMutation.ts +34 -16
- package/src/api/useRequest/index.test.ts +1 -1
- package/src/api/useRequest/index.ts +1 -1
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/CrudPage/Actions/Filters.tsx +1 -1
- package/src/components/CrudPage/Actions/useSearch.tsx +1 -1
- package/src/components/CrudPage/Columns/Actions.tsx +2 -2
- package/src/components/CrudPage/CrudPageRoot.tsx +1 -1
- package/src/components/CrudPage/DeleteModal.tsx +14 -6
- package/src/components/CrudPage/Form/AddModal.tsx +16 -4
- package/src/components/CrudPage/Form/UpdateModal.tsx +2 -2
- package/src/components/CrudPage/Listing.tsx +2 -1
- package/src/components/CrudPage/hooks/useDeleteItem.ts +5 -1
- package/src/components/CrudPage/hooks/useGetItem.ts +3 -3
- package/src/components/DataTable/DataListing.tsx +1 -1
- package/src/components/ExpandableContainer/ExpandableContainer.tsx +1 -0
- package/src/components/Form/AccessRights/Actions/Actions.tsx +1 -1
- package/src/components/Form/AccessRights/Actions/useActions.ts +1 -4
- package/src/components/Form/AccessRights/List/StateChip.tsx +1 -1
- package/src/components/Form/AccessRights/Stats/Stats.tsx +1 -1
- package/src/components/Form/AccessRights/common/RoleSelectField.tsx +4 -6
- package/src/components/Form/Dashboard/DashboardForm.tsx +2 -2
- package/src/components/Header/PageHeader/PageHeader.styles.ts +26 -20
- package/src/components/Menu/useMenu.tsx +3 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +14 -9
- package/src/components/Modal/Modal.tsx +5 -3
- package/src/components/Modal/ModalActions.tsx +1 -1
- package/src/components/Modal/ModalBody.tsx +2 -2
- package/src/components/Modal/ModalHeader.tsx +2 -2
- package/src/components/Tooltip/TextOverflowTooltip/TextOverflowTooltip.tsx +8 -2
- package/src/index.ts +1 -1
- package/src/utils/sanitizedHTML.ts +1 -1
- package/src/utils/useDebounce.ts +3 -1
- package/src/utils/useLicenseExpirationWarning.ts +11 -6
- package/src/utils/useLocaleDateTimeFormat/index.test.tsx +3 -1
- package/src/utils/useLocaleDateTimeFormat/localeFallback.test.tsx +3 -1
- package/src/utils/useMemoComponent.ts +1 -1
- package/src/utils/usePluralizedTranslation.test.ts +2 -0
|
@@ -69,6 +69,7 @@ const toTimeTickWithMetrics = ({
|
|
|
69
69
|
metrics,
|
|
70
70
|
times
|
|
71
71
|
}): Array<TimeTickWithMetrics> =>
|
|
72
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
72
73
|
map(
|
|
73
74
|
(timeTick) => ({
|
|
74
75
|
metrics,
|
|
@@ -178,6 +179,7 @@ const getTime = (timeValue: TimeValue): number =>
|
|
|
178
179
|
new Date(timeValue.timeTick).valueOf();
|
|
179
180
|
|
|
180
181
|
const getMetrics = (timeValue: TimeValue): Array<string> =>
|
|
182
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
181
183
|
pipe(keys, reject(equals('timeTick')))(timeValue);
|
|
182
184
|
|
|
183
185
|
const getValueForMetric =
|
|
@@ -186,6 +188,7 @@ const getValueForMetric =
|
|
|
186
188
|
prop(metric_id, timeValue) as number;
|
|
187
189
|
|
|
188
190
|
const getUnits = (lines: Array<Line>): Array<string> =>
|
|
191
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
189
192
|
pipe(map(prop('unit')), uniq)(lines);
|
|
190
193
|
|
|
191
194
|
interface ValuesForUnitProps {
|
|
@@ -270,7 +273,9 @@ const getStackedMetricValues = ({
|
|
|
270
273
|
);
|
|
271
274
|
|
|
272
275
|
const metricsValues = pipe(
|
|
276
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
273
277
|
map(prop('metric_id')) as (metric) => Array<number>,
|
|
278
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
274
279
|
map(getTimeSeriesValuesForMetric) as () => Array<Array<number>>
|
|
275
280
|
)(lines as Array<Line>);
|
|
276
281
|
|
|
@@ -297,12 +302,14 @@ const getSortedStackedLines = (lines: Array<Line>): Array<Line> =>
|
|
|
297
302
|
|
|
298
303
|
const getInvertedStackedLines = (lines: Array<Line>): Array<Line> =>
|
|
299
304
|
pipe(
|
|
305
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
300
306
|
filter(({ invert }: Line): boolean => invert) as (lines) => Array<Line>,
|
|
301
307
|
getSortedStackedLines
|
|
302
308
|
)(lines);
|
|
303
309
|
|
|
304
310
|
const getNotInvertedStackedLines = (lines: Array<Line>): Array<Line> =>
|
|
305
311
|
pipe(
|
|
312
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
306
313
|
reject(({ invert }: Line): boolean => invert) as (lines) => Array<Line>,
|
|
307
314
|
getSortedStackedLines
|
|
308
315
|
)(lines);
|
|
@@ -313,6 +320,7 @@ interface HasStackedLines {
|
|
|
313
320
|
}
|
|
314
321
|
|
|
315
322
|
const hasUnitStackedLines = ({ lines, unit }: HasStackedLines): boolean =>
|
|
323
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
316
324
|
pipe(getSortedStackedLines, any(propEq(unit, 'unit')))(lines);
|
|
317
325
|
|
|
318
326
|
const getTimeSeriesForLines = ({
|
|
@@ -336,6 +344,7 @@ const getTimeSeriesForLines = ({
|
|
|
336
344
|
: metricsValue[metric_id]
|
|
337
345
|
};
|
|
338
346
|
},
|
|
347
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
339
348
|
{},
|
|
340
349
|
metrics
|
|
341
350
|
),
|
|
@@ -427,9 +436,11 @@ const getScale = ({
|
|
|
427
436
|
: getSanitizedValues([
|
|
428
437
|
getMax(graphValues),
|
|
429
438
|
getMax(stackedValues),
|
|
439
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
430
440
|
hasOnlyZeroesHasValue(graphValues) ? 1 : null,
|
|
431
441
|
Math.max(...thresholds)
|
|
432
442
|
]);
|
|
443
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
433
444
|
const maxValue = Math.max(...sanitizedValuesForMaximum.filter(isNotNil));
|
|
434
445
|
|
|
435
446
|
const minValueWithMargin =
|
|
@@ -857,6 +868,7 @@ export const getStackedLinesTimeSeriesPerStackAndUnit = ({
|
|
|
857
868
|
{}
|
|
858
869
|
);
|
|
859
870
|
const affectedLinesPerStackKey = flatten(
|
|
871
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
860
872
|
pluck('lines', Object.values(stackedLinesTimeSeriesPerStackKey))
|
|
861
873
|
);
|
|
862
874
|
const stackedLinesTimeSeriesPerUnit = stackedKeysWithOnlyUnit.reduce(
|
|
@@ -127,6 +127,7 @@ export const emphasizeCurveColor = ({
|
|
|
127
127
|
|
|
128
128
|
if (gte(getLuminance(color), 0.5)) {
|
|
129
129
|
if (gte(index, totalLevels * 2)) {
|
|
130
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
130
131
|
return darken(color, normalizeLevel({ factor, level: last(levels) }));
|
|
131
132
|
}
|
|
132
133
|
if (gte(index, totalLevels)) {
|
|
@@ -140,6 +141,7 @@ export const emphasizeCurveColor = ({
|
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
if (gte(index, totalLevels * 2)) {
|
|
144
|
+
// @ts-expect-error - suppressing pre-existing type mismatch
|
|
143
145
|
return lighten(color, normalizeLevel({ factor, level: last(levels) }));
|
|
144
146
|
}
|
|
145
147
|
if (gte(index, totalLevels)) {
|
|
@@ -203,8 +205,10 @@ export const getStyle = ({
|
|
|
203
205
|
metricId
|
|
204
206
|
}: GetStyleProps): BarStyle | LineStyle => {
|
|
205
207
|
return equals(type(style), 'Array')
|
|
206
|
-
?
|
|
207
|
-
|
|
208
|
+
? // @ts-expect-error - suppressing pre-existing type mismatch
|
|
209
|
+
style.find((metricStyle) => equals(metricId, metricStyle.metricId))
|
|
210
|
+
: // @ts-expect-error - suppressing pre-existing type mismatch
|
|
211
|
+
style;
|
|
208
212
|
};
|
|
209
213
|
|
|
210
214
|
interface GetFormattedAxisValuesProps {
|
|
@@ -43,10 +43,16 @@ const NumberField = ({
|
|
|
43
43
|
T,
|
|
44
44
|
always(
|
|
45
45
|
clamp(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
(
|
|
47
|
+
textFieldSlotsAndSlotProps?.slotProps?.htmlInput as
|
|
48
|
+
| Record<string, number>
|
|
49
|
+
| undefined
|
|
50
|
+
)?.min || Number.NEGATIVE_INFINITY,
|
|
51
|
+
(
|
|
52
|
+
textFieldSlotsAndSlotProps?.slotProps?.htmlInput as
|
|
53
|
+
| Record<string, number>
|
|
54
|
+
| undefined
|
|
55
|
+
)?.max || Number.POSITIVE_INFINITY,
|
|
50
56
|
number
|
|
51
57
|
)
|
|
52
58
|
)
|
|
@@ -2,7 +2,7 @@ import IconHelp from '@mui/icons-material/HelpOutline';
|
|
|
2
2
|
import IconClose from '@mui/icons-material/HighlightOff';
|
|
3
3
|
import { IconButton, Tooltip } from '@mui/material';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { isNil } from 'ramda';
|
|
6
6
|
import { type ReactElement, useState } from 'react';
|
|
7
7
|
import { makeStyles } from 'tss-react/mui';
|
|
8
8
|
|
|
@@ -41,10 +41,11 @@ const PersistentTooltip = ({
|
|
|
41
41
|
const [open, setOpen] = useState(openTooltip || false);
|
|
42
42
|
|
|
43
43
|
const toggleTooltip = (): void => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
if (isNil(openTooltip)) {
|
|
45
|
+
setOpen(!open);
|
|
46
|
+
} else {
|
|
47
|
+
toggleTooltipProp?.();
|
|
48
|
+
}
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
const closeTooltip = (): void => {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
1
3
|
import AutocompleteField from '..';
|
|
2
4
|
import ConnectedAutocompleteField from '.';
|
|
3
5
|
|
|
4
6
|
const SingleConnectedAutocompleteField = ConnectedAutocompleteField(
|
|
5
|
-
AutocompleteField,
|
|
7
|
+
AutocompleteField as unknown as (props: unknown) => ReactElement,
|
|
6
8
|
false
|
|
7
9
|
);
|
|
8
10
|
|
|
@@ -95,7 +95,7 @@ describe(SingleConnectedAutocompleteField, () => {
|
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
await waitFor(() => {
|
|
98
|
-
expect(decodeURIComponent(getFetchCall(2))).toEqual(
|
|
98
|
+
expect(decodeURIComponent(getFetchCall(2) as string)).toEqual(
|
|
99
99
|
'endpoint?page=1&search={"$and":[{"$and":[{"host.name":{"$lk":"%My Option 2%"}}]}]}',
|
|
100
100
|
);
|
|
101
101
|
});
|
|
@@ -375,7 +375,11 @@ const ConnectedAutocompleteField = (
|
|
|
375
375
|
allowUniqOption ? uniqBy(getRenderedOptionText, options) : options
|
|
376
376
|
}
|
|
377
377
|
renderOption={renderOptions}
|
|
378
|
-
total={
|
|
378
|
+
total={
|
|
379
|
+
(data && 'meta' in data ? data.meta.total : undefined) ||
|
|
380
|
+
(data && 'totalElements' in data ? data.totalElements : undefined) ||
|
|
381
|
+
1
|
|
382
|
+
}
|
|
379
383
|
{...props}
|
|
380
384
|
/>
|
|
381
385
|
);
|
|
@@ -2,7 +2,7 @@ import { lighten } from '@mui/material';
|
|
|
2
2
|
|
|
3
3
|
import { rectIntersection } from '@dnd-kit/core';
|
|
4
4
|
import { rectSortingStrategy } from '@dnd-kit/sortable';
|
|
5
|
-
import { find,
|
|
5
|
+
import { find, propEq } from 'ramda';
|
|
6
6
|
import { makeStyles } from 'tss-react/mui';
|
|
7
7
|
|
|
8
8
|
import SortableItems from '../../../../SortableItems';
|
|
@@ -46,10 +46,9 @@ const SortableList = ({
|
|
|
46
46
|
|
|
47
47
|
const dragEnd = ({ items: newItems }): void =>
|
|
48
48
|
changeItemsOrder(
|
|
49
|
-
map(
|
|
50
|
-
(item) => find(propEq(item, 'id'), items)
|
|
51
|
-
|
|
52
|
-
) as Array<DraggableSelectEntry>
|
|
49
|
+
(newItems as Array<string>).map(
|
|
50
|
+
(item) => find(propEq(item, 'id'), items) as DraggableSelectEntry
|
|
51
|
+
)
|
|
53
52
|
);
|
|
54
53
|
|
|
55
54
|
return (
|
|
@@ -13,8 +13,7 @@ import {
|
|
|
13
13
|
pipe,
|
|
14
14
|
pluck,
|
|
15
15
|
propEq,
|
|
16
|
-
remove
|
|
17
|
-
type
|
|
16
|
+
remove
|
|
18
17
|
} from 'ramda';
|
|
19
18
|
import { type ChangeEvent, useEffect, useState } from 'react';
|
|
20
19
|
|
|
@@ -93,8 +92,8 @@ const DraggableAutocomplete = (
|
|
|
93
92
|
return;
|
|
94
93
|
}
|
|
95
94
|
const lastValue = last(newValue);
|
|
96
|
-
if (
|
|
97
|
-
const lastDraggableItem = {
|
|
95
|
+
if (typeof lastValue === 'string') {
|
|
96
|
+
const lastDraggableItem: DraggableSelectEntry = {
|
|
98
97
|
createOption: lastValue,
|
|
99
98
|
id: `${lastValue}_${totalValues}`,
|
|
100
99
|
name: lastValue
|
|
@@ -115,7 +114,7 @@ const DraggableAutocomplete = (
|
|
|
115
114
|
newValue
|
|
116
115
|
) as DraggableSelectEntry;
|
|
117
116
|
|
|
118
|
-
const lastDraggableItem = {
|
|
117
|
+
const lastDraggableItem: DraggableSelectEntry = {
|
|
119
118
|
id: `${lastItem.name}_${totalValues}`,
|
|
120
119
|
name: lastItem.name
|
|
121
120
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ListSubheader, Typography } from '@mui/material';
|
|
2
2
|
|
|
3
|
+
import type React from 'react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
|
|
5
6
|
import { Button } from '../../../../components/Button';
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
labelSelectAll,
|
|
9
10
|
labelUnSelectAll
|
|
10
11
|
} from '../../../translatedLabels';
|
|
12
|
+
import type { SelectEntry } from '../..';
|
|
11
13
|
import { useListboxStyles } from './Multi.styles';
|
|
12
14
|
|
|
13
15
|
const CustomListbox = ({
|
|
@@ -34,6 +36,19 @@ const CustomListbox = ({
|
|
|
34
36
|
);
|
|
35
37
|
};
|
|
36
38
|
|
|
39
|
+
interface ListboxProps {
|
|
40
|
+
disableSelectAll?: boolean;
|
|
41
|
+
options: Array<SelectEntry>;
|
|
42
|
+
isOptionSelected: (opt: SelectEntry) => boolean;
|
|
43
|
+
onChange?: (
|
|
44
|
+
event: React.SyntheticEvent,
|
|
45
|
+
value: Array<SelectEntry>,
|
|
46
|
+
reason: string
|
|
47
|
+
) => void;
|
|
48
|
+
total?: number;
|
|
49
|
+
value?: Array<SelectEntry>;
|
|
50
|
+
}
|
|
51
|
+
|
|
37
52
|
const ListboxComponent = ({
|
|
38
53
|
disableSelectAll,
|
|
39
54
|
options,
|
|
@@ -41,7 +56,7 @@ const ListboxComponent = ({
|
|
|
41
56
|
onChange,
|
|
42
57
|
total,
|
|
43
58
|
value = []
|
|
44
|
-
}) => {
|
|
59
|
+
}: ListboxProps) => {
|
|
45
60
|
const { t } = useTranslation();
|
|
46
61
|
|
|
47
62
|
if (disableSelectAll) {
|
|
@@ -36,7 +36,8 @@ const MultiAutocompleteField = ({
|
|
|
36
36
|
disableSortedOptions = false,
|
|
37
37
|
disableSelectAll = true,
|
|
38
38
|
optionProperty = 'name',
|
|
39
|
-
getOptionLabel = (option): string =>
|
|
39
|
+
getOptionLabel = (option): string =>
|
|
40
|
+
typeof option === 'string' ? option : option?.name,
|
|
40
41
|
getTagLabel = (option): string => option[optionProperty],
|
|
41
42
|
getOptionTooltipLabel,
|
|
42
43
|
chipProps,
|
|
@@ -65,7 +66,13 @@ const MultiAutocompleteField = ({
|
|
|
65
66
|
size="medium"
|
|
66
67
|
{...getTagProps({ index })}
|
|
67
68
|
{...chipProps}
|
|
68
|
-
onDelete={(event) =>
|
|
69
|
+
onDelete={(event) =>
|
|
70
|
+
(
|
|
71
|
+
chipProps?.onDelete as
|
|
72
|
+
| ((event: React.SyntheticEvent, option: SelectEntry) => void)
|
|
73
|
+
| undefined
|
|
74
|
+
)?.(event, option)
|
|
75
|
+
}
|
|
69
76
|
/>
|
|
70
77
|
</Tooltip>
|
|
71
78
|
);
|
|
@@ -89,35 +96,42 @@ const MultiAutocompleteField = ({
|
|
|
89
96
|
|
|
90
97
|
return (
|
|
91
98
|
<Autocomplete
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
{...({
|
|
100
|
+
disableCloseOnSelect: true,
|
|
101
|
+
displayOptionThumbnail: true,
|
|
102
|
+
getLimitTagsText,
|
|
103
|
+
ListboxComponent: ListboxComponent({
|
|
104
|
+
disableSelectAll,
|
|
105
|
+
isOptionSelected,
|
|
106
|
+
onChange: onChange as (
|
|
107
|
+
event: React.SyntheticEvent,
|
|
108
|
+
value: Array<SelectEntry>,
|
|
109
|
+
reason: string
|
|
110
|
+
) => void,
|
|
111
|
+
options: options as Array<SelectEntry>,
|
|
112
|
+
total,
|
|
113
|
+
value: values
|
|
114
|
+
}),
|
|
115
|
+
multiple: true,
|
|
98
116
|
onChange,
|
|
99
|
-
options,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
: renderTags(renderedValue, getTagProps)
|
|
118
|
-
}
|
|
119
|
-
value={values}
|
|
120
|
-
{...props}
|
|
117
|
+
options: autocompleteOptions,
|
|
118
|
+
renderOption: (renderProps, option, { selected }): JSX.Element => (
|
|
119
|
+
<li
|
|
120
|
+
key={option.id}
|
|
121
|
+
{...(renderProps as React.HTMLAttributes<HTMLLIElement>)}
|
|
122
|
+
>
|
|
123
|
+
<Option checkboxSelected={selected}>
|
|
124
|
+
{getOptionLabel(option)}
|
|
125
|
+
</Option>
|
|
126
|
+
</li>
|
|
127
|
+
),
|
|
128
|
+
renderTags: (renderedValue, getTagProps): React.ReactNode =>
|
|
129
|
+
customRenderTags
|
|
130
|
+
? customRenderTags(renderTags(renderedValue, getTagProps))
|
|
131
|
+
: renderTags(renderedValue, getTagProps),
|
|
132
|
+
value: values,
|
|
133
|
+
...props
|
|
134
|
+
} as React.ComponentProps<typeof Autocomplete>)}
|
|
121
135
|
/>
|
|
122
136
|
);
|
|
123
137
|
};
|
|
@@ -153,7 +153,13 @@ const AutocompleteField = forwardRef(
|
|
|
153
153
|
root: classes.textfield
|
|
154
154
|
}}
|
|
155
155
|
error={error}
|
|
156
|
-
externalValueForAutoSize={
|
|
156
|
+
externalValueForAutoSize={
|
|
157
|
+
typeof autocompleteProps?.value === 'object' &&
|
|
158
|
+
autocompleteProps?.value !== null &&
|
|
159
|
+
!Array.isArray(autocompleteProps.value)
|
|
160
|
+
? (autocompleteProps.value as SelectEntry).name
|
|
161
|
+
: undefined
|
|
162
|
+
}
|
|
157
163
|
helperText={helperText}
|
|
158
164
|
label={label}
|
|
159
165
|
onChange={onTextChange}
|
|
@@ -97,9 +97,6 @@ const IconPopoverMultiAutocomplete = ({
|
|
|
97
97
|
</IconButton>
|
|
98
98
|
<Popper
|
|
99
99
|
anchorEl={anchorEl}
|
|
100
|
-
nonce={undefined}
|
|
101
|
-
onResize={(): undefined => undefined}
|
|
102
|
-
onResizeCapture={(): undefined => undefined}
|
|
103
100
|
open={isOpen}
|
|
104
101
|
placement={popperPlacement}
|
|
105
102
|
style={{ zIndex: theme.zIndex.tooltip }}
|
|
@@ -47,7 +47,12 @@ const Option = forwardRef(
|
|
|
47
47
|
)}
|
|
48
48
|
<Stack alignItems="center" direction="row" spacing={1}>
|
|
49
49
|
{thumbnailUrl && (
|
|
50
|
-
<img
|
|
50
|
+
<img
|
|
51
|
+
alt={typeof children === 'string' ? children : ''}
|
|
52
|
+
height={20}
|
|
53
|
+
src={thumbnailUrl}
|
|
54
|
+
width={20}
|
|
55
|
+
/>
|
|
51
56
|
)}
|
|
52
57
|
<Typography variant="body2">{children}</Typography>
|
|
53
58
|
</Stack>
|
|
@@ -59,7 +59,7 @@ type Props = {
|
|
|
59
59
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
60
60
|
options: Array<SelectEntry>;
|
|
61
61
|
selectedOptionId: number | string;
|
|
62
|
-
formControlProps
|
|
62
|
+
formControlProps?: FormControlProps;
|
|
63
63
|
} & Omit<SelectProps, 'error'>;
|
|
64
64
|
|
|
65
65
|
const SelectField = ({
|
|
@@ -112,9 +112,9 @@ const SelectField = ({
|
|
|
112
112
|
[classes.noLabelInput]: !label && !compact,
|
|
113
113
|
[classes.compact]: compact
|
|
114
114
|
}),
|
|
115
|
-
'data-testid': dataTestId,
|
|
116
115
|
id: getNormalizedId(dataTestId || ''),
|
|
117
|
-
...inputProps
|
|
116
|
+
...inputProps,
|
|
117
|
+
...({ 'data-testid': dataTestId } as Record<string, string>)
|
|
118
118
|
}
|
|
119
119
|
}}
|
|
120
120
|
value={selectedOptionId}
|
|
@@ -77,7 +77,7 @@ const OptionalLabelInputAdornment = ({
|
|
|
77
77
|
type SizeVariant = 'large' | 'medium' | 'small' | 'compact';
|
|
78
78
|
|
|
79
79
|
export type TextProps = {
|
|
80
|
-
EndAdornment?: React.FC |
|
|
80
|
+
EndAdornment?: React.FC | React.ReactNode;
|
|
81
81
|
StartAdornment?: React.FC;
|
|
82
82
|
ariaLabel?: string;
|
|
83
83
|
autoSize?: boolean;
|
|
@@ -192,9 +192,17 @@ const TextField = forwardRef(
|
|
|
192
192
|
endAdornment: (
|
|
193
193
|
<OptionalLabelInputAdornment label={label} position="end">
|
|
194
194
|
{EndAdornment ? (
|
|
195
|
-
|
|
195
|
+
typeof EndAdornment === 'function' ? (
|
|
196
|
+
<EndAdornment />
|
|
197
|
+
) : (
|
|
198
|
+
EndAdornment
|
|
199
|
+
)
|
|
196
200
|
) : (
|
|
197
|
-
|
|
201
|
+
(
|
|
202
|
+
textFieldSlotsAndSlotProps?.slotProps?.input as
|
|
203
|
+
| Record<string, React.ReactNode>
|
|
204
|
+
| undefined
|
|
205
|
+
)?.endAdornment
|
|
198
206
|
)}
|
|
199
207
|
</OptionalLabelInputAdornment>
|
|
200
208
|
),
|
|
@@ -34,7 +34,7 @@ const useAutoSize = ({
|
|
|
34
34
|
}: UseAutoSizeProps): UseAutoSizeState => {
|
|
35
35
|
const [innerValue, setInnerValue] = useState(value || '');
|
|
36
36
|
const [width, setWidth] = useState(autoSizeDefaultWidth);
|
|
37
|
-
const inputRef = useRef();
|
|
37
|
+
const inputRef = useRef<HTMLDivElement>(null);
|
|
38
38
|
const theme = useTheme();
|
|
39
39
|
|
|
40
40
|
const changeInputValue = (
|
|
@@ -58,7 +58,7 @@ const useAutoSize = ({
|
|
|
58
58
|
return {
|
|
59
59
|
changeInputValue,
|
|
60
60
|
innerValue,
|
|
61
|
-
inputRef
|
|
61
|
+
inputRef: inputRef as RefObject<HTMLDivElement>,
|
|
62
62
|
width: `calc(${width}px + ${theme.spacing(
|
|
63
63
|
autoSizeCustomPadding || defaultPaddingTotal
|
|
64
64
|
)})`
|
|
@@ -216,9 +216,8 @@ const MemoListingActionBar = ({
|
|
|
216
216
|
listingVariant,
|
|
217
217
|
themeMode,
|
|
218
218
|
limit,
|
|
219
|
-
|
|
220
|
-
['id', 'label', 'disabled', 'width', 'shortLabel', 'sortField']
|
|
221
|
-
columns
|
|
219
|
+
columns.map(
|
|
220
|
+
pick(['id', 'label', 'disabled', 'width', 'shortLabel', 'sortField'])
|
|
222
221
|
),
|
|
223
222
|
columnConfiguration,
|
|
224
223
|
customPaginationClassName,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import type { ListingVariant } from '@centreon/ui-context';
|
|
12
12
|
|
|
13
13
|
import { useAtom } from 'jotai';
|
|
14
|
-
import {
|
|
14
|
+
import { equals, includes, isNil, reject } from 'ramda';
|
|
15
15
|
import type { ElementType } from 'react';
|
|
16
16
|
import type { CSSObject } from 'tss-react';
|
|
17
17
|
|
|
@@ -98,7 +98,7 @@ const handleSubItems = ({
|
|
|
98
98
|
return reject(equals(id), currentSubItemsPivots);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
return
|
|
101
|
+
return [...currentSubItemsPivots, id];
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
const Cell = ({
|
|
@@ -142,26 +142,28 @@ const Cell = ({
|
|
|
142
142
|
root: 'flex items-center h-full overflow-hidden border-b-1 border-divider px-2 whitespace-nowrap py-0'
|
|
143
143
|
}}
|
|
144
144
|
component={'div' as unknown as ElementType<TableCellBaseProps>}
|
|
145
|
-
style={
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
145
|
+
style={
|
|
146
|
+
{
|
|
147
|
+
backgroundColor: getBackgroundColor({
|
|
148
|
+
disableRowCondition,
|
|
149
|
+
isRowHovered,
|
|
150
|
+
row,
|
|
151
|
+
rowColorConditions,
|
|
152
|
+
theme
|
|
153
|
+
}),
|
|
154
|
+
...getTextStyleByViewMode({
|
|
155
|
+
listingVariant,
|
|
156
|
+
theme
|
|
157
|
+
}),
|
|
158
|
+
...getRowTextColor({
|
|
159
|
+
disableRowCondition,
|
|
160
|
+
isRowHighlighted,
|
|
161
|
+
row,
|
|
162
|
+
theme
|
|
163
|
+
}),
|
|
164
|
+
...style
|
|
165
|
+
} as React.CSSProperties
|
|
166
|
+
}
|
|
165
167
|
{...props}
|
|
166
168
|
>
|
|
167
169
|
{displaySubItemsCaret && hasSubItems && (
|
|
@@ -159,8 +159,8 @@ const MemoizedListingHeader = memo<Props>(
|
|
|
159
159
|
equals(prevProps.selectedRowCount, nextProps.selectedRowCount) &&
|
|
160
160
|
equals(prevProps.rowCount, nextProps.rowCount) &&
|
|
161
161
|
equals(
|
|
162
|
-
map(pick(columnMemoProps), prevProps.columns),
|
|
163
|
-
map(pick(columnMemoProps), nextProps.columns)
|
|
162
|
+
map(pick(columnMemoProps as Array<keyof Column>), prevProps.columns),
|
|
163
|
+
map(pick(columnMemoProps as Array<keyof Column>), nextProps.columns)
|
|
164
164
|
) &&
|
|
165
165
|
equals(prevProps.checkable, nextProps.checkable) &&
|
|
166
166
|
equals(prevProps.columnConfiguration, nextProps.columnConfiguration) &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { List,
|
|
1
|
+
import { List, ListItemButton, ListItemText } from '@mui/material';
|
|
2
2
|
|
|
3
3
|
import type { PredefinedRowSelection } from '../../models';
|
|
4
4
|
|
|
@@ -21,9 +21,9 @@ const PredefinedSelectionList = ({
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
24
|
+
<ListItemButton key={label} onClick={onSelectionClick}>
|
|
25
25
|
<ListItemText>{label}</ListItemText>
|
|
26
|
-
</
|
|
26
|
+
</ListItemButton>
|
|
27
27
|
);
|
|
28
28
|
})}
|
|
29
29
|
</List>
|