Skip to content
Snippets Groups Projects
Commit 87d90cc6 authored by rhenck's avatar rhenck
Browse files

Table: Fix styling options

Only background color makes sense here.
parent 18295a8c
No related branches found
No related tags found
No related merge requests found
......@@ -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"
......
......@@ -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);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment