From 92a5ec78bb0e2ee59cf73bb6a4f76146f7471781 Mon Sep 17 00:00:00 2001 From: Jake Bassett Date: Mon, 26 Apr 2021 13:29:46 -0700 Subject: [PATCH] fix: filter out all meta types from table edit columns modal --- .../enum/string-enum-table-cell-renderer.component.ts | 2 +- .../table/columns/table-edit-columns-modal.component.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/components/src/table/cells/data-renderers/enum/string-enum-table-cell-renderer.component.ts b/projects/components/src/table/cells/data-renderers/enum/string-enum-table-cell-renderer.component.ts index 3c1929ff1..0192712a8 100644 --- a/projects/components/src/table/cells/data-renderers/enum/string-enum-table-cell-renderer.component.ts +++ b/projects/components/src/table/cells/data-renderers/enum/string-enum-table-cell-renderer.component.ts @@ -13,7 +13,7 @@ import { TableCellAlignmentType } from '../../types/table-cell-alignment-type';
{{ this.value | htDisplayStringEnum }}
diff --git a/projects/components/src/table/columns/table-edit-columns-modal.component.ts b/projects/components/src/table/columns/table-edit-columns-modal.component.ts index b28ba548b..d6a68e8a8 100644 --- a/projects/components/src/table/columns/table-edit-columns-modal.component.ts +++ b/projects/components/src/table/columns/table-edit-columns-modal.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectionStrategy, Component, Inject } from '@angular/core'; import { ButtonRole } from '../../button/button'; +import { FilterAttribute } from '../../filtering/filter/filter-attribute'; import { ModalRef, MODAL_DATA } from '../../modal/modal'; import { TableColumnConfigExtended } from '../table.service'; @@ -49,10 +50,14 @@ export class TableEditColumnsModalComponent { @Inject(MODAL_DATA) public readonly modalData: TableColumnConfigExtended[] ) { this.editColumns = this.modalData - .filter(column => (column.attribute?.type as string) !== '$$state') + .filter(column => !this.isMetaTypeColumn(column.attribute)) .sort((a, b) => (a.visible === b.visible ? 0 : a.visible ? -1 : 1)); } + private isMetaTypeColumn(attribute: FilterAttribute | undefined): boolean { + return attribute === undefined || attribute.type.startsWith('$$'); + } + public isLastRemainingColumn(column: TableColumnConfigExtended): boolean { const visibleCount: number = this.editColumns.filter(editColumn => editColumn.visible).length;