weboffice-js-sdk 2.0.3-beta.7 → 2.0.3-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,8 @@ export interface HeaderBarsCommandRef {
28
28
  readonly id: string;
29
29
  visible: boolean;
30
30
  disabled: boolean;
31
+ src?: string;
32
+ label?: string;
31
33
  editable?: boolean;
32
34
  onCommandClick?: () => void | Promise<void>;
33
35
  getState: () => HeaderBarsCommandState | undefined;
@@ -42,6 +44,44 @@ export interface HeaderBarsFacade {
42
44
  getCommand: (id: string) => HeaderBarsCommandRef;
43
45
  listViewCommands: () => Promise<HeaderBarsCommandState[]>;
44
46
  }
47
+ export interface TitleFacade {
48
+ addChangedListener: (listener: (title: string) => void) => () => void;
49
+ setTitle: (title: string) => Promise<void>;
50
+ }
51
+ export interface CommentsFacade {
52
+ show: (type?: 'list' | 'card') => Promise<void>;
53
+ hide: (type?: 'list' | 'card') => Promise<void>;
54
+ }
55
+ export interface HistoryFacade {
56
+ show: () => Promise<void>;
57
+ hide: () => Promise<void>;
58
+ }
59
+ export interface LocksFacade {
60
+ show: () => Promise<void>;
61
+ hide: () => Promise<void>;
62
+ addRangeLock: (options: Record<string, unknown>) => Promise<void>;
63
+ addSheetLock: (options: Record<string, unknown>) => Promise<void>;
64
+ removeRangeLocksInRanges: (options: Record<string, unknown>) => Promise<void>;
65
+ removeSheetLock: (options: Record<string, unknown>) => Promise<void>;
66
+ }
67
+ export interface MentionFacade {
68
+ locateCellByGuid: (guid: string, notificationType?: string) => Promise<void>;
69
+ }
70
+ export interface ContentFacade {
71
+ setContent: (content: unknown) => Promise<void>;
72
+ }
73
+ export interface VersionFacade {
74
+ createRevision: (options?: {
75
+ name?: string;
76
+ }) => Promise<void>;
77
+ }
78
+ export interface PresentationFacade {
79
+ start: (index?: number) => Promise<void>;
80
+ quit: () => Promise<void>;
81
+ startFromCurrent: () => Promise<void>;
82
+ startRemoteLive: () => Promise<void>;
83
+ startSpeakerView: () => Promise<void>;
84
+ }
45
85
  export declare const MessageEvent: typeof InvokeMethod;
46
86
  export declare class OfficeSDK extends TinyEmitter {
47
87
  /**
@@ -66,10 +106,37 @@ export declare class OfficeSDK extends TinyEmitter {
66
106
  */
67
107
  spreadsheet?: Spreadsheet.Editor;
68
108
  /**
69
- * 专业幻灯片编辑器实例
70
- * @deprecated - 用 `sdk.getEditor<T>()` 替代
109
+ * 当前套件支持的标题能力。
110
+ */
111
+ title?: TitleFacade;
112
+ /**
113
+ * 当前套件支持的历史能力。
114
+ */
115
+ history?: HistoryFacade;
116
+ /**
117
+ * 当前套件支持的评论能力。
118
+ */
119
+ comments?: CommentsFacade;
120
+ /**
121
+ * 当前套件支持的锁定能力。
71
122
  */
72
- presentation?: Presentation.Editor;
123
+ locks?: LocksFacade;
124
+ /**
125
+ * 当前套件支持的提及定位能力。
126
+ */
127
+ mention?: MentionFacade;
128
+ /**
129
+ * 当前套件支持的内容写入能力。
130
+ */
131
+ content?: ContentFacade;
132
+ /**
133
+ * 当前套件支持的版本能力。
134
+ */
135
+ version?: VersionFacade;
136
+ /**
137
+ * 当前套件支持的演示能力。
138
+ */
139
+ presentation?: PresentationFacade;
73
140
  /**
74
141
  * 应用表格编辑器实例
75
142
  * @deprecated - 用 `sdk.getEditor<T>()` 替代
@@ -178,6 +245,30 @@ export declare class OfficeSDK extends TinyEmitter {
178
245
  private syncHeaderBarsVisible;
179
246
  private setHeaderBarsVisible;
180
247
  private getHeaderBarsCommandRef;
248
+ /**
249
+ * 按当前套件挂载根级能力命名空间。
250
+ * 输入:无,读取当前 fileType。
251
+ * 输出:直接更新 SDK 实例上的根级 facade 字段。
252
+ */
253
+ private installRootFacade;
254
+ /**
255
+ * 重置根级能力命名空间,避免不同套件间字段残留。
256
+ * 输入:无。
257
+ * 输出:将所有 facade 字段置空。
258
+ */
259
+ private clearRootFacade;
260
+ /**
261
+ * 调用显式 editor facade method-path。
262
+ * 输入:method-path 与参数数组。
263
+ * 输出:返回 iframe 侧序列化结果。
264
+ */
265
+ private invokeEditorFacade;
266
+ /**
267
+ * 为结构化 facade 建立 editor 事件监听,并返回取消监听函数。
268
+ * 输入:事件名与监听器。
269
+ * 输出:返回一个可取消当前监听的函数。
270
+ */
271
+ private listenEditorEvent;
181
272
  private initEditor;
182
273
  private shouldHandleMessage;
183
274
  private getContainerRect;
@@ -0,0 +1,16 @@
1
+ import type { OfficeSDK } from './OfficeSDK';
2
+ type IsAssignable<T, U> = T extends U ? true : false;
3
+ type Assert<T extends true> = T;
4
+ export type EditorFacadeContractAssertions = [
5
+ Assert<IsAssignable<NonNullable<OfficeSDK['title']>['setTitle'], (title: string) => Promise<void>>>,
6
+ Assert<IsAssignable<NonNullable<OfficeSDK['title']>['addChangedListener'], (listener: (title: string) => void) => () => void>>,
7
+ Assert<IsAssignable<NonNullable<OfficeSDK['locks']>['addRangeLock'], (options: Record<string, unknown>) => Promise<void>>>,
8
+ Assert<IsAssignable<NonNullable<OfficeSDK['history']>['show'], () => Promise<void>>>,
9
+ Assert<IsAssignable<NonNullable<OfficeSDK['mention']>['locateCellByGuid'], (guid: string, notificationType?: string) => Promise<void>>>,
10
+ Assert<IsAssignable<NonNullable<OfficeSDK['version']>['createRevision'], (options?: {
11
+ name?: string;
12
+ }) => Promise<void>>>,
13
+ Assert<IsAssignable<NonNullable<OfficeSDK['presentation']>['start'], (index?: number) => Promise<void>>>,
14
+ Assert<IsAssignable<NonNullable<OfficeSDK['presentation']>['startFromCurrent'], () => Promise<void>>>
15
+ ];
16
+ export {};