(core) add grist.getTable(tableId) and a getTableId() method in plugin api

Summary:
Makes the new TableOperations API available for all tables
in the document. Adds methods for discovering the tableId of the
selected table. I was very tempted to implement the select() TODO
in the TableOperations API, but it requires a significant refactor
of the backend.

Test Plan: added test

Reviewers: alexmojaki

Reviewed By: alexmojaki

Differential Revision: https://phab.getgrist.com/D3325
This commit is contained in:
Paul Fitzpatrick
2022-03-16 14:33:48 -04:00
parent fa75f60bfd
commit a5f5ecce19
3 changed files with 41 additions and 12 deletions

View File

@@ -16,6 +16,10 @@ export class TableOperationsImpl implements TableOperations {
private _defaultOptions: OpOptions) {
}
public getTableId() {
return this._platform.getTableId();
}
public create(records: Types.NewRecord, options?: OpOptions): Promise<Types.MinimalRecord>;
public create(records: Types.NewRecord[], options?: OpOptions): Promise<Types.MinimalRecord[]>;
public async create(recordsOrRecord: Types.NewRecord[]|Types.NewRecord,