@centreon/ui 24.4.1-sync-release-34022.1 → 24.4.1-test-code-coverage.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +48 -40
- package/src/ActionsList/ActionsList.styles.ts +40 -71
- package/src/Button/Icon/index.stories.tsx +1 -1
- package/src/Button/Icon/index.tsx +1 -1
- package/src/Dashboard/Dashboard.styles.ts +6 -5
- package/src/Dialog/Confirm/index.tsx +10 -2
- package/src/Dialog/UnsavedChanges/index.tsx +21 -20
- package/src/Dialog/UnsavedChanges/translatedLabels.ts +4 -6
- package/src/Dialog/index.tsx +8 -1
- package/src/Form/Inputs/CheckboxGroup.tsx +4 -1
- package/src/Form/Inputs/Text.tsx +3 -1
- package/src/Form/Inputs/models.ts +1 -0
- package/src/Graph/BarStack/BarStack.cypress.spec.tsx +139 -0
- package/src/Graph/BarStack/BarStack.stories.tsx +123 -0
- package/src/Graph/BarStack/BarStack.styles.ts +37 -0
- package/src/Graph/BarStack/BarStack.tsx +14 -0
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +209 -0
- package/src/Graph/BarStack/index.ts +1 -0
- package/src/Graph/BarStack/models.ts +19 -0
- package/src/Graph/BarStack/useResponsiveBarStack.ts +131 -0
- package/src/Graph/Gauge/Gauge.cypress.spec.tsx +102 -0
- package/src/Graph/Gauge/Gauge.tsx +1 -1
- package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +145 -0
- package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -25
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +8 -2
- package/src/Graph/Legend/Legend.tsx +21 -0
- package/src/Graph/Legend/index.ts +1 -0
- package/src/Graph/Legend/models.ts +11 -0
- package/src/Graph/LineChart/BasicComponents/Lines/Threshold/index.tsx +4 -5
- package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +3 -1
- package/src/Graph/LineChart/Header/index.tsx +3 -31
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +9 -11
- package/src/Graph/LineChart/InteractiveComponents/Annotations/Annotation/index.tsx +3 -2
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +68 -0
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +27 -0
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +31 -0
- package/src/Graph/LineChart/InteractiveComponents/index.tsx +132 -17
- package/src/Graph/LineChart/InteractiveComponents/interactionWithGraphAtoms.ts +7 -27
- package/src/Graph/LineChart/Legend/Legend.styles.ts +5 -9
- package/src/Graph/LineChart/Legend/LegendHeader.tsx +10 -22
- package/src/Graph/LineChart/Legend/index.tsx +17 -55
- package/src/Graph/LineChart/LineChart.cypress.spec.tsx +91 -0
- package/src/Graph/LineChart/LineChart.styles.ts +8 -0
- package/src/Graph/LineChart/LineChart.tsx +106 -116
- package/src/Graph/LineChart/LoadingSkeleton.tsx +2 -2
- package/src/Graph/LineChart/index.tsx +6 -7
- package/src/Graph/LineChart/mockedData/lastDayWithIncompleteValues.json +1320 -0
- package/src/Graph/LineChart/mockedData/lastDayWithNullValues.json +1314 -0
- package/src/Graph/LineChart/models.ts +12 -1
- package/src/Graph/PieChart/PieChart.cypress.spec.tsx +154 -0
- package/src/Graph/PieChart/PieChart.stories.tsx +194 -0
- package/src/Graph/PieChart/PieChart.styles.ts +39 -0
- package/src/Graph/PieChart/PieChart.tsx +14 -0
- package/src/Graph/PieChart/ResponsivePie.tsx +243 -0
- package/src/Graph/PieChart/index.ts +1 -0
- package/src/Graph/PieChart/models.ts +19 -0
- package/src/Graph/PieChart/useResponsivePie.ts +81 -0
- package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +121 -0
- package/src/Graph/Text/Text.cypress.spec.tsx +101 -0
- package/src/Graph/Text/Text.styles.ts +12 -1
- package/src/Graph/Text/Text.tsx +17 -12
- package/src/Graph/Tree/DescendantNodes.tsx +89 -0
- package/src/Graph/Tree/Links.tsx +77 -0
- package/src/Graph/Tree/StandaloneTree.tsx +32 -0
- package/src/Graph/Tree/Tree.cypress.spec.tsx +195 -0
- package/src/Graph/Tree/Tree.stories.tsx +160 -0
- package/src/Graph/Tree/Tree.tsx +116 -0
- package/src/Graph/Tree/constants.ts +2 -0
- package/src/Graph/Tree/index.ts +4 -0
- package/src/Graph/Tree/models.ts +55 -0
- package/src/Graph/Tree/stories/contents.tsx +164 -0
- package/src/Graph/Tree/stories/datas.ts +305 -0
- package/src/Graph/Tree/utils.ts +49 -0
- package/src/Graph/common/testUtils.ts +71 -0
- package/src/Graph/common/timeSeries/index.ts +50 -12
- package/src/Graph/common/utils.ts +19 -0
- package/src/Graph/index.ts +4 -0
- package/src/InputField/Number/Number.cypress.spec.tsx +85 -0
- package/src/InputField/Number/Number.stories.tsx +66 -0
- package/src/InputField/Number/Number.tsx +74 -0
- package/src/InputField/Search/index.tsx +2 -2
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +4 -2
- package/src/InputField/Select/Autocomplete/index.tsx +10 -3
- package/src/InputField/Select/IconPopover/index.tsx +1 -1
- package/src/InputField/Select/index.tsx +14 -1
- package/src/InputField/Text/index.tsx +38 -38
- package/src/Listing/ActionBar/index.tsx +10 -10
- package/src/Listing/Cell/DataCell.styles.ts +3 -0
- package/src/Listing/Cell/DataCell.tsx +8 -4
- package/src/Listing/Listing.cypress.spec.tsx +217 -33
- package/src/Listing/Listing.styles.ts +3 -5
- package/src/Listing/Row/Row.tsx +7 -3
- package/src/Listing/index.stories.tsx +25 -2
- package/src/Listing/index.test.tsx +1 -1
- package/src/Listing/index.tsx +202 -143
- package/src/Listing/models.ts +1 -0
- package/src/Listing/useStyleTable.ts +1 -0
- package/src/Panel/index.tsx +1 -1
- package/src/PopoverMenu/index.tsx +6 -5
- package/src/ThemeProvider/index.tsx +3 -0
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +6 -7
- package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +12 -9
- package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +27 -0
- package/src/Typography/FluidTypography/index.stories.tsx +2 -2
- package/src/Typography/FluidTypography/index.tsx +21 -28
- package/src/api/index.ts +3 -3
- package/src/api/useGraphQuery/index.ts +26 -5
- package/src/api/useGraphQuery/models.ts +5 -0
- package/src/api/useMutationQuery/index.test.ts +4 -4
- package/src/api/useMutationQuery/index.ts +24 -13
- package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +76 -0
- package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +26 -0
- package/src/components/CollapsibleItem/CollapsibleItem.tsx +43 -14
- package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +24 -1
- package/src/components/DataTable/DataTable.cypress.spec.tsx +14 -33
- package/src/components/DataTable/Item/DataTableItem.tsx +4 -60
- package/src/components/Form/{AccessRightsV2 → AccessRights}/AccessRights.cypress.spec.tsx +36 -13
- package/src/components/Form/{AccessRightsV2 → AccessRights}/ShareInput/ContactSwitch.tsx +11 -3
- package/src/components/Form/{AccessRightsV2 → AccessRights}/ShareInput/ShareInput.styles.ts +8 -0
- package/src/components/Form/{AccessRightsV2 → AccessRights}/ShareInput/ShareInput.tsx +1 -0
- package/src/components/Form/{AccessRightsV2 → AccessRights}/ShareInput/useShareInput.tsx +4 -0
- package/src/components/Form/{AccessRightsV2 → AccessRights}/models.ts +1 -0
- package/src/components/Form/{AccessRightsV2 → AccessRights}/storiesData.ts +23 -22
- package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +85 -0
- package/src/components/Form/Dashboard/index.ts +1 -0
- package/src/components/Form/FormActions.tsx +7 -2
- package/src/components/Form/index.ts +2 -2
- package/src/components/ItemComposition/Item.tsx +1 -1
- package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +113 -0
- package/src/components/ItemComposition/ItemComposition.stories.tsx +14 -0
- package/src/components/ItemComposition/ItemComposition.styles.ts +36 -3
- package/src/components/ItemComposition/ItemComposition.tsx +41 -17
- package/src/components/List/Item/ListItem.tsx +3 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +168 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +62 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +87 -0
- package/src/components/Modal/Modal.styles.ts +8 -3
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +3 -3
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +1 -1
- package/src/components/Tooltip/ConfirmationTooltip/models.ts +1 -1
- package/src/components/Zoom/Minimap.tsx +129 -0
- package/src/components/Zoom/Zoom.cypress.spec.tsx +246 -0
- package/src/components/Zoom/Zoom.stories.tsx +115 -0
- package/src/components/Zoom/Zoom.styles.tsx +68 -0
- package/src/components/Zoom/Zoom.tsx +64 -0
- package/src/components/Zoom/ZoomContent.tsx +170 -0
- package/src/components/Zoom/constants.ts +2 -0
- package/src/components/Zoom/localPoint.ts +51 -0
- package/src/components/Zoom/models.ts +25 -0
- package/src/components/Zoom/useMinimap.ts +156 -0
- package/src/components/Zoom/useZoom.ts +70 -0
- package/src/components/Zoom/utils.ts +55 -0
- package/src/components/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/resourcesStatusURL.ts +166 -0
- package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +130 -0
- package/src/utils/useFullscreen/atoms.ts +3 -0
- package/src/utils/useFullscreen/index.ts +2 -0
- package/src/utils/useFullscreen/translatedLabels.ts +1 -0
- package/src/utils/useFullscreen/useFullscreen.ts +73 -0
- package/src/utils/useFullscreen/useFullscreenListener.ts +62 -0
- package/src/utils/useInfiniteScrollListing.ts +4 -1
- package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -96
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +0 -107
- package/src/Graph/LineChart/Legend/InteractiveValue.tsx +0 -22
- package/src/Graph/LineChart/Legend/useInteractiveValues.ts +0 -99
- package/src/Typography/FluidTypography/useFluidResizeObserver.ts +0 -56
- package/src/components/Form/AccessRights/AccessRights.resource.ts +0 -45
- package/src/components/Form/AccessRights/AccessRightsForm.stories.tsx +0 -59
- package/src/components/Form/AccessRights/AccessRightsForm.styles.ts +0 -21
- package/src/components/Form/AccessRights/AccessRightsForm.tsx +0 -67
- package/src/components/Form/AccessRights/AccessRightsFormActions.tsx +0 -80
- package/src/components/Form/AccessRights/Input/AddAction.tsx +0 -31
- package/src/components/Form/AccessRights/Input/ContactAccessRightInput.stories.tsx +0 -54
- package/src/components/Form/AccessRights/Input/ContactAccessRightInput.tsx +0 -72
- package/src/components/Form/AccessRights/Input/ContactAccessRightsInput.styles.ts +0 -22
- package/src/components/Form/AccessRights/Input/ContactInputField.tsx +0 -105
- package/src/components/Form/AccessRights/Input/RoleInputField.tsx +0 -29
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.stories.tsx +0 -97
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.styles.ts +0 -71
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.tsx +0 -51
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.stories.tsx +0 -116
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.tsx +0 -118
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItemSkeleton.tsx +0 -26
- package/src/components/Form/AccessRights/List/ContactAccessRightsListSkeleton.tsx +0 -28
- package/src/components/Form/AccessRights/Stats/AccessRightsStats.styles.ts +0 -18
- package/src/components/Form/AccessRights/Stats/AccessRightsStats.tsx +0 -41
- package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +0 -54
- package/src/components/Form/AccessRights/common/GroupLabel.styles.ts +0 -18
- package/src/components/Form/AccessRights/common/GroupLabel.tsx +0 -15
- package/src/components/Form/AccessRights/common/Input.styles.ts +0 -48
- package/src/components/Form/AccessRights/common/RoleInputSelect.styles.ts +0 -11
- package/src/components/Form/AccessRights/common/RoleInputSelect.tsx +0 -57
- package/src/components/Form/AccessRights/index.ts +0 -3
- package/src/components/Form/AccessRights/useAccessRightsForm.test.tsx +0 -531
- package/src/components/Form/AccessRights/useAccessRightsForm.tsx +0 -282
- package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +0 -41
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/AccessRights.stories.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/AccessRights.styles.ts +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/AccessRights.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/Actions/Actions.styles.ts +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/Actions/Actions.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/Actions/useActions.ts +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/Item.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/List.styles.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/List.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/ListItemSkeleton.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/ListSkeleton.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/RemoveAccessRight.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/StateChip.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/List/useItem.ts +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/Provider.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/Stats/Stats.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/atoms.ts +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/common/RoleSelectField.styles.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/common/RoleSelectField.tsx +0 -0
- /package/src/components/Form/{AccessRightsV2 → AccessRights}/useAccessRightsInitValues.ts +0 -0
package/src/Listing/index.tsx
CHANGED
|
@@ -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 [
|
|
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
|
-
|
|
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,
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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,
|
|
469
|
+
if (equals(hoveredRowId, getRowId(row))) {
|
|
412
470
|
return;
|
|
413
471
|
}
|
|
414
|
-
setHoveredRowId(
|
|
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
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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
|
-
|
|
563
|
+
role={undefined}
|
|
564
|
+
size="small"
|
|
541
565
|
>
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
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
|
-
|
|
596
|
-
|
|
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
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
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
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
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>
|
package/src/Listing/models.ts
CHANGED
|
@@ -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';
|
package/src/Panel/index.tsx
CHANGED
|
@@ -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 '
|
|
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}
|
|
@@ -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
|
-
|
|
18
|
-
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
gap: theme.spacing(0.5)
|
|
19
18
|
}
|
|
20
19
|
},
|
|
21
20
|
date: {
|
|
22
|
-
minWidth: theme.spacing(12
|
|
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: '
|
|
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(
|
|
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/
|
|
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: '
|
|
23
|
-
resolution: { height:
|
|
22
|
+
locale: 'en_US',
|
|
23
|
+
resolution: { height: 590, width: 500 },
|
|
24
24
|
timezone: 'Europe/Paris'
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
locale: '
|
|
28
|
-
resolution: { height:
|
|
27
|
+
locale: 'en_US',
|
|
28
|
+
resolution: { height: 590, width: 200 },
|
|
29
29
|
timezone: 'Europe/Paris'
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
locale: '
|
|
33
|
-
resolution: { height:
|
|
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: '
|
|
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.
|
|
62
|
+
cy.makeSnapshotWithCustomResolution({
|
|
63
|
+
resolution: { height, width },
|
|
64
|
+
title: `${width}px`
|
|
65
|
+
});
|
|
63
66
|
});
|
|
64
67
|
})
|
|
65
68
|
);
|