dingtalk-docs-cool-app
Version:
钉钉文档酷应用插件扩展 开发者初始化包
99 lines (98 loc) • 2.91 kB
TypeScript
import { OffListener } from "./common";
export declare class DingdocsWorkbook {
host: DingdocsWorkbookHost;
event: DingdocsWorkbookEvent;
}
export declare class DingdocsWorkbookHost {
/** 弹出对话框 */
showDialog: (url: string, dialogOptions?: IWorkbookDialogOptions) => Promise<IWorkbookView>;
/** 当酷应用支持后台运行时,展开酷应用的侧边栏 */
showSidebar: () => Promise<void>;
/** 当酷应用支持后台运行时,隐藏酷应用的侧边栏 */
hideSidebar: () => Promise<void>;
/** 将对话框中的消息传送到其父页 */
messageParent: (data: any) => Promise<void>;
/** 关闭当前 view 容器 */
close: () => Promise<void>;
/** 请求authcode */
getAuthCode: (corpId: string) => Promise<{
code: string;
}>;
/** 文档酷应用JSAPI鉴权 */
configPermission: (agentId: string, corpId: string, timeStamp: number, nonceStr: string, signature: string, jsApiList: string[]) => Promise<void>;
/** 将当前表格导出为excel */
exportExcel: () => Promise<void>;
synchronizeBindCoolApp: () => Promise<{
isBind: boolean;
}>;
}
export interface IWorkbookDialogOptions {
width?: number;
height?: number;
title?: string;
}
export interface IWorkbookView {
onMessageReceived: (handler: (args: {
data: any;
}) => void) => OffListener;
}
export interface CellTipOption {
/**
* 提示内容
*/
content: string;
/**
* 单元格提示样式类型, 默认为'error'
*/
tipStyle?: 'error' | 'warning' | 'info';
}
export interface ContentChanged {
/**
* 内容变更的单元格所在工作表id
*/
sheetId: string;
/**
* 内容变更的单元格位置
*/
a1Notation: string;
}
export interface RowInserted {
sheetId: string;
a1Notation: string;
}
export interface RowDeleted {
sheetId: string;
a1Notation: string;
}
export interface SaveStateChanged {
/**
* 当前文档是否已保存
*/
isSaved: boolean;
}
export interface SelectionChanged {
/**
* 选区所在工作表id
*/
sheetId: string;
/**
* 当前激活的单元格位置
*/
cellA1Notation: string;
/**
* 当前激活的单元格所处选区位置
*/
rangeA1Notation: string;
}
export declare class DingdocsWorkbookEvent {
/** 内容变更 */
onContentChanged: (handler: (data: ContentChanged) => void) => OffListener;
/** 插入行 */
onRowInserted: (handler: (data: RowInserted) => void) => OffListener;
/** 删除行 */
onRowDeleted: (handler: (data: RowDeleted) => void) => OffListener;
/** 状态变更 */
onSaveStateChanged: (handler: (data: SaveStateChanged) => void) => OffListener;
/** 选区变更 */
onSelectionChanged: (handler: (data: SelectionChanged) => void) => OffListener;
}