diff --git a/projects/common/components/compound-elements/table/table.component.ts b/projects/common/components/compound-elements/table/table.component.ts index 0b7db4574b6752b47499e077303c29cd27cec7e9..5405678090f1aecdc4a094d847b45cb560174195 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 3c108967d97fd910f53ffb66044c954c2d6de7b0..23e8ab0bbc215b7e5c11d9304ccabfe80596e0d7 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); }