@centreon/ui 26.5.14 → 26.7.0

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.
Files changed (170) hide show
  1. package/package.json +6 -1
  2. package/src/ActionsList/ActionsList.styles.ts +2 -1
  3. package/src/ActionsList/index.tsx +1 -1
  4. package/src/Button/Icon/index.tsx +1 -1
  5. package/src/Button/Save/useSave.tsx +2 -1
  6. package/src/Checkbox/Checkbox.tsx +14 -9
  7. package/src/Checkbox/CheckboxGroup/index.tsx +1 -1
  8. package/src/Colors/index.tsx +12 -2
  9. package/src/Dashboard/Item.tsx +1 -1
  10. package/src/Dialog/Duplicate/index.tsx +5 -3
  11. package/src/Dialog/index.tsx +4 -1
  12. package/src/Form/Inputs/Autocomplete.tsx +30 -19
  13. package/src/Form/Inputs/ConnectedAutocomplete.tsx +27 -9
  14. package/src/Form/Inputs/FieldsTable/FieldsTable.tsx +24 -13
  15. package/src/Form/Inputs/FieldsTable/Row.tsx +7 -1
  16. package/src/Form/Inputs/List/Content.tsx +2 -2
  17. package/src/Form/Inputs/List/List.tsx +2 -1
  18. package/src/Form/Inputs/List/useList.ts +1 -1
  19. package/src/Form/Inputs/Radio.tsx +4 -1
  20. package/src/Form/Inputs/models.ts +42 -8
  21. package/src/Form/Section/PanelTabs.tsx +1 -1
  22. package/src/Form/storiesData.tsx +2 -2
  23. package/src/Graph/BarChart/Bar.tsx +39 -5
  24. package/src/Graph/BarChart/BarGroup.tsx +9 -5
  25. package/src/Graph/BarChart/BarStack.tsx +17 -4
  26. package/src/Graph/BarChart/useBarStack.ts +16 -8
  27. package/src/Graph/BarStack/Graph.tsx +21 -5
  28. package/src/Graph/BarStack/GraphAndLegend.tsx +2 -1
  29. package/src/Graph/BarStack/models.ts +23 -3
  30. package/src/Graph/BarStack/useGraphAndLegend.ts +10 -6
  31. package/src/Graph/BarStack/useResponsiveBarStack.ts +2 -1
  32. package/src/Graph/Chart/BasicComponents/Lines/Point.tsx +2 -1
  33. package/src/Graph/Chart/BasicComponents/Lines/RegularLines/index.tsx +4 -3
  34. package/src/Graph/Chart/BasicComponents/Lines/RegularLines/useRegularLines.ts +1 -1
  35. package/src/Graph/Chart/BasicComponents/Lines/StackedLines/index.tsx +4 -5
  36. package/src/Graph/Chart/BasicComponents/Lines/StackedLines/useStackedLines.ts +10 -1
  37. package/src/Graph/Chart/BasicComponents/Lines/Threshold/index.tsx +13 -4
  38. package/src/Graph/Chart/BasicComponents/Lines/Threshold/models.ts +2 -2
  39. package/src/Graph/Chart/BasicComponents/Lines/index.tsx +2 -10
  40. package/src/Graph/Chart/InteractiveComponents/AnchorPoint/StackedAnchorPoint.tsx +7 -3
  41. package/src/Graph/Chart/InteractiveComponents/AnchorPoint/models.ts +2 -2
  42. package/src/Graph/Chart/InteractiveComponents/AnchorPoint/useTickGraph.ts +4 -4
  43. package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/Area.tsx +9 -1
  44. package/src/Graph/Chart/InteractiveComponents/Annotations/Annotation/Line.tsx +9 -1
  45. package/src/Graph/Chart/InteractiveComponents/Annotations/EventAnnotations.tsx +9 -1
  46. package/src/Graph/Chart/InteractiveComponents/Annotations/useAnnotation.ts +1 -5
  47. package/src/Graph/Chart/InteractiveComponents/Tooltip/useGraphTooltip.ts +2 -2
  48. package/src/Graph/Chart/InteractiveComponents/index.tsx +8 -8
  49. package/src/Graph/Chart/Legend/LegendHeader.tsx +6 -1
  50. package/src/Graph/Chart/Legend/index.tsx +4 -1
  51. package/src/Graph/Chart/Legend/useLegend.ts +2 -2
  52. package/src/Graph/Chart/helpers/doc.ts +11 -1
  53. package/src/Graph/Chart/models.ts +2 -2
  54. package/src/Graph/Chart/useChartData.ts +4 -3
  55. package/src/Graph/Chart/useChartIntersection.ts +5 -1
  56. package/src/Graph/Gauge/AnimatedPie.tsx +7 -2
  57. package/src/Graph/Gauge/models.ts +7 -1
  58. package/src/Graph/PieChart/ResponsivePie.tsx +7 -1
  59. package/src/Graph/PieChart/models.ts +22 -3
  60. package/src/Graph/PieChart/useResponsivePie.ts +3 -2
  61. package/src/Graph/SingleBar/ThresholdLine.tsx +5 -1
  62. package/src/Graph/SingleBar/Thresholds.tsx +5 -1
  63. package/src/Graph/Timeline/ResponsiveTimeline.tsx +2 -2
  64. package/src/Graph/Timeline/useTimeline.ts +2 -1
  65. package/src/Graph/Tree/DescendantNodes.tsx +4 -3
  66. package/src/Graph/Tree/Tree.tsx +7 -1
  67. package/src/Graph/Tree/models.ts +2 -2
  68. package/src/Graph/common/Axes/UnitLabel.tsx +1 -1
  69. package/src/Graph/common/Axes/index.tsx +15 -6
  70. package/src/Graph/common/Axes/useAxisY.ts +3 -3
  71. package/src/Graph/common/BaseChart/AdditionalLine.tsx +2 -1
  72. package/src/Graph/common/BaseChart/ChartSvgWrapper.tsx +7 -3
  73. package/src/Graph/common/Grids/index.tsx +9 -3
  74. package/src/Graph/common/Thresholds/ThresholdLine.tsx +7 -1
  75. package/src/Graph/common/Thresholds/Thresholds.tsx +7 -1
  76. package/src/Graph/common/models.ts +9 -1
  77. package/src/Graph/common/timeSeries/index.test.ts +1 -1
  78. package/src/Graph/common/timeSeries/index.ts +72 -26
  79. package/src/Graph/common/timeSeries/models.ts +1 -1
  80. package/src/Graph/common/utils.ts +3 -1
  81. package/src/Image/useLoadImage.ts +6 -1
  82. package/src/InputField/Search/RegexpHelpTooltip.tsx +3 -1
  83. package/src/InputField/Select/Autocomplete/Connected/Multi/utils/index.ts +4 -1
  84. package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +7 -2
  85. package/src/InputField/Select/Autocomplete/Connected/index.tsx +70 -26
  86. package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +2 -2
  87. package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +6 -4
  88. package/src/InputField/Select/Autocomplete/Draggable/index.tsx +35 -10
  89. package/src/InputField/Select/Autocomplete/Multi/Listbox.tsx +12 -2
  90. package/src/InputField/Select/Autocomplete/Multi/Multi.tsx +15 -8
  91. package/src/InputField/Select/Autocomplete/Popover/index.tsx +5 -2
  92. package/src/InputField/Select/Autocomplete/index.tsx +23 -10
  93. package/src/InputField/Select/IconPopover/index.tsx +8 -5
  94. package/src/InputField/Select/index.tsx +4 -3
  95. package/src/InputField/Text/index.tsx +1 -1
  96. package/src/InputField/Text/useAutoSize.ts +0 -2
  97. package/src/Listing/ActionBar/ColumnMultiSelect.tsx +2 -2
  98. package/src/Listing/ActionBar/Pagination.tsx +4 -2
  99. package/src/Listing/ActionBar/PaginationActions.tsx +12 -4
  100. package/src/Listing/ActionBar/index.tsx +19 -7
  101. package/src/Listing/Cell/DataCell.tsx +3 -3
  102. package/src/Listing/Cell/index.tsx +26 -13
  103. package/src/Listing/Header/Cell/ListingHeaderCell.tsx +2 -2
  104. package/src/Listing/Header/Cell/SelectActionListingHeaderCell.tsx +6 -4
  105. package/src/Listing/Header/ListingHeader.tsx +2 -2
  106. package/src/Listing/Header/_internals/PredefinedSelectionList.tsx +3 -1
  107. package/src/Listing/Row/Row.tsx +3 -3
  108. package/src/Listing/index.tsx +48 -28
  109. package/src/Listing/models.ts +11 -9
  110. package/src/MultiSelectEntries/index.tsx +3 -3
  111. package/src/Pagination/Pagination.tsx +3 -1
  112. package/src/Panel/index.tsx +2 -2
  113. package/src/PopoverMenu/index.tsx +3 -3
  114. package/src/RichTextEditor/ContentEditable.tsx +2 -1
  115. package/src/RichTextEditor/RichTextEditor.tsx +1 -1
  116. package/src/RichTextEditor/plugins/FloatingLinkEditorPlugin.tsx +16 -14
  117. package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +3 -3
  118. package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +1 -1
  119. package/src/RichTextEditor/plugins/ToolbarPlugin/MacrosButton.tsx +1 -1
  120. package/src/Snackbar/SnackbarProvider.tsx +1 -1
  121. package/src/Snackbar/index.tsx +4 -2
  122. package/src/Snackbar/useSnackbar.tsx +14 -4
  123. package/src/SortableItems/index.tsx +4 -4
  124. package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.tsx +1 -1
  125. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +1 -1
  126. package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/usePickersStartEndDate.ts +9 -3
  127. package/src/TimePeriods/CustomTimePeriod/index.tsx +7 -2
  128. package/src/TimePeriods/helpers/index.ts +7 -2
  129. package/src/TimePeriods/models.ts +4 -1
  130. package/src/TimePeriods/useTimePeriod.ts +0 -2
  131. package/src/Wizard/ActionsBar.tsx +1 -1
  132. package/src/Wizard/index.test.tsx +0 -66
  133. package/src/Wizard/index.tsx +10 -5
  134. package/src/Wizard/models.ts +1 -1
  135. package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +2 -1
  136. package/src/api/buildListingEndpoint/index.ts +7 -1
  137. package/src/api/customFetch.ts +3 -3
  138. package/src/api/useBulkResponse.ts +31 -9
  139. package/src/api/useFetchQuery/index.ts +28 -6
  140. package/src/api/useGraphQuery/index.ts +1 -1
  141. package/src/api/useRequest/index.ts +7 -7
  142. package/src/components/Button/Button.tsx +1 -1
  143. package/src/components/Button/Icon/IconButton.tsx +1 -1
  144. package/src/components/CrudPage/Listing.tsx +3 -3
  145. package/src/components/CrudPage/utils.ts +1 -1
  146. package/src/components/Form/AccessRights/AccessRights.tsx +4 -1
  147. package/src/components/Form/AccessRights/Actions/Actions.tsx +4 -1
  148. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +1 -1
  149. package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +35 -13
  150. package/src/components/Form/AccessRights/common/RoleSelectField.tsx +1 -1
  151. package/src/components/Form/AccessRights/storiesData.ts +2 -2
  152. package/src/components/ItemComposition/ItemComposition.tsx +1 -1
  153. package/src/components/Menu/Button/MenuButton.tsx +1 -1
  154. package/src/components/Menu/useMenu.tsx +3 -1
  155. package/src/components/Tabs/Tabs.tsx +1 -1
  156. package/src/components/Tooltip/ConfirmationTooltip/models.ts +5 -1
  157. package/src/components/Zoom/useMinimap.ts +16 -10
  158. package/src/components/Zoom/useZoom.ts +12 -6
  159. package/src/components/Zoom/utils.ts +3 -1
  160. package/src/queryParameters/index.ts +8 -2
  161. package/src/utils/resourcesStatusURL.ts +20 -3
  162. package/src/utils/translatedLabel.ts +4 -2
  163. package/src/utils/useDebounce.ts +10 -9
  164. package/src/utils/useInfiniteScrollListing.ts +2 -2
  165. package/src/utils/useIntersectionObserver.ts +2 -2
  166. package/src/utils/useLicenseExpirationWarning.test.tsx +4 -2
  167. package/src/utils/useLoadImage.tsx +7 -2
  168. package/src/utils/useLocaleDateTimeFormat/index.test.tsx +2 -3
  169. package/src/utils/useLocaleDateTimeFormat/localeFallback.test.tsx +2 -3
  170. package/test/testRenderer.tsx +9 -5
@@ -10,8 +10,10 @@ import { labelPredefinedRowsSelectionMenu } from '../../translatedLabels';
10
10
  import PredefinedSelectionList from '../_internals/PredefinedSelectionList';
11
11
 
12
12
  export interface SelectActionListingHeaderCellProps {
13
- onSelectAllClick: (event) => void;
14
- onSelectRowsWithCondition: (condition) => void;
13
+ onSelectAllClick: (event: React.ChangeEvent<HTMLInputElement>) => void;
14
+ onSelectRowsWithCondition: (
15
+ condition: (row: Record<string, unknown>) => boolean
16
+ ) => void;
15
17
  predefinedRowsSelection: Array<PredefinedRowSelection>;
16
18
  rowCount: number;
17
19
  selectedRowCount: number;
@@ -46,9 +48,9 @@ const SelectActionListingHeaderCell = ({
46
48
  icon={<ArrowDropDownIcon />}
47
49
  title={labelPredefinedRowsSelectionMenu}
48
50
  >
49
- {({ close }): JSX.Element => (
51
+ {(props): JSX.Element => (
50
52
  <PredefinedSelectionList
51
- close={close}
53
+ close={props?.close ?? ((): void => undefined)}
52
54
  onSelectRowsWithCondition={onSelectRowsWithCondition}
53
55
  predefinedRowsSelection={predefinedRowsSelection}
54
56
  />
@@ -34,13 +34,13 @@ type Props = Pick<
34
34
  } & SelectActionListingHeaderCellProps;
35
35
 
36
36
  interface ContentProps extends Pick<Props, 'sortField' | 'sortOrder'> {
37
- attributes;
37
+ attributes: Record<string, unknown>;
38
38
  id: string;
39
39
  isDragging: boolean;
40
40
  isInDragOverlay?: boolean;
41
41
  itemRef: React.RefObject<HTMLDivElement>;
42
42
  listeners: DraggableSyntheticListeners;
43
- style;
43
+ style: React.CSSProperties;
44
44
  }
45
45
 
46
46
  const ListingHeader = ({
@@ -4,7 +4,9 @@ import type { PredefinedRowSelection } from '../../models';
4
4
 
5
5
  interface Props {
6
6
  close: () => void;
7
- onSelectRowsWithCondition: (condition) => void;
7
+ onSelectRowsWithCondition: (
8
+ condition: (row: Record<string, unknown>) => boolean
9
+ ) => void;
8
10
  predefinedRowsSelection: Array<PredefinedRowSelection>;
9
11
  }
10
12
 
@@ -10,17 +10,17 @@ import type { Column, ColumnConfiguration, RowColorCondition } from '../models';
10
10
 
11
11
  type Props = {
12
12
  checkable: boolean;
13
- children;
13
+ children: React.ReactNode;
14
14
  columnConfiguration?: ColumnConfiguration;
15
15
  columnIds: Array<string>;
16
- disableRowCondition: (row) => boolean;
16
+ disableRowCondition: (row: Record<string, unknown>) => boolean;
17
17
  isHovered?: boolean;
18
18
  isSelected?: boolean;
19
19
  isShiftKeyDown: boolean;
20
20
  lastSelectionIndex: number | null;
21
21
  limit: number;
22
22
  listingVariant?: ListingVariant;
23
- row;
23
+ row: Record<string, unknown>;
24
24
  rowColorConditions: Array<RowColorCondition>;
25
25
  shiftKeyDownRowPivot: number | null;
26
26
  subItemsPivots: Array<number | string>;
@@ -97,8 +97,8 @@ export interface Props<TRow> {
97
97
  currentPage?: number;
98
98
  customListingComponent?: JSX.Element;
99
99
  customPaginationClassName?: string;
100
- disableRowCheckCondition?: (row) => boolean;
101
- disableRowCondition?: (row) => boolean;
100
+ disableRowCheckCondition?: (row: TRow) => boolean;
101
+ disableRowCondition?: (row: TRow) => boolean;
102
102
  displayCustomListing?: boolean;
103
103
  getHighlightRowCondition?: (row: TRow) => boolean;
104
104
  getId?: (row: TRow) => RowId;
@@ -109,8 +109,8 @@ export interface Props<TRow> {
109
109
  listingVariant?: ListingVariant;
110
110
  loading?: boolean;
111
111
  moveTablePagination?: boolean;
112
- onLimitChange?: (limit) => void;
113
- onPaginate?: (page) => void;
112
+ onLimitChange?: (limit: string | number) => void;
113
+ onPaginate?: (page: number) => void;
114
114
  onResetColumns?: () => void;
115
115
  onRowClick?: (row: TRow) => void;
116
116
  onSelectColumns?: (selectedColumnIds: Array<string>) => void;
@@ -126,14 +126,14 @@ export interface Props<TRow> {
126
126
  subItems?: {
127
127
  canCheckSubItems: boolean;
128
128
  enable: boolean;
129
- getRowProperty: (row?) => string;
129
+ getRowProperty: (row?: TRow) => string;
130
130
  labelCollapse: string;
131
131
  labelExpand: string;
132
132
  };
133
133
  totalRows?: number;
134
134
  viewerModeConfiguration?: ViewerModeConfiguration;
135
135
  widthToMoveTablePagination?: number;
136
- isActionBarVisible: boolean;
136
+ isActionBarVisible?: boolean;
137
137
  labelNoResultFound?: string | JSX.Element;
138
138
  }
139
139
 
@@ -226,8 +226,13 @@ const Listing = <
226
226
  rows.reduce<Array<string | number>>(
227
227
  (acc, row) => [
228
228
  ...acc,
229
- ...(row[subItems?.getRowProperty() || ''] || []).map(
230
- ({ id }) => `${subItemPrefixKey}_${getId(row)}_${id}`
229
+ ...(
230
+ ((row as Record<string, unknown>)[
231
+ subItems?.getRowProperty() || ''
232
+ ] as Array<{ id: string | number }> | undefined) || []
233
+ ).map(
234
+ ({ id }: { id: string | number }) =>
235
+ `${subItemPrefixKey}_${getId(row)}_${id}`
231
236
  )
232
237
  ],
233
238
  []
@@ -239,18 +244,21 @@ const Listing = <
239
244
  () =>
240
245
  subItems?.enable
241
246
  ? rows.reduce<Array<TRow>>((acc, row): Array<TRow> => {
247
+ const rowAsRecord = row as Record<string, unknown>;
242
248
  if (
243
- row[subItems.getRowProperty()] &&
249
+ rowAsRecord[subItems.getRowProperty()] &&
244
250
  subItemsPivots.includes(row.id)
245
251
  ) {
246
252
  return [
247
253
  ...acc,
248
254
  row,
249
- ...row[subItems.getRowProperty()].map((subRow) => ({
250
- ...subRow,
251
- internalListingParentId: row.id,
252
- internalListingParentRow: row
253
- }))
255
+ ...(rowAsRecord[subItems.getRowProperty()] as Array<TRow>).map(
256
+ (subRow: TRow) => ({
257
+ ...subRow,
258
+ internalListingParentId: row.id,
259
+ internalListingParentRow: row
260
+ })
261
+ )
254
262
  ];
255
263
  }
256
264
 
@@ -282,13 +290,13 @@ const Listing = <
282
290
  const haveSameId = (row: TRow, rowToCompare: TRow): boolean =>
283
291
  equals(getId(row), getId(rowToCompare));
284
292
 
285
- const selectedRowsInclude = (row): boolean => {
293
+ const selectedRowsInclude = (row: TRow): boolean => {
286
294
  return !!selectedRows.find((includedRow) =>
287
295
  equals(getId(includedRow), getId(row))
288
296
  );
289
297
  };
290
298
 
291
- const selectAllRows = (event): void => {
299
+ const selectAllRows = (event: React.ChangeEvent<HTMLInputElement>): void => {
292
300
  if (
293
301
  event.target.checked &&
294
302
  event.target.getAttribute('data-indeterminate') === 'false'
@@ -303,13 +311,15 @@ const Listing = <
303
311
  setLastSelectionIndex(null);
304
312
  };
305
313
 
306
- const onSelectRowsWithCondition = (condition: (row) => boolean): void => {
314
+ const onSelectRowsWithCondition = (
315
+ condition: (row: TRow) => boolean
316
+ ): void => {
307
317
  onSelectRows(reject(disableRowCheckCondition, filter(condition, rows)));
308
318
  setLastSelectionIndex(null);
309
319
  };
310
320
 
311
321
  interface GetSelectedRowsWithShiftKeyProps {
312
- compareFunction;
322
+ compareFunction: (a: number, b: number) => boolean;
313
323
  comparisonSliceEndIndex: number;
314
324
  comparisonSliceStartIndex: number;
315
325
  newSelection: Array<TRow>;
@@ -329,7 +339,10 @@ const Listing = <
329
339
  return differenceWith(haveSameId, selectedRows, newSelection);
330
340
  }
331
341
  if (
332
- compareFunction(lastSelectionIndex, last(selectedRowsIndex) as number)
342
+ compareFunction(
343
+ lastSelectionIndex as number,
344
+ last(selectedRowsIndex) as number
345
+ )
333
346
  ) {
334
347
  const normalizedNewSelection = slice(
335
348
  comparisonSliceStartIndex,
@@ -428,7 +441,7 @@ const Listing = <
428
441
  );
429
442
  };
430
443
 
431
- const selectRow = (event: React.MouseEvent, row): void => {
444
+ const selectRow = (event: React.MouseEvent, row: TRow): void => {
432
445
  event.preventDefault();
433
446
  event.stopPropagation();
434
447
  // This prevents unwanted text selection
@@ -462,7 +475,7 @@ const Listing = <
462
475
  onSelectRows([...selectedRows, row]);
463
476
  };
464
477
 
465
- const hoverRow = (row): void => {
478
+ const hoverRow = (row: TRow): void => {
466
479
  if (equals(hoveredRowId, getRowId(row))) {
467
480
  return;
468
481
  }
@@ -473,11 +486,11 @@ const Listing = <
473
486
  setHoveredRowId(null);
474
487
  };
475
488
 
476
- const isSelected = (row): boolean => {
489
+ const isSelected = (row: TRow): boolean => {
477
490
  return selectedRowsInclude(row);
478
491
  };
479
492
 
480
- const changeLimit = (updatedLimit: string): void => {
493
+ const changeLimit = (updatedLimit: string | number): void => {
481
494
  onLimitChange?.(Number(updatedLimit));
482
495
  };
483
496
 
@@ -497,6 +510,13 @@ const Listing = <
497
510
 
498
511
  const areColumnsEditable = not(isNil(onSelectColumns));
499
512
 
513
+ const disableRowConditionForCell = disableRowCondition as (
514
+ row: Record<string, unknown>
515
+ ) => boolean;
516
+ const getHighlightRowConditionForCell = getHighlightRowCondition as
517
+ | ((row: Record<string, unknown>) => boolean)
518
+ | undefined;
519
+
500
520
  return (
501
521
  <div className="h-full w-full overflow-hidden">
502
522
  {loading && rows.length > 0 && (
@@ -604,7 +624,7 @@ const Listing = <
604
624
  }
605
625
  columnConfiguration={columnConfiguration}
606
626
  columnIds={columns.map(prop('id'))}
607
- disableRowCondition={disableRowCondition}
627
+ disableRowCondition={disableRowConditionForCell}
608
628
  isHovered={isRowHovered}
609
629
  isSelected={isRowSelected}
610
630
  isShiftKeyDown={isShiftKeyDown}
@@ -633,7 +653,7 @@ const Listing = <
633
653
  <Cell
634
654
  align="left"
635
655
  className="justify-start"
636
- disableRowCondition={disableRowCondition}
656
+ disableRowCondition={disableRowConditionForCell}
637
657
  isRowHovered={isRowHovered}
638
658
  onClick={(event): void => selectRow(event, row)}
639
659
  row={row}
@@ -656,7 +676,7 @@ const Listing = <
656
676
  ) : (
657
677
  <Cell
658
678
  align="left"
659
- disableRowCondition={disableRowCondition}
679
+ disableRowCondition={disableRowConditionForCell}
660
680
  isRowHovered={isRowHovered}
661
681
  row={row}
662
682
  rowColorConditions={rowColorConditions}
@@ -666,9 +686,9 @@ const Listing = <
666
686
  {visibleColumns.map((column) => (
667
687
  <DataCell
668
688
  column={column}
669
- disableRowCondition={disableRowCondition}
689
+ disableRowCondition={disableRowConditionForCell}
670
690
  getHighlightRowCondition={
671
- getHighlightRowCondition
691
+ getHighlightRowConditionForCell
672
692
  }
673
693
  isRowHovered={isRowHovered}
674
694
  isRowSelected={isRowSelected}
@@ -3,6 +3,8 @@ interface EllipsisTypography {
3
3
  formattedString: string;
4
4
  }
5
5
 
6
+ export type RowRecord = Record<string, unknown>;
7
+
6
8
  export interface ComponentColumnProps {
7
9
  isHovered: boolean;
8
10
  isSelected: boolean;
@@ -10,7 +12,7 @@ export interface ComponentColumnProps {
10
12
  className,
11
13
  formattedString
12
14
  }: EllipsisTypography) => JSX.Element;
13
- row;
15
+ row: RowRecord;
14
16
  }
15
17
 
16
18
  export interface Column {
@@ -21,11 +23,11 @@ export interface Column {
21
23
  disablePadding?: boolean;
22
24
  disabled?: boolean;
23
25
  displaySubItemsCaret?: boolean;
24
- getColSpan?: (isSelected) => number | undefined;
25
- getFormattedString?: (row) => string | null;
26
- getHiddenCondition?: (isSelected) => boolean;
27
- getRenderComponentCondition?: (row) => boolean;
28
- getRenderComponentOnRowUpdateCondition?: (row) => boolean;
26
+ getColSpan?: (isSelected: boolean) => number | undefined;
27
+ getFormattedString?: (row: RowRecord) => string | null;
28
+ getHiddenCondition?: (isSelected: boolean) => boolean;
29
+ getRenderComponentCondition?: (row: RowRecord) => boolean;
30
+ getRenderComponentOnRowUpdateCondition?: (row: RowRecord) => boolean;
29
31
  hasHoverableComponent?: boolean;
30
32
  id: string;
31
33
  isTruncated?: boolean;
@@ -45,7 +47,7 @@ export enum ColumnType {
45
47
 
46
48
  export interface RowColorCondition {
47
49
  color: string;
48
- condition: (row) => boolean;
50
+ condition: (row: RowRecord) => boolean;
49
51
  name: string;
50
52
  }
51
53
 
@@ -60,7 +62,7 @@ export type SortOrder = 'asc' | 'desc';
60
62
 
61
63
  export interface PredefinedRowSelection {
62
64
  label: string;
63
- rowCondition: (row) => boolean;
65
+ rowCondition: (row: RowRecord) => boolean;
64
66
  }
65
67
 
66
68
  export interface TableStyleAtom {
@@ -80,7 +82,7 @@ export interface TableStyleAtom {
80
82
  export interface ListingSubItems {
81
83
  canCheckSubItems: boolean;
82
84
  enable: boolean;
83
- getRowProperty: (row?) => string;
85
+ getRowProperty: (row?: RowRecord) => string;
84
86
  labelCollapse: string;
85
87
  labelExpand: string;
86
88
  }
@@ -71,7 +71,7 @@ const EntryChip = ({
71
71
  );
72
72
  };
73
73
 
74
- const EmptyEntry = ({ label }): JSX.Element => {
74
+ const EmptyEntry = ({ label }: { label: string }): JSX.Element => {
75
75
  const { classes } = useStyles();
76
76
 
77
77
  return (
@@ -81,7 +81,7 @@ const EmptyEntry = ({ label }): JSX.Element => {
81
81
  );
82
82
  };
83
83
 
84
- const Caption = ({ children }): JSX.Element => {
84
+ const Caption = ({ children }: { children: React.ReactNode }): JSX.Element => {
85
85
  const { classes } = useStyles();
86
86
 
87
87
  return (
@@ -98,7 +98,7 @@ interface Value {
98
98
 
99
99
  interface Props {
100
100
  emptyLabel: string;
101
- error?;
101
+ error?: React.ReactNode;
102
102
  gridWidth?: 'auto' | number;
103
103
  highlight?: boolean;
104
104
  label: string;
@@ -22,7 +22,9 @@ interface Props {
22
22
  api: {
23
23
  baseEndpoint: string;
24
24
  queryKey: Array<string>;
25
- searchConditions?;
25
+ searchConditions?: Array<
26
+ import('../api/buildListingEndpoint/models').ConditionsSearchParameter
27
+ >;
26
28
  };
27
29
  labelHasNoElements?: string;
28
30
  onItemClick?: ({ id }: { id: number }) => void;
@@ -94,7 +94,7 @@ export interface Props {
94
94
  minWidth?: number;
95
95
  onClose?: () => void;
96
96
  onResize?: (newWidth: number) => void;
97
- onTabSelect?: (event, id: number) => void;
97
+ onTabSelect?: (event: React.SyntheticEvent, id: number) => void;
98
98
  selectedTab: ReactElement;
99
99
  selectedTabId?: number;
100
100
  tabs?: Array<JSX.Element>;
@@ -154,7 +154,7 @@ const Panel = forwardRef(
154
154
  };
155
155
 
156
156
  const moveMouse = useCallback(
157
- (e) => {
157
+ (e: MouseEvent) => {
158
158
  e.preventDefault();
159
159
 
160
160
  const maxWidth = getMaxWidth();
@@ -28,7 +28,7 @@ interface PopoverData {
28
28
 
29
29
  interface Props {
30
30
  canOpen?: boolean;
31
- children: (props?) => JSX.Element | JSX.Element;
31
+ children: ((props?: { close?: () => void }) => JSX.Element) | JSX.Element;
32
32
  className?: string;
33
33
  tooltipClassName?: string;
34
34
  dataTestId?: string;
@@ -59,7 +59,7 @@ const PopoverMenu = ({
59
59
  const [anchorEl, setAnchorEl] = useState<HTMLElement | undefined>();
60
60
  const isOpen = Boolean(anchorEl);
61
61
 
62
- const close = (reason?): void => {
62
+ const close = (reason?: { type?: string }): void => {
63
63
  const isClosedByInputClick = reason?.type === 'mousedown';
64
64
  if (isClosedByInputClick) {
65
65
  return;
@@ -69,7 +69,7 @@ const PopoverMenu = ({
69
69
  setAnchorEl(undefined);
70
70
  };
71
71
 
72
- const toggle = (event): void => {
72
+ const toggle = (event: React.MouseEvent<HTMLButtonElement>): void => {
73
73
  if (isOpen) {
74
74
  close();
75
75
 
@@ -3,6 +3,7 @@
3
3
  import { Typography } from '@mui/material';
4
4
 
5
5
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
6
+ import type { LexicalEditor } from 'lexical';
6
7
  import { isEmpty, isNil } from 'ramda';
7
8
  import { useCallback, useEffect, useLayoutEffect, useState } from 'react';
8
9
  import { useTranslation } from 'react-i18next';
@@ -59,7 +60,7 @@ interface Props {
59
60
  error?: string;
60
61
  hasInitialTextContent?: boolean;
61
62
  initialEditorState?: string;
62
- initialize?: (editor) => void;
63
+ initialize?: (editor: LexicalEditor) => void;
63
64
  inputClassname?: string;
64
65
  minInputHeight: number;
65
66
  namespace: string;
@@ -31,7 +31,7 @@ export interface RichTextEditorProps {
31
31
  error?: string;
32
32
  getEditorState?: (editorState: EditorState, editor: LexicalEditor) => void;
33
33
  initialEditorState?: string;
34
- initialize?: (editor) => void;
34
+ initialize?: (editor: LexicalEditor) => void;
35
35
  inputClassname?: string;
36
36
  minInputHeight?: number;
37
37
  namespace?: string;
@@ -63,8 +63,8 @@ const FloatingLinkEditor = ({
63
63
  const rangeRect = getDOMRangeRect(nativeSelection, rootElement);
64
64
 
65
65
  const acceptOrCancelNewLinkValue = useCallback(
66
- (event): void => {
67
- const { value } = event.target;
66
+ (event: React.KeyboardEvent<HTMLInputElement>): void => {
67
+ const { value } = event.target as HTMLInputElement;
68
68
 
69
69
  event.preventDefault();
70
70
 
@@ -90,22 +90,24 @@ const FloatingLinkEditor = ({
90
90
  setEditMode(true);
91
91
  }, [linkUrl, setEditMode]);
92
92
 
93
- const changeValue = useCallback((event): void => {
94
- const { value } = event.target;
93
+ const changeValue = useCallback(
94
+ (event: React.ChangeEvent<HTMLInputElement>): void => {
95
+ const { value } = event.target;
95
96
 
96
- const matched = value.match(/https?:\/\//g);
97
+ const matched = value.match(/https?:\/\//g);
97
98
 
98
- if (gt(matched.length, 1)) {
99
- setEditedUrl(
100
- // @ts-expect-error - suppressing pre-existing type mismatch
101
- replace(matched.join(''), matched[dec(matched.length)], value)
102
- );
99
+ if (matched && gt(matched.length, 1)) {
100
+ setEditedUrl(
101
+ replace(matched.join(''), matched[dec(matched.length)], value)
102
+ );
103
103
 
104
- return;
105
- }
104
+ return;
105
+ }
106
106
 
107
- setEditedUrl(value);
108
- }, []);
107
+ setEditedUrl(value);
108
+ },
109
+ []
110
+ );
109
111
 
110
112
  useEffect(() => {
111
113
  const isPositioned =
@@ -38,7 +38,7 @@ const blockTypes = ['h3', 'h5', 'paragraph', 'h6'];
38
38
 
39
39
  const blockTypeOptions = blockTypes.map((blockType) => ({
40
40
  id: blockType,
41
- name: blockTypeToBlockName[blockType]
41
+ name: blockTypeToBlockName[blockType as keyof typeof blockTypeToBlockName]
42
42
  }));
43
43
 
44
44
  const BlockButtons = ({ disabled }: Props): JSX.Element => {
@@ -68,8 +68,8 @@ const BlockButtons = ({ disabled }: Props): JSX.Element => {
68
68
  }
69
69
  };
70
70
 
71
- const changeBlockType = (newBlockType): void => {
72
- const formatFunction = cond<Array<string>, (value?) => void>([
71
+ const changeBlockType = (newBlockType: string): void => {
72
+ const formatFunction = cond<Array<string>, (value?: unknown) => void>([
73
73
  [equals('h3'), always(() => formatHeading('h3'))],
74
74
  [equals('h5'), always(() => formatHeading('h5'))],
75
75
  [equals('h6'), always(() => formatHeading('h6'))],
@@ -64,7 +64,7 @@ const ListButton = ({ disabled }: Props): JSX.Element => {
64
64
  }
65
65
  };
66
66
 
67
- const formatList = (type): void => {
67
+ const formatList = (type: string): void => {
68
68
  if (equals(type, elementList)) {
69
69
  setElementList(null);
70
70
  }
@@ -29,7 +29,7 @@ const MacrosButton = ({ disabled }: Props): JSX.Element => {
29
29
 
30
30
  const insertMacrosCommand: LexicalCommand<string> = createCommand();
31
31
 
32
- const onClick = (macro): void => {
32
+ const onClick = (macro: string): void => {
33
33
  editor.dispatchCommand(insertMacrosCommand, macro);
34
34
  };
35
35
 
@@ -21,7 +21,7 @@ const SnackbarProvider = ({
21
21
  TransitionComponent={
22
22
  Transition as JSXElementConstructor<
23
23
  TransitionProps & {
24
- children;
24
+ children: ReactElement;
25
25
  }
26
26
  >
27
27
  }
@@ -30,7 +30,7 @@ const useStyles = makeStyles()((theme) => ({
30
30
 
31
31
  export interface SnackbarProps {
32
32
  id: string | number;
33
- message: string;
33
+ message: string | JSX.Element;
34
34
  severity: Severity;
35
35
  }
36
36
 
@@ -57,7 +57,9 @@ const Snackbar = forwardRef(
57
57
  }
58
58
  closeSnackbar(id);
59
59
  };
60
- const sanitizedMessage = sanitizedHTML({ initialContent: message });
60
+ const sanitizedMessage = sanitizedHTML({
61
+ initialContent: message as string
62
+ });
61
63
 
62
64
  const formatedMessage =
63
65
  typeof message === 'string' ? <div>{sanitizedMessage}</div> : message;
@@ -1,6 +1,10 @@
1
1
  import { Typography } from '@mui/material';
2
2
 
3
- import { useSnackbar as useNotistackSnackbar } from 'notistack';
3
+ import {
4
+ type SnackbarKey,
5
+ type SnackbarMessage,
6
+ useSnackbar as useNotistackSnackbar
7
+ } from 'notistack';
4
8
 
5
9
  import { sanitizedHTML } from '../utils';
6
10
  import Snackbar from '.';
@@ -34,9 +38,15 @@ const useSnackbar = (): UseSnackbar => {
34
38
  const notistackHookProps = useNotistackSnackbar();
35
39
 
36
40
  const snackbarContent =
37
- (severity) =>
38
- (key: string | number, message): JSX.Element => {
39
- return <Snackbar id={key} message={message} severity={severity} />;
41
+ (severity: Severity) =>
42
+ (key: SnackbarKey, message?: SnackbarMessage): JSX.Element => {
43
+ return (
44
+ <Snackbar
45
+ id={key}
46
+ message={message as string | JSX.Element}
47
+ severity={severity}
48
+ />
49
+ );
40
50
  };
41
51
 
42
52
  const showMessage = ({ message, severity }: ShowMessageProps): void => {
@@ -35,12 +35,12 @@ import Item from './Item';
35
35
  import SortableItem from './SortableItem';
36
36
 
37
37
  interface ContentProps {
38
- attributes;
39
- index;
38
+ attributes: Record<string, unknown>;
39
+ index: number;
40
40
  isDragging: boolean;
41
41
  itemRef: RefObject<HTMLDivElement>;
42
42
  listeners: DraggableSyntheticListeners;
43
- style;
43
+ style: React.CSSProperties;
44
44
  }
45
45
 
46
46
  export interface RootComponentProps {
@@ -162,7 +162,7 @@ const SortableItems = <T extends { [propertyToFilterItemsOn]: string }>({
162
162
  onDragOver?.(event);
163
163
  };
164
164
 
165
- const getItemById = (id): T | undefined =>
165
+ const getItemById = (id: string | null): T | undefined =>
166
166
  find(propEq(id, propertyToFilterItemsOn), items);
167
167
 
168
168
  const activeItem = getItemById(activeId) as Record<string, unknown>;
@@ -17,7 +17,7 @@ import useStyles from './CompactCustomTimePeriod.styles';
17
17
  interface Props {
18
18
  disabled?: boolean;
19
19
  isCondensed?: boolean;
20
- onClick: (event) => void;
20
+ onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
21
21
  }
22
22
 
23
23
  const CompactCustomTimePeriod = ({
@@ -10,7 +10,7 @@ interface RangeDate {
10
10
 
11
11
  export interface AcceptDateProps {
12
12
  date: Date;
13
- property: CustomTimePeriodProperty;
13
+ property: CustomTimePeriodProperty | string;
14
14
  }
15
15
 
16
16
  export interface PickersData {