(core) Show summary tables on Raw Data page

Summary:
Summary tables now have their own raw viewsection, and are shown
under Raw Data Tables on the Raw Data page.

Test Plan: Browser and Python tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3495
This commit is contained in:
George Gevoian
2022-07-06 00:41:09 -07:00
parent 8bab8c18fa
commit a051830aeb
31 changed files with 452 additions and 308 deletions

View File

@@ -124,7 +124,7 @@ export function createColumnRec(this: ColumnRec, docModel: DocModel): void {
// Returns the rowModel for the referenced table, or null, if this is not a reference column.
this.refTable = ko.pureComputed(() => {
const refTableId = getReferencedTableId(this.type() || "");
return refTableId ? docModel.allTables.all().find(t => t.tableId() === refTableId) || null : null;
return refTableId ? docModel.visibleTables.all().find(t => t.tableId() === refTableId) || null : null;
});
// Helper for Reference/ReferenceList columns, which returns a formatter according to the visibleCol

View File

@@ -13,7 +13,7 @@ export function createPageRec(this: PageRec, docModel: DocModel): void {
const name = this.view().name();
const isTableHidden = () => {
const viewId = this.view().id();
const tables = docModel.rawTables.all();
const tables = docModel.rawDataTables.all();
const primaryTable = tables.find(t => t.primaryViewId() === viewId);
return !!primaryTable && primaryTable.isHidden();
};

View File

@@ -30,6 +30,9 @@ export interface TableRec extends IRowModel<"_grist_Tables"> {
tableName: modelUtil.KoSaveableObservable<string>;
// Table name with a default value (which is tableId).
tableNameDef: modelUtil.KoSaveableObservable<string>;
// Like tableNameDef, but formatted to be more suitable for displaying to
// users (e.g. including group columns for summary tables).
formattedTableName: ko.PureComputed<string>;
// If user can select this table in various places.
// Note: Some hidden tables can still be visible on RawData view.
isHidden: ko.Computed<boolean>;
@@ -114,4 +117,9 @@ export function createTableRec(this: TableRec, docModel: DocModel): void {
return table.tableId() || '';
})
);
this.formattedTableName = ko.pureComputed(() => {
return this.summarySourceTable()
? `${this.tableNameDef()} ${this.groupDesc()}`
: this.tableNameDef();
});
}