mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(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:
@@ -341,3 +341,9 @@ export function isRefListType(type: string) {
|
||||
export function isFullReferencingType(type: string) {
|
||||
return type.startsWith('Ref:') || isRefListType(type);
|
||||
}
|
||||
|
||||
export function isValidRuleValue(value: CellValue|undefined) {
|
||||
// We want to strictly test if a value is boolean, when the value is 0 or 1 it might
|
||||
// indicate other number in the future.
|
||||
return value === null || typeof value === 'boolean';
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { GristObjCode } from "app/plugin/GristData";
|
||||
|
||||
// tslint:disable:object-literal-key-quotes
|
||||
|
||||
export const SCHEMA_VERSION = 26;
|
||||
export const SCHEMA_VERSION = 27;
|
||||
|
||||
export const schema = {
|
||||
|
||||
@@ -38,6 +38,7 @@ export const schema = {
|
||||
summarySourceCol : "Ref:_grist_Tables_column",
|
||||
displayCol : "Ref:_grist_Tables_column",
|
||||
visibleCol : "Ref:_grist_Tables_column",
|
||||
rules : "RefList:_grist_Tables_column",
|
||||
recalcWhen : "Int",
|
||||
recalcDeps : "RefList:_grist_Tables_column",
|
||||
},
|
||||
@@ -125,6 +126,7 @@ export const schema = {
|
||||
displayCol : "Ref:_grist_Tables_column",
|
||||
visibleCol : "Ref:_grist_Tables_column",
|
||||
filter : "Text",
|
||||
rules : "RefList:_grist_Tables_column",
|
||||
},
|
||||
|
||||
"_grist_Validations": {
|
||||
@@ -226,6 +228,7 @@ export interface SchemaTypes {
|
||||
summarySourceCol: number;
|
||||
displayCol: number;
|
||||
visibleCol: number;
|
||||
rules: [GristObjCode.List, ...number[]]|null;
|
||||
recalcWhen: number;
|
||||
recalcDeps: [GristObjCode.List, ...number[]]|null;
|
||||
};
|
||||
@@ -313,6 +316,7 @@ export interface SchemaTypes {
|
||||
displayCol: number;
|
||||
visibleCol: number;
|
||||
filter: string;
|
||||
rules: [GristObjCode.List, ...number[]]|null;
|
||||
};
|
||||
|
||||
"_grist_Validations": {
|
||||
|
||||
Reference in New Issue
Block a user