mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Implementing row conditional formatting
Summary: Conditional formatting can now be used for whole rows. Related fix: - Font styles weren't applicable for summary columns. - Checkbox and slider weren't using colors properly Test Plan: Existing and new tests Reviewers: paulfitz, georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3547
This commit is contained in:
@@ -89,6 +89,7 @@ class MetaTableExtras(object):
|
||||
usedByFields = _record_set('_grist_Views_section_field', 'displayCol')
|
||||
ruleUsedByCols = _record_ref_list_set('_grist_Tables_column', 'rules')
|
||||
ruleUsedByFields = _record_ref_list_set('_grist_Views_section_field', 'rules')
|
||||
ruleUsedByTables = _record_ref_list_set('_grist_Views_section', 'rules')
|
||||
|
||||
def tableId(rec, table):
|
||||
return rec.parentId.tableId
|
||||
@@ -101,10 +102,16 @@ class MetaTableExtras(object):
|
||||
|
||||
def numRuleColUsers(rec, table):
|
||||
"""
|
||||
Returns the number of cols and fields using this col as a rule col
|
||||
Returns the number of cols and fields using this col as a rule
|
||||
"""
|
||||
return len(rec.ruleUsedByCols) + len(rec.ruleUsedByFields)
|
||||
|
||||
def numRuleTableUsers(rec, table):
|
||||
"""
|
||||
Returns the number of tables using this col as a rule
|
||||
"""
|
||||
return len(rec.ruleUsedByTables)
|
||||
|
||||
def recalcOnChangesToSelf(rec, table):
|
||||
"""
|
||||
Whether the column is a trigger-formula column that depends on itself, used for
|
||||
@@ -115,8 +122,11 @@ class MetaTableExtras(object):
|
||||
def setAutoRemove(rec, table):
|
||||
"""Marks the col for removal if it's a display/rule helper col with no more users."""
|
||||
as_display = rec.colId.startswith('gristHelper_Display') and rec.numDisplayColUsers == 0
|
||||
as_rule = rec.colId.startswith('gristHelper_Conditional') and rec.numRuleColUsers == 0
|
||||
table.docmodel.setAutoRemove(rec, as_display or as_rule)
|
||||
as_col_rule = rec.colId.startswith('gristHelper_ConditionalRule') and rec.numRuleColUsers == 0
|
||||
as_row_rule = (
|
||||
rec.colId.startswith('gristHelper_RowConditionalRule') and rec.numRuleTableUsers == 0
|
||||
)
|
||||
table.docmodel.setAutoRemove(rec, as_display or as_col_rule or as_row_rule)
|
||||
|
||||
|
||||
class _grist_Views(object):
|
||||
|
||||
Reference in New Issue
Block a user