declare module "app/client/components/AceEditor"; declare module "app/client/components/Clipboard"; declare module "app/client/components/CodeEditorPanel"; declare module "app/client/components/DetailView"; declare module "app/client/components/DocConfigTab"; declare module "app/client/components/GridView"; declare module "app/client/components/Layout"; declare module "app/client/components/LayoutEditor"; declare module "app/client/components/commandList"; declare module "app/client/lib/Mousetrap"; declare module "app/client/lib/browserGlobals"; declare module "app/client/lib/dom"; declare module "app/client/lib/koDom"; declare module "app/client/lib/koForm"; // tslint:disable:max-classes-per-file declare module "app/client/components/Base" { import {GristDoc} from 'app/client/components/GristDoc'; namespace Base { } class Base { public static setBaseFor(ctor: any): void; constructor(gristDoc: GristDoc); } export = Base; } declare module "app/client/components/BaseView" { import {Cursor, CursorPos} from 'app/client/components/Cursor'; import {GristDoc} from 'app/client/components/GristDoc'; import {SelectionSummary} from 'app/client/components/SelectionSummary'; import {Disposable} from 'app/client/lib/dispose'; import BaseRowModel from "app/client/models/BaseRowModel"; import {DataRowModel} from 'app/client/models/DataRowModel'; import {LazyArrayModel} from "app/client/models/DataTableModel"; import DataTableModel from "app/client/models/DataTableModel"; import {ViewFieldRec, ViewSectionRec} from "app/client/models/DocModel"; import {FilterInfo} from 'app/client/models/entities/ViewSectionRec'; import {SortedRowSet} from 'app/client/models/rowset'; import {FieldBuilder} from "app/client/widgets/FieldBuilder"; import {DomArg} from 'grainjs'; import {IOpenController} from 'popweasel'; interface Options { init?: string; state?: any; } namespace BaseView {} class BaseView extends Disposable { public viewSection: ViewSectionRec; public viewPane: any; public viewData: LazyArrayModel; public gristDoc: GristDoc; public cursor: Cursor; public sortedRows: SortedRowSet; public rowSource: RowSource; public activeFieldBuilder: ko.Computed; public selectedColumns: ko.Computed|null; public disableEditing: ko.Computed; public isTruncated: ko.Observable; public tableModel: DataTableModel; public selectionSummary?: SelectionSummary; constructor(gristDoc: GristDoc, viewSectionModel: any, options?: {addNewRow?: boolean, isPreview?: boolean}); public setCursorPos(cursorPos: CursorPos): void; public createFilterMenu(ctl: IOpenController, filterInfo: FilterInfo, onClose?: () => void): HTMLElement; public buildTitleControls(): DomArg; public getLoadingDonePromise(): Promise; public activateEditorAtCursor(options?: Options): void; public openDiscussionAtCursor(discussionId?: number): boolean; public onResize(): void; public prepareToPrint(onOff: boolean): void; public moveEditRowToCursor(): DataRowModel; public scrollToCursor(sync: boolean): Promise; } export = BaseView; } declare module "app/client/components/ViewConfigTab" { import {GristDoc} from 'app/client/components/GristDoc'; import {Disposable} from 'app/client/lib/dispose'; import {KoArray} from "app/client/lib/koArray"; import {ColumnRec, ViewRec, ViewSectionRec} from "app/client/models/DocModel"; import {DomArg, DomContents} from 'grainjs'; namespace ViewConfigTab { interface ViewSectionData { section: ViewSectionRec; hiddenFields: KoArray; } } class ViewConfigTab extends Disposable { constructor(options: {gristDoc: GristDoc, viewModel: ViewRec}); public buildSortDom(): DomContents; // TODO: these should be made private or renamed. public _buildAdvancedSettingsDom(): DomArg; public _buildFilterDom(): DomArg; public _buildThemeDom(): DomArg; public _buildChartConfigDom(): DomContents; public _buildLayoutDom(): DomArg; public _buildCustomTypeItems(): DomArg; } export = ViewConfigTab; } declare module "app/client/components/commands" { export class Command { public name: string; public desc: string; public humanKeys: string[]; public keys: string[]; public run: () => any; } export type CommandsGroup = any; export const init: any; export const allCommands: any; export const createGroup: any; } declare module "app/client/models/BaseRowModel" { import {Disposable} from 'app/client/lib/dispose'; import TableModel from 'app/client/models/TableModel'; import {ColValues} from 'app/common/DocActions'; namespace BaseRowModel {} class BaseRowModel extends Disposable { public id: ko.Computed; public _index: ko.Observable; public _table: TableModel; protected _rowId: number | 'new' | null; protected _fields: string[]; public getRowId(): number; public updateColValues(colValues: ColValues): Promise; } export = BaseRowModel; } declare module "app/client/models/MetaRowModel" { import BaseRowModel from "app/client/models/BaseRowModel"; import {ColValues} from 'app/common/DocActions'; import {SchemaTypes} from 'app/common/schema'; type NPartial = { [P in keyof T]?: T[P]|null; }; type Values = T extends keyof SchemaTypes ? NPartial : ColValues; namespace MetaRowModel {} class MetaRowModel extends BaseRowModel { public _isDeleted: ko.Observable; public events: { trigger: (key: string) => void }; public updateColValues(colValues: Values): Promise; } export = MetaRowModel; } declare module "app/client/models/modelUtil" { interface SaveInterface { saveOnly(value: T): Promise; save(): Promise; setAndSave(value: T): Promise; } type KoSaveableObservable = ko.Observable & SaveInterface; type KoSaveableComputed = ko.Computed & SaveInterface; interface CustomComputed extends KoSaveableComputed { isSaved: ko.Computed; revert(): void; } function addSaveInterface( obs: ko.Observable|ko.Computed, saveFunc: (value: T) => Promise): KoSaveableObservable; interface ObjObservable extends ko.Observable { update(obj: T): void; prop(propName: string): ko.Observable; } interface SaveableObjObservable extends ko.Observable, SaveInterface { update(obj: T): void; prop(propName: string): KoSaveableObservable; } function objObservable(obs: ko.KoSaveableObservable): SaveableObjObservable; function objObservable(obs: ko.Observable): ObjObservable; function jsonObservable(obs: KoSaveableObservable, modifierFunc?: any, optContext?: any): SaveableObjObservable; function jsonObservable(obs: ko.Observable|ko.Computed, modifierFunc?: any, optContext?: any): ObjObservable; function fieldWithDefault(fieldObs: KoSaveableObservable, defaultOrFunc: T | (() => T)): KoSaveableObservable; function customValue(obs: KoSaveableObservable): CustomComputed; function savingComputed(options: { read: () => T, write: (setter: (obs: ko.Observable, val: T) => void, val: T) => void; }): KoSaveableObservable; function customComputed(options: { read: () => T, save?: (val: T) => Promise; }): CustomComputed; function setSaveValue(obs: KoSaveableObservable, val: T): Promise; } declare module "app/client/models/TableModel" { import {DocModel} from "app/client/models/DocModel"; import {RowGrouping, RowSource} from "app/client/models/rowset"; import {TableData} from "app/client/models/TableData"; import {CellValue, UserAction} from "app/common/DocActions"; namespace TableModel {} class TableModel extends RowSource { public docModel: DocModel; public tableData: TableData; public isLoaded: ko.Observable; constructor(docModel: DocModel, tableData: TableData); public fetch(force?: boolean): Promise; public getAllRows(): ReadonlyArray; public getNumRows(): number; public getRowGrouping(groupByCol: string): RowGrouping; public sendTableActions(actions: UserAction[], optDesc?: string): Promise; public sendTableAction(action: UserAction, optDesc?: string): Promise | undefined; } export = TableModel; } declare module "app/client/models/MetaTableModel" { import {KoArray} from "app/client/lib/koArray"; import {DocModel} from "app/client/models/DocModel"; import MetaRowModel from "app/client/models/MetaRowModel"; import {RowSource} from "app/client/models/rowset"; import {TableData} from "app/client/models/TableData"; import TableModel from "app/client/models/TableModel"; import {CellValue} from "app/common/DocActions"; namespace MetaTableModel {} class MetaTableModel extends TableModel { public rowModels: RowModel[]; constructor(docModel: DocModel, tableData: TableData, fields: string[], rowConstructor: (dm: DocModel) => void); public loadData(): void; public getRowModel(rowId: number, dependOnVersion?: boolean): RowModel; public getEmptyRowModel(): RowModel; public createFloatingRowModel(rowIdObs: ko.Observable|ko.Computed): RowModel; public createRowGroupModel(groupValue: CellValue, options: {groupBy: string, sortBy: string}): KoArray; public createAllRowsModel(sortColId: string): KoArray; public _createRowSetModel(rowSource: RowSource, sortColId: string): KoArray; } export = MetaTableModel; } declare module "app/client/models/DataTableModel" { import {KoArray} from "app/client/lib/koArray"; import BaseRowModel from "app/client/models/BaseRowModel"; import {DocModel, TableRec} from "app/client/models/DocModel"; import {TableQuerySets} from 'app/client/models/QuerySet'; import {SortedRowSet} from "app/client/models/rowset"; import {TableData} from "app/client/models/TableData"; import TableModel from "app/client/models/TableModel"; import {UIRowId} from "app/common/UIRowId"; namespace DataTableModel { interface LazyArrayModel extends KoArray { getRowId(index: number): UIRowId; getRowIndex(rowId: UIRowId): number; getRowIndexWithSub(rowId: UIRowId): number; getRowModel(rowId: UIRowId): T|undefined; } } class DataTableModel extends TableModel { public tableMetaRow: TableRec; public tableQuerySets: TableQuerySets; constructor(docModel: DocModel, tableData: TableData, tableMetaRow: TableRec); public createLazyRowsModel(sortedRowSet: SortedRowSet, optRowModelClass: any): DataTableModel.LazyArrayModel; public createFloatingRowModel(optRowModelClass?: any): BaseRowModel; } export = DataTableModel; } declare module "app/client/lib/koUtil" { export interface ComputedWithKoUtils extends ko.Computed { onlyNotifyUnequal(): this; previousOnUndefined(): this; } export interface ObservableWithKoUtils extends ko.Observable { assign(value: unknown): this; } export function withKoUtils(computed: ko.Computed): ComputedWithKoUtils; export function withKoUtils(computed: ko.Observable): ObservableWithKoUtils; export function computedBuilder(callback: any, optContext: any): any; export function observableWithDefault(obs: any, defaultOrFunc: any, optContext?: any): any; export function computedAutoDispose(optionsOrReadFunc: any, target: any, options: any): any; } // Used in browser check. Bowser does in fact have types, but not the bundled version // with polyfills for old browsers. declare module "bowser/bundled"; declare module "randomcolor"; interface Location { // We use reload(true) in places, which has an effect in Firefox, but may be more of a // historical accident than an intentional choice. reload(forceGet?: boolean): void; }