@file-viewer/vue2.7 2.0.0

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.
@@ -0,0 +1,417 @@
1
+ import { createViewer } from '@file-viewer/core';
2
+ import { DEFAULT_FILE_VIEWER_SOURCE_FILENAME, getExtension, normalizeFilename, readFileViewerBuffer, resolveFileViewerSourceFilename, wrapFileViewerFileRef, } from '@file-viewer/core';
3
+ const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined';
4
+ const hasSource = (options = {}) => {
5
+ return !!(options.url || options.file || options.buffer);
6
+ };
7
+ const toViewerSourceInput = (options = {}) => ({
8
+ url: options.url,
9
+ file: options.file,
10
+ buffer: options.buffer,
11
+ filename: options.filename || options.name,
12
+ name: options.name,
13
+ type: options.type,
14
+ size: options.size,
15
+ });
16
+ const canUseFetch = () => typeof fetch === 'function';
17
+ const defaultFetchFile = async ({ url, signal }) => {
18
+ if (!canUseFetch()) {
19
+ throw new Error('fetch is not available in the current environment.');
20
+ }
21
+ const response = await fetch(url, { signal });
22
+ if (!response.ok) {
23
+ throw new Error(`Failed to fetch file: ${response.status} ${response.statusText}`);
24
+ }
25
+ return response.blob();
26
+ };
27
+ const resolveViewerSourceFilename = (source) => {
28
+ return normalizeFilename(source.filename || source.name || resolveFileViewerSourceFilename({
29
+ file: source.file,
30
+ url: source.url,
31
+ fallback: DEFAULT_FILE_VIEWER_SOURCE_FILENAME,
32
+ }), source.type ? `preview.${source.type}` : DEFAULT_FILE_VIEWER_SOURCE_FILENAME);
33
+ };
34
+ const resolveViewerLoadSource = async (source, options = {}) => {
35
+ var _a, _b, _c;
36
+ const filename = resolveViewerSourceFilename(source);
37
+ const type = source.type || getExtension(filename);
38
+ if (source.buffer) {
39
+ return {
40
+ buffer: source.buffer,
41
+ filename,
42
+ type,
43
+ size: (_a = source.size) !== null && _a !== void 0 ? _a : source.buffer.byteLength,
44
+ url: source.url,
45
+ };
46
+ }
47
+ if (source.file) {
48
+ const file = wrapFileViewerFileRef(source.file, filename);
49
+ return {
50
+ file,
51
+ buffer: await readFileViewerBuffer(file),
52
+ filename: file.name || filename,
53
+ type: type || getExtension(file.name),
54
+ size: (_b = source.size) !== null && _b !== void 0 ? _b : file.size,
55
+ url: source.url,
56
+ };
57
+ }
58
+ if (source.url) {
59
+ const fileRef = await (options.fetchFile || defaultFetchFile)({
60
+ url: source.url,
61
+ signal: options.signal,
62
+ source,
63
+ });
64
+ if (!fileRef) {
65
+ throw new Error('Downloaded file is empty.');
66
+ }
67
+ const file = wrapFileViewerFileRef(fileRef, filename);
68
+ return {
69
+ file,
70
+ buffer: await readFileViewerBuffer(file),
71
+ filename: file.name || filename,
72
+ type: type || getExtension(file.name),
73
+ size: (_c = source.size) !== null && _c !== void 0 ? _c : file.size,
74
+ url: source.url,
75
+ };
76
+ }
77
+ return {
78
+ filename,
79
+ type,
80
+ };
81
+ };
82
+ export const createViewerControllerHandle = (getController, dispose) => ({
83
+ load(options) {
84
+ var _a, _b;
85
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.load(options)) !== null && _b !== void 0 ? _b : Promise.resolve();
86
+ },
87
+ update(options) {
88
+ var _a, _b;
89
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.update(options)) !== null && _b !== void 0 ? _b : Promise.resolve();
90
+ },
91
+ reload() {
92
+ var _a, _b;
93
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.reload()) !== null && _b !== void 0 ? _b : Promise.resolve();
94
+ },
95
+ destroy() {
96
+ dispose();
97
+ },
98
+ getController,
99
+ getApi() {
100
+ var _a, _b;
101
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.getApi()) !== null && _b !== void 0 ? _b : null;
102
+ },
103
+ downloadOriginalFile() {
104
+ var _a, _b;
105
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.downloadOriginalFile()) !== null && _b !== void 0 ? _b : Promise.resolve();
106
+ },
107
+ printRenderedHtml() {
108
+ var _a, _b;
109
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.printRenderedHtml()) !== null && _b !== void 0 ? _b : Promise.resolve();
110
+ },
111
+ exportRenderedHtml() {
112
+ var _a, _b;
113
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.exportRenderedHtml()) !== null && _b !== void 0 ? _b : Promise.resolve();
114
+ },
115
+ zoomIn() {
116
+ var _a, _b;
117
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.zoomIn()) !== null && _b !== void 0 ? _b : Promise.resolve(null);
118
+ },
119
+ zoomOut() {
120
+ var _a, _b;
121
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.zoomOut()) !== null && _b !== void 0 ? _b : Promise.resolve(null);
122
+ },
123
+ resetZoom() {
124
+ var _a, _b;
125
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.resetZoom()) !== null && _b !== void 0 ? _b : Promise.resolve(null);
126
+ },
127
+ searchDocument(query) {
128
+ var _a, _b;
129
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.searchDocument(query)) !== null && _b !== void 0 ? _b : Promise.resolve(null);
130
+ },
131
+ clearDocumentSearch() {
132
+ var _a, _b;
133
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.clearDocumentSearch()) !== null && _b !== void 0 ? _b : Promise.resolve(null);
134
+ },
135
+ nextSearchResult() {
136
+ var _a, _b;
137
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.nextSearchResult()) !== null && _b !== void 0 ? _b : Promise.resolve(null);
138
+ },
139
+ previousSearchResult() {
140
+ var _a, _b;
141
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.previousSearchResult()) !== null && _b !== void 0 ? _b : Promise.resolve(null);
142
+ },
143
+ collectDocumentAnchors() {
144
+ var _a, _b;
145
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.collectDocumentAnchors()) !== null && _b !== void 0 ? _b : Promise.resolve([]);
146
+ },
147
+ scrollToAnchor(anchor) {
148
+ var _a, _b;
149
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.scrollToAnchor(anchor)) !== null && _b !== void 0 ? _b : Promise.resolve(false);
150
+ },
151
+ scrollToLine(line) {
152
+ var _a, _b;
153
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.scrollToLine(line)) !== null && _b !== void 0 ? _b : Promise.resolve(false);
154
+ },
155
+ getDocumentTextChunks() {
156
+ var _a, _b;
157
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.getDocumentTextChunks()) !== null && _b !== void 0 ? _b : [];
158
+ },
159
+ getOperationAvailability() {
160
+ var _a, _b;
161
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.getOperationAvailability()) !== null && _b !== void 0 ? _b : null;
162
+ },
163
+ getZoomState() {
164
+ var _a, _b;
165
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.getZoomState()) !== null && _b !== void 0 ? _b : null;
166
+ },
167
+ getSearchState() {
168
+ var _a, _b;
169
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.getSearchState()) !== null && _b !== void 0 ? _b : null;
170
+ },
171
+ getState() {
172
+ var _a, _b;
173
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.getState()) !== null && _b !== void 0 ? _b : null;
174
+ },
175
+ subscribe(listener) {
176
+ var _a, _b;
177
+ return (_b = (_a = getController()) === null || _a === void 0 ? void 0 : _a.subscribe(listener)) !== null && _b !== void 0 ? _b : (() => { });
178
+ },
179
+ });
180
+ const callApi = async (api, action, fallback) => {
181
+ if (!api) {
182
+ return fallback;
183
+ }
184
+ return action(api);
185
+ };
186
+ const isAbortError = (error) => {
187
+ return Boolean(error && typeof error === 'object' && error.name === 'AbortError');
188
+ };
189
+ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) => {
190
+ if (!isBrowser()) {
191
+ throw new Error('Flyfish File Viewer can only be mounted in a browser DOM environment.');
192
+ }
193
+ let disposed = false;
194
+ let currentOptions = initialOptions;
195
+ let currentSource = hasSource(currentOptions)
196
+ ? toViewerSourceInput(currentOptions)
197
+ : null;
198
+ let abortController = null;
199
+ const listeners = new Set();
200
+ const state = {
201
+ loading: false,
202
+ ready: false,
203
+ error: null,
204
+ lastEvent: null,
205
+ lifecycle: null,
206
+ availability: null,
207
+ search: null,
208
+ zoom: null,
209
+ location: null,
210
+ };
211
+ const snapshotState = () => ({
212
+ ...state,
213
+ search: state.search
214
+ ? { ...state.search, matches: [...state.search.matches] }
215
+ : null,
216
+ });
217
+ const notifyState = (event) => {
218
+ var _a;
219
+ const snapshot = snapshotState();
220
+ (_a = currentOptions.onStateChange) === null || _a === void 0 ? void 0 : _a.call(currentOptions, snapshot, event);
221
+ listeners.forEach(listener => listener(snapshot, event));
222
+ };
223
+ const applyViewerEvent = (event) => {
224
+ var _a;
225
+ state.lastEvent = event;
226
+ if (event.type === 'load-start') {
227
+ state.loading = true;
228
+ state.ready = false;
229
+ state.error = null;
230
+ state.lifecycle = event.payload;
231
+ }
232
+ else if (event.type === 'load-complete') {
233
+ state.loading = false;
234
+ state.ready = true;
235
+ state.lifecycle = event.payload;
236
+ }
237
+ else if (event.type === 'unload-start') {
238
+ state.loading = true;
239
+ state.ready = false;
240
+ state.lifecycle = event.payload;
241
+ }
242
+ else if (event.type === 'unload-complete') {
243
+ state.loading = false;
244
+ state.ready = false;
245
+ state.lifecycle = event.payload;
246
+ }
247
+ else if (event.type === 'operation-availability-change') {
248
+ state.availability = event.payload;
249
+ }
250
+ else if (event.type === 'search-change') {
251
+ state.search = event.payload;
252
+ }
253
+ else if (event.type === 'location-change') {
254
+ state.location = event.payload;
255
+ }
256
+ else if (event.type === 'zoom-change') {
257
+ state.zoom = event.payload;
258
+ }
259
+ (_a = currentOptions.onEvent) === null || _a === void 0 ? void 0 : _a.call(currentOptions, event);
260
+ notifyState(event);
261
+ };
262
+ const instance = createViewer(container, {
263
+ registry: coreOptions.registry,
264
+ options: currentOptions.options,
265
+ onEvent: applyViewerEvent,
266
+ });
267
+ const cancel = () => {
268
+ abortController === null || abortController === void 0 ? void 0 : abortController.abort();
269
+ abortController = null;
270
+ };
271
+ const loadSource = async (nextSource) => {
272
+ var _a;
273
+ cancel();
274
+ currentSource = nextSource;
275
+ abortController = typeof AbortController !== 'undefined' ? new AbortController() : null;
276
+ const controller = abortController;
277
+ try {
278
+ state.loading = true;
279
+ state.error = null;
280
+ notifyState();
281
+ const resolvedSource = await resolveViewerLoadSource(nextSource, {
282
+ fetchFile: coreOptions.fetchFile,
283
+ signal: controller === null || controller === void 0 ? void 0 : controller.signal,
284
+ });
285
+ return await instance.load(resolvedSource);
286
+ }
287
+ catch (error) {
288
+ if (isAbortError(error) && (controller === null || controller === void 0 ? void 0 : controller.signal.aborted)) {
289
+ return null;
290
+ }
291
+ state.loading = false;
292
+ state.ready = false;
293
+ state.error = error;
294
+ notifyState();
295
+ (_a = coreOptions.onError) === null || _a === void 0 ? void 0 : _a.call(coreOptions, error, nextSource);
296
+ throw error;
297
+ }
298
+ finally {
299
+ if (abortController === controller) {
300
+ abortController = null;
301
+ }
302
+ }
303
+ };
304
+ if (currentSource) {
305
+ void loadSource(currentSource);
306
+ }
307
+ const controller = {
308
+ container,
309
+ async load(nextOptions) {
310
+ if (disposed)
311
+ return;
312
+ currentOptions = nextOptions;
313
+ instance.updateOptions(currentOptions.options || {});
314
+ if (hasSource(currentOptions)) {
315
+ await loadSource(toViewerSourceInput(currentOptions));
316
+ }
317
+ },
318
+ async update(nextOptions = {}) {
319
+ var _a;
320
+ if (disposed)
321
+ return;
322
+ currentOptions = {
323
+ ...currentOptions,
324
+ ...nextOptions,
325
+ options: (_a = nextOptions.options) !== null && _a !== void 0 ? _a : currentOptions.options,
326
+ };
327
+ instance.updateOptions(currentOptions.options || {});
328
+ if (hasSource(currentOptions)) {
329
+ await loadSource(toViewerSourceInput(currentOptions));
330
+ }
331
+ else {
332
+ currentSource = null;
333
+ await instance.load({ filename: DEFAULT_FILE_VIEWER_SOURCE_FILENAME });
334
+ }
335
+ },
336
+ async reload() {
337
+ if (disposed)
338
+ return;
339
+ if (currentSource) {
340
+ await loadSource(currentSource);
341
+ }
342
+ },
343
+ destroy() {
344
+ if (disposed)
345
+ return;
346
+ disposed = true;
347
+ cancel();
348
+ void instance.destroy('component-unmount');
349
+ container.innerHTML = '';
350
+ },
351
+ getApi() {
352
+ return instance;
353
+ },
354
+ downloadOriginalFile() {
355
+ return callApi(instance, api => api.download(), undefined);
356
+ },
357
+ printRenderedHtml() {
358
+ return callApi(instance, api => api.print(), undefined);
359
+ },
360
+ exportRenderedHtml() {
361
+ return callApi(instance, api => api.exportHtml({ download: true }).then(() => undefined), undefined);
362
+ },
363
+ zoomIn() {
364
+ return callApi(instance, api => api.zoomIn(), null);
365
+ },
366
+ zoomOut() {
367
+ return callApi(instance, api => api.zoomOut(), null);
368
+ },
369
+ resetZoom() {
370
+ return callApi(instance, api => api.resetZoom(), null);
371
+ },
372
+ searchDocument(query) {
373
+ return callApi(instance, api => api.search(query), null);
374
+ },
375
+ clearDocumentSearch() {
376
+ return callApi(instance, api => api.clearSearch(), null);
377
+ },
378
+ nextSearchResult() {
379
+ return callApi(instance, api => api.nextSearchResult(), null);
380
+ },
381
+ previousSearchResult() {
382
+ return callApi(instance, api => api.previousSearchResult(), null);
383
+ },
384
+ collectDocumentAnchors() {
385
+ return callApi(instance, api => api.collectDocumentAnchors(), []);
386
+ },
387
+ scrollToAnchor(anchor) {
388
+ return callApi(instance, api => api.scrollToDocumentAnchor(anchor), false);
389
+ },
390
+ scrollToLine(line) {
391
+ return callApi(instance, api => api.scrollToLine(line), false);
392
+ },
393
+ getDocumentTextChunks() {
394
+ return instance.getDocumentTextChunks();
395
+ },
396
+ getOperationAvailability() {
397
+ return instance.getCapabilities();
398
+ },
399
+ getZoomState() {
400
+ return instance.getZoomState();
401
+ },
402
+ getSearchState() {
403
+ return instance.getSearchState();
404
+ },
405
+ getState() {
406
+ return snapshotState();
407
+ },
408
+ subscribe(listener) {
409
+ listeners.add(listener);
410
+ listener(snapshotState());
411
+ return () => {
412
+ listeners.delete(listener);
413
+ };
414
+ },
415
+ };
416
+ return controller;
417
+ };
@@ -0,0 +1,46 @@
1
+ import Vue from 'vue';
2
+ import type { PluginObject, VueConstructor } from 'vue';
3
+ import { type ViewerController, type ViewerControllerHandle, type ViewerEvent, type ViewerMountOptions } from './controller.js';
4
+ export type { FileRef, ViewerAiOptions, ViewerArchiveOptions, ViewerCadOptions, ViewerController, ViewerControllerAccessor, ViewerControllerHandle, ViewerDocxOptions, ViewerEvent, ViewerEventHandler, ViewerEventType, ViewerFetchFile, ViewerFetchInput, ViewerMountOptions, ViewerOptions, ViewerPdfOptions, ViewerSpreadsheetOptions, ViewerSearchOptions, ViewerSourceInput, ViewerThemeMode, ViewerToolbarOptions, ViewerToolbarPosition, ViewerTypstOptions, ViewerWatermarkOptions, ViewerLifecycleContext, ViewerOperationContext, ViewerState, ViewerStateListener } from './controller.js';
5
+ export interface FileViewerVue27PluginOptions {
6
+ componentName?: string;
7
+ }
8
+ export interface FileViewerVue27PublicInstance extends Vue, ViewerControllerHandle {
9
+ }
10
+ export declare const FileViewer: import("vue/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue>, {
11
+ controller: ViewerController | null;
12
+ }, {
13
+ getViewerOptions(): ViewerMountOptions;
14
+ handleViewerEvent(event: ViewerEvent): void;
15
+ mountViewer(): void;
16
+ updateViewer(): void;
17
+ disposeViewer(): void;
18
+ getController(): ViewerController | null;
19
+ getApi(): import("@file-viewer/core").FileViewerPublicApi | import("@file-viewer/core").FileViewerInstance | null;
20
+ load(options: ViewerMountOptions): Promise<void>;
21
+ update(options: ViewerMountOptions): Promise<void>;
22
+ reload(): Promise<void>;
23
+ downloadOriginalFile(): Promise<void>;
24
+ printRenderedHtml(): Promise<void>;
25
+ exportRenderedHtml(): Promise<void>;
26
+ zoomIn(): Promise<import("@file-viewer/core").FileViewerZoomState | null>;
27
+ zoomOut(): Promise<import("@file-viewer/core").FileViewerZoomState | null>;
28
+ resetZoom(): Promise<import("@file-viewer/core").FileViewerZoomState | null>;
29
+ searchDocument(query: string): Promise<import("@file-viewer/core").FileViewerSearchState | null>;
30
+ clearDocumentSearch(): Promise<import("@file-viewer/core").FileViewerSearchState | null>;
31
+ nextSearchResult(): Promise<import("@file-viewer/core").FileViewerSearchState | null>;
32
+ previousSearchResult(): Promise<import("@file-viewer/core").FileViewerSearchState | null>;
33
+ collectDocumentAnchors(): Promise<import("@file-viewer/core").FileViewerDocumentAnchor[]>;
34
+ scrollToAnchor(anchor: Parameters<ViewerControllerHandle["scrollToAnchor"]>[0]): Promise<boolean>;
35
+ scrollToLine(line: number): Promise<boolean>;
36
+ getDocumentTextChunks(): import("@file-viewer/core").FileViewerDocumentChunk[];
37
+ getOperationAvailability(): import("@file-viewer/core").FileViewerOperationAvailability | null;
38
+ getZoomState(): import("@file-viewer/core").FileViewerZoomState | null;
39
+ getSearchState(): import("@file-viewer/core").FileViewerSearchState | null;
40
+ getState(): import("./controller.js").ViewerState | null;
41
+ subscribe(listener: Parameters<ViewerControllerHandle["subscribe"]>[0]): () => void;
42
+ destroy(): void;
43
+ }, unknown, Record<never, any>, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin>;
44
+ export declare const install: (VueCtor: VueConstructor, options?: FileViewerVue27PluginOptions) => void;
45
+ export declare const FileViewerPlugin: PluginObject<FileViewerVue27PluginOptions>;
46
+ export default FileViewerPlugin;
package/dist/index.js ADDED
@@ -0,0 +1,187 @@
1
+ import Vue from 'vue';
2
+ import { createViewerControllerHandle, mountViewer, } from './controller.js';
3
+ import { fileViewerCoreRendererRegistry } from '@file-viewer/core';
4
+ const defaultContainerStyle = {
5
+ width: '100%',
6
+ height: '100%',
7
+ minHeight: '0'
8
+ };
9
+ const viewerCoreOptions = {
10
+ registry: fileViewerCoreRendererRegistry
11
+ };
12
+ const toVm = (value) => value;
13
+ const getVmHandle = (vm) => {
14
+ return createViewerControllerHandle(() => vm.controller, () => vm.disposeViewer());
15
+ };
16
+ export const FileViewer = Vue.extend({
17
+ name: 'FileViewer',
18
+ props: {
19
+ url: String,
20
+ file: null,
21
+ buffer: null,
22
+ name: String,
23
+ filename: String,
24
+ type: String,
25
+ size: Number,
26
+ options: Object,
27
+ onEvent: Function,
28
+ containerClass: [String, Array, Object],
29
+ containerStyle: [String, Array, Object]
30
+ },
31
+ data() {
32
+ return {
33
+ controller: null
34
+ };
35
+ },
36
+ mounted() {
37
+ toVm(this).mountViewer();
38
+ },
39
+ beforeDestroy() {
40
+ toVm(this).disposeViewer();
41
+ },
42
+ watch: {
43
+ url: 'updateViewer',
44
+ file: 'updateViewer',
45
+ buffer: 'updateViewer',
46
+ name: 'updateViewer',
47
+ filename: 'updateViewer',
48
+ type: 'updateViewer',
49
+ size: 'updateViewer',
50
+ options: {
51
+ handler: 'updateViewer',
52
+ deep: true
53
+ }
54
+ },
55
+ methods: {
56
+ getViewerOptions() {
57
+ const vm = toVm(this);
58
+ return {
59
+ url: vm.url,
60
+ file: vm.file,
61
+ buffer: vm.buffer,
62
+ name: vm.name,
63
+ filename: vm.filename,
64
+ type: vm.type,
65
+ size: vm.size,
66
+ options: vm.options,
67
+ onEvent: event => vm.handleViewerEvent(event)
68
+ };
69
+ },
70
+ handleViewerEvent(event) {
71
+ this.$emit('viewer-event', event);
72
+ this.$emit('viewerEvent', event);
73
+ },
74
+ mountViewer() {
75
+ const vm = toVm(this);
76
+ const container = this.$refs.container;
77
+ if (!container || vm.controller) {
78
+ return;
79
+ }
80
+ vm.controller = mountViewer(container, vm.getViewerOptions(), viewerCoreOptions);
81
+ },
82
+ updateViewer() {
83
+ const vm = toVm(this);
84
+ if (vm.controller) {
85
+ vm.controller.update(vm.getViewerOptions());
86
+ return;
87
+ }
88
+ vm.mountViewer();
89
+ },
90
+ disposeViewer() {
91
+ var _a;
92
+ const vm = toVm(this);
93
+ (_a = vm.controller) === null || _a === void 0 ? void 0 : _a.destroy();
94
+ vm.controller = null;
95
+ },
96
+ getController() {
97
+ return getVmHandle(toVm(this)).getController();
98
+ },
99
+ getApi() {
100
+ return getVmHandle(toVm(this)).getApi();
101
+ },
102
+ load(options) {
103
+ return getVmHandle(toVm(this)).load(options);
104
+ },
105
+ update(options) {
106
+ return getVmHandle(toVm(this)).update(options);
107
+ },
108
+ reload() {
109
+ return getVmHandle(toVm(this)).reload();
110
+ },
111
+ downloadOriginalFile() {
112
+ return getVmHandle(toVm(this)).downloadOriginalFile();
113
+ },
114
+ printRenderedHtml() {
115
+ return getVmHandle(toVm(this)).printRenderedHtml();
116
+ },
117
+ exportRenderedHtml() {
118
+ return getVmHandle(toVm(this)).exportRenderedHtml();
119
+ },
120
+ zoomIn() {
121
+ return getVmHandle(toVm(this)).zoomIn();
122
+ },
123
+ zoomOut() {
124
+ return getVmHandle(toVm(this)).zoomOut();
125
+ },
126
+ resetZoom() {
127
+ return getVmHandle(toVm(this)).resetZoom();
128
+ },
129
+ searchDocument(query) {
130
+ return getVmHandle(toVm(this)).searchDocument(query);
131
+ },
132
+ clearDocumentSearch() {
133
+ return getVmHandle(toVm(this)).clearDocumentSearch();
134
+ },
135
+ nextSearchResult() {
136
+ return getVmHandle(toVm(this)).nextSearchResult();
137
+ },
138
+ previousSearchResult() {
139
+ return getVmHandle(toVm(this)).previousSearchResult();
140
+ },
141
+ collectDocumentAnchors() {
142
+ return getVmHandle(toVm(this)).collectDocumentAnchors();
143
+ },
144
+ scrollToAnchor(anchor) {
145
+ return getVmHandle(toVm(this)).scrollToAnchor(anchor);
146
+ },
147
+ scrollToLine(line) {
148
+ return getVmHandle(toVm(this)).scrollToLine(line);
149
+ },
150
+ getDocumentTextChunks() {
151
+ return getVmHandle(toVm(this)).getDocumentTextChunks();
152
+ },
153
+ getOperationAvailability() {
154
+ return getVmHandle(toVm(this)).getOperationAvailability();
155
+ },
156
+ getZoomState() {
157
+ return getVmHandle(toVm(this)).getZoomState();
158
+ },
159
+ getSearchState() {
160
+ return getVmHandle(toVm(this)).getSearchState();
161
+ },
162
+ getState() {
163
+ return getVmHandle(toVm(this)).getState();
164
+ },
165
+ subscribe(listener) {
166
+ return getVmHandle(toVm(this)).subscribe(listener);
167
+ },
168
+ destroy() {
169
+ getVmHandle(toVm(this)).destroy();
170
+ }
171
+ },
172
+ render(h) {
173
+ const vm = toVm(this);
174
+ return h('div', {
175
+ ref: 'container',
176
+ class: ['ff-file-viewer-vue27', vm.containerClass],
177
+ style: [defaultContainerStyle, vm.containerStyle]
178
+ });
179
+ }
180
+ });
181
+ export const install = (VueCtor, options = {}) => {
182
+ VueCtor.component(options.componentName || 'FileViewer', FileViewer);
183
+ };
184
+ export const FileViewerPlugin = {
185
+ install
186
+ };
187
+ export default FileViewerPlugin;