2020-10-02 15:10:00 +00:00
|
|
|
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>;
|
2021-08-27 17:25:20 +00:00
|
|
|
isHidden: ko.Computed<boolean>;
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function createPageRec(this: PageRec, docModel: DocModel): void {
|
|
|
|
this.view = refRecord(docModel.views, this.viewRef);
|
2021-08-27 17:25:20 +00:00
|
|
|
this.isHidden = ko.pureComputed(() => {
|
|
|
|
const name = this.view().name();
|
|
|
|
return !name || (name === 'GristDocTour' && !docModel.showDocTourTable);
|
|
|
|
});
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|