mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
3edb3a6826
Summary: - Filters out hidden pages from docModel.allPagesList (used for knowing default page, and for search iteration). - Filters out hidden pages from TreeModel (uses raw tableData, so has a different way to filter). Test Plan: WIP Reviewers: georgegevoian Reviewed By: georgegevoian Differential Revision: https://phab.getgrist.com/D2996
17 lines
586 B
TypeScript
17 lines
586 B
TypeScript
import {DocModel, IRowModel, refRecord, ViewRec} from 'app/client/models/DocModel';
|
|
import * as ko from 'knockout';
|
|
|
|
// Represents a page entry in the tree of pages.
|
|
export interface PageRec extends IRowModel<"_grist_Pages"> {
|
|
view: ko.Computed<ViewRec>;
|
|
isHidden: ko.Computed<boolean>;
|
|
}
|
|
|
|
export function createPageRec(this: PageRec, docModel: DocModel): void {
|
|
this.view = refRecord(docModel.views, this.viewRef);
|
|
this.isHidden = ko.pureComputed(() => {
|
|
const name = this.view().name();
|
|
return !name || (name === 'GristDocTour' && !docModel.showDocTourTable);
|
|
});
|
|
}
|