2022-03-22 13:41:11 +00:00
|
|
|
export interface Style {
|
|
|
|
textColor?: string;
|
|
|
|
fillColor?: string;
|
2022-04-07 14:58:16 +00:00
|
|
|
fontBold?: boolean;
|
|
|
|
fontUnderline?: boolean;
|
|
|
|
fontItalic?: boolean;
|
|
|
|
fontStrikethrough?: boolean;
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|