跳转到内容

eidos

声明 eidos/schema、eidos/table 或 eidos/config。Lite 支持三者,Serve 支持 table。表格操作针对绑定表格并使用字段 ID。配置写入需 write 权限和 expectedVersion,版本过期时需重新读取并协调。watch 发送失效通知,不含初始值,收到通知后应重新读取。setViewConfig 替换配置,不会合并。

使用指南: tables. API 索引.

签名、参数及返回类型从 SDK 自动生成;可选成员不保证在每个宿主和上下文中存在。

源码

支持宿主: Lite Serve Mobile

readonly tableId: string;

支持宿主: Lite Serve Mobile

readonly viewId: string;

支持宿主: Lite Serve Mobile

读取绑定表格的字段与已保存视图信息。

readContext(): Promise<EidosTableSnapshot>;

返回值: Promise<EidosTableSnapshot>.

支持宿主: Lite Serve Mobile

分页读取绑定表格中的记录。

readRows(options: {
offset: number;
limit: number;
}): Promise<EidosFileRowPage>;
参数 类型 必填
options { offset: number; limit: number; } 是

返回值: Promise<EidosFileRowPage>.

支持宿主: Lite Serve Mobile

按字段 ID 和指定指标聚合记录。

aggregate(options: TableAggregateOptions): Promise<TableAggregateResult>;
参数 类型 必填
options TableAggregateOptions 是

返回值: Promise<TableAggregateResult>.

支持宿主: Lite Serve Mobile

替换已保存视图的插件配置,调用前应自行合并需要保留的键。

setViewConfig(config: Record<string, unknown>): Promise<void>;
参数 类型 必填
config Record<string, unknown> 是

返回值: Promise<void>.

支持宿主: Lite Serve Mobile

在宿主中打开记录。

openRecord(rowId: string): Promise<void>;
参数 类型 必填
rowId string 是

返回值: Promise<void>.

支持宿主: Lite Serve Mobile

接收失效通知,收到后重新读取当前数据。

watch(listener: () => void): Disposable;
参数 类型 必填
listener () => void 是

返回值: Disposable.

关联类型: EidosTableSnapshot, TableAggregateOptions, TableAggregateResult, Disposable.

源码

支持宿主: Lite Mobile

readonly schema?: EidosSchema;

支持宿主: Lite Serve Mobile

readonly table?: EidosTable;

支持宿主: Lite Mobile

readonly config?: EidosConfig;

关联类型: EidosSchema, EidosTable, EidosConfig.

源码

支持宿主: Lite Mobile

列出当前 Eidos 文件中的表格。

listTables(): Promise<Array<{
id: string;
name: string;
}>>;

返回值: Promise<Array<{ id: string; name: string; }>>.

支持宿主: Lite Mobile

读取当前文件中指定表格的字段。

readTable(tableId: string): Promise<{
fields: EidosFileFieldInfo[];
}>;
参数 类型 必填
tableId string 是

返回值: Promise<{ fields: EidosFileFieldInfo[]; }>.

源码

支持宿主: Lite Mobile

读取指定表格中本插件的配置及版本。

read(tableId: string): Promise<EidosConfigSnapshot>;
参数 类型 必填
tableId string 是

返回值: Promise<EidosConfigSnapshot>.

支持宿主: Lite Mobile

expectedVersion 匹配时替换配置,版本过期会返回 STALE_REVISION。

write(tableId: string, input: {
value: JsonObject | null;
expectedVersion: string;
}): Promise<EidosConfigSnapshot>;
参数 类型 必填
tableId string 是
input { value: JsonObject &#124; null; expectedVersion: string; } 是

返回值: Promise<EidosConfigSnapshot>.

支持宿主: Lite Mobile

订阅失效通知,不包含初始值;通知可能包含无关变更。

watch(tableId: string, listener: () => void): Disposable;
参数 类型 必填
tableId string 是
listener () => void 是

返回值: Disposable.

关联类型: EidosConfigSnapshot, Disposable.