mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
b1c3943bf4
Summary: Adding conditional formatting rules feature. Each column can have multiple styling rules which are applied in order when evaluated to a truthy value. - The creator panel has a new section: Cell Style - New user action AddEmptyRule for adding an empty rule - New columns in _grist_Table_columns and fields A new color picker will be introduced in a follow-up diff (as it is also used in choice/choice list/filters). Design document: https://grist.quip.com/FVzfAgoO5xOF/Conditional-Formatting-Implementation-Design Test Plan: new tests Reviewers: georgegevoian Reviewed By: georgegevoian Subscribers: alexmojaki Differential Revision: https://phab.getgrist.com/D3282
20 lines
527 B
TypeScript
20 lines
527 B
TypeScript
export interface Style {
|
|
textColor?: string;
|
|
fillColor?: string;
|
|
}
|
|
|
|
export class CombinedStyle implements Style {
|
|
public readonly textColor?: string;
|
|
public readonly fillColor?: string;
|
|
constructor(rules: Style[], flags: any[]) {
|
|
for (let i = 0; i < rules.length; i++) {
|
|
if (flags[i]) {
|
|
const textColor = rules[i].textColor;
|
|
const fillColor = rules[i].fillColor;
|
|
this.textColor = textColor || this.textColor;
|
|
this.fillColor = fillColor || this.fillColor;
|
|
}
|
|
}
|
|
}
|
|
}
|