@centreon/ui 24.4.76 → 24.4.78

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "24.4.76",
3
+ "version": "24.4.78",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "update:deps": "pnpx npm-check-updates -i --format group",
@@ -15,7 +15,7 @@ type Props = Pick<
15
15
  >;
16
16
 
17
17
  const toSelectEntries = (columns: Array<Column>): Array<SelectEntry> => {
18
- return columns.map(({ id, label, shortLabel }) => ({
18
+ return columns.filter(Boolean).map(({ id, label, shortLabel }) => ({
19
19
  id,
20
20
  name: `${label}${!isNil(shortLabel) ? ` (${shortLabel})` : ''}`
21
21
  }));
@@ -28,10 +28,11 @@ const ColumnMultiSelect = ({
28
28
  onResetColumns
29
29
  }: Props): JSX.Element => {
30
30
  const { t } = useTranslation();
31
+ const sanitizedColumns = columns.filter(Boolean);
31
32
 
32
33
  const visibleColumns = getVisibleColumns({
33
34
  columnConfiguration,
34
- columns
35
+ columns: sanitizedColumns
35
36
  });
36
37
 
37
38
  const selectColumnIds = (updatedColumns): void => {
@@ -41,7 +42,7 @@ const ColumnMultiSelect = ({
41
42
  return (
42
43
  <IconPopoverMultiSelect
43
44
  icon={<ColumnIcon />}
44
- options={toSelectEntries(columns)}
45
+ options={toSelectEntries(sanitizedColumns)}
45
46
  popperPlacement="bottom-end"
46
47
  title={t(labelAddColumns)}
47
48
  value={toSelectEntries(visibleColumns)}
@@ -123,7 +123,7 @@ const ListingHeader = ({
123
123
  additionalProps={[sortField, sortOrder]}
124
124
  collisionDetection={closestCenter}
125
125
  itemProps={['id']}
126
- items={visibleColumns}
126
+ items={visibleColumns.filter(Boolean)}
127
127
  memoProps={memoProps}
128
128
  sortingStrategy={horizontalListSortingStrategy}
129
129
  onDragEnd={({ items }): void => {
@@ -188,9 +188,10 @@ const Listing = <TRow extends { id: RowId; internalListingParentId?: RowId }>({
188
188
  labelExpand: 'Expand'
189
189
  }
190
190
  }: Props<TRow>): JSX.Element => {
191
+ const sanitizedColumns = columns.filter(Boolean);
191
192
  const currentVisibleColumns = getVisibleColumns({
192
193
  columnConfiguration,
193
- columns
194
+ columns: sanitizedColumns
194
195
  });
195
196
  const { dataStyle, getGridTemplateColumn } = useStyleTable({
196
197
  checkable,
@@ -486,7 +487,7 @@ const Listing = <TRow extends { id: RowId; internalListingParentId?: RowId }>({
486
487
 
487
488
  const visibleColumns = getVisibleColumns({
488
489
  columnConfiguration,
489
- columns
490
+ columns: sanitizedColumns
490
491
  });
491
492
 
492
493
  React.useEffect(() => {
@@ -520,7 +521,7 @@ const Listing = <TRow extends { id: RowId; internalListingParentId?: RowId }>({
520
521
  actions={actions}
521
522
  actionsBarMemoProps={actionsBarMemoProps}
522
523
  columnConfiguration={columnConfiguration}
523
- columns={columns}
524
+ columns={sanitizedColumns}
524
525
  currentPage={currentPage}
525
526
  customPaginationClassName={customPaginationClassName}
526
527
  limit={limit}
@@ -567,7 +568,7 @@ const Listing = <TRow extends { id: RowId; internalListingParentId?: RowId }>({
567
568
  areColumnsEditable={areColumnsEditable}
568
569
  checkable={checkable}
569
570
  columnConfiguration={columnConfiguration}
570
- columns={columns}
571
+ columns={sanitizedColumns}
571
572
  listingVariant={listingVariant}
572
573
  memoProps={headerMemoProps}
573
574
  predefinedRowsSelection={predefinedRowsSelection}
@@ -600,7 +601,7 @@ const Listing = <TRow extends { id: RowId; internalListingParentId?: RowId }>({
600
601
  (!isSubItem || subItems.canCheckSubItems)
601
602
  }
602
603
  columnConfiguration={columnConfiguration}
603
- columnIds={columns.map(prop('id'))}
604
+ columnIds={sanitizedColumns.map(prop('id'))}
604
605
  disableRowCondition={disableRowCondition}
605
606
  isHovered={isRowHovered}
606
607
  isSelected={isRowSelected}