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:
@@ -25,6 +25,8 @@ export type ISelectorOption<T> = (T & string) | ISelectorOptionFull<T>;
|
||||
* A "light" style is supported in CSS by passing cssButtonSelect.cls('-light') as an additional
|
||||
* argument.
|
||||
*
|
||||
* A disabled state is supported by passing cssButtonSelect.cls('-disabled').
|
||||
*
|
||||
* Usage:
|
||||
* const fruit = observable("apple");
|
||||
* buttonSelect(fruit, ["apple", "banana", "mango"]);
|
||||
@@ -61,13 +63,13 @@ export function buttonToggleSelect<T>(
|
||||
/**
|
||||
* Pre-made text alignment selector.
|
||||
*/
|
||||
export function alignmentSelect(obs: Observable<string>) {
|
||||
export function alignmentSelect(obs: Observable<string>, ...domArgs: DomElementArg[]) {
|
||||
const alignments: Array<ISelectorOption<string>> = [
|
||||
{value: 'left', icon: 'LeftAlign'},
|
||||
{value: 'center', icon: 'CenterAlign'},
|
||||
{value: 'right', icon: 'RightAlign'}
|
||||
];
|
||||
return buttonSelect(obs, alignments, {}, testId('alignment-select'));
|
||||
return buttonSelect(obs, alignments, {}, testId('alignment-select'), ...domArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,6 +218,14 @@ const cssSelectorBtn = styled('div', `
|
||||
border: none;
|
||||
background-color: ${theme.hover};
|
||||
}
|
||||
.${cssButtonSelect.className}-disabled > &,
|
||||
.${cssButtonSelect.className}-disabled > &:hover {
|
||||
--icon-color: ${theme.rightPanelToggleButtonDisabledFg};
|
||||
color: ${theme.rightPanelToggleButtonDisabledFg};
|
||||
background-color: ${theme.rightPanelToggleButtonDisabledBg};
|
||||
border-color: ${theme.buttonGroupBorder};
|
||||
pointer-events: none;
|
||||
}
|
||||
`);
|
||||
|
||||
const cssSelectorLabel = styled('span', `
|
||||
|
||||
Reference in New Issue
Block a user