mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Sending visible columns for not configured widgets
Summary: Custom widgets will receive all visible columns when they are not configured. This will make the existing configuration work without the need to pick columns. Test Plan: updated tests Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3259
This commit is contained in:
parent
1c855537d6
commit
e99122433a
@ -529,18 +529,11 @@ export function createViewSectionRec(this: ViewSectionRec, docModel: DocModel):
|
|||||||
// if we have a saved configuration.
|
// if we have a saved configuration.
|
||||||
const request = this.columnsToMap();
|
const request = this.columnsToMap();
|
||||||
const mapping = this.customDef.columnsMapping();
|
const mapping = this.customDef.columnsMapping();
|
||||||
if (!request) {
|
if (!request || !mapping) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Convert simple column expressions (widget can just specify a name of a column) to a rich column definition.
|
// Convert simple column expressions (widget can just specify a name of a column) to a rich column definition.
|
||||||
const columnsToMap = request.map(r => new ColumnToMapImpl(r));
|
const columnsToMap = request.map(r => new ColumnToMapImpl(r));
|
||||||
if (!mapping) {
|
|
||||||
// If we don't have mappings, return an empty object.
|
|
||||||
return columnsToMap.reduce((o: WidgetColumnMap, c) => {
|
|
||||||
o[c.name] = c.allowMultiple ? [] : null;
|
|
||||||
return o;
|
|
||||||
}, {});
|
|
||||||
}
|
|
||||||
const result: WidgetColumnMap = {};
|
const result: WidgetColumnMap = {};
|
||||||
// Prepare map of existing column, will need this for translating colRefs to colIds.
|
// Prepare map of existing column, will need this for translating colRefs to colIds.
|
||||||
const colMap = new Map(this.columns().map(f => [f.id.peek(), f]));
|
const colMap = new Map(this.columns().map(f => [f.id.peek(), f]));
|
||||||
|
Loading…
Reference in New Issue
Block a user