(core) Conditional formatting rules

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
This commit is contained in:
Jarosław Sadziński
2022-03-22 14:41:11 +01:00
parent 96a34122a5
commit b1c3943bf4
25 changed files with 952 additions and 231 deletions

View File

@@ -15,7 +15,7 @@ import six
import actions
SCHEMA_VERSION = 26
SCHEMA_VERSION = 27
def make_column(col_id, col_type, formula='', isFormula=False):
return {
@@ -83,6 +83,8 @@ def schema_create_actions():
# E.g. Foo.person may have a visibleCol pointing to People.Name, with the displayCol
# pointing to Foo._gristHelper_DisplayX column with the formula "$person.Name".
make_column("visibleCol", "Ref:_grist_Tables_column"),
# Points to formula columns that hold conditional formatting rules.
make_column("rules", "RefList:_grist_Tables_column"),
# Instructions when to recalculate the formula on a column with isFormula=False (previously
# known as a "default formula"). Values are RecalcWhen constants defined below.
@@ -206,6 +208,8 @@ def schema_create_actions():
make_column("visibleCol", "Ref:_grist_Tables_column"),
# DEPRECATED: replaced with _grist_Filters in version 25. Do not remove or reuse.
make_column("filter", "Text"),
# Points to formula columns that hold conditional formatting rules for this field.
make_column("rules", "RefList:_grist_Tables_column"),
]),
# The code for all of the validation rules available to a Grist document