From 87d90cc6c223d747a5164dc2e25312a74e325c0d Mon Sep 17 00:00:00 2001
From: rhenck <richard.henck@iqb.hu-berlin.de>
Date: Mon, 24 Jun 2024 18:39:35 +0200
Subject: [PATCH] Table: Fix styling options

Only background color makes sense here.
---
 .../compound-elements/table/table.component.ts   |  3 ++-
 .../elements/compound-elements/table/table.ts    | 16 +++++++++-------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/projects/common/components/compound-elements/table/table.component.ts b/projects/common/components/compound-elements/table/table.component.ts
index 0b7db4574..540567809 100644
--- a/projects/common/components/compound-elements/table/table.component.ts
+++ b/projects/common/components/compound-elements/table/table.component.ts
@@ -27,7 +27,8 @@ import { Subject } from 'rxjs';
          [style.grid-template-columns]="elementModel.gridColumnSizes | measure"
          [style.grid-template-rows]="elementModel.gridRowSizes | measure"
          [style.grid-auto-columns]="'auto'"
-         [style.grid-auto-rows]="'auto'">
+         [style.grid-auto-rows]="'auto'"
+         [style.background-color]="elementModel.styling.backgroundColor">
       <ng-container *ngFor="let row of elementGrid; let i = index;">
         <div *ngFor="let column of row; let j = index;"
              class="cell-container"
diff --git a/projects/common/models/elements/compound-elements/table/table.ts b/projects/common/models/elements/compound-elements/table/table.ts
index 3c108967d..23e8ab0bb 100644
--- a/projects/common/models/elements/compound-elements/table/table.ts
+++ b/projects/common/models/elements/compound-elements/table/table.ts
@@ -3,7 +3,7 @@ import {
   UIElementProperties, UIElementType, UIElementValue
 } from 'common/models/elements/element';
 import {
-  BasicStyles, BorderStyles, PositionProperties,
+  BorderStyles, PositionProperties,
   PropertyGroupGenerators, PropertyGroupValidators
 } from 'common/models/elements/property-group-interfaces';
 import { Type } from '@angular/core';
@@ -20,7 +20,7 @@ export class TableElement extends CompoundElement implements PositionedUIElement
   elements: PositionedUIElement[] = [];
   tableEdgesEnabled: boolean = false;
   position: PositionProperties;
-  styling: BasicStyles & BorderStyles;
+  styling: { backgroundColor: string } & BorderStyles;
 
   static title: string = 'Tabelle';
   static icon: string = 'table_view';
@@ -47,11 +47,12 @@ export class TableElement extends CompoundElement implements PositionedUIElement
       if (element?.tableEdgesEnabled !== undefined) this.tableEdgesEnabled = element.tableEdgesEnabled;
       this.position = PropertyGroupGenerators.generatePositionProps(element?.position);
       this.styling = {
-        ...PropertyGroupGenerators.generateBasicStyleProps(element?.styling),
+        backgroundColor: 'transparent',
         ...PropertyGroupGenerators.generateBorderStylingProps({
           borderWidth: 1,
           ...element?.styling
-        })
+        }),
+        ...element?.styling
       };
     }
   }
@@ -80,15 +81,16 @@ export interface TableProperties extends UIElementProperties {
   elements: UIElement[];
   tableEdgesEnabled: boolean;
   position: PositionProperties;
-  styling: BasicStyles & BorderStyles;
+  styling: { backgroundColor: string } & BorderStyles;
 }
 
 function isValid(blueprint?: TableProperties): boolean {
   if (!blueprint) return false;
   return blueprint.gridColumnSizes !== undefined &&
-    blueprint. gridRowSizes !== undefined &&
+    blueprint.gridRowSizes !== undefined &&
     blueprint.elements !== undefined &&
     blueprint.tableEdgesEnabled !== undefined &&
     PropertyGroupValidators.isValidPosition(blueprint.position) &&
-    PropertyGroupValidators.isValidBasicStyles(blueprint.styling);
+    blueprint.styling.backgroundColor !== undefined &&
+    PropertyGroupValidators.isValidBorderStyles(blueprint.styling);
 }
-- 
GitLab