2020-10-02 15:10:00 +00:00
|
|
|
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';
|
2022-09-29 16:32:54 +00:00
|
|
|
import {SelectionSummary} from 'app/client/components/SelectionSummary';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {Disposable} from 'app/client/lib/dispose';
|
2022-07-04 14:14:55 +00:00
|
|
|
import BaseRowModel from "app/client/models/BaseRowModel";
|
2021-03-17 03:45:44 +00:00
|
|
|
import {DataRowModel} from 'app/client/models/DataRowModel';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {LazyArrayModel} from "app/client/models/DataTableModel";
|
2022-07-04 14:14:55 +00:00
|
|
|
import DataTableModel from "app/client/models/DataTableModel";
|
2022-10-14 10:07:19 +00:00
|
|
|
import {ViewFieldRec, ViewSectionRec} from "app/client/models/DocModel";
|
2021-11-19 20:30:11 +00:00
|
|
|
import {FilterInfo} from 'app/client/models/entities/ViewSectionRec';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {SortedRowSet} from 'app/client/models/rowset';
|
2021-03-17 03:45:44 +00:00
|
|
|
import {FieldBuilder} from "app/client/widgets/FieldBuilder";
|
2020-10-02 15:10:00 +00:00
|
|
|
import {DomArg} from 'grainjs';
|
|
|
|
import {IOpenController} from 'popweasel';
|
|
|
|
|
2021-05-23 17:43:11 +00:00
|
|
|
interface Options {
|
|
|
|
init?: string;
|
|
|
|
state?: any;
|
2021-05-17 14:05:49 +00:00
|
|
|
}
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
namespace BaseView {}
|
|
|
|
class BaseView extends Disposable {
|
|
|
|
public viewSection: ViewSectionRec;
|
|
|
|
public viewPane: any;
|
|
|
|
public viewData: LazyArrayModel<BaseRowModel>;
|
|
|
|
public gristDoc: GristDoc;
|
|
|
|
public cursor: Cursor;
|
|
|
|
public sortedRows: SortedRowSet;
|
2021-03-17 03:45:44 +00:00
|
|
|
public activeFieldBuilder: ko.Computed<FieldBuilder>;
|
2022-10-14 10:07:19 +00:00
|
|
|
public selectedColumns: ko.Computed<ViewFieldRec[]>|null;
|
2020-10-02 15:10:00 +00:00
|
|
|
public disableEditing: ko.Computed<boolean>;
|
|
|
|
public isTruncated: ko.Observable<boolean>;
|
2022-01-12 13:30:51 +00:00
|
|
|
public tableModel: DataTableModel;
|
2022-09-29 16:32:54 +00:00
|
|
|
public selectionSummary?: SelectionSummary;
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2022-04-11 19:33:26 +00:00
|
|
|
constructor(gristDoc: GristDoc, viewSectionModel: any, options?: {addNewRow?: boolean, isPreview?: boolean});
|
2020-10-02 15:10:00 +00:00
|
|
|
public setCursorPos(cursorPos: CursorPos): void;
|
2021-11-19 20:30:11 +00:00
|
|
|
public createFilterMenu(ctl: IOpenController, filterInfo: FilterInfo, onClose?: () => void): HTMLElement;
|
2020-10-02 15:10:00 +00:00
|
|
|
public buildTitleControls(): DomArg;
|
|
|
|
public getLoadingDonePromise(): Promise<void>;
|
2021-05-23 17:43:11 +00:00
|
|
|
public activateEditorAtCursor(options?: Options): void;
|
2020-10-02 15:10:00 +00:00
|
|
|
public onResize(): void;
|
2020-10-09 21:39:13 +00:00
|
|
|
public prepareToPrint(onOff: boolean): void;
|
2021-03-17 03:45:44 +00:00
|
|
|
public moveEditRowToCursor(): DataRowModel;
|
2022-01-05 20:14:44 +00:00
|
|
|
public scrollToCursor(sync: boolean): Promise<void>;
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
export = BaseView;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module "app/client/components/ViewConfigTab" {
|
2022-02-03 17:23:53 +00:00
|
|
|
import {GristDoc} from 'app/client/components/GristDoc';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {Disposable} from 'app/client/lib/dispose';
|
|
|
|
import {KoArray} from "app/client/lib/koArray";
|
|
|
|
import {ColumnRec, ViewRec, ViewSectionRec} from "app/client/models/DocModel";
|
2021-12-05 05:14:38 +00:00
|
|
|
import {DomArg, DomContents} from 'grainjs';
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
namespace ViewConfigTab {
|
|
|
|
interface ViewSectionData {
|
|
|
|
section: ViewSectionRec;
|
|
|
|
hiddenFields: KoArray<ColumnRec>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ViewConfigTab extends Disposable {
|
2022-02-03 17:23:53 +00:00
|
|
|
constructor(options: {gristDoc: GristDoc, viewModel: ViewRec});
|
2021-12-05 05:14:38 +00:00
|
|
|
public buildSortDom(): DomContents;
|
2020-10-02 15:10:00 +00:00
|
|
|
// TODO: these should be made private or renamed.
|
|
|
|
public _buildAdvancedSettingsDom(): DomArg;
|
|
|
|
public _buildFilterDom(): DomArg;
|
|
|
|
public _buildThemeDom(): DomArg;
|
2021-12-05 05:14:38 +00:00
|
|
|
public _buildChartConfigDom(): DomContents;
|
2020-10-02 15:10:00 +00:00
|
|
|
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';
|
2022-07-04 14:14:55 +00:00
|
|
|
import TableModel from 'app/client/models/TableModel';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {ColValues} from 'app/common/DocActions';
|
|
|
|
|
|
|
|
namespace BaseRowModel {}
|
|
|
|
class BaseRowModel extends Disposable {
|
|
|
|
public id: ko.Computed<number>;
|
|
|
|
public _index: ko.Observable<number|null>;
|
|
|
|
public _table: TableModel;
|
|
|
|
protected _rowId: number | 'new' | null;
|
|
|
|
protected _fields: string[];
|
2021-04-26 21:54:09 +00:00
|
|
|
public getRowId(): number;
|
|
|
|
public updateColValues(colValues: ColValues): Promise<void>;
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
export = BaseRowModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module "app/client/models/MetaRowModel" {
|
2022-07-04 14:14:55 +00:00
|
|
|
import BaseRowModel from "app/client/models/BaseRowModel";
|
2020-10-02 15:10:00 +00:00
|
|
|
namespace MetaRowModel {}
|
|
|
|
class MetaRowModel extends BaseRowModel {
|
|
|
|
public _isDeleted: ko.Observable<boolean>;
|
|
|
|
public events: { trigger: (key: string) => void };
|
|
|
|
}
|
|
|
|
export = MetaRowModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module "app/client/models/modelUtil" {
|
|
|
|
interface SaveInterface<T> {
|
|
|
|
saveOnly(value: T): Promise<void>;
|
|
|
|
save(): Promise<void>;
|
|
|
|
setAndSave(value: T): Promise<void>;
|
|
|
|
}
|
|
|
|
|
|
|
|
type KoSaveableObservable<T> = ko.Observable<T> & SaveInterface<T>;
|
|
|
|
type KoSaveableComputed<T> = ko.Computed<T> & SaveInterface<T>;
|
|
|
|
|
|
|
|
interface CustomComputed<T> extends KoSaveableComputed<T> {
|
|
|
|
isSaved: ko.Computed<boolean>;
|
|
|
|
revert(): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
function addSaveInterface<T>(
|
|
|
|
obs: ko.Observable<T>|ko.Computed<T>,
|
|
|
|
saveFunc: (value: T) => Promise<void>): KoSaveableObservable<T>;
|
|
|
|
|
|
|
|
interface ObjObservable<T> extends ko.Observable<T> {
|
|
|
|
update(obj: T): void;
|
|
|
|
prop(propName: string): ko.Observable<any>;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface SaveableObjObservable<T> extends ko.Observable<T>, SaveInterface<T> {
|
|
|
|
update(obj: T): void;
|
|
|
|
prop(propName: string): KoSaveableObservable<any>;
|
|
|
|
}
|
|
|
|
|
2022-10-14 10:07:19 +00:00
|
|
|
function objObservable<T>(obs: ko.KoSaveableObservable<T>): SaveableObjObservable<T>;
|
2020-10-02 15:10:00 +00:00
|
|
|
function objObservable<T>(obs: ko.Observable<T>): ObjObservable<T>;
|
|
|
|
function jsonObservable(obs: KoSaveableObservable<string>,
|
|
|
|
modifierFunc?: any, optContext?: any): SaveableObjObservable<any>;
|
|
|
|
function jsonObservable(obs: ko.Observable<string>|ko.Computed<string>,
|
|
|
|
modifierFunc?: any, optContext?: any): ObjObservable<any>;
|
|
|
|
|
|
|
|
function fieldWithDefault<T>(fieldObs: KoSaveableObservable<T>, defaultOrFunc: T | (() => T)):
|
|
|
|
KoSaveableObservable<T>;
|
|
|
|
|
|
|
|
function customValue<T>(obs: KoSaveableObservable<T>): CustomComputed<T>;
|
|
|
|
|
|
|
|
function savingComputed<T>(options: {
|
|
|
|
read: () => T,
|
|
|
|
write: (setter: (obs: ko.Observable<T>, val: T) => void, val: T) => void;
|
|
|
|
}): KoSaveableObservable<T>;
|
|
|
|
|
|
|
|
function customComputed<T>(options: {
|
|
|
|
read: () => T,
|
|
|
|
save?: (val: T) => Promise<void>;
|
|
|
|
}): CustomComputed<T>;
|
|
|
|
|
|
|
|
function setSaveValue<T>(obs: KoSaveableObservable<T>, val: T): Promise<void>;
|
|
|
|
}
|
|
|
|
|
|
|
|
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<boolean>;
|
|
|
|
|
|
|
|
constructor(docModel: DocModel, tableData: TableData);
|
|
|
|
public fetch(force?: boolean): Promise<void>;
|
|
|
|
public getAllRows(): ReadonlyArray<number>;
|
2021-03-05 15:17:07 +00:00
|
|
|
public getNumRows(): number;
|
2020-10-02 15:10:00 +00:00
|
|
|
public getRowGrouping(groupByCol: string): RowGrouping<CellValue>;
|
|
|
|
public sendTableActions(actions: UserAction[], optDesc?: string): Promise<any[]>;
|
|
|
|
public sendTableAction(action: UserAction, optDesc?: string): Promise<any> | undefined;
|
|
|
|
}
|
|
|
|
export = TableModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module "app/client/models/MetaTableModel" {
|
|
|
|
import {KoArray} from "app/client/lib/koArray";
|
|
|
|
import {DocModel} from "app/client/models/DocModel";
|
2022-07-04 14:14:55 +00:00
|
|
|
import MetaRowModel from "app/client/models/MetaRowModel";
|
2020-10-02 15:10:00 +00:00
|
|
|
import {RowSource} from "app/client/models/rowset";
|
|
|
|
import {TableData} from "app/client/models/TableData";
|
2022-07-04 14:14:55 +00:00
|
|
|
import TableModel from "app/client/models/TableModel";
|
2020-10-02 15:10:00 +00:00
|
|
|
import {CellValue} from "app/common/DocActions";
|
|
|
|
|
|
|
|
namespace MetaTableModel {}
|
|
|
|
class MetaTableModel<RowModel extends MetaRowModel> 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<number>|ko.Computed<number>): RowModel;
|
|
|
|
public createRowGroupModel(groupValue: CellValue, options: {groupBy: string, sortBy: string}): KoArray<RowModel>;
|
|
|
|
public createAllRowsModel(sortColId: string): KoArray<RowModel>;
|
|
|
|
public _createRowSetModel(rowSource: RowSource, sortColId: string): KoArray<RowModel>;
|
|
|
|
}
|
|
|
|
export = MetaTableModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module "app/client/models/DataTableModel" {
|
|
|
|
import {KoArray} from "app/client/lib/koArray";
|
2022-07-04 14:14:55 +00:00
|
|
|
import BaseRowModel from "app/client/models/BaseRowModel";
|
2020-10-02 15:10:00 +00:00
|
|
|
import {DocModel, TableRec} from "app/client/models/DocModel";
|
|
|
|
import {TableQuerySets} from 'app/client/models/QuerySet';
|
2021-04-26 21:54:09 +00:00
|
|
|
import {SortedRowSet} from "app/client/models/rowset";
|
2020-10-02 15:10:00 +00:00
|
|
|
import {TableData} from "app/client/models/TableData";
|
2022-07-04 14:14:55 +00:00
|
|
|
import TableModel from "app/client/models/TableModel";
|
2021-09-23 22:47:36 +00:00
|
|
|
import {UIRowId} from "app/common/UIRowId";
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
namespace DataTableModel {
|
|
|
|
interface LazyArrayModel<T> extends KoArray<T | null> {
|
2021-09-23 22:47:36 +00:00
|
|
|
getRowId(index: number): UIRowId;
|
|
|
|
getRowIndex(rowId: UIRowId): number;
|
|
|
|
getRowIndexWithSub(rowId: UIRowId): number;
|
|
|
|
getRowModel(rowId: UIRowId): T|undefined;
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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<BaseRowModel>;
|
2021-08-26 11:39:17 +00:00
|
|
|
public createFloatingRowModel(optRowModelClass?: any): BaseRowModel;
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
export = DataTableModel;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module "app/client/lib/koUtil" {
|
|
|
|
export interface ComputedWithKoUtils<T> extends ko.Computed<T> {
|
|
|
|
onlyNotifyUnequal(): this;
|
2022-03-22 13:41:11 +00:00
|
|
|
previousOnUndefined(): this;
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
export interface ObservableWithKoUtils<T> extends ko.Observable<T> {
|
|
|
|
assign(value: unknown): this;
|
|
|
|
}
|
|
|
|
export function withKoUtils<T>(computed: ko.Computed<T>): ComputedWithKoUtils<T>;
|
|
|
|
export function withKoUtils<T>(computed: ko.Observable<T>): ObservableWithKoUtils<T>;
|
|
|
|
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";
|
(core) Speed up and upgrade build.
Summary:
- Upgrades to build-related packages:
- Upgrade typescript, related libraries and typings.
- Upgrade webpack, eslint; add tsc-watch, node-dev, eslint_d.
- Build organization changes:
- Build webpack from original typescript, transpiling only; with errors still
reported by a background tsc watching process.
- Typescript-related changes:
- Reduce imports of AWS dependencies (very noticeable speedup)
- Avoid auto-loading global @types
- Client code is now built with isolatedModules flag (for safe transpilation)
- Use allowJs to avoid copying JS files manually.
- Linting changes
- Enhance Arcanist ESLintLinter to run before/after commands, and set up to use eslint_d
- Update eslint config, and include .eslintignore to avoid linting generated files.
- Include a bunch of eslint-prompted and eslint-generated fixes
- Add no-unused-expression rule to eslint, and fix a few warnings about it
- Other items:
- Refactor cssInput to avoid circular dependency
- Remove a bit of unused code, libraries, dependencies
Test Plan: No behavior changes, all existing tests pass. There are 30 tests fewer reported because `test_gpath.py` was removed (it's been unused for years)
Reviewers: paulfitz
Reviewed By: paulfitz
Subscribers: paulfitz
Differential Revision: https://phab.getgrist.com/D3498
2022-06-27 20:09:41 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|