2022-03-22 13:41:11 +00:00
|
|
|
export interface Style {
|
2022-10-14 10:07:19 +00:00
|
|
|
textColor?: string|undefined; // this can be string, undefined or an absent key.
|
|
|
|
fillColor?: string|undefined;
|
|
|
|
fontBold?: boolean|undefined;
|
|
|
|
fontUnderline?: boolean|undefined;
|
|
|
|
fontItalic?: boolean|undefined;
|
|
|
|
fontStrikethrough?: boolean|undefined;
|
2022-03-22 13:41:11 +00:00
|
|
|
}
|
|
|
|
|
2023-08-07 18:01:35 +00:00
|
|
|
export interface HeaderStyle {
|
|
|
|
headerTextColor?: string | undefined; // this can be string, undefined or an absent key.
|
|
|
|
headerFillColor?: string | undefined;
|
|
|
|
headerFontBold?: boolean | undefined;
|
|
|
|
headerFontUnderline?: boolean | undefined;
|
|
|
|
headerFontItalic?: boolean | undefined;
|
|
|
|
headerFontStrikethrough?: boolean | undefined;
|
|
|
|
}
|
|
|
|
|
2022-03-22 13:41:11 +00:00
|
|
|
export class CombinedStyle implements Style {
|
|
|
|
public readonly textColor?: string;
|
|
|
|
public readonly fillColor?: string;
|
2022-04-07 14:58:16 +00:00
|
|
|
public readonly fontBold?: boolean;
|
|
|
|
public readonly fontUnderline?: boolean;
|
|
|
|
public readonly fontItalic?: boolean;
|
|
|
|
public readonly fontStrikethrough?: boolean;
|
|
|
|
constructor(rules: (Style|undefined|null)[], flags: any[]) {
|
2022-03-22 13:41:11 +00:00
|
|
|
for (let i = 0; i < rules.length; i++) {
|
|
|
|
if (flags[i]) {
|
2022-04-07 14:58:16 +00:00
|
|
|
const textColor = rules[i]?.textColor;
|
|
|
|
const fillColor = rules[i]?.fillColor;
|
|
|
|
const fontBold = rules[i]?.fontBold;
|
|
|
|
const fontUnderline = rules[i]?.fontUnderline;
|
|
|
|
const fontItalic = rules[i]?.fontItalic;
|
|
|
|
const fontStrikethrough = rules[i]?.fontStrikethrough;
|
2022-03-22 13:41:11 +00:00
|
|
|
this.textColor = textColor || this.textColor;
|
|
|
|
this.fillColor = fillColor || this.fillColor;
|
2022-04-07 14:58:16 +00:00
|
|
|
this.fontBold = fontBold || this.fontBold;
|
|
|
|
this.fontUnderline = fontUnderline || this.fontUnderline;
|
|
|
|
this.fontItalic = fontItalic || this.fontItalic;
|
|
|
|
this.fontStrikethrough = fontStrikethrough || this.fontStrikethrough;
|
2022-03-22 13:41:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|