dingtalk-docs-cool-app
Version:
钉钉文档酷应用插件扩展 开发者初始化包
86 lines (85 loc) • 2.82 kB
TypeScript
import { OffListener } from './common';
import { Selection, IOpenAttachment } from './script/base';
export declare class DingdocsBase {
host: DingdocsBaseHost;
event: DingdocsBaseEvent;
}
export { type Selection } from './script/base';
export { type IOpenAttachment } from './script/base';
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';
export type Theme = 'light' | 'dark';
export declare class DingdocsBaseHost {
/** 私有API */
private: DingdocsBaseHostPrivate;
/** 弹出对话框 */
showDialog: (url: string, dialogOptions?: IBaseDialogOptions) => Promise<IBaseView>;
/** 将对话框中的消息传送到其父页 */
messageParent: (data: any) => Promise<void>;
/** 关闭当前 view 容器 */
close: () => Promise<void>;
/** 请求authcode */
getAuthCode: (corpId: string) => Promise<{
code: string;
}>;
getLocale: () => Promise<Locale>;
getTheme: () => Promise<Theme>;
batchUploadFiles: (files: File[]) => Promise<IOpenAttachment[]>;
}
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;
}
export declare class DingdocsBaseHostPrivate {
lwpSendMsg<T>(url: string, headers: Record<string, string>, body: unknown[]): Promise<T>;
}
export interface IBaseDialogOptions {
width?: number;
height?: number;
title?: string;
}
export interface IBaseView {
onMessageReceived: (handler: (args: {
data: any;
}) => void) => OffListener;
}