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:
@@ -183,6 +183,9 @@ function BaseView(gristDoc, viewSectionModel, options) {
|
||||
this.fieldBuilders.at(this.cursor.fieldIndex())
|
||||
));
|
||||
|
||||
// By default, a view doesn't support selectedColumns, but it can be overridden.
|
||||
this.selectedColumns = null;
|
||||
|
||||
// Observable for whether the data in this view is truncated, i.e. not all rows are included
|
||||
// (this can only be true for on-demand tables).
|
||||
this.isTruncated = ko.observable(false);
|
||||
|
||||
@@ -86,6 +86,16 @@ function GridView(gristDoc, viewSectionModel, isPreview = false) {
|
||||
this.cellSelector, this.tableModel.tableData, this.sortedRows, this.viewSection.viewFields);
|
||||
this.colMenuTargets = {}; // Reference from column ref to its menu target dom
|
||||
|
||||
this.selectedColumns = this.autoDispose(ko.pureComputed(() => {
|
||||
const result = this.viewSection.viewFields().all().filter((field, index) => {
|
||||
// During column removal or restoring (with undo), some columns fields
|
||||
// might be disposed.
|
||||
if (field.isDisposed() || field.column().isDisposed()) { return false; }
|
||||
return this.cellSelector.containsCol(index);
|
||||
});
|
||||
return result;
|
||||
}));
|
||||
|
||||
// Cache of column right offsets, used to determine the col select range
|
||||
this.colRightOffsets = this.autoDispose(ko.computed(() => {
|
||||
let fields = this.viewSection.viewFields();
|
||||
|
||||
Reference in New Issue
Block a user