import { OffListener } from './common'; import { Selection, IOpenFile, IHostApiSelectRecordIdListOptions, IHostApiSelectRecordIdListResult } from './script/base'; export declare class DingdocsBase { host: DingdocsBaseHost; event: DingdocsBaseEvent; } export type Locale = 'zh-CN' | 'zh-HK' | 'zh-TW' | 'ja-JP' | 'en-US' | 'ko-KR' | 'pt-BR' | 'tr-TR' | 'th-TH' | 'id-ID' | 'ms-MY' | 'es-LA'; export type Theme = 'light' | 'dark'; export declare class DingdocsBaseHost { /** 私有API */ private: DingdocsBaseHostPrivate; /** 数据源能力 */ dataSource: DingdocsBaseHostDataSource; /** 弹出对话框 */ showDialog: (url: string, dialogOptions?: IBaseDialogOptions) => Promise; /** 将对话框中的消息传送到其父页 */ messageParent: (data: any) => Promise; /** 关闭当前 view 容器 */ close: () => Promise; /** 请求authcode */ getAuthCode: (corpId: string) => Promise<{ code: string; }>; /** 请求JSAPI鉴权 */ configPermission: (agentId: string, corpId: string, timeStamp: number, nonceStr: string, signature: string, jsApiList: string[]) => Promise; /** 获取当前用户的语言 */ getLocale: () => Promise; /** 获取当前文档的主题色 */ getTheme: () => Promise; /** 批量上传文件 */ batchUploadFiles: (files: File[]) => Promise; /** * 唤起记录列表弹窗,允许用户选择记录 * * @param {IHostApiSelectRecordIdListOptions} options 选择记录弹窗配置 * @returns {Promise} 用户选择的记录ID列表 */ selectRecordIdList: (options: IHostApiSelectRecordIdListOptions) => Promise; /** * @deprecated 请使用 `dataSource.saveConfigAndGoNext` 代替 */ saveConfigAndGoNext: (config: T, options?: ISaveConfigOptions) => Promise; /** * @deprecated 请使用 `dataSource.getSyncConfig` 代替 */ getSyncConfig: () => Promise; } export declare class DingdocsBaseEvent { /** 插入数据表 */ onSheetInserted: (handler: (data: { baseId: string; }) => void) => OffListener; /** 删除数据表 */ onSheetDeleted: (handler: (data: { baseId: string; }) => void) => OffListener; /** 插入字段 */ onFieldInserted: (handler: (data: { baseId: string; sheetId: string; }) => void) => OffListener; /** 删除字段 */ onFieldDeleted: (handler: (data: { baseId: string; sheetId: string; }) => void) => OffListener; /** 修改字段 */ onFieldModified: (handler: (data: { baseId: string; sheetId: string; }) => void) => OffListener; /** 插入记录 */ onRecordInserted: (handler: (data: { baseId: string; sheetId: string; recordId: string; }) => void) => OffListener; /** 删除记录 */ onRecordDeleted: (handler: (data: { baseId: string; sheetId: string; recordId: string; }) => void) => OffListener; /** 修改记录 */ onRecordModified: (handler: (data: { baseId: string; sheetId: string; recordId: string; }) => void) => OffListener; /** 更新当前选中的区域 */ onSelectionChanged: (handler: (data: Selection) => void) => OffListener; /** 按钮字段被点击 */ onButtonFieldClicked: (handler: (data: { baseId: string; sheetId: string; viewId: string; recordId: string; }) => void) => OffListener; } export interface IDataSourceAccountItem { /** 账号托管在 AI 表格时分配的账号标识 */ accountId: string; /** 账号名称 */ name: string; /** 账号头像 */ avatar?: string; } export interface IDataSourceAccountCreateParams { /** 账号名称 */ name: string; /** 账号凭证信息 */ credentials: Record; } export interface IDataSourceAccountCreateResult { /** 账号托管在 AI 表格时分配的账号标识 */ accountId: string; } export interface IDataSourceAccountCredentialTokenResult { /** 凭证 token */ credentialToken: string; } export interface ISaveConfigOptions { /** 账号托管在钉钉时生成的账号标识 */ accountId?: string; } export declare class DingdocsBaseHostDataSourceAccount { /** 获取账号列表 */ list: () => Promise; /** 创建账号 */ create: (params: IDataSourceAccountCreateParams) => Promise; /** 删除账号 */ remove: (accountId: string) => Promise; /** 重命名账号 */ rename: (accountId: string, name: string) => Promise; /** 获取凭证 token */ getCredentialToken: (accountId: string) => Promise; } export declare class DingdocsBaseHostDataSource { /** 账号管理 */ account: DingdocsBaseHostDataSourceAccount; /** 保存配置并进入下一步 */ saveConfigAndGoNext: (config: T, options?: ISaveConfigOptions) => Promise; /** 获取同步配置 */ getSyncConfig: () => Promise; } export declare class DingdocsBaseHostPrivate { lwpSendMsg(url: string, headers: Record, body: unknown[]): Promise; } export interface IBaseDialogOptions { width?: number; height?: number; title?: string; } export interface IBaseView { onMessageReceived: (handler: (args: { data: any; }) => void) => OffListener; }