@centreon/ui 24.4.1-sync-release-34022.0 → 24.4.1-test-code-coverage.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 (220) hide show
  1. package/package.json +48 -40
  2. package/src/ActionsList/ActionsList.styles.ts +40 -71
  3. package/src/Button/Icon/index.stories.tsx +1 -1
  4. package/src/Button/Icon/index.tsx +1 -1
  5. package/src/Dashboard/Dashboard.styles.ts +6 -5
  6. package/src/Dialog/Confirm/index.tsx +10 -2
  7. package/src/Dialog/UnsavedChanges/index.tsx +21 -20
  8. package/src/Dialog/UnsavedChanges/translatedLabels.ts +4 -6
  9. package/src/Dialog/index.tsx +8 -1
  10. package/src/Form/Inputs/CheckboxGroup.tsx +4 -1
  11. package/src/Form/Inputs/Text.tsx +3 -1
  12. package/src/Form/Inputs/models.ts +1 -0
  13. package/src/Graph/BarStack/BarStack.cypress.spec.tsx +139 -0
  14. package/src/Graph/BarStack/BarStack.stories.tsx +123 -0
  15. package/src/Graph/BarStack/BarStack.styles.ts +37 -0
  16. package/src/Graph/BarStack/BarStack.tsx +14 -0
  17. package/src/Graph/BarStack/ResponsiveBarStack.tsx +209 -0
  18. package/src/Graph/BarStack/index.ts +1 -0
  19. package/src/Graph/BarStack/models.ts +19 -0
  20. package/src/Graph/BarStack/useResponsiveBarStack.ts +131 -0
  21. package/src/Graph/Gauge/Gauge.cypress.spec.tsx +102 -0
  22. package/src/Graph/Gauge/Gauge.tsx +1 -1
  23. package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +145 -0
  24. package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -25
  25. package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +8 -2
  26. package/src/Graph/Legend/Legend.tsx +21 -0
  27. package/src/Graph/Legend/index.ts +1 -0
  28. package/src/Graph/Legend/models.ts +11 -0
  29. package/src/Graph/LineChart/BasicComponents/Lines/Threshold/index.tsx +4 -5
  30. package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +3 -1
  31. package/src/Graph/LineChart/Header/index.tsx +3 -31
  32. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +9 -11
  33. package/src/Graph/LineChart/InteractiveComponents/Annotations/Annotation/index.tsx +3 -2
  34. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +68 -0
  35. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +27 -0
  36. package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +31 -0
  37. package/src/Graph/LineChart/InteractiveComponents/index.tsx +132 -17
  38. package/src/Graph/LineChart/InteractiveComponents/interactionWithGraphAtoms.ts +7 -27
  39. package/src/Graph/LineChart/Legend/Legend.styles.ts +5 -9
  40. package/src/Graph/LineChart/Legend/LegendHeader.tsx +10 -22
  41. package/src/Graph/LineChart/Legend/index.tsx +17 -55
  42. package/src/Graph/LineChart/LineChart.cypress.spec.tsx +91 -0
  43. package/src/Graph/LineChart/LineChart.styles.ts +8 -0
  44. package/src/Graph/LineChart/LineChart.tsx +106 -116
  45. package/src/Graph/LineChart/LoadingSkeleton.tsx +2 -2
  46. package/src/Graph/LineChart/index.tsx +6 -7
  47. package/src/Graph/LineChart/mockedData/lastDayWithIncompleteValues.json +1320 -0
  48. package/src/Graph/LineChart/mockedData/lastDayWithNullValues.json +1314 -0
  49. package/src/Graph/LineChart/models.ts +12 -1
  50. package/src/Graph/PieChart/PieChart.cypress.spec.tsx +154 -0
  51. package/src/Graph/PieChart/PieChart.stories.tsx +194 -0
  52. package/src/Graph/PieChart/PieChart.styles.ts +39 -0
  53. package/src/Graph/PieChart/PieChart.tsx +14 -0
  54. package/src/Graph/PieChart/ResponsivePie.tsx +243 -0
  55. package/src/Graph/PieChart/index.ts +1 -0
  56. package/src/Graph/PieChart/models.ts +19 -0
  57. package/src/Graph/PieChart/useResponsivePie.ts +81 -0
  58. package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +121 -0
  59. package/src/Graph/Text/Text.cypress.spec.tsx +101 -0
  60. package/src/Graph/Text/Text.styles.ts +12 -1
  61. package/src/Graph/Text/Text.tsx +17 -12
  62. package/src/Graph/Tree/DescendantNodes.tsx +89 -0
  63. package/src/Graph/Tree/Links.tsx +77 -0
  64. package/src/Graph/Tree/StandaloneTree.tsx +32 -0
  65. package/src/Graph/Tree/Tree.cypress.spec.tsx +195 -0
  66. package/src/Graph/Tree/Tree.stories.tsx +160 -0
  67. package/src/Graph/Tree/Tree.tsx +116 -0
  68. package/src/Graph/Tree/constants.ts +2 -0
  69. package/src/Graph/Tree/index.ts +4 -0
  70. package/src/Graph/Tree/models.ts +55 -0
  71. package/src/Graph/Tree/stories/contents.tsx +164 -0
  72. package/src/Graph/Tree/stories/datas.ts +305 -0
  73. package/src/Graph/Tree/utils.ts +49 -0
  74. package/src/Graph/common/testUtils.ts +71 -0
  75. package/src/Graph/common/timeSeries/index.ts +50 -12
  76. package/src/Graph/common/utils.ts +19 -0
  77. package/src/Graph/index.ts +4 -0
  78. package/src/InputField/Number/Number.cypress.spec.tsx +85 -0
  79. package/src/InputField/Number/Number.stories.tsx +66 -0
  80. package/src/InputField/Number/Number.tsx +74 -0
  81. package/src/InputField/Search/index.tsx +2 -2
  82. package/src/InputField/Select/Autocomplete/Multi/index.tsx +4 -2
  83. package/src/InputField/Select/Autocomplete/index.tsx +10 -3
  84. package/src/InputField/Select/IconPopover/index.tsx +1 -1
  85. package/src/InputField/Select/index.tsx +14 -1
  86. package/src/InputField/Text/index.tsx +38 -38
  87. package/src/Listing/ActionBar/index.tsx +10 -10
  88. package/src/Listing/Cell/DataCell.styles.ts +3 -0
  89. package/src/Listing/Cell/DataCell.tsx +8 -4
  90. package/src/Listing/Listing.cypress.spec.tsx +217 -33
  91. package/src/Listing/Listing.styles.ts +3 -5
  92. package/src/Listing/Row/Row.tsx +7 -3
  93. package/src/Listing/index.stories.tsx +25 -2
  94. package/src/Listing/index.test.tsx +1 -1
  95. package/src/Listing/index.tsx +202 -143
  96. package/src/Listing/models.ts +1 -0
  97. package/src/Listing/useStyleTable.ts +1 -0
  98. package/src/Panel/index.tsx +1 -1
  99. package/src/PopoverMenu/index.tsx +6 -5
  100. package/src/ThemeProvider/index.tsx +3 -0
  101. package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +6 -7
  102. package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +12 -9
  103. package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +27 -0
  104. package/src/Typography/FluidTypography/index.stories.tsx +2 -2
  105. package/src/Typography/FluidTypography/index.tsx +21 -28
  106. package/src/api/index.ts +3 -3
  107. package/src/api/useGraphQuery/index.ts +26 -5
  108. package/src/api/useGraphQuery/models.ts +5 -0
  109. package/src/api/useMutationQuery/index.test.ts +4 -4
  110. package/src/api/useMutationQuery/index.ts +24 -13
  111. package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +76 -0
  112. package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +26 -0
  113. package/src/components/CollapsibleItem/CollapsibleItem.tsx +43 -14
  114. package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +24 -1
  115. package/src/components/DataTable/DataTable.cypress.spec.tsx +14 -33
  116. package/src/components/DataTable/Item/DataTableItem.tsx +4 -60
  117. package/src/components/Form/{AccessRightsV2 → AccessRights}/AccessRights.cypress.spec.tsx +36 -13
  118. package/src/components/Form/{AccessRightsV2 → AccessRights}/ShareInput/ContactSwitch.tsx +11 -3
  119. package/src/components/Form/{AccessRightsV2 → AccessRights}/ShareInput/ShareInput.styles.ts +8 -0
  120. package/src/components/Form/{AccessRightsV2 → AccessRights}/ShareInput/ShareInput.tsx +1 -0
  121. package/src/components/Form/{AccessRightsV2 → AccessRights}/ShareInput/useShareInput.tsx +4 -0
  122. package/src/components/Form/{AccessRightsV2 → AccessRights}/models.ts +1 -0
  123. package/src/components/Form/{AccessRightsV2 → AccessRights}/storiesData.ts +23 -22
  124. package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +85 -0
  125. package/src/components/Form/Dashboard/index.ts +1 -0
  126. package/src/components/Form/FormActions.tsx +7 -2
  127. package/src/components/Form/index.ts +2 -2
  128. package/src/components/ItemComposition/Item.tsx +1 -1
  129. package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +113 -0
  130. package/src/components/ItemComposition/ItemComposition.stories.tsx +14 -0
  131. package/src/components/ItemComposition/ItemComposition.styles.ts +36 -3
  132. package/src/components/ItemComposition/ItemComposition.tsx +41 -17
  133. package/src/components/List/Item/ListItem.tsx +3 -3
  134. package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +168 -0
  135. package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +62 -0
  136. package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +87 -0
  137. package/src/components/Modal/Modal.styles.ts +8 -3
  138. package/src/components/Modal/index.ts +2 -0
  139. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +3 -3
  140. package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +1 -1
  141. package/src/components/Tooltip/ConfirmationTooltip/models.ts +1 -1
  142. package/src/components/Zoom/Minimap.tsx +129 -0
  143. package/src/components/Zoom/Zoom.cypress.spec.tsx +246 -0
  144. package/src/components/Zoom/Zoom.stories.tsx +115 -0
  145. package/src/components/Zoom/Zoom.styles.tsx +68 -0
  146. package/src/components/Zoom/Zoom.tsx +64 -0
  147. package/src/components/Zoom/ZoomContent.tsx +170 -0
  148. package/src/components/Zoom/constants.ts +2 -0
  149. package/src/components/Zoom/localPoint.ts +51 -0
  150. package/src/components/Zoom/models.ts +25 -0
  151. package/src/components/Zoom/useMinimap.ts +156 -0
  152. package/src/components/Zoom/useZoom.ts +70 -0
  153. package/src/components/Zoom/utils.ts +55 -0
  154. package/src/components/index.ts +1 -0
  155. package/src/index.ts +1 -0
  156. package/src/utils/index.ts +3 -0
  157. package/src/utils/resourcesStatusURL.ts +166 -0
  158. package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +130 -0
  159. package/src/utils/useFullscreen/atoms.ts +3 -0
  160. package/src/utils/useFullscreen/index.ts +2 -0
  161. package/src/utils/useFullscreen/translatedLabels.ts +1 -0
  162. package/src/utils/useFullscreen/useFullscreen.ts +73 -0
  163. package/src/utils/useFullscreen/useFullscreenListener.ts +62 -0
  164. package/src/utils/useInfiniteScrollListing.ts +4 -1
  165. package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
  166. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -96
  167. package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +0 -107
  168. package/src/Graph/LineChart/Legend/InteractiveValue.tsx +0 -22
  169. package/src/Graph/LineChart/Legend/useInteractiveValues.ts +0 -99
  170. package/src/Typography/FluidTypography/useFluidResizeObserver.ts +0 -56
  171. package/src/components/Form/AccessRights/AccessRights.resource.ts +0 -45
  172. package/src/components/Form/AccessRights/AccessRightsForm.stories.tsx +0 -59
  173. package/src/components/Form/AccessRights/AccessRightsForm.styles.ts +0 -21
  174. package/src/components/Form/AccessRights/AccessRightsForm.tsx +0 -67
  175. package/src/components/Form/AccessRights/AccessRightsFormActions.tsx +0 -80
  176. package/src/components/Form/AccessRights/Input/AddAction.tsx +0 -31
  177. package/src/components/Form/AccessRights/Input/ContactAccessRightInput.stories.tsx +0 -54
  178. package/src/components/Form/AccessRights/Input/ContactAccessRightInput.tsx +0 -72
  179. package/src/components/Form/AccessRights/Input/ContactAccessRightsInput.styles.ts +0 -22
  180. package/src/components/Form/AccessRights/Input/ContactInputField.tsx +0 -105
  181. package/src/components/Form/AccessRights/Input/RoleInputField.tsx +0 -29
  182. package/src/components/Form/AccessRights/List/ContactAccessRightsList.stories.tsx +0 -97
  183. package/src/components/Form/AccessRights/List/ContactAccessRightsList.styles.ts +0 -71
  184. package/src/components/Form/AccessRights/List/ContactAccessRightsList.tsx +0 -51
  185. package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.stories.tsx +0 -116
  186. package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.tsx +0 -118
  187. package/src/components/Form/AccessRights/List/ContactAccessRightsListItemSkeleton.tsx +0 -26
  188. package/src/components/Form/AccessRights/List/ContactAccessRightsListSkeleton.tsx +0 -28
  189. package/src/components/Form/AccessRights/Stats/AccessRightsStats.styles.ts +0 -18
  190. package/src/components/Form/AccessRights/Stats/AccessRightsStats.tsx +0 -41
  191. package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +0 -54
  192. package/src/components/Form/AccessRights/common/GroupLabel.styles.ts +0 -18
  193. package/src/components/Form/AccessRights/common/GroupLabel.tsx +0 -15
  194. package/src/components/Form/AccessRights/common/Input.styles.ts +0 -48
  195. package/src/components/Form/AccessRights/common/RoleInputSelect.styles.ts +0 -11
  196. package/src/components/Form/AccessRights/common/RoleInputSelect.tsx +0 -57
  197. package/src/components/Form/AccessRights/index.ts +0 -3
  198. package/src/components/Form/AccessRights/useAccessRightsForm.test.tsx +0 -531
  199. package/src/components/Form/AccessRights/useAccessRightsForm.tsx +0 -282
  200. package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +0 -41
  201. /package/src/components/Form/{AccessRightsV2 → AccessRights}/AccessRights.stories.tsx +0 -0
  202. /package/src/components/Form/{AccessRightsV2 → AccessRights}/AccessRights.styles.ts +0 -0
  203. /package/src/components/Form/{AccessRightsV2 → AccessRights}/AccessRights.tsx +0 -0
  204. /package/src/components/Form/{AccessRightsV2 → AccessRights}/Actions/Actions.styles.ts +0 -0
  205. /package/src/components/Form/{AccessRightsV2 → AccessRights}/Actions/Actions.tsx +0 -0
  206. /package/src/components/Form/{AccessRightsV2 → AccessRights}/Actions/useActions.ts +0 -0
  207. /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/Item.tsx +0 -0
  208. /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/List.styles.tsx +0 -0
  209. /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/List.tsx +0 -0
  210. /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/ListItemSkeleton.tsx +0 -0
  211. /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/ListSkeleton.tsx +0 -0
  212. /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/RemoveAccessRight.tsx +0 -0
  213. /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/StateChip.tsx +0 -0
  214. /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/useItem.ts +0 -0
  215. /package/src/components/Form/{AccessRightsV2 → AccessRights}/Provider.tsx +0 -0
  216. /package/src/components/Form/{AccessRightsV2 → AccessRights}/Stats/Stats.tsx +0 -0
  217. /package/src/components/Form/{AccessRightsV2 → AccessRights}/atoms.ts +0 -0
  218. /package/src/components/Form/{AccessRightsV2 → AccessRights}/common/RoleSelectField.styles.tsx +0 -0
  219. /package/src/components/Form/{AccessRightsV2 → AccessRights}/common/RoleSelectField.tsx +0 -0
  220. /package/src/components/Form/{AccessRightsV2 → AccessRights}/useAccessRightsInitValues.ts +0 -0
@@ -18,7 +18,6 @@ import {
18
18
  map,
19
19
  not,
20
20
  pick,
21
- pluck,
22
21
  prop,
23
22
  propEq,
24
23
  reduce,
@@ -58,6 +57,8 @@ import { SkeletonLoader } from './Row/SkeletonLoaderRows';
58
57
  import { ListingHeader } from './Header';
59
58
  import { subItemsPivotsAtom } from './tableAtoms';
60
59
 
60
+ const subItemPrefixKey = 'listing';
61
+
61
62
  const getVisibleColumns = ({
62
63
  columnConfiguration,
63
64
  columns
@@ -93,13 +94,16 @@ export interface Props<TRow> {
93
94
  columnConfiguration?: ColumnConfiguration;
94
95
  columns: Array<Column>;
95
96
  currentPage?: number;
97
+ customListingComponent?: JSX.Element;
96
98
  customPaginationClassName?: string;
97
99
  disableRowCheckCondition?: (row) => boolean;
98
100
  disableRowCondition?: (row) => boolean;
101
+ displayCustomListing?: boolean;
99
102
  getHighlightRowCondition?: (row: TRow) => boolean;
100
103
  getId?: (row: TRow) => RowId;
101
104
  headerMemoProps?: Array<unknown>;
102
105
  innerScrollDisabled?: boolean;
106
+ isResponsive?: boolean;
103
107
  limit?: number;
104
108
  listingVariant?: ListingVariant;
105
109
  loading?: boolean;
@@ -137,12 +141,15 @@ const defaultColumnConfiguration = {
137
141
 
138
142
  export const performanceRowsLimit = 60;
139
143
 
140
- const Listing = <TRow extends { id: RowId }>({
144
+ const Listing = <TRow extends { id: RowId; internalListingParentId?: RowId }>({
145
+ customListingComponent,
146
+ displayCustomListing,
141
147
  limit = 10,
142
148
  visualizationActions,
143
149
  columns,
144
150
  columnConfiguration = defaultColumnConfiguration,
145
151
  customPaginationClassName,
152
+ isResponsive = false,
146
153
  onResetColumns,
147
154
  onSelectColumns,
148
155
  rows = [],
@@ -205,6 +212,21 @@ const Listing = <TRow extends { id: RowId }>({
205
212
 
206
213
  const subItemsPivots = useAtomValue(subItemsPivotsAtom);
207
214
 
215
+ const allSubItemIds = React.useMemo(
216
+ () =>
217
+ reduce<TRow | number, Array<string | number>>(
218
+ (acc, row) => [
219
+ ...acc,
220
+ ...(row[subItems?.getRowProperty() || ''] || []).map(
221
+ ({ id }) => `${subItemPrefixKey}_${getId(row)}_${id}`
222
+ )
223
+ ],
224
+ [],
225
+ rows
226
+ ),
227
+ [rows, subItems]
228
+ );
229
+
208
230
  const rowsToDisplay = React.useMemo(
209
231
  () =>
210
232
  subItems?.enable
@@ -214,7 +236,14 @@ const Listing = <TRow extends { id: RowId }>({
214
236
  row[subItems.getRowProperty()] &&
215
237
  subItemsPivots.includes(row.id)
216
238
  ) {
217
- return [...acc, row, ...row[subItems.getRowProperty()]];
239
+ return [
240
+ ...acc,
241
+ row,
242
+ ...row[subItems.getRowProperty()].map((subRow) => ({
243
+ ...subRow,
244
+ internalListingParentId: row.id
245
+ }))
246
+ ];
218
247
  }
219
248
 
220
249
  return [...acc, row];
@@ -226,10 +255,28 @@ const Listing = <TRow extends { id: RowId }>({
226
255
  [rows, subItemsPivots, subItems]
227
256
  );
228
257
 
258
+ const getSubItemRowId = React.useCallback((row: TRow) => {
259
+ return `${subItemPrefixKey}_${row.internalListingParentId}_${row.id}`;
260
+ }, []);
261
+
262
+ const getIsSubItem = React.useCallback(
263
+ (row: TRow) => {
264
+ return allSubItemIds.includes(getSubItemRowId(row));
265
+ },
266
+ [allSubItemIds]
267
+ );
268
+
269
+ const getRowId = React.useCallback(
270
+ (row: TRow) => {
271
+ return getIsSubItem(row) ? getSubItemRowId(row) : getId(row);
272
+ },
273
+ [allSubItemIds]
274
+ );
275
+
229
276
  const { classes } = useListingStyles({
230
277
  dataStyle,
231
278
  getGridTemplateColumn,
232
- listingVariant,
279
+ isResponsive,
233
280
  rows: rowsToDisplay
234
281
  });
235
282
 
@@ -249,7 +296,7 @@ const Listing = <TRow extends { id: RowId }>({
249
296
  event.target.checked &&
250
297
  event.target.getAttribute('data-indeterminate') === 'false'
251
298
  ) {
252
- onSelectRows(reject(disableRowCheckCondition, rows));
299
+ onSelectRows(reject(disableRowCheckCondition, rowsToDisplay));
253
300
  setLastSelectionIndex(null);
254
301
 
255
302
  return;
@@ -321,7 +368,11 @@ const Listing = <TRow extends { id: RowId }>({
321
368
  const selectRowsWithShiftKey = (selectedRowIndex: number): void => {
322
369
  const lastSelectedIndex = lastSelectionIndex as number;
323
370
  if (isNil(shiftKeyDownRowPivot)) {
324
- const selectedRowsFromTheStart = slice(0, selectedRowIndex + 1, rows);
371
+ const selectedRowsFromTheStart = slice(
372
+ 0,
373
+ selectedRowIndex + 1,
374
+ rowsToDisplay
375
+ );
325
376
 
326
377
  onSelectRows(reject(disableRowCheckCondition, selectedRowsFromTheStart));
327
378
 
@@ -330,7 +381,10 @@ const Listing = <TRow extends { id: RowId }>({
330
381
 
331
382
  const selectedRowsIndex = map(
332
383
  (row) =>
333
- findIndex((listingRow) => equals(getId(row), getId(listingRow)), rows),
384
+ findIndex(
385
+ (listingRow) => equals(getId(row), getId(listingRow)),
386
+ rowsToDisplay
387
+ ),
334
388
  selectedRows
335
389
  ).sort(subtract);
336
390
 
@@ -338,7 +392,7 @@ const Listing = <TRow extends { id: RowId }>({
338
392
  const newSelection = slice(
339
393
  selectedRowIndex,
340
394
  (lastSelectionIndex as number) + 1,
341
- rows
395
+ rowsToDisplay
342
396
  );
343
397
  onSelectRows(
344
398
  reject(
@@ -357,7 +411,11 @@ const Listing = <TRow extends { id: RowId }>({
357
411
  return;
358
412
  }
359
413
 
360
- const newSelection = slice(lastSelectedIndex, selectedRowIndex + 1, rows);
414
+ const newSelection = slice(
415
+ lastSelectedIndex,
416
+ selectedRowIndex + 1,
417
+ rowsToDisplay
418
+ );
361
419
  onSelectRows(
362
420
  reject(
363
421
  disableRowCheckCondition,
@@ -381,7 +439,7 @@ const Listing = <TRow extends { id: RowId }>({
381
439
 
382
440
  const selectedRowIndex = findIndex(
383
441
  (listingRow) => equals(getId(row), getId(listingRow)),
384
- rows
442
+ rowsToDisplay
385
443
  );
386
444
 
387
445
  if (isShiftKeyDown) {
@@ -408,10 +466,10 @@ const Listing = <TRow extends { id: RowId }>({
408
466
  };
409
467
 
410
468
  const hoverRow = (row): void => {
411
- if (equals(hoveredRowId, getId(row))) {
469
+ if (equals(hoveredRowId, getRowId(row))) {
412
470
  return;
413
471
  }
414
- setHoveredRowId(getId(row));
472
+ setHoveredRowId(getRowId(row));
415
473
  };
416
474
 
417
475
  const clearHoveredRow = (): void => {
@@ -422,8 +480,6 @@ const Listing = <TRow extends { id: RowId }>({
422
480
  return selectedRowsInclude(row);
423
481
  };
424
482
 
425
- const emptyRows = limit - Math.min(limit, totalRows - currentPage * limit);
426
-
427
483
  const changeLimit = (updatedLimit: string): void => {
428
484
  onLimitChange?.(Number(updatedLimit));
429
485
  };
@@ -444,19 +500,6 @@ const Listing = <TRow extends { id: RowId }>({
444
500
 
445
501
  const areColumnsEditable = not(isNil(onSelectColumns));
446
502
 
447
- const allSubItemIds = React.useMemo(
448
- () =>
449
- reduce<TRow | number, Array<string | number>>(
450
- (acc, row) => [
451
- ...acc,
452
- ...pluck('id', row[subItems?.getRowProperty() || ''] || [])
453
- ],
454
- [],
455
- rows
456
- ),
457
- [rows, subItems]
458
- );
459
-
460
503
  return (
461
504
  <div className={classes.listingContainer}>
462
505
  {loading && rows.length > 0 && (
@@ -494,6 +537,7 @@ const Listing = <TRow extends { id: RowId }>({
494
537
  onSelectColumns={onSelectColumns}
495
538
  />
496
539
  </div>
540
+
497
541
  <ParentSize
498
542
  parentSizeStyles={{
499
543
  height: '100%',
@@ -509,132 +553,147 @@ const Listing = <TRow extends { id: RowId }>({
509
553
  height: innerScrollDisabled ? '100%' : `calc(${height}px - 4px)`
510
554
  }}
511
555
  >
512
- <Table
513
- stickyHeader
514
- className={classes.table}
515
- component="div"
516
- role={undefined}
517
- size="small"
518
- >
519
- <ListingHeader
520
- areColumnsEditable={areColumnsEditable}
521
- checkable={checkable}
522
- columnConfiguration={columnConfiguration}
523
- columns={columns}
524
- listingVariant={listingVariant}
525
- memoProps={headerMemoProps}
526
- predefinedRowsSelection={predefinedRowsSelection}
527
- rowCount={limit - emptyRows}
528
- selectedRowCount={selectedRows.length}
529
- sortField={sortField}
530
- sortOrder={sortOrder}
531
- onSelectAllClick={selectAllRows}
532
- onSelectColumns={onSelectColumns}
533
- onSelectRowsWithCondition={onSelectRowsWithCondition}
534
- onSort={onSort}
535
- />
536
-
537
- <TableBody
538
- className={classes.tableBody}
556
+ {displayCustomListing ? (
557
+ customListingComponent
558
+ ) : (
559
+ <Table
560
+ stickyHeader
561
+ className={classes.table}
539
562
  component="div"
540
- onMouseLeave={clearHoveredRow}
563
+ role={undefined}
564
+ size="small"
541
565
  >
542
- {rowsToDisplay.map((row, index) => {
543
- const isRowSelected = isSelected(row);
544
- const isRowHovered = equals(hoveredRowId, getId(row));
545
- const isSubItem = allSubItemIds.includes(row.id);
546
-
547
- return (
548
- <ListingRow
549
- checkable={
550
- checkable && (!isSubItem || subItems.canCheckSubItems)
551
- }
552
- columnConfiguration={columnConfiguration}
553
- columnIds={columns.map(prop('id'))}
554
- disableRowCondition={disableRowCondition}
555
- isHovered={isRowHovered}
556
- isSelected={isRowSelected}
557
- isShiftKeyDown={isShiftKeyDown}
558
- key={
559
- gte(limit, performanceRowsLimit)
560
- ? `row_${index}`
561
- : getId(row)
562
- }
563
- lastSelectionIndex={lastSelectionIndex}
564
- limit={limit}
565
- listingVariant={listingVariant}
566
- row={row}
567
- rowColorConditions={rowColorConditions}
568
- shiftKeyDownRowPivot={shiftKeyDownRowPivot}
569
- subItemsPivots={subItemsPivots}
570
- tabIndex={-1}
571
- visibleColumns={visibleColumns}
572
- onClick={(): void => {
573
- onRowClick(row);
574
- }}
575
- onFocus={(): void => hoverRow(row)}
576
- onMouseOver={(): void => hoverRow(row)}
577
- >
578
- {checkable &&
579
- (!isSubItem || subItems.canCheckSubItems ? (
580
- <Cell
581
- align="left"
582
- className={classes.checkbox}
583
- disableRowCondition={disableRowCondition}
584
- isRowHovered={isRowHovered}
585
- row={row}
586
- rowColorConditions={rowColorConditions}
587
- onClick={(event): void => selectRow(event, row)}
588
- >
589
- <Checkbox
590
- checked={isRowSelected}
591
- disabled={
592
- disableRowCheckCondition(row) ||
593
- disableRowCondition(row)
566
+ <ListingHeader
567
+ areColumnsEditable={areColumnsEditable}
568
+ checkable={checkable}
569
+ columnConfiguration={columnConfiguration}
570
+ columns={columns}
571
+ listingVariant={listingVariant}
572
+ memoProps={headerMemoProps}
573
+ predefinedRowsSelection={predefinedRowsSelection}
574
+ rowCount={rowsToDisplay.length}
575
+ selectedRowCount={selectedRows.length}
576
+ sortField={sortField}
577
+ sortOrder={sortOrder}
578
+ onSelectAllClick={selectAllRows}
579
+ onSelectColumns={onSelectColumns}
580
+ onSelectRowsWithCondition={onSelectRowsWithCondition}
581
+ onSort={onSort}
582
+ />
583
+
584
+ <TableBody
585
+ className={classes.tableBody}
586
+ component="div"
587
+ onMouseLeave={clearHoveredRow}
588
+ >
589
+ {rowsToDisplay.map((row, index) => {
590
+ const isRowSelected = isSelected(row);
591
+ const isSubItem = allSubItemIds.includes(
592
+ getSubItemRowId(row)
593
+ );
594
+ const isRowHovered = equals(hoveredRowId, getRowId(row));
595
+
596
+ return (
597
+ <ListingRow
598
+ checkable={
599
+ checkable &&
600
+ (!isSubItem || subItems.canCheckSubItems)
601
+ }
602
+ columnConfiguration={columnConfiguration}
603
+ columnIds={columns.map(prop('id'))}
604
+ disableRowCondition={disableRowCondition}
605
+ isHovered={isRowHovered}
606
+ isSelected={isRowSelected}
607
+ isShiftKeyDown={isShiftKeyDown}
608
+ key={
609
+ gte(limit, performanceRowsLimit)
610
+ ? `row_${index}`
611
+ : getRowId(row)
612
+ }
613
+ lastSelectionIndex={lastSelectionIndex}
614
+ limit={limit}
615
+ listingVariant={listingVariant}
616
+ row={row}
617
+ rowColorConditions={rowColorConditions}
618
+ shiftKeyDownRowPivot={shiftKeyDownRowPivot}
619
+ subItemsPivots={subItemsPivots}
620
+ tabIndex={-1}
621
+ visibleColumns={visibleColumns}
622
+ onClick={
623
+ isSubItem
624
+ ? undefined
625
+ : (): void => {
626
+ onRowClick(row);
594
627
  }
595
- inputProps={{
596
- 'aria-label': `Select row ${getId(row)}`
597
- }}
628
+ }
629
+ onFocus={(): void => hoverRow(row)}
630
+ onMouseOver={(): void => hoverRow(row)}
631
+ >
632
+ {checkable &&
633
+ (!isSubItem || subItems.canCheckSubItems ? (
634
+ <Cell
635
+ align="left"
636
+ className={classes.checkbox}
637
+ disableRowCondition={disableRowCondition}
638
+ isRowHovered={isRowHovered}
639
+ row={row}
640
+ rowColorConditions={rowColorConditions}
641
+ onClick={(event): void => selectRow(event, row)}
642
+ >
643
+ <Checkbox
644
+ checked={isRowSelected}
645
+ disabled={
646
+ disableRowCheckCondition(row) ||
647
+ disableRowCondition(row)
648
+ }
649
+ inputProps={{
650
+ 'aria-label': `Select row ${getId(row)}`
651
+ }}
652
+ />
653
+ </Cell>
654
+ ) : (
655
+ <Cell
656
+ align="left"
657
+ disableRowCondition={disableRowCondition}
658
+ isRowHovered={isRowHovered}
659
+ row={row}
660
+ rowColorConditions={rowColorConditions}
598
661
  />
599
- </Cell>
600
- ) : (
601
- <Cell
602
- align="left"
662
+ ))}
663
+
664
+ {visibleColumns.map((column) => (
665
+ <DataCell
666
+ column={column}
603
667
  disableRowCondition={disableRowCondition}
668
+ getHighlightRowCondition={
669
+ getHighlightRowCondition
670
+ }
604
671
  isRowHovered={isRowHovered}
672
+ isRowSelected={isRowSelected}
673
+ key={`${getId(row)}-${column.id}`}
674
+ labelCollapse={subItems.labelCollapse}
675
+ labelExpand={subItems.labelExpand}
676
+ listingVariant={listingVariant}
605
677
  row={row}
606
678
  rowColorConditions={rowColorConditions}
679
+ subItemsRowProperty={subItems?.getRowProperty(
680
+ row
681
+ )}
607
682
  />
608
683
  ))}
609
-
610
- {visibleColumns.map((column) => (
611
- <DataCell
612
- column={column}
613
- disableRowCondition={disableRowCondition}
614
- getHighlightRowCondition={getHighlightRowCondition}
615
- isRowHovered={isRowHovered}
616
- isRowSelected={isRowSelected}
617
- key={`${getId(row)}-${column.id}`}
618
- labelCollapse={subItems.labelCollapse}
619
- labelExpand={subItems.labelExpand}
620
- listingVariant={listingVariant}
621
- row={row}
622
- rowColorConditions={rowColorConditions}
623
- subItemsRowProperty={subItems?.getRowProperty(row)}
624
- />
625
- ))}
626
- </ListingRow>
627
- );
628
- })}
629
-
630
- {rows.length < 1 &&
631
- (loading ? (
632
- <SkeletonLoader rows={limit} />
633
- ) : (
634
- <EmptyResult label={t(labelNoResultFound)} />
635
- ))}
636
- </TableBody>
637
- </Table>
684
+ </ListingRow>
685
+ );
686
+ })}
687
+
688
+ {rows.length < 1 &&
689
+ (loading ? (
690
+ <SkeletonLoader rows={limit} />
691
+ ) : (
692
+ <EmptyResult label={t(labelNoResultFound)} />
693
+ ))}
694
+ </TableBody>
695
+ </Table>
696
+ )}
638
697
  </Box>
639
698
  )}
640
699
  </ParentSize>
@@ -15,6 +15,7 @@ export interface ComponentColumnProps {
15
15
 
16
16
  export interface Column {
17
17
  Component?: (props: ComponentColumnProps) => JSX.Element | null;
18
+ align?: 'start' | 'end' | 'center';
18
19
  clickable?: boolean;
19
20
  compact?: boolean;
20
21
  disablePadding?: boolean;
@@ -53,6 +53,7 @@ const useStyleTable = ({
53
53
  const checkbox = checkable ? 'fit-content(1rem) ' : ''; // SelectAction (checkbox) cell adjusts to content
54
54
 
55
55
  const columnTemplate = currentVisibleColumns
56
+ ?.filter((column) => column)
56
57
  ?.map(({ width, shortLabel }) => {
57
58
  if (!isNil(shortLabel)) {
58
59
  return 'min-content';
@@ -9,7 +9,7 @@ import { makeStyles } from 'tss-react/mui';
9
9
  import { Paper, Slide, Divider, AppBar, Tabs } from '@mui/material';
10
10
  import IconClose from '@mui/icons-material/Clear';
11
11
 
12
- import IconButton from '../Button/Icon';
12
+ import { IconButton } from '..';
13
13
 
14
14
  import { minTabHeight } from './Tab';
15
15
 
@@ -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}
@@ -184,6 +184,9 @@ export const getTheme = (mode: ThemeMode): ThemeOptions => ({
184
184
  padding: 0;
185
185
  width: 100%;
186
186
  }
187
+ #root {
188
+ background-color: ${theme.palette.background.paper};
189
+ }
187
190
  @font-face {
188
191
  font-family: 'Roboto';
189
192
  font-style: normal;
@@ -12,22 +12,21 @@ const useStyles = makeStyles()((theme) => ({
12
12
  },
13
13
  containerDates: {
14
14
  display: 'flex',
15
- gap: theme.spacing(0.5),
16
15
  [theme.breakpoints.down('sm')]: {
17
- columnGap: theme.spacing(0.5),
18
- flexDirection: 'column'
16
+ flexDirection: 'column',
17
+ gap: theme.spacing(0.5)
19
18
  }
20
19
  },
21
20
  date: {
22
- minWidth: theme.spacing(12.5),
21
+ minWidth: theme.spacing(12),
23
22
  textAlign: 'start'
24
23
  },
25
24
  error: {
26
25
  textAlign: 'center'
27
26
  },
28
27
  label: {
29
- minWidth: theme.spacing(3),
30
- textAlign: 'start'
28
+ minWidth: theme.spacing(3.5),
29
+ textAlign: 'end'
31
30
  },
32
31
 
33
32
  picker: {
@@ -39,7 +38,7 @@ const useStyles = makeStyles()((theme) => ({
39
38
  },
40
39
  timeContainer: {
41
40
  alignItems: 'center',
42
- columnGap: theme.spacing(1),
41
+ columnGap: theme.spacing(0.5),
43
42
  display: 'flex',
44
43
  flexDirection: 'row',
45
44
  [theme.breakpoints.down('sm')]: {
@@ -1,5 +1,5 @@
1
1
  import dayjs from 'dayjs';
2
- import 'dayjs/locale/fr';
2
+ import 'dayjs/locale/en';
3
3
  import localizedFormatPlugin from 'dayjs/plugin/localizedFormat';
4
4
  import timezonePlugin from 'dayjs/plugin/timezone';
5
5
  import utcPlugin from 'dayjs/plugin/utc';
@@ -19,18 +19,18 @@ dayjs.extend(localizedFormatPlugin);
19
19
 
20
20
  const data = [
21
21
  {
22
- locale: 'fr_FR',
23
- resolution: { height: 720, width: 500 },
22
+ locale: 'en_US',
23
+ resolution: { height: 590, width: 500 },
24
24
  timezone: 'Europe/Paris'
25
25
  },
26
26
  {
27
- locale: 'fr_FR',
28
- resolution: { height: 720, width: 200 },
27
+ locale: 'en_US',
28
+ resolution: { height: 590, width: 200 },
29
29
  timezone: 'Europe/Paris'
30
30
  },
31
31
  {
32
- locale: 'fr_FR',
33
- resolution: { height: 720, width: 1024 },
32
+ locale: 'en_US',
33
+ resolution: { height: 590, width: 1024 },
34
34
  timezone: 'Europe/Paris'
35
35
  }
36
36
  ];
@@ -45,7 +45,7 @@ data.forEach((item) =>
45
45
 
46
46
  store.set(userAtom, {
47
47
  ...retrievedUser,
48
- locale: 'fr_FR',
48
+ locale: 'en_US',
49
49
  timezone: 'Europe/Paris'
50
50
  });
51
51
 
@@ -59,7 +59,10 @@ data.forEach((item) =>
59
59
  });
60
60
 
61
61
  it(`displays correctly the dates design when screen resolution is ${width}px`, () => {
62
- cy.makeSnapshot(`${width}px`);
62
+ cy.makeSnapshotWithCustomResolution({
63
+ resolution: { height, width },
64
+ title: `${width}px`
65
+ });
63
66
  });
64
67
  })
65
68
  );