@centreon/ui 24.4.10 → 24.4.11
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
|
@@ -77,9 +77,9 @@ const mountListing = (): void => {
|
|
|
77
77
|
subItems={{
|
|
78
78
|
canCheckSubItems: false,
|
|
79
79
|
enable: true,
|
|
80
|
+
getRowProperty: () => 'subItems',
|
|
80
81
|
labelCollapse: 'Collapse',
|
|
81
|
-
labelExpand: 'Expand'
|
|
82
|
-
rowProperty: 'subItems'
|
|
82
|
+
labelExpand: 'Expand'
|
|
83
83
|
}}
|
|
84
84
|
totalRows={10}
|
|
85
85
|
/>
|
|
@@ -387,9 +387,9 @@ export const ListingWithSubItems = {
|
|
|
387
387
|
subItems: {
|
|
388
388
|
canCheckSubItems: false,
|
|
389
389
|
enable: true,
|
|
390
|
+
getRowProperty: () => 'subItems',
|
|
390
391
|
labelCollapse: 'Collapse',
|
|
391
|
-
labelExpand: 'Expand'
|
|
392
|
-
rowProperty: 'subItems'
|
|
392
|
+
labelExpand: 'Expand'
|
|
393
393
|
},
|
|
394
394
|
totalRows: 10
|
|
395
395
|
},
|
package/src/Listing/index.tsx
CHANGED
|
@@ -121,9 +121,9 @@ export interface Props<TRow> {
|
|
|
121
121
|
subItems?: {
|
|
122
122
|
canCheckSubItems: boolean;
|
|
123
123
|
enable: boolean;
|
|
124
|
+
getRowProperty: (row?) => string;
|
|
124
125
|
labelCollapse: string;
|
|
125
126
|
labelExpand: string;
|
|
126
|
-
rowProperty: string;
|
|
127
127
|
};
|
|
128
128
|
totalRows?: number;
|
|
129
129
|
viewerModeConfiguration?: ViewerModeConfiguration;
|
|
@@ -176,9 +176,9 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
176
176
|
subItems = {
|
|
177
177
|
canCheckSubItems: false,
|
|
178
178
|
enable: false,
|
|
179
|
+
getRowProperty: () => '',
|
|
179
180
|
labelCollapse: 'Collapse',
|
|
180
|
-
labelExpand: 'Expand'
|
|
181
|
-
rowProperty: ''
|
|
181
|
+
labelExpand: 'Expand'
|
|
182
182
|
}
|
|
183
183
|
}: Props<TRow>): JSX.Element => {
|
|
184
184
|
const currentVisibleColumns = getVisibleColumns({
|
|
@@ -211,10 +211,10 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
211
211
|
? reduce<TRow, Array<TRow>>(
|
|
212
212
|
(acc, row): Array<TRow> => {
|
|
213
213
|
if (
|
|
214
|
-
row[subItems.
|
|
214
|
+
row[subItems.getRowProperty()] &&
|
|
215
215
|
subItemsPivots.includes(row.id)
|
|
216
216
|
) {
|
|
217
|
-
return [...acc, row, ...row[subItems.
|
|
217
|
+
return [...acc, row, ...row[subItems.getRowProperty()]];
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
return [...acc, row];
|
|
@@ -449,7 +449,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
449
449
|
reduce<TRow | number, Array<string | number>>(
|
|
450
450
|
(acc, row) => [
|
|
451
451
|
...acc,
|
|
452
|
-
...pluck('id', row[subItems?.
|
|
452
|
+
...pluck('id', row[subItems?.getRowProperty() || ''] || [])
|
|
453
453
|
],
|
|
454
454
|
[],
|
|
455
455
|
rows
|
|
@@ -620,7 +620,7 @@ const Listing = <TRow extends { id: RowId }>({
|
|
|
620
620
|
listingVariant={listingVariant}
|
|
621
621
|
row={row}
|
|
622
622
|
rowColorConditions={rowColorConditions}
|
|
623
|
-
subItemsRowProperty={subItems?.
|
|
623
|
+
subItemsRowProperty={subItems?.getRowProperty(row)}
|
|
624
624
|
/>
|
|
625
625
|
))}
|
|
626
626
|
</ListingRow>
|