@centreon/ui 24.4.57 → 24.4.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
1
3
|
import { Button, Typography } from '@mui/material';
|
|
2
4
|
|
|
3
5
|
import { ListingVariant } from '@centreon/ui-context';
|
|
@@ -20,20 +22,20 @@ const LargeText = (): JSX.Element => (
|
|
|
20
22
|
</Typography>
|
|
21
23
|
);
|
|
22
24
|
|
|
23
|
-
const
|
|
25
|
+
const tenElements = new Array(10).fill(0);
|
|
26
|
+
|
|
27
|
+
const generateSubItems = (): Array<unknown> => {
|
|
24
28
|
return tenElements.map((__, subIndex) => ({
|
|
25
29
|
active: false,
|
|
26
|
-
description: `Sub item ${subIndex
|
|
30
|
+
description: `Sub item ${subIndex * 10} description`,
|
|
27
31
|
disableCheckbox: false,
|
|
28
32
|
disableRow: false,
|
|
29
|
-
id: subIndex
|
|
30
|
-
name: `Sub Item ${subIndex
|
|
33
|
+
id: subIndex * 10,
|
|
34
|
+
name: `Sub Item ${subIndex * 10}`,
|
|
31
35
|
selected: false
|
|
32
36
|
}));
|
|
33
37
|
};
|
|
34
38
|
|
|
35
|
-
const tenElements = new Array(10).fill(0);
|
|
36
|
-
|
|
37
39
|
const listingWithSubItems = tenElements.map((_, index) => ({
|
|
38
40
|
active: false,
|
|
39
41
|
description: `Entity ${index}`,
|
|
@@ -42,9 +44,22 @@ const listingWithSubItems = tenElements.map((_, index) => ({
|
|
|
42
44
|
id: index,
|
|
43
45
|
name: `E${index}`,
|
|
44
46
|
selected: false,
|
|
45
|
-
subItems: index % 2 === 0 ? generateSubItems(
|
|
47
|
+
subItems: index % 2 === 0 ? generateSubItems() : undefined
|
|
46
48
|
}));
|
|
47
49
|
|
|
50
|
+
const listingWithSubItems3Rows = Array(3)
|
|
51
|
+
.fill(0)
|
|
52
|
+
.map((_, index) => ({
|
|
53
|
+
active: false,
|
|
54
|
+
description: `Entity ${index}`,
|
|
55
|
+
disableCheckbox: false,
|
|
56
|
+
disableRow: false,
|
|
57
|
+
id: index,
|
|
58
|
+
name: `E${index}`,
|
|
59
|
+
selected: false,
|
|
60
|
+
subItems: index % 2 === 0 ? generateSubItems() : undefined
|
|
61
|
+
}));
|
|
62
|
+
|
|
48
63
|
const defaultColumn = [
|
|
49
64
|
{
|
|
50
65
|
getFormattedString: ({ name }): string => name,
|
|
@@ -112,26 +127,50 @@ const mountListingResponsive = (listingVariant: ListingVariant): void => {
|
|
|
112
127
|
});
|
|
113
128
|
};
|
|
114
129
|
|
|
115
|
-
|
|
130
|
+
interface TestComponentProps {
|
|
131
|
+
canCheckSubItems?: boolean;
|
|
132
|
+
isSmallListing?: boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const TestComponent = ({
|
|
136
|
+
isSmallListing = false,
|
|
137
|
+
canCheckSubItems = false
|
|
138
|
+
}: TestComponentProps): JSX.Element => {
|
|
139
|
+
const [selectedRows, setSelectedRows] = useState([]);
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<Listing
|
|
143
|
+
checkable
|
|
144
|
+
columns={columnsWithSubItems}
|
|
145
|
+
currentPage={1}
|
|
146
|
+
limit={10}
|
|
147
|
+
rows={isSmallListing ? listingWithSubItems3Rows : listingWithSubItems}
|
|
148
|
+
selectedRows={selectedRows}
|
|
149
|
+
subItems={{
|
|
150
|
+
canCheckSubItems,
|
|
151
|
+
enable: true,
|
|
152
|
+
getRowProperty: () => 'subItems',
|
|
153
|
+
labelCollapse: 'Collapse',
|
|
154
|
+
labelExpand: 'Expand'
|
|
155
|
+
}}
|
|
156
|
+
totalRows={10}
|
|
157
|
+
onSelectRows={setSelectedRows}
|
|
158
|
+
/>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const mountListingForSubItems = ({
|
|
163
|
+
isSmallListing = false,
|
|
164
|
+
canCheckSubItems = false
|
|
165
|
+
}: TestComponentProps): void => {
|
|
116
166
|
cy.viewport('macbook-13');
|
|
117
167
|
|
|
118
168
|
cy.mount({
|
|
119
169
|
Component: (
|
|
120
170
|
<div style={{ height: '100vh' }}>
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
currentPage={1}
|
|
125
|
-
limit={10}
|
|
126
|
-
rows={listingWithSubItems}
|
|
127
|
-
subItems={{
|
|
128
|
-
canCheckSubItems: false,
|
|
129
|
-
enable: true,
|
|
130
|
-
getRowProperty: () => 'subItems',
|
|
131
|
-
labelCollapse: 'Collapse',
|
|
132
|
-
labelExpand: 'Expand'
|
|
133
|
-
}}
|
|
134
|
-
totalRows={10}
|
|
171
|
+
<TestComponent
|
|
172
|
+
canCheckSubItems={canCheckSubItems}
|
|
173
|
+
isSmallListing={isSmallListing}
|
|
135
174
|
/>
|
|
136
175
|
</div>
|
|
137
176
|
)
|
|
@@ -139,37 +178,107 @@ const mountListingForSubItems = (): void => {
|
|
|
139
178
|
};
|
|
140
179
|
|
|
141
180
|
describe('Listing', () => {
|
|
142
|
-
|
|
143
|
-
|
|
181
|
+
describe('Sub items', () => {
|
|
182
|
+
it('expands the row when the corresponding icon is clicked', () => {
|
|
183
|
+
mountListingForSubItems({});
|
|
184
|
+
|
|
185
|
+
cy.contains('E0').should('be.visible');
|
|
144
186
|
|
|
145
|
-
|
|
187
|
+
expandedItems.forEach((index) => {
|
|
188
|
+
const subItems = generateSubItems(index);
|
|
146
189
|
|
|
147
|
-
|
|
148
|
-
const subItems = generateSubItems(index);
|
|
190
|
+
cy.findByLabelText(`Expand ${index}`).click();
|
|
149
191
|
|
|
150
|
-
|
|
192
|
+
cy.findByLabelText(`Collapse ${index}`).should('exist');
|
|
151
193
|
|
|
152
|
-
|
|
194
|
+
subItems.forEach(({ name, description }) => {
|
|
195
|
+
cy.contains(name).should('exist');
|
|
196
|
+
cy.contains(description).should('exist');
|
|
197
|
+
});
|
|
153
198
|
|
|
154
|
-
|
|
155
|
-
cy.contains(name).should('exist');
|
|
156
|
-
cy.contains(description).should('exist');
|
|
199
|
+
cy.findByLabelText(`Collapse ${index}`).click();
|
|
157
200
|
});
|
|
201
|
+
|
|
202
|
+
cy.makeSnapshot();
|
|
158
203
|
});
|
|
159
204
|
|
|
160
|
-
|
|
161
|
-
|
|
205
|
+
it('collapses the row when the corresponding icon is clicked', () => {
|
|
206
|
+
mountListingForSubItems({});
|
|
162
207
|
|
|
163
|
-
|
|
164
|
-
mountListingForSubItems();
|
|
208
|
+
cy.findByLabelText(`Expand 0`).click();
|
|
165
209
|
|
|
166
|
-
|
|
210
|
+
cy.contains('Sub item 10').should('be.visible');
|
|
167
211
|
|
|
168
|
-
|
|
212
|
+
cy.findByLabelText('Collapse 0').click();
|
|
169
213
|
|
|
170
|
-
|
|
214
|
+
cy.contains('Sub item 10').should('not.exist');
|
|
171
215
|
|
|
172
|
-
|
|
216
|
+
cy.makeSnapshot();
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('displays only one row as hovered when mutilple rows are expanded and a sub item row is hovered', () => {
|
|
220
|
+
mountListingForSubItems({ isSmallListing: true });
|
|
221
|
+
|
|
222
|
+
cy.findByLabelText('Expand 2').click();
|
|
223
|
+
cy.findByLabelText('Expand 0').click();
|
|
224
|
+
|
|
225
|
+
cy.findByLabelText('Collapse 0').should('be.visible');
|
|
226
|
+
cy.findByLabelText('Collapse 2').should('be.visible');
|
|
227
|
+
|
|
228
|
+
cy.contains('Sub Item 0').realHover();
|
|
229
|
+
|
|
230
|
+
cy.get('[data-isHovered="true"]').should('have.length', 1);
|
|
231
|
+
cy.get('[data-isHovered="true"]').contains('Sub Item 0').should('exist');
|
|
232
|
+
|
|
233
|
+
cy.findByLabelText('Collapse 0').click();
|
|
234
|
+
cy.findByLabelText('Collapse 2').click();
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('selects displayed rows when a row is selected and another row is selected with the shift key', () => {
|
|
238
|
+
mountListingForSubItems({ canCheckSubItems: true, isSmallListing: true });
|
|
239
|
+
|
|
240
|
+
cy.findByLabelText('Expand 0').click();
|
|
241
|
+
|
|
242
|
+
cy.findByLabelText('Collapse 0').should('be.visible');
|
|
243
|
+
|
|
244
|
+
cy.findAllByLabelText('Select row 0').eq(0).click();
|
|
245
|
+
cy.get('body').type('{shift}', { release: false });
|
|
246
|
+
cy.findByLabelText('Select row 50').eq(0).click();
|
|
247
|
+
|
|
248
|
+
cy.findAllByLabelText('Select row 0').eq(0).should('be.checked');
|
|
249
|
+
cy.findAllByLabelText('Select row 0').eq(1).should('be.checked');
|
|
250
|
+
cy.findByLabelText('Select row 10').should('be.checked');
|
|
251
|
+
cy.findByLabelText('Select row 20').should('be.checked');
|
|
252
|
+
cy.findByLabelText('Select row 30').should('be.checked');
|
|
253
|
+
cy.findByLabelText('Select row 40').should('be.checked');
|
|
254
|
+
cy.findByLabelText('Select row 50').should('be.checked');
|
|
255
|
+
|
|
256
|
+
cy.findByLabelText('Collapse 0').click();
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('selects displayed rows when the corresponding checkbox is clicked', () => {
|
|
260
|
+
mountListingForSubItems({ canCheckSubItems: true, isSmallListing: true });
|
|
261
|
+
|
|
262
|
+
cy.findByLabelText('Expand 0').click();
|
|
263
|
+
|
|
264
|
+
cy.findByLabelText('Collapse 0').should('be.visible');
|
|
265
|
+
|
|
266
|
+
cy.findAllByLabelText('Select all').eq(0).click();
|
|
267
|
+
|
|
268
|
+
cy.findAllByLabelText('Select row 0').eq(0).should('be.checked');
|
|
269
|
+
tenElements.forEach((_, index) => {
|
|
270
|
+
if (index === 0) {
|
|
271
|
+
cy.findAllByLabelText('Select row 0').eq(1).should('be.checked');
|
|
272
|
+
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
cy.findByLabelText(`Select row ${index * 10}`).should('be.checked');
|
|
276
|
+
});
|
|
277
|
+
cy.findByLabelText('Select row 1').should('be.checked');
|
|
278
|
+
cy.findByLabelText('Select row 2').should('be.checked');
|
|
279
|
+
|
|
280
|
+
cy.findByLabelText('Collapse 0').click();
|
|
281
|
+
});
|
|
173
282
|
});
|
|
174
283
|
|
|
175
284
|
it('displays the last column on several lines in compact mode when the isResponsive prop is set', () => {
|
package/src/Listing/Row/Row.tsx
CHANGED
|
@@ -197,7 +197,7 @@ const Row = memo<RowProps>(
|
|
|
197
197
|
}
|
|
198
198
|
);
|
|
199
199
|
|
|
200
|
-
const IntersectionRow = (
|
|
200
|
+
const IntersectionRow = ({ isHovered, ...rest }: Props): JSX.Element => {
|
|
201
201
|
const rowRef = useRef<HTMLDivElement | null>(null);
|
|
202
202
|
const theme = useTheme();
|
|
203
203
|
const { isInViewport, setElement } = useViewportIntersection({
|
|
@@ -214,8 +214,12 @@ const IntersectionRow = (props: Props): JSX.Element => {
|
|
|
214
214
|
}, [getFirstCellElement()]);
|
|
215
215
|
|
|
216
216
|
return (
|
|
217
|
-
<div
|
|
218
|
-
|
|
217
|
+
<div
|
|
218
|
+
className={classes.intersectionRow}
|
|
219
|
+
data-isHovered={isHovered}
|
|
220
|
+
ref={rowRef}
|
|
221
|
+
>
|
|
222
|
+
<Row {...rest} isHovered={isHovered} isInViewport={isInViewport} />
|
|
219
223
|
</div>
|
|
220
224
|
);
|
|
221
225
|
};
|
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
|
|
@@ -140,7 +141,7 @@ const defaultColumnConfiguration = {
|
|
|
140
141
|
|
|
141
142
|
export const performanceRowsLimit = 60;
|
|
142
143
|
|
|
143
|
-
const Listing = <TRow extends { id: RowId }>({
|
|
144
|
+
const Listing = <TRow extends { id: RowId; internalListingParentId?: RowId }>({
|
|
144
145
|
customListingComponent,
|
|
145
146
|
displayCustomListing,
|
|
146
147
|
limit = 10,
|
|
@@ -211,6 +212,21 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
211
212
|
|
|
212
213
|
const subItemsPivots = useAtomValue(subItemsPivotsAtom);
|
|
213
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
|
+
|
|
214
230
|
const rowsToDisplay = React.useMemo(
|
|
215
231
|
() =>
|
|
216
232
|
subItems?.enable
|
|
@@ -220,7 +236,14 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
220
236
|
row[subItems.getRowProperty()] &&
|
|
221
237
|
subItemsPivots.includes(row.id)
|
|
222
238
|
) {
|
|
223
|
-
return [
|
|
239
|
+
return [
|
|
240
|
+
...acc,
|
|
241
|
+
row,
|
|
242
|
+
...row[subItems.getRowProperty()].map((subRow) => ({
|
|
243
|
+
...subRow,
|
|
244
|
+
internalListingParentId: row.id
|
|
245
|
+
}))
|
|
246
|
+
];
|
|
224
247
|
}
|
|
225
248
|
|
|
226
249
|
return [...acc, row];
|
|
@@ -232,6 +255,24 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
232
255
|
[rows, subItemsPivots, subItems]
|
|
233
256
|
);
|
|
234
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
|
+
|
|
235
276
|
const { classes } = useListingStyles({
|
|
236
277
|
dataStyle,
|
|
237
278
|
getGridTemplateColumn,
|
|
@@ -255,7 +296,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
255
296
|
event.target.checked &&
|
|
256
297
|
event.target.getAttribute('data-indeterminate') === 'false'
|
|
257
298
|
) {
|
|
258
|
-
onSelectRows(reject(disableRowCheckCondition,
|
|
299
|
+
onSelectRows(reject(disableRowCheckCondition, rowsToDisplay));
|
|
259
300
|
setLastSelectionIndex(null);
|
|
260
301
|
|
|
261
302
|
return;
|
|
@@ -327,7 +368,11 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
327
368
|
const selectRowsWithShiftKey = (selectedRowIndex: number): void => {
|
|
328
369
|
const lastSelectedIndex = lastSelectionIndex as number;
|
|
329
370
|
if (isNil(shiftKeyDownRowPivot)) {
|
|
330
|
-
const selectedRowsFromTheStart = slice(
|
|
371
|
+
const selectedRowsFromTheStart = slice(
|
|
372
|
+
0,
|
|
373
|
+
selectedRowIndex + 1,
|
|
374
|
+
rowsToDisplay
|
|
375
|
+
);
|
|
331
376
|
|
|
332
377
|
onSelectRows(reject(disableRowCheckCondition, selectedRowsFromTheStart));
|
|
333
378
|
|
|
@@ -336,7 +381,10 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
336
381
|
|
|
337
382
|
const selectedRowsIndex = map(
|
|
338
383
|
(row) =>
|
|
339
|
-
findIndex(
|
|
384
|
+
findIndex(
|
|
385
|
+
(listingRow) => equals(getId(row), getId(listingRow)),
|
|
386
|
+
rowsToDisplay
|
|
387
|
+
),
|
|
340
388
|
selectedRows
|
|
341
389
|
).sort(subtract);
|
|
342
390
|
|
|
@@ -344,7 +392,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
344
392
|
const newSelection = slice(
|
|
345
393
|
selectedRowIndex,
|
|
346
394
|
(lastSelectionIndex as number) + 1,
|
|
347
|
-
|
|
395
|
+
rowsToDisplay
|
|
348
396
|
);
|
|
349
397
|
onSelectRows(
|
|
350
398
|
reject(
|
|
@@ -363,7 +411,11 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
363
411
|
return;
|
|
364
412
|
}
|
|
365
413
|
|
|
366
|
-
const newSelection = slice(
|
|
414
|
+
const newSelection = slice(
|
|
415
|
+
lastSelectedIndex,
|
|
416
|
+
selectedRowIndex + 1,
|
|
417
|
+
rowsToDisplay
|
|
418
|
+
);
|
|
367
419
|
onSelectRows(
|
|
368
420
|
reject(
|
|
369
421
|
disableRowCheckCondition,
|
|
@@ -387,7 +439,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
387
439
|
|
|
388
440
|
const selectedRowIndex = findIndex(
|
|
389
441
|
(listingRow) => equals(getId(row), getId(listingRow)),
|
|
390
|
-
|
|
442
|
+
rowsToDisplay
|
|
391
443
|
);
|
|
392
444
|
|
|
393
445
|
if (isShiftKeyDown) {
|
|
@@ -414,10 +466,10 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
414
466
|
};
|
|
415
467
|
|
|
416
468
|
const hoverRow = (row): void => {
|
|
417
|
-
if (equals(hoveredRowId,
|
|
469
|
+
if (equals(hoveredRowId, getRowId(row))) {
|
|
418
470
|
return;
|
|
419
471
|
}
|
|
420
|
-
setHoveredRowId(
|
|
472
|
+
setHoveredRowId(getRowId(row));
|
|
421
473
|
};
|
|
422
474
|
|
|
423
475
|
const clearHoveredRow = (): void => {
|
|
@@ -428,8 +480,6 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
428
480
|
return selectedRowsInclude(row);
|
|
429
481
|
};
|
|
430
482
|
|
|
431
|
-
const emptyRows = limit - Math.min(limit, totalRows - currentPage * limit);
|
|
432
|
-
|
|
433
483
|
const changeLimit = (updatedLimit: string): void => {
|
|
434
484
|
onLimitChange?.(Number(updatedLimit));
|
|
435
485
|
};
|
|
@@ -450,19 +500,6 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
450
500
|
|
|
451
501
|
const areColumnsEditable = not(isNil(onSelectColumns));
|
|
452
502
|
|
|
453
|
-
const allSubItemIds = React.useMemo(
|
|
454
|
-
() =>
|
|
455
|
-
reduce<TRow | number, Array<string | number>>(
|
|
456
|
-
(acc, row) => [
|
|
457
|
-
...acc,
|
|
458
|
-
...pluck('id', row[subItems?.getRowProperty() || ''] || [])
|
|
459
|
-
],
|
|
460
|
-
[],
|
|
461
|
-
rows
|
|
462
|
-
),
|
|
463
|
-
[rows, subItems]
|
|
464
|
-
);
|
|
465
|
-
|
|
466
503
|
return (
|
|
467
504
|
<div className={classes.listingContainer}>
|
|
468
505
|
{loading && rows.length > 0 && (
|
|
@@ -534,7 +571,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
534
571
|
listingVariant={listingVariant}
|
|
535
572
|
memoProps={headerMemoProps}
|
|
536
573
|
predefinedRowsSelection={predefinedRowsSelection}
|
|
537
|
-
rowCount={
|
|
574
|
+
rowCount={rowsToDisplay.length}
|
|
538
575
|
selectedRowCount={selectedRows.length}
|
|
539
576
|
sortField={sortField}
|
|
540
577
|
sortOrder={sortOrder}
|
|
@@ -551,8 +588,10 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
551
588
|
>
|
|
552
589
|
{rowsToDisplay.map((row, index) => {
|
|
553
590
|
const isRowSelected = isSelected(row);
|
|
554
|
-
const
|
|
555
|
-
|
|
591
|
+
const isSubItem = allSubItemIds.includes(
|
|
592
|
+
getSubItemRowId(row)
|
|
593
|
+
);
|
|
594
|
+
const isRowHovered = equals(hoveredRowId, getRowId(row));
|
|
556
595
|
|
|
557
596
|
return (
|
|
558
597
|
<ListingRow
|
|
@@ -569,7 +608,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
569
608
|
key={
|
|
570
609
|
gte(limit, performanceRowsLimit)
|
|
571
610
|
? `row_${index}`
|
|
572
|
-
:
|
|
611
|
+
: getRowId(row)
|
|
573
612
|
}
|
|
574
613
|
lastSelectionIndex={lastSelectionIndex}
|
|
575
614
|
limit={limit}
|
|
@@ -580,9 +619,13 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
580
619
|
subItemsPivots={subItemsPivots}
|
|
581
620
|
tabIndex={-1}
|
|
582
621
|
visibleColumns={visibleColumns}
|
|
583
|
-
onClick={
|
|
584
|
-
|
|
585
|
-
|
|
622
|
+
onClick={
|
|
623
|
+
isSubItem
|
|
624
|
+
? undefined
|
|
625
|
+
: (): void => {
|
|
626
|
+
onRowClick(row);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
586
629
|
onFocus={(): void => hoverRow(row)}
|
|
587
630
|
onMouseOver={(): void => hoverRow(row)}
|
|
588
631
|
>
|
|
@@ -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';
|