@rhc-office/sdk 6.6.268 → 6.6.363
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.
- package/README.md +1 -5
- package/dist/api/annotation-tool.d.ts +187 -102
- package/dist/api/annotation-tool.d.ts.map +1 -1
- package/dist/api/callbacks.d.ts +32 -6
- package/dist/api/callbacks.d.ts.map +1 -1
- package/dist/api/document-sdk.d.ts +6 -5
- package/dist/api/document-sdk.d.ts.map +1 -1
- package/dist/api/document-tool.d.ts +19 -11
- package/dist/api/document-tool.d.ts.map +1 -1
- package/dist/api/menu-visibility.d.ts +6 -1
- package/dist/api/menu-visibility.d.ts.map +1 -1
- package/dist/api/page-arrange-tool.d.ts +28 -0
- package/dist/api/page-arrange-tool.d.ts.map +1 -0
- package/dist/api/security-tool.d.ts +21 -0
- package/dist/api/security-tool.d.ts.map +1 -0
- package/dist/api/ui-tool.d.ts +19 -0
- package/dist/api/ui-tool.d.ts.map +1 -1
- package/dist/browser/document-viewer.js +1 -1
- package/dist/browser/document-viewer.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +469 -359
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/tools/AnnotationToolImpl.d.ts +8 -27
- package/dist/tools/AnnotationToolImpl.d.ts.map +1 -1
- package/dist/tools/DigitalSignToolImpl.d.ts.map +1 -1
- package/dist/tools/DocumentToolImpl.d.ts.map +1 -1
- package/dist/tools/PageArrangeToolImpl.d.ts +21 -0
- package/dist/tools/PageArrangeToolImpl.d.ts.map +1 -0
- package/dist/tools/SecurityToolImpl.d.ts +12 -0
- package/dist/tools/SecurityToolImpl.d.ts.map +1 -0
- package/dist/tools/UIToolImpl.d.ts +13 -0
- package/dist/tools/UIToolImpl.d.ts.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/viewer/AdapterProtocol.d.ts +3 -1
- package/dist/viewer/AdapterProtocol.d.ts.map +1 -1
- package/dist/viewer/BridgeToolAdapter.d.ts +1 -0
- package/dist/viewer/BridgeToolAdapter.d.ts.map +1 -1
- package/dist/viewer/DocumentSDK.d.ts +10 -4
- package/dist/viewer/DocumentSDK.d.ts.map +1 -1
- package/dist/viewer/ReaderBridgeClient.d.ts +3 -0
- package/dist/viewer/ReaderBridgeClient.d.ts.map +1 -1
- package/dist/viewer/ReaderConfiguration.d.ts +0 -1
- package/dist/viewer/ReaderConfiguration.d.ts.map +1 -1
- package/dist/viewer/ReaderStateStore.d.ts +2 -0
- package/dist/viewer/ReaderStateStore.d.ts.map +1 -1
- package/dist/viewer/SdkCallbackRegistry.d.ts +2 -2
- package/dist/viewer/SdkCallbackRegistry.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/api/annotation-tool.ts +257 -140
- package/src/api/callbacks.ts +48 -7
- package/src/api/document-sdk.ts +9 -5
- package/src/api/document-tool.ts +28 -13
- package/src/api/menu-visibility.ts +10 -1
- package/src/api/page-arrange-tool.ts +67 -0
- package/src/api/security-tool.ts +32 -0
- package/src/api/ui-tool.ts +33 -0
- package/src/index.ts +2 -0
- package/src/tools/AnnotationToolImpl.ts +84 -163
- package/src/tools/DigitalSignToolImpl.ts +13 -2
- package/src/tools/DocumentToolImpl.ts +8 -4
- package/src/tools/PageArrangeToolImpl.ts +99 -0
- package/src/tools/SecurityToolImpl.ts +48 -0
- package/src/tools/UIToolImpl.ts +98 -12
- package/src/tools/index.ts +2 -1
- package/src/viewer/AdapterProtocol.ts +4 -0
- package/src/viewer/BridgeToolAdapter.ts +11 -2
- package/src/viewer/DocumentSDK.ts +120 -30
- package/src/viewer/ReaderBridgeClient.ts +9 -0
- package/src/viewer/ReaderConfiguration.ts +0 -2
- package/src/viewer/ReaderStateStore.ts +13 -1
- package/src/viewer/SdkCallbackRegistry.ts +75 -6
- package/dist/tools/Phase1ToolPlaceholder.d.ts +0 -5
- package/dist/tools/Phase1ToolPlaceholder.d.ts.map +0 -1
- package/src/tools/Phase1ToolPlaceholder.ts +0 -35
|
@@ -1,199 +1,316 @@
|
|
|
1
|
-
export type
|
|
2
|
-
| '
|
|
3
|
-
| '
|
|
4
|
-
| '
|
|
5
|
-
| '
|
|
6
|
-
| '
|
|
7
|
-
| '
|
|
8
|
-
| '
|
|
9
|
-
| '
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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;
|
|
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
|
+
}
|
|
71
81
|
|
|
72
|
-
|
|
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
|
+
}
|
|
73
92
|
|
|
74
|
-
|
|
93
|
+
export type AnnotationStampOptions =
|
|
94
|
+
| AnnotationPresetStampOptions
|
|
95
|
+
| AnnotationTextStampOptions
|
|
96
|
+
| AnnotationImageStampOptions;
|
|
97
|
+
|
|
98
|
+
export interface AnnotationCustomTextStampInput {
|
|
99
|
+
fontFamily?: string;
|
|
100
|
+
fontSize: number;
|
|
101
|
+
name?: string;
|
|
102
|
+
text: string;
|
|
103
|
+
textColor: string;
|
|
104
|
+
}
|
|
75
105
|
|
|
76
|
-
|
|
106
|
+
export interface AnnotationCustomImageStampInput {
|
|
107
|
+
height?: number;
|
|
108
|
+
imageData: string;
|
|
109
|
+
mimeType?: string;
|
|
110
|
+
name?: string;
|
|
111
|
+
naturalHeight: number;
|
|
112
|
+
naturalWidth: number;
|
|
113
|
+
width?: number;
|
|
114
|
+
}
|
|
77
115
|
|
|
78
|
-
|
|
116
|
+
export interface AnnotationCustomStampRecord {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
stamp: AnnotationStampOptions;
|
|
120
|
+
type: 'image' | 'text';
|
|
121
|
+
}
|
|
79
122
|
|
|
80
|
-
|
|
123
|
+
export interface AnnotationTextBoxOptions {
|
|
124
|
+
text?: string;
|
|
125
|
+
fontFamily?: string;
|
|
126
|
+
fontSize?: number;
|
|
127
|
+
fontWeight?: 'normal' | 'bold';
|
|
128
|
+
fontStyle?: 'normal' | 'italic';
|
|
129
|
+
fontColor?: string;
|
|
130
|
+
backgroundColor?: string;
|
|
131
|
+
backgroundOpacity?: number;
|
|
132
|
+
borderColor?: string;
|
|
133
|
+
borderWidth?: number;
|
|
134
|
+
borderRadius?: number;
|
|
135
|
+
padding?: number;
|
|
136
|
+
lineHeight?: number;
|
|
137
|
+
letterSpacing?: number;
|
|
138
|
+
firstLineIndentEnabled?: boolean;
|
|
139
|
+
firstLineIndentChars?: number;
|
|
140
|
+
captionSeal?: string;
|
|
141
|
+
captionName?: string;
|
|
142
|
+
captionShowDate?: boolean;
|
|
143
|
+
}
|
|
81
144
|
|
|
82
|
-
|
|
145
|
+
export type LegacyAnnotationPenType =
|
|
146
|
+
| AnnotationViewPenType
|
|
147
|
+
| 'draw'
|
|
148
|
+
| 'highlight'
|
|
149
|
+
| 'text'
|
|
150
|
+
| 'markup';
|
|
83
151
|
|
|
84
|
-
|
|
152
|
+
export interface AnnotationViewOptions<TPenType extends string = AnnotationViewPenType> {
|
|
153
|
+
penType?: TPenType;
|
|
154
|
+
penColor?: string;
|
|
155
|
+
penWidth?: number;
|
|
156
|
+
textSize?: number;
|
|
157
|
+
textColor?: string;
|
|
158
|
+
textFont?: '仿宋' | '楷体' | '黑体' | string;
|
|
159
|
+
textMarkup?: AnnotationTextMarkupOptions;
|
|
160
|
+
shape?: AnnotationShapeOptions;
|
|
161
|
+
stamp?: AnnotationStampOptions;
|
|
162
|
+
textBox?: AnnotationTextBoxOptions;
|
|
163
|
+
}
|
|
85
164
|
|
|
86
|
-
|
|
165
|
+
export interface LegacyAnnotationViewOptions extends AnnotationViewOptions<LegacyAnnotationPenType> {
|
|
166
|
+
penType?: LegacyAnnotationPenType;
|
|
167
|
+
}
|
|
87
168
|
|
|
88
|
-
|
|
169
|
+
export interface AnnotationPenStyleOptions {
|
|
170
|
+
penTipStyle?: 'round' | 'tapered';
|
|
171
|
+
pressureSensitivity?: boolean;
|
|
172
|
+
}
|
|
89
173
|
|
|
90
|
-
|
|
174
|
+
export interface AnnotationToolSelectOptions {
|
|
175
|
+
stamp?: AnnotationStampOptions;
|
|
176
|
+
}
|
|
91
177
|
|
|
92
|
-
|
|
178
|
+
export type AnnotationType =
|
|
179
|
+
| 'drawing'
|
|
180
|
+
| 'shape'
|
|
181
|
+
| 'text-markup'
|
|
182
|
+
| 'text-redaction'
|
|
183
|
+
| 'text-note'
|
|
184
|
+
| 'stamp';
|
|
93
185
|
|
|
94
|
-
|
|
186
|
+
export type AnnotationState = 'creating' | 'created' | 'editing' | 'selected' | 'hidden';
|
|
95
187
|
|
|
96
|
-
|
|
188
|
+
export type AnnotationGeometryUnit = 'mm' | 'pt';
|
|
97
189
|
|
|
98
|
-
|
|
190
|
+
export interface AnnotationAuthor {
|
|
191
|
+
id: string;
|
|
192
|
+
name: string;
|
|
193
|
+
avatar?: string;
|
|
194
|
+
color?: string;
|
|
195
|
+
}
|
|
99
196
|
|
|
100
|
-
|
|
197
|
+
export interface AnnotationStyle {
|
|
198
|
+
strokeColor?: number;
|
|
199
|
+
strokeWidth?: number;
|
|
200
|
+
strokeOpacity?: number;
|
|
201
|
+
fillColor?: number;
|
|
202
|
+
fillOpacity?: number;
|
|
203
|
+
dashArray?: readonly [number, number];
|
|
204
|
+
lineCap?: 'butt' | 'round' | 'square';
|
|
205
|
+
lineJoin?: 'miter' | 'round' | 'bevel';
|
|
206
|
+
pressureSensitivity?: boolean;
|
|
207
|
+
}
|
|
101
208
|
|
|
102
|
-
|
|
209
|
+
export interface AnnotationGeometry {
|
|
210
|
+
unit?: AnnotationGeometryUnit;
|
|
211
|
+
[property: string]: unknown;
|
|
103
212
|
}
|
|
104
213
|
|
|
105
|
-
export interface
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
214
|
+
export interface AnnotationRecord {
|
|
215
|
+
id: string;
|
|
216
|
+
type?: AnnotationType;
|
|
217
|
+
pageRange?: readonly [number, number];
|
|
218
|
+
createdAt?: number;
|
|
219
|
+
modifiedAt?: number;
|
|
220
|
+
author?: AnnotationAuthor;
|
|
221
|
+
state?: AnnotationState;
|
|
222
|
+
zIndex?: number;
|
|
223
|
+
visible?: boolean;
|
|
224
|
+
locked?: boolean;
|
|
225
|
+
persisted?: boolean;
|
|
226
|
+
customData?: Record<string, unknown>;
|
|
227
|
+
tool?: string;
|
|
228
|
+
style?: AnnotationStyle;
|
|
229
|
+
geometry?: AnnotationGeometry;
|
|
230
|
+
[property: string]: unknown;
|
|
117
231
|
}
|
|
118
232
|
|
|
119
|
-
export interface
|
|
120
|
-
|
|
233
|
+
export interface AnnotationChangePayload {
|
|
234
|
+
annotationId?: string;
|
|
235
|
+
annotation?: AnnotationRecord;
|
|
236
|
+
}
|
|
121
237
|
|
|
122
|
-
|
|
238
|
+
export type AnnotationEventName =
|
|
239
|
+
| 'annotationAdded'
|
|
240
|
+
| 'annotationRemoved'
|
|
241
|
+
| 'annotationUpdated'
|
|
242
|
+
| 'annotationModeChange'
|
|
243
|
+
| 'annotationInputDeviceChange'
|
|
244
|
+
| 'annotationEvent';
|
|
123
245
|
|
|
124
|
-
|
|
246
|
+
export type AnnotationEventPayload = AnnotationChangePayload | Record<string, unknown>;
|
|
125
247
|
|
|
126
|
-
|
|
248
|
+
export type AnnotationEventCallback = (
|
|
249
|
+
event: AnnotationEventName | string,
|
|
250
|
+
payload?: AnnotationEventPayload,
|
|
251
|
+
) => void;
|
|
127
252
|
|
|
128
|
-
|
|
253
|
+
export interface IDigitalAnnotationInfo {
|
|
254
|
+
author: string;
|
|
255
|
+
customData: string;
|
|
256
|
+
digest: string;
|
|
257
|
+
creationDate: Date;
|
|
258
|
+
pageIndex: number;
|
|
259
|
+
pageX: number;
|
|
260
|
+
pageY: number;
|
|
261
|
+
}
|
|
129
262
|
|
|
130
|
-
|
|
263
|
+
export interface ITextAnnotationInfo {
|
|
264
|
+
content: string;
|
|
265
|
+
pageIndex: number;
|
|
266
|
+
x: number;
|
|
267
|
+
y: number;
|
|
268
|
+
width: number;
|
|
269
|
+
height: number;
|
|
270
|
+
}
|
|
131
271
|
|
|
132
|
-
|
|
272
|
+
export type AnnotationHistoryCommandResult = boolean | Promise<boolean>;
|
|
133
273
|
|
|
134
|
-
|
|
274
|
+
export interface AnnotationTool {
|
|
275
|
+
openAnnotationView(options?: LegacyAnnotationViewOptions): void;
|
|
135
276
|
|
|
136
|
-
|
|
277
|
+
closeAnnotationView(): void;
|
|
137
278
|
|
|
138
279
|
saveAnnotations(saveCallback?: () => void): void;
|
|
139
280
|
|
|
140
|
-
|
|
281
|
+
clearAnnotations(): AnnotationHistoryCommandResult;
|
|
141
282
|
|
|
142
|
-
|
|
283
|
+
undoAnnotation(): AnnotationHistoryCommandResult;
|
|
143
284
|
|
|
144
|
-
|
|
285
|
+
redoAnnotation(): AnnotationHistoryCommandResult;
|
|
145
286
|
|
|
146
|
-
|
|
287
|
+
canUndoAnnotation(): AnnotationHistoryCommandResult;
|
|
147
288
|
|
|
148
|
-
|
|
289
|
+
canRedoAnnotation(): AnnotationHistoryCommandResult;
|
|
149
290
|
|
|
150
|
-
selectAnnotationTool(tool:
|
|
291
|
+
selectAnnotationTool(tool: AnnotationMode, options?: AnnotationToolSelectOptions): void;
|
|
151
292
|
|
|
152
|
-
|
|
293
|
+
selectAnnotationStamp(stamp: AnnotationStampOptions): void;
|
|
153
294
|
|
|
154
|
-
|
|
295
|
+
getCustomStamps(): Promise<AnnotationCustomStampRecord[]>;
|
|
155
296
|
|
|
156
|
-
|
|
297
|
+
addCustomTextStamp(input: AnnotationCustomTextStampInput): Promise<AnnotationCustomStampRecord>;
|
|
157
298
|
|
|
158
|
-
|
|
299
|
+
addCustomImageStamp(input: AnnotationCustomImageStampInput): Promise<AnnotationCustomStampRecord>;
|
|
159
300
|
|
|
160
301
|
setAnnotationPenColor(hexColor: string): void;
|
|
161
302
|
|
|
162
303
|
setAnnotationPenWidth(penWidth: number): void;
|
|
163
304
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
enableAnnotationsInfoView(enabled: boolean): void;
|
|
167
|
-
|
|
168
|
-
enableAnnotationsDeletion(enabled: boolean): void;
|
|
169
|
-
|
|
170
|
-
enableAnnotationsDeletionOnlyByAuthor(onlyByAuthor: boolean): void;
|
|
171
|
-
|
|
172
|
-
listDigitalStamps(): void;
|
|
305
|
+
setAnnotationPenStyle(options: AnnotationPenStyleOptions): void;
|
|
173
306
|
|
|
174
307
|
isInAnnotationMode(): boolean;
|
|
175
308
|
|
|
176
|
-
|
|
309
|
+
getAnnotationMode(): AnnotationMode;
|
|
177
310
|
|
|
178
|
-
getAnnotations():
|
|
311
|
+
getAnnotations(): AnnotationRecord[];
|
|
179
312
|
|
|
180
313
|
getAnnotationsCount(): number;
|
|
181
314
|
|
|
182
|
-
|
|
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;
|
|
315
|
+
addAnnotationEventCallback(callback: AnnotationEventCallback): void;
|
|
199
316
|
}
|
package/src/api/callbacks.ts
CHANGED
|
@@ -1,20 +1,63 @@
|
|
|
1
|
-
import {
|
|
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
|
|
14
|
+
export interface DocumentReaderStatus {
|
|
15
|
+
currentPage?: number;
|
|
16
|
+
documentType?: string;
|
|
17
|
+
totalPages?: number;
|
|
18
|
+
zoomLevel?: number;
|
|
19
|
+
}
|
|
7
20
|
|
|
8
|
-
export
|
|
21
|
+
export interface DocumentOpenResult {
|
|
22
|
+
error?: string;
|
|
23
|
+
state?: DocumentReaderStatus;
|
|
24
|
+
status?: string;
|
|
25
|
+
success: boolean;
|
|
26
|
+
}
|
|
9
27
|
|
|
10
|
-
export
|
|
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?:
|
|
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 = (
|
package/src/api/document-sdk.ts
CHANGED
|
@@ -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
|
-
|
|
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;
|
package/src/api/document-tool.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
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
|
|
|
@@ -22,6 +28,9 @@ export interface IFileOpenOptions {
|
|
|
22
28
|
fontSize: number;
|
|
23
29
|
};
|
|
24
30
|
uploadUrl?: string;
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
formData?: Record<string, string | number | boolean>;
|
|
33
|
+
fileFieldName?: string;
|
|
25
34
|
readOnly?: boolean;
|
|
26
35
|
fromCache?: boolean;
|
|
27
36
|
viewMode?: 'view' | 'annotation' | 'digital-sign';
|
|
@@ -50,26 +59,34 @@ export interface IFileSaveResult {
|
|
|
50
59
|
error?: string;
|
|
51
60
|
}
|
|
52
61
|
|
|
62
|
+
export interface DocumentCreatePreviewOptions extends Record<string, unknown> {
|
|
63
|
+
fileId?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type DocumentOpenCallback = (event: DocumentOpenResult) => void;
|
|
67
|
+
|
|
68
|
+
export type DocumentContentCallback = (result: DocumentContentResult) => void;
|
|
69
|
+
|
|
53
70
|
export interface DocumentTool {
|
|
54
|
-
addDocumentOpenedCallback(callback:
|
|
71
|
+
addDocumentOpenedCallback(callback: DocumentOpenedCallback): void;
|
|
55
72
|
|
|
56
73
|
addDocumentSavedCallback(callback: DocumentSavedCallback): void;
|
|
57
74
|
|
|
58
75
|
addDocumentClosedCallback(callback: DocumentClosedCallback): void;
|
|
59
76
|
|
|
60
|
-
openPDFDocument(options: IFileOpenOptions, onDocumentOpened?:
|
|
77
|
+
openPDFDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
|
|
61
78
|
|
|
62
|
-
openPdfDocument(options: IFileOpenOptions, onDocumentOpened?:
|
|
79
|
+
openPdfDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
|
|
63
80
|
|
|
64
|
-
openOFDDocument(options: IFileOpenOptions, onDocumentOpened?:
|
|
81
|
+
openOFDDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
|
|
65
82
|
|
|
66
|
-
openOfdDocument(options: IFileOpenOptions, onDocumentOpened?:
|
|
83
|
+
openOfdDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
|
|
67
84
|
|
|
68
|
-
openOfficeDocument(options: IFileOpenOptions, onDocumentOpened?:
|
|
85
|
+
openOfficeDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
|
|
69
86
|
|
|
70
|
-
openImageDocument(options: IFileOpenOptions, onDocumentOpened?:
|
|
87
|
+
openImageDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
|
|
71
88
|
|
|
72
|
-
openTextDocument(options: IFileOpenOptions, onDocumentOpened?:
|
|
89
|
+
openTextDocument(options: IFileOpenOptions, onDocumentOpened?: DocumentOpenCallback): void;
|
|
73
90
|
|
|
74
91
|
openFromLocalStorage(): void;
|
|
75
92
|
|
|
@@ -83,9 +100,7 @@ export interface DocumentTool {
|
|
|
83
100
|
|
|
84
101
|
saveAs(options?: IFileSaveOptions): Promise<IFileSaveResult>;
|
|
85
102
|
|
|
86
|
-
getDocumentContent(
|
|
87
|
-
onDocumentContent?: (fileCacheId?: string, fileBuffer?: ArrayBuffer) => void,
|
|
88
|
-
): void;
|
|
103
|
+
getDocumentContent(onDocumentContent?: DocumentContentCallback): void;
|
|
89
104
|
|
|
90
105
|
closeDocument(
|
|
91
106
|
discardModify: boolean,
|
|
@@ -102,5 +117,5 @@ export interface DocumentTool {
|
|
|
102
117
|
|
|
103
118
|
print(): void;
|
|
104
119
|
|
|
105
|
-
createPreview(serverUrl: string, options:
|
|
120
|
+
createPreview(serverUrl: string, options: DocumentCreatePreviewOptions): void;
|
|
106
121
|
}
|