mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Multi-column configuration
Summary: Creator panel allows now to edit multiple columns at once for some options that are common for them. Options that are not common are disabled. List of options that can be edited for multiple columns: - Column behavior (but limited to empty/formula columns) - Alignment and wrapping - Default style - Number options (for numeric columns) - Column types (but only for empty/formula columns) If multiple columns of the same type are selected, most of the options are available to change, except formula, trigger formula and conditional styles. Editing column label or column id is disabled by default for multiple selection. Not related: some tests were fixed due to the change in the column label and id widget in grist-core (disabled attribute was replaced by readonly). Test Plan: Updated and new tests. Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D3598
This commit is contained in:
@@ -959,3 +959,21 @@ export function assertIsDefined<T>(name: string, value: T): asserts value is Non
|
||||
return await fn();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if value is 'empty' (like null, undefined, empty string, empty array/set/map, empty object).
|
||||
* Values like 0, true, false are not empty.
|
||||
*/
|
||||
export function notSet(value: any) {
|
||||
return value === undefined || value === null || value === ''
|
||||
|| (Array.isArray(value) && !value.length)
|
||||
|| (typeof value === 'object' && !Object.keys(value).length)
|
||||
|| (['[object Map]', '[object Set'].includes(value.toString()) && !value.size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if value is 'empty', if it is, returns the default value (which is null).
|
||||
*/
|
||||
export function ifNotSet(value: any, def: any = null) {
|
||||
return notSet(value) ? def : value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user