mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
ac5452c89f
Summary: This simplifies writing custom widgets that access selected data. To access the record at which the cursor is set, and get any future changes to it as the cursor moves or data changes, it suffices now to do: ``` grist.ready(); grist.onRecord(record => /* render */); ``` Similarly to access the set of selected records, and get any changes, it suffices now to do: ``` grist.ready(); grist.onRecords(records => /* render */); ``` The `records` argument will be a list of objects, each of which is a single record. This is distinct from the column-based representation favored in Grist up ontil now. That remains how methods like `fetchTable` or `fetchSelectedTable` represent their results. In the future, methods named like `fetchRecords` or `fetchSelectedRecords` could be added that return lists. Test Plan: extended tests Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2583
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
/**
|
|
* This module was automatically generated by `ts-interface-builder`
|
|
*/
|
|
import * as t from "ts-interface-checker";
|
|
// tslint:disable:object-literal-key-quotes
|
|
|
|
export const ComponentKind = t.union(t.lit("safeBrowser"), t.lit("safePython"), t.lit("unsafeNode"));
|
|
|
|
export const GristAPI = t.iface([], {
|
|
"render": t.func("number", t.param("path", "string"), t.param("target", "RenderTarget"),
|
|
t.param("options", "RenderOptions", true)),
|
|
"dispose": t.func("void", t.param("procId", "number")),
|
|
"subscribe": t.func("void", t.param("tableId", "string")),
|
|
"unsubscribe": t.func("void", t.param("tableId", "string")),
|
|
});
|
|
|
|
export const GristDocAPI = t.iface([], {
|
|
"getDocName": t.func("string"),
|
|
"listTables": t.func(t.array("string")),
|
|
"fetchTable": t.func("any", t.param("tableId", "string")),
|
|
"applyUserActions": t.func("any", t.param("actions", t.array(t.array("any")))),
|
|
});
|
|
|
|
export const GristView = t.iface([], {
|
|
"fetchSelectedTable": t.func("any"),
|
|
"fetchSelectedRecord": t.func("any", t.param("rowId", "number")),
|
|
});
|
|
|
|
const exportedTypeSuite: t.ITypeSuite = {
|
|
ComponentKind,
|
|
GristAPI,
|
|
GristDocAPI,
|
|
GristView,
|
|
};
|
|
export default exportedTypeSuite;
|