@rhc-office/sdk 6.6.268 → 6.6.351

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.
Files changed (78) hide show
  1. package/README.md +1 -5
  2. package/dist/api/annotation-tool.d.ts +162 -102
  3. package/dist/api/annotation-tool.d.ts.map +1 -1
  4. package/dist/api/callbacks.d.ts +32 -6
  5. package/dist/api/callbacks.d.ts.map +1 -1
  6. package/dist/api/document-sdk.d.ts +6 -5
  7. package/dist/api/document-sdk.d.ts.map +1 -1
  8. package/dist/api/document-tool.d.ts +16 -11
  9. package/dist/api/document-tool.d.ts.map +1 -1
  10. package/dist/api/menu-visibility.d.ts +6 -1
  11. package/dist/api/menu-visibility.d.ts.map +1 -1
  12. package/dist/api/page-arrange-tool.d.ts +28 -0
  13. package/dist/api/page-arrange-tool.d.ts.map +1 -0
  14. package/dist/api/security-tool.d.ts +21 -0
  15. package/dist/api/security-tool.d.ts.map +1 -0
  16. package/dist/api/ui-tool.d.ts +19 -0
  17. package/dist/api/ui-tool.d.ts.map +1 -1
  18. package/dist/browser/document-viewer.js +1 -1
  19. package/dist/browser/document-viewer.js.map +1 -1
  20. package/dist/index.d.ts +2 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +446 -360
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.umd.cjs +1 -1
  25. package/dist/index.umd.cjs.map +1 -1
  26. package/dist/tools/AnnotationToolImpl.d.ts +5 -27
  27. package/dist/tools/AnnotationToolImpl.d.ts.map +1 -1
  28. package/dist/tools/DigitalSignToolImpl.d.ts.map +1 -1
  29. package/dist/tools/DocumentToolImpl.d.ts.map +1 -1
  30. package/dist/tools/PageArrangeToolImpl.d.ts +21 -0
  31. package/dist/tools/PageArrangeToolImpl.d.ts.map +1 -0
  32. package/dist/tools/SecurityToolImpl.d.ts +12 -0
  33. package/dist/tools/SecurityToolImpl.d.ts.map +1 -0
  34. package/dist/tools/UIToolImpl.d.ts +13 -0
  35. package/dist/tools/UIToolImpl.d.ts.map +1 -1
  36. package/dist/tools/index.d.ts +2 -1
  37. package/dist/tools/index.d.ts.map +1 -1
  38. package/dist/viewer/AdapterProtocol.d.ts +3 -1
  39. package/dist/viewer/AdapterProtocol.d.ts.map +1 -1
  40. package/dist/viewer/BridgeToolAdapter.d.ts +1 -0
  41. package/dist/viewer/BridgeToolAdapter.d.ts.map +1 -1
  42. package/dist/viewer/DocumentSDK.d.ts +7 -4
  43. package/dist/viewer/DocumentSDK.d.ts.map +1 -1
  44. package/dist/viewer/ReaderBridgeClient.d.ts +3 -0
  45. package/dist/viewer/ReaderBridgeClient.d.ts.map +1 -1
  46. package/dist/viewer/ReaderConfiguration.d.ts +0 -1
  47. package/dist/viewer/ReaderConfiguration.d.ts.map +1 -1
  48. package/dist/viewer/ReaderStateStore.d.ts +2 -0
  49. package/dist/viewer/ReaderStateStore.d.ts.map +1 -1
  50. package/dist/viewer/SdkCallbackRegistry.d.ts +2 -2
  51. package/dist/viewer/SdkCallbackRegistry.d.ts.map +1 -1
  52. package/package.json +2 -2
  53. package/src/api/annotation-tool.ts +232 -146
  54. package/src/api/callbacks.ts +48 -7
  55. package/src/api/document-sdk.ts +9 -5
  56. package/src/api/document-tool.ts +25 -13
  57. package/src/api/menu-visibility.ts +10 -1
  58. package/src/api/page-arrange-tool.ts +67 -0
  59. package/src/api/security-tool.ts +32 -0
  60. package/src/api/ui-tool.ts +33 -0
  61. package/src/index.ts +2 -0
  62. package/src/tools/AnnotationToolImpl.ts +71 -165
  63. package/src/tools/DigitalSignToolImpl.ts +13 -2
  64. package/src/tools/DocumentToolImpl.ts +8 -4
  65. package/src/tools/PageArrangeToolImpl.ts +99 -0
  66. package/src/tools/SecurityToolImpl.ts +48 -0
  67. package/src/tools/UIToolImpl.ts +98 -12
  68. package/src/tools/index.ts +2 -1
  69. package/src/viewer/AdapterProtocol.ts +4 -0
  70. package/src/viewer/BridgeToolAdapter.ts +11 -2
  71. package/src/viewer/DocumentSDK.ts +58 -30
  72. package/src/viewer/ReaderBridgeClient.ts +9 -0
  73. package/src/viewer/ReaderConfiguration.ts +0 -2
  74. package/src/viewer/ReaderStateStore.ts +13 -1
  75. package/src/viewer/SdkCallbackRegistry.ts +75 -6
  76. package/dist/tools/Phase1ToolPlaceholder.d.ts +0 -5
  77. package/dist/tools/Phase1ToolPlaceholder.d.ts.map +0 -1
  78. package/src/tools/Phase1ToolPlaceholder.ts +0 -35
@@ -1,199 +1,285 @@
1
- export type AnnotationSubject =
2
- | 'InkAnnotation'
3
- | 'HighlightAnnotation'
4
- | 'UnderlineAnnotation'
5
- | 'StrikeoutAnnotation'
6
- | 'StampAnnotation'
7
- | 'TextAnnotation'
8
- | 'TemplateSignMarker'
9
- | 'DigitalRedaction';
10
-
11
- export interface IDigitalAnnotationInfo {
12
- author: string;
13
- customData: string;
14
- digest: string;
15
- creationDate: Date;
16
- pageIndex: number;
17
- pageX: number;
18
- pageY: number;
1
+ export type AnnotationMode =
2
+ | 'none'
3
+ | 'select'
4
+ | 'pen'
5
+ | 'eraser'
6
+ | 'line'
7
+ | 'arrow'
8
+ | 'rectangle'
9
+ | 'circle'
10
+ | 'text-highlight'
11
+ | 'text-underline'
12
+ | 'text-strikethrough'
13
+ | 'text-squiggly'
14
+ | 'text-note'
15
+ | 'stamp';
16
+
17
+ export type AnnotationViewPenType = AnnotationMode;
18
+
19
+ export type AnnotationTextMarkupType = 'highlight' | 'underline' | 'strikethrough' | 'squiggly';
20
+
21
+ export type AnnotationShapeType = 'line' | 'arrow' | 'rectangle' | 'ellipse';
22
+
23
+ export type AnnotationPresetStampType =
24
+ | 'approved'
25
+ | 'rejected'
26
+ | 'pending'
27
+ | 'draft'
28
+ | 'final'
29
+ | 'completed'
30
+ | 'void'
31
+ | 'confidential'
32
+ | 'urgent'
33
+ | 'received'
34
+ | 'archived'
35
+ | 'copy';
36
+
37
+ export type AnnotationStampSourceType = 'preset' | 'text' | 'image';
38
+
39
+ export type AnnotationStampShape = 'rectangle' | 'rounded-rectangle' | 'ellipse' | 'circle';
40
+
41
+ export interface AnnotationTextMarkupOptions {
42
+ type?: AnnotationTextMarkupType;
43
+ color?: string;
44
+ opacity?: number;
45
+ lineWidth?: number;
46
+ highlightStyle?: 'solid' | 'gradient' | 'translucent';
47
+ squigglyStyle?: 'wave' | 'zigzag' | 'sine' | 'sawtooth';
19
48
  }
20
49
 
21
- export interface IDigitalAnnotationOptions {
22
- author: string;
23
- penColor?: string;
24
- penWidth?: number;
25
- customData?: string;
50
+ export interface AnnotationShapeOptions {
51
+ type?: AnnotationShapeType;
52
+ color?: string;
53
+ strokeWidth?: number;
54
+ opacity?: number;
55
+ fillColor?: string;
56
+ fillOpacity?: number;
57
+ fillEnabled?: boolean;
26
58
  }
27
59
 
28
- export interface ITextAnnotationInfo {
29
- content: string;
30
- pageIndex: number;
31
- x: number;
32
- y: number;
33
- width: number;
34
- height: number;
60
+ export interface AnnotationPresetStampOptions {
61
+ sourceType: 'preset';
62
+ presetType: AnnotationPresetStampType;
63
+ customColor?: string;
64
+ customText?: string;
35
65
  }
36
66
 
37
- export interface AnnotationQueryParams {
38
- batchId?: string;
39
- batchIdSet?: string[];
40
- author?: string;
41
- authorNull?: 'undefined' | 'defined';
42
- userName?: string;
43
- userNameNull?: 'undefined' | 'defined';
44
- userId?: string;
45
- userIdNull?: 'undefined' | 'defined';
46
- customData?: string;
47
- customDataNull?: 'undefined' | 'defined';
48
- pageIndex?: number;
49
- pageRange?: number[];
50
- subject?: AnnotationSubject;
51
- locked?: boolean;
52
- creationDateBefore?: Date;
53
- creationDateAfter?: Date;
54
- creationDateEquals?: Date;
55
-
56
- parseSKQueryParams(query: string): void;
57
-
58
- convertSKAnnotationTypeToSubject(skType: string): AnnotationSubject;
59
-
60
- subjectEquals(subject: AnnotationSubject): AnnotationQueryParams;
61
-
62
- batchIdEquals(batchId: string): AnnotationQueryParams;
63
-
64
- batchIdInSet(batchIds: string[]): AnnotationQueryParams;
65
-
66
- authorEquals(author: string): AnnotationQueryParams;
67
-
68
- authorIsNull(): AnnotationQueryParams;
69
-
70
- authorIsNotNull(): AnnotationQueryParams;
71
-
72
- userNameEquals(userName: string): AnnotationQueryParams;
73
-
74
- userNameIsNull(): AnnotationQueryParams;
75
-
76
- userNameIsNotNull(): AnnotationQueryParams;
67
+ export interface AnnotationTextStampOptions {
68
+ sourceType: 'text';
69
+ text: string;
70
+ fontFamily?: string;
71
+ fontSize?: number;
72
+ fontBold?: boolean;
73
+ textColor?: string;
74
+ backgroundColor?: string;
75
+ borderColor?: string;
76
+ borderWidth?: number;
77
+ shape?: AnnotationStampShape;
78
+ cornerRadius?: number;
79
+ padding?: number;
80
+ }
77
81
 
78
- userIdEquals(userId: string): AnnotationQueryParams;
82
+ export interface AnnotationImageStampOptions {
83
+ height?: number;
84
+ sourceType: 'image';
85
+ imageData: string;
86
+ mimeType?: string;
87
+ naturalHeight?: number;
88
+ naturalWidth?: number;
89
+ preserveAspectRatio?: boolean;
90
+ width?: number;
91
+ }
79
92
 
80
- userIdIsNull(): AnnotationQueryParams;
93
+ export type AnnotationStampOptions =
94
+ | AnnotationPresetStampOptions
95
+ | AnnotationTextStampOptions
96
+ | AnnotationImageStampOptions;
97
+
98
+ export interface AnnotationTextBoxOptions {
99
+ text?: string;
100
+ fontFamily?: string;
101
+ fontSize?: number;
102
+ fontWeight?: 'normal' | 'bold';
103
+ fontStyle?: 'normal' | 'italic';
104
+ fontColor?: string;
105
+ backgroundColor?: string;
106
+ backgroundOpacity?: number;
107
+ borderColor?: string;
108
+ borderWidth?: number;
109
+ borderRadius?: number;
110
+ padding?: number;
111
+ lineHeight?: number;
112
+ letterSpacing?: number;
113
+ firstLineIndentEnabled?: boolean;
114
+ firstLineIndentChars?: number;
115
+ captionSeal?: string;
116
+ captionName?: string;
117
+ captionShowDate?: boolean;
118
+ }
81
119
 
82
- userIdIsNotNull(): AnnotationQueryParams;
120
+ export type LegacyAnnotationPenType =
121
+ | AnnotationViewPenType
122
+ | 'draw'
123
+ | 'highlight'
124
+ | 'text'
125
+ | 'markup';
83
126
 
84
- customDataEquals(customData: string): AnnotationQueryParams;
127
+ export interface AnnotationViewOptions<TPenType extends string = AnnotationViewPenType> {
128
+ penType?: TPenType;
129
+ penColor?: string;
130
+ penWidth?: number;
131
+ textSize?: number;
132
+ textColor?: string;
133
+ textFont?: '仿宋' | '楷体' | '黑体' | string;
134
+ textMarkup?: AnnotationTextMarkupOptions;
135
+ shape?: AnnotationShapeOptions;
136
+ stamp?: AnnotationStampOptions;
137
+ textBox?: AnnotationTextBoxOptions;
138
+ }
85
139
 
86
- customDataIsNull(): AnnotationQueryParams;
140
+ export interface LegacyAnnotationViewOptions extends AnnotationViewOptions<LegacyAnnotationPenType> {
141
+ penType?: LegacyAnnotationPenType;
142
+ }
87
143
 
88
- customDataIsNotNull(): AnnotationQueryParams;
144
+ export interface AnnotationPenStyleOptions {
145
+ penTipStyle?: 'round' | 'tapered';
146
+ pressureSensitivity?: boolean;
147
+ }
89
148
 
90
- pageIndexEquals(pageIndex: number): AnnotationQueryParams;
149
+ export interface AnnotationToolSelectOptions {
150
+ stamp?: AnnotationStampOptions;
151
+ }
91
152
 
92
- pageRangeEquals(fromPage: number, toPage: number): AnnotationQueryParams;
153
+ export type AnnotationType =
154
+ | 'drawing'
155
+ | 'shape'
156
+ | 'text-markup'
157
+ | 'text-redaction'
158
+ | 'text-note'
159
+ | 'stamp';
93
160
 
94
- isLocked(): AnnotationQueryParams;
161
+ export type AnnotationState = 'creating' | 'created' | 'editing' | 'selected' | 'hidden';
95
162
 
96
- isNotLocked(): AnnotationQueryParams;
163
+ export type AnnotationGeometryUnit = 'mm' | 'pt';
97
164
 
98
- creationDateIsBefore(before: Date): AnnotationQueryParams;
165
+ export interface AnnotationAuthor {
166
+ id: string;
167
+ name: string;
168
+ avatar?: string;
169
+ color?: string;
170
+ }
99
171
 
100
- creationDateIsAfter(after: Date): AnnotationQueryParams;
172
+ export interface AnnotationStyle {
173
+ strokeColor?: number;
174
+ strokeWidth?: number;
175
+ strokeOpacity?: number;
176
+ fillColor?: number;
177
+ fillOpacity?: number;
178
+ dashArray?: readonly [number, number];
179
+ lineCap?: 'butt' | 'round' | 'square';
180
+ lineJoin?: 'miter' | 'round' | 'bevel';
181
+ pressureSensitivity?: boolean;
182
+ }
101
183
 
102
- creationDateIsEquals(date: Date): AnnotationQueryParams;
184
+ export interface AnnotationGeometry {
185
+ unit?: AnnotationGeometryUnit;
186
+ [property: string]: unknown;
103
187
  }
104
188
 
105
- export interface AnnotationRawData {
106
- annotationData: Blob;
107
- previews: {
108
- imageBuffer: Blob;
109
- boundary: {
110
- x: number;
111
- y: number;
112
- width: number;
113
- height: number;
114
- };
115
- pageIndex: number;
116
- };
189
+ export interface AnnotationRecord {
190
+ id: string;
191
+ type?: AnnotationType;
192
+ pageRange?: readonly [number, number];
193
+ createdAt?: number;
194
+ modifiedAt?: number;
195
+ author?: AnnotationAuthor;
196
+ state?: AnnotationState;
197
+ zIndex?: number;
198
+ visible?: boolean;
199
+ locked?: boolean;
200
+ persisted?: boolean;
201
+ customData?: Record<string, unknown>;
202
+ tool?: string;
203
+ style?: AnnotationStyle;
204
+ geometry?: AnnotationGeometry;
205
+ [property: string]: unknown;
117
206
  }
118
207
 
119
- export interface AnnotationTool {
120
- setToolSource(source: 'stylus' | 'auto'): void;
208
+ export interface AnnotationChangePayload {
209
+ annotationId?: string;
210
+ annotation?: AnnotationRecord;
211
+ }
121
212
 
122
- openAnnotationView(options?: any): void;
213
+ export type AnnotationEventName =
214
+ | 'annotationAdded'
215
+ | 'annotationRemoved'
216
+ | 'annotationUpdated'
217
+ | 'annotationModeChange'
218
+ | 'annotationInputDeviceChange'
219
+ | 'annotationEvent';
123
220
 
124
- closeAnnotationView(saveModifications: boolean): void;
221
+ export type AnnotationEventPayload = AnnotationChangePayload | Record<string, unknown>;
125
222
 
126
- openTextAnnotationView(): void;
223
+ export type AnnotationEventCallback = (
224
+ event: AnnotationEventName | string,
225
+ payload?: AnnotationEventPayload,
226
+ ) => void;
127
227
 
128
- setTextAnnotationFontColor(color: string): void;
228
+ export interface IDigitalAnnotationInfo {
229
+ author: string;
230
+ customData: string;
231
+ digest: string;
232
+ creationDate: Date;
233
+ pageIndex: number;
234
+ pageX: number;
235
+ pageY: number;
236
+ }
129
237
 
130
- setTextAnnotationFontSize(size: number): void;
238
+ export interface ITextAnnotationInfo {
239
+ content: string;
240
+ pageIndex: number;
241
+ x: number;
242
+ y: number;
243
+ width: number;
244
+ height: number;
245
+ }
131
246
 
132
- closeTextAnnotationView(saveModifications: boolean): void;
247
+ export type AnnotationHistoryCommandResult = boolean | Promise<boolean>;
133
248
 
134
- createTextAnnotation(options: any): void;
249
+ export interface AnnotationTool {
250
+ openAnnotationView(options?: LegacyAnnotationViewOptions): void;
135
251
 
136
- setPersistToDocument(persist?: boolean): void;
252
+ closeAnnotationView(): void;
137
253
 
138
254
  saveAnnotations(saveCallback?: () => void): void;
139
255
 
140
- saveTextAnnotations(): void;
141
-
142
- clearAnnotations(): void;
256
+ clearAnnotations(): AnnotationHistoryCommandResult;
143
257
 
144
- clearTextAnnotations(): void;
258
+ undoAnnotation(): AnnotationHistoryCommandResult;
145
259
 
146
- undoAnnotation(): void;
260
+ redoAnnotation(): AnnotationHistoryCommandResult;
147
261
 
148
- redoAnnotation(): void;
262
+ canUndoAnnotation(): AnnotationHistoryCommandResult;
149
263
 
150
- selectAnnotationTool(tool: string): void;
264
+ canRedoAnnotation(): AnnotationHistoryCommandResult;
151
265
 
152
- showAnnotationColorPicker(): void;
266
+ selectAnnotationTool(tool: AnnotationMode, options?: AnnotationToolSelectOptions): void;
153
267
 
154
- setAnnotationPenType(penType: string): void;
155
-
156
- appendAnnotations(inkData: Blob, callback?: (event: { error: string } | 'ok') => void): void;
157
-
158
- batchAppendAnnotations(inkData: Blob[], callback?: (event: { error: string } | 'ok') => void): void;
268
+ selectAnnotationStamp(stamp: AnnotationStampOptions): void;
159
269
 
160
270
  setAnnotationPenColor(hexColor: string): void;
161
271
 
162
272
  setAnnotationPenWidth(penWidth: number): void;
163
273
 
164
- setAnnotationPenThickness(thickness: number): void;
165
-
166
- enableAnnotationsInfoView(enabled: boolean): void;
167
-
168
- enableAnnotationsDeletion(enabled: boolean): void;
169
-
170
- enableAnnotationsDeletionOnlyByAuthor(onlyByAuthor: boolean): void;
171
-
172
- listDigitalStamps(): void;
274
+ setAnnotationPenStyle(options: AnnotationPenStyleOptions): void;
173
275
 
174
276
  isInAnnotationMode(): boolean;
175
277
 
176
- listAnnotations(options?: any): void;
278
+ getAnnotationMode(): AnnotationMode;
177
279
 
178
- getAnnotations(): any[];
280
+ getAnnotations(): AnnotationRecord[];
179
281
 
180
282
  getAnnotationsCount(): number;
181
283
 
182
- queryAnnotationsBy(query?: AnnotationQueryParams): any[];
183
-
184
- deleteAnnotationsBy(query?: AnnotationQueryParams, prompt?: boolean): void;
185
-
186
- deleteAnnotationsById(annotationIds?: string[], prompt?: boolean): void;
187
-
188
- addDigitalAnnotation(options: void | unknown): void;
189
-
190
- addInkAnnotationCallback(callback: (event: any) => void): void;
191
-
192
- addAnnotationEventCallback(callback: (event: string, payload: any) => void): void;
193
-
194
- addAnnotationPersistCallback(callback: (event: any) => void): void;
195
-
196
- addAnnotationRetrieveCallback(callback: (event: any) => void): void;
197
-
198
- addDigitalAnnotationRetrieveCallback(callback: (annotations: IDigitalAnnotationInfo[]) => void): void;
284
+ addAnnotationEventCallback(callback: AnnotationEventCallback): void;
199
285
  }
@@ -1,20 +1,63 @@
1
- import { IDigitalAnnotationInfo, ITextAnnotationInfo } from './annotation-tool';
1
+ import {
2
+ type AnnotationEventCallback,
3
+ type AnnotationEventName,
4
+ type AnnotationEventPayload,
5
+ IDigitalAnnotationInfo,
6
+ ITextAnnotationInfo,
7
+ } from './annotation-tool';
8
+
9
+ export type { AnnotationEventCallback, AnnotationEventName, AnnotationEventPayload };
2
10
 
3
11
  export type ReaderReadyCallback = () => void;
4
12
  export type ReaderUnloadCallback = () => void;
5
13
 
6
- export type DocumentOpenedCallback = (status: string, error?: any, docInfo?: any) => void;
14
+ export interface DocumentReaderStatus {
15
+ currentPage?: number;
16
+ documentType?: string;
17
+ totalPages?: number;
18
+ zoomLevel?: number;
19
+ }
7
20
 
8
- export type DocumentSavedCallback = (response?: any) => void;
21
+ export interface DocumentOpenResult {
22
+ error?: string;
23
+ state?: DocumentReaderStatus;
24
+ status?: string;
25
+ success: boolean;
26
+ }
9
27
 
10
- export type DocumentModifiedCallback = (documentInfo: any) => boolean;
28
+ export interface DocumentSaveResult extends Record<string, unknown> {
29
+ error?: string;
30
+ savedContentType?: string;
31
+ success: boolean;
32
+ }
33
+
34
+ export interface DocumentContentResult {
35
+ fileBuffer?: ArrayBuffer;
36
+ fileCacheId?: string;
37
+ }
38
+
39
+ export interface DocumentCloseResult {
40
+ closed: boolean;
41
+ error?: string;
42
+ success: boolean;
43
+ }
44
+
45
+ export type DocumentOpenedCallback = (
46
+ status: string,
47
+ error?: string,
48
+ docInfo?: DocumentOpenResult,
49
+ ) => void;
50
+
51
+ export type DocumentSavedCallback = (response?: DocumentSaveResult) => void;
52
+
53
+ export type DocumentModifiedCallback = (documentInfo: DocumentOpenResult) => boolean;
11
54
 
12
55
  export interface IDocumentCloseEvent {
13
56
  docId: string;
14
57
  docTitle: string;
15
58
  }
16
59
 
17
- export type DocumentClosedCallback = (payload?: any) => void;
60
+ export type DocumentClosedCallback = (payload?: DocumentCloseResult) => void;
18
61
 
19
62
  export type PageChangeCallback = (pageIndex: number, pageCount: number) => void;
20
63
 
@@ -26,8 +69,6 @@ export type PageModeChangeCallback = (pageMode: number) => void;
26
69
 
27
70
  export type AnnotationSaveCallback = () => void;
28
71
 
29
- export type AnnotationEventCallback = (event: string, payload: any) => void;
30
-
31
72
  export type DigitalSignCallback = (response: any) => void;
32
73
 
33
74
  export type DigitalAnnotationRetrieveCallback = (
@@ -3,6 +3,7 @@ import { ReaderReadyCallback, ReaderUnloadCallback } from './callbacks';
3
3
  import { DocumentTool } from './document-tool';
4
4
  import { AnnotationTool } from './annotation-tool';
5
5
  import { UITool } from './ui-tool';
6
+ import { PageArrangeTool } from './page-arrange-tool';
6
7
  import { PageTool } from './page-tool';
7
8
  import { FindTool } from './find-tool';
8
9
  import { DigitalSignTool } from './sign-tool';
@@ -12,6 +13,7 @@ import { SymbologyTool } from './symbology-tool';
12
13
  import { TemplateSignTool } from './template-sign';
13
14
  import { PdfFormFiller } from './pdf-formfiller';
14
15
  import { CryptoTool } from './crypto-tool';
16
+ import { SecurityTool } from './security-tool';
15
17
 
16
18
  export interface IReaderEmbedOptions {
17
19
  debug?: boolean;
@@ -29,10 +31,6 @@ export interface IReaderEmbedOptions {
29
31
  * View: 阅读模式,Annotation: 批注模式,DigitalSign: 签章模式
30
32
  */
31
33
  viewMode: string;
32
- /**
33
- * 签章功能:Server: 服务器签章,Extension: 浏览器控件签章
34
- */
35
- signMode?: 'Extension' | 'Server';
36
34
  /**
37
35
  * 是否显示菜单
38
36
  */
@@ -69,12 +67,14 @@ export interface IReaderEmbedOptions {
69
67
  height?: string;
70
68
  }
71
69
 
70
+ export type ReaderThemeMode = 'light' | 'dark' | 'high-contrast' | 'auto';
71
+
72
72
  export interface IDocumentSDK {
73
73
  enableDebug(debug: boolean): void;
74
74
 
75
75
  changeLanguage(lang: string): void;
76
76
 
77
- setLicense(license: string, feature: string): void;
77
+ setThemeMode(theme: ReaderThemeMode): void;
78
78
 
79
79
  setSessionUser(
80
80
  userNameOrInfo:
@@ -115,6 +115,8 @@ export interface IDocumentSDK {
115
115
 
116
116
  getPageTool(): PageTool;
117
117
 
118
+ getPageArrangeTool(): PageArrangeTool;
119
+
118
120
  getFindTool(): FindTool;
119
121
 
120
122
  getSignServerTool(): SignServerTool;
@@ -133,6 +135,8 @@ export interface IDocumentSDK {
133
135
 
134
136
  getCryptoTool(): CryptoTool;
135
137
 
138
+ getSecurityTool(): SecurityTool;
139
+
136
140
  createDigitalSignOptions(): IDigitalSignOptions;
137
141
 
138
142
  createKVField(key: string, value: string, description?: string): IKVField;
@@ -1,4 +1,10 @@
1
- import { DocumentClosedCallback, DocumentSavedCallback } from './callbacks';
1
+ import {
2
+ DocumentClosedCallback,
3
+ DocumentContentResult,
4
+ DocumentOpenedCallback,
5
+ DocumentOpenResult,
6
+ DocumentSavedCallback,
7
+ } from './callbacks';
2
8
 
3
9
  export type IFileSaveFormat = 'pdf' | 'png' | 'jpeg' | 'jpg' | 'tiff';
4
10
 
@@ -50,26 +56,34 @@ export interface IFileSaveResult {
50
56
  error?: string;
51
57
  }
52
58
 
59
+ export interface DocumentCreatePreviewOptions extends Record<string, unknown> {
60
+ fileId?: string;
61
+ }
62
+
63
+ export type DocumentOpenCallback = (event: DocumentOpenResult) => void;
64
+
65
+ export type DocumentContentCallback = (result: DocumentContentResult) => void;
66
+
53
67
  export interface DocumentTool {
54
- addDocumentOpenedCallback(callback: (status: string, error: string) => void): void;
68
+ addDocumentOpenedCallback(callback: DocumentOpenedCallback): void;
55
69
 
56
70
  addDocumentSavedCallback(callback: DocumentSavedCallback): void;
57
71
 
58
72
  addDocumentClosedCallback(callback: DocumentClosedCallback): void;
59
73
 
60
- openPDFDocument(options: IFileOpenOptions, onDocumentOpened?: (event: any) => void): void;
74
+ openPDFDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
61
75
 
62
- openPdfDocument(options: IFileOpenOptions, onDocumentOpened?: (event: any) => void): void;
76
+ openPdfDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
63
77
 
64
- openOFDDocument(options: IFileOpenOptions, onDocumentOpened?: (event: any) => void): void;
78
+ openOFDDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
65
79
 
66
- openOfdDocument(options: IFileOpenOptions, onDocumentOpened?: (event: any) => void): void;
80
+ openOfdDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
67
81
 
68
- openOfficeDocument(options: IFileOpenOptions, onDocumentOpened?: (event: any) => void): void;
82
+ openOfficeDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
69
83
 
70
- openImageDocument(options: IFileOpenOptions, onDocumentOpened?: (event: any) => void): void;
84
+ openImageDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
71
85
 
72
- openTextDocument(options: IFileOpenOptions, onDocumentOpened?: (event: any) => void): void;
86
+ openTextDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
73
87
 
74
88
  openFromLocalStorage(): void;
75
89
 
@@ -83,9 +97,7 @@ export interface DocumentTool {
83
97
 
84
98
  saveAs(options?: IFileSaveOptions): Promise<IFileSaveResult>;
85
99
 
86
- getDocumentContent(
87
- onDocumentContent?: (fileCacheId?: string, fileBuffer?: ArrayBuffer) => void,
88
- ): void;
100
+ getDocumentContent(onDocumentContent?: DocumentContentCallback): void;
89
101
 
90
102
  closeDocument(
91
103
  discardModify: boolean,
@@ -102,5 +114,5 @@ export interface DocumentTool {
102
114
 
103
115
  print(): void;
104
116
 
105
- createPreview(serverUrl: string, options: any): void;
117
+ createPreview(serverUrl: string, options: DocumentCreatePreviewOptions): void;
106
118
  }
@@ -10,8 +10,17 @@ export interface RibbonMenuItemVisibility {
10
10
  [propName: string]: ViewVisibility;
11
11
  }
12
12
 
13
- export interface MenuActionButtonStyle {
13
+ export interface RibbonMenuButtonContentStyle {
14
14
  type: 'Icon' | 'Label' | 'ToolTip';
15
15
  content: string;
16
16
  iconContentType?: 'application/svg' | 'url';
17
+ showLabel?: boolean;
17
18
  }
19
+
20
+ export interface RibbonMenuButtonLabelVisibilityStyle {
21
+ showLabel: boolean;
22
+ }
23
+
24
+ export type MenuActionButtonStyle =
25
+ | RibbonMenuButtonContentStyle
26
+ | RibbonMenuButtonLabelVisibilityStyle;