@progress/kendo-pdfviewer-common 0.4.2-develop.1 → 0.5.0-develop.2

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 (48) hide show
  1. package/dist/es/annotations/annotation-editor-layer-builder.js +6 -1
  2. package/dist/es/annotations/annotation-editor-ui-manager.js +25 -0
  3. package/dist/es/annotations/annotation-layer-builder.js +14 -4
  4. package/dist/es/annotations/annotation-layer.js +358 -337
  5. package/dist/es/annotations/draw-layer-builder.js +5 -1
  6. package/dist/es/annotations/helpers/annotation-storage.js +14 -0
  7. package/dist/es/annotations/helpers/text-accessibility-manager.js +5 -0
  8. package/dist/es/annotations/shared/event_utils.js +6 -0
  9. package/dist/es/text/text-layer-builder.js +13 -1
  10. package/dist/es/utils.js +3 -2
  11. package/dist/es/widget/page.js +22 -0
  12. package/dist/es/widget/pdfviewer.js +24 -13
  13. package/dist/es2015/annotations/annotation-editor-layer-builder.js +6 -1
  14. package/dist/es2015/annotations/annotation-editor-ui-manager.js +25 -0
  15. package/dist/es2015/annotations/annotation-layer-builder.js +14 -4
  16. package/dist/es2015/annotations/annotation-layer.js +358 -337
  17. package/dist/es2015/annotations/draw-layer-builder.js +5 -1
  18. package/dist/es2015/annotations/helpers/annotation-storage.js +14 -0
  19. package/dist/es2015/annotations/helpers/text-accessibility-manager.js +5 -0
  20. package/dist/es2015/annotations/shared/event_utils.js +6 -0
  21. package/dist/es2015/text/text-layer-builder.js +13 -1
  22. package/dist/es2015/utils.js +3 -2
  23. package/dist/es2015/widget/page.js +22 -0
  24. package/dist/es2015/widget/pdfviewer.js +24 -13
  25. package/dist/npm/annotations/annotation-editor-layer-builder.d.ts +3 -1
  26. package/dist/npm/annotations/annotation-editor-layer-builder.js +6 -1
  27. package/dist/npm/annotations/annotation-editor-ui-manager.d.ts +3 -0
  28. package/dist/npm/annotations/annotation-editor-ui-manager.js +25 -0
  29. package/dist/npm/annotations/annotation-layer-builder.d.ts +3 -1
  30. package/dist/npm/annotations/annotation-layer-builder.js +14 -4
  31. package/dist/npm/annotations/annotation-layer.d.ts +3 -1
  32. package/dist/npm/annotations/annotation-layer.js +358 -337
  33. package/dist/npm/annotations/draw-layer-builder.d.ts +3 -1
  34. package/dist/npm/annotations/draw-layer-builder.js +5 -1
  35. package/dist/npm/annotations/helpers/annotation-storage.d.ts +10 -0
  36. package/dist/npm/annotations/helpers/annotation-storage.js +14 -0
  37. package/dist/npm/annotations/helpers/text-accessibility-manager.d.ts +1 -0
  38. package/dist/npm/annotations/helpers/text-accessibility-manager.js +5 -0
  39. package/dist/npm/annotations/shared/event_utils.d.ts +4 -0
  40. package/dist/npm/annotations/shared/event_utils.js +6 -0
  41. package/dist/npm/text/text-layer-builder.d.ts +3 -1
  42. package/dist/npm/text/text-layer-builder.js +13 -1
  43. package/dist/npm/utils.d.ts +1 -0
  44. package/dist/npm/utils.js +5 -3
  45. package/dist/npm/widget/page.js +22 -0
  46. package/dist/npm/widget/pdfviewer.d.ts +1 -0
  47. package/dist/npm/widget/pdfviewer.js +23 -12
  48. package/package.json +1 -1
@@ -112,11 +112,12 @@ class AnnotationEditorLayerBuilder {
112
112
  });
113
113
  }
114
114
  cancel() {
115
+ var _a;
115
116
  this._cancelled = true;
116
117
  if (!this.div) {
117
118
  return;
118
119
  }
119
- this.annotationEditorLayer.destroy();
120
+ (_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
120
121
  }
121
122
  hide() {
122
123
  if (!this.div) {
@@ -130,6 +131,10 @@ class AnnotationEditorLayerBuilder {
130
131
  }
131
132
  this.div.hidden = false;
132
133
  }
134
+ destroy() {
135
+ var _a;
136
+ (_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
137
+ }
133
138
  }
134
139
  _AnnotationEditorLayerBuilder_annotationLayer = new WeakMap(), _AnnotationEditorLayerBuilder_drawLayer = new WeakMap(), _AnnotationEditorLayerBuilder_onAppend = new WeakMap(), _AnnotationEditorLayerBuilder_textLayer = new WeakMap(), _AnnotationEditorLayerBuilder_uiManager = new WeakMap();
135
140
  export { AnnotationEditorLayerBuilder };
@@ -242,6 +242,9 @@ export class AnnotationEditorUIManager {
242
242
  this._eventBus._on("setpreference", this.onSetPreference.bind(this), {
243
243
  signal
244
244
  });
245
+ this._eventBus._on("namedaction", this.onNamedAction.bind(this), {
246
+ signal
247
+ });
245
248
  __classPrivateFieldGet(this, _AnnotationEditorUIManager_instances, "m", _AnnotationEditorUIManager_addSelectionListener).call(this);
246
249
  __classPrivateFieldGet(this, _AnnotationEditorUIManager_instances, "m", _AnnotationEditorUIManager_addDragAndDropListeners).call(this);
247
250
  __classPrivateFieldGet(this, _AnnotationEditorUIManager_instances, "m", _AnnotationEditorUIManager_addKeyboardManager).call(this);
@@ -388,6 +391,18 @@ export class AnnotationEditorUIManager {
388
391
  default: break;
389
392
  }
390
393
  }
394
+ onNamedAction(event) {
395
+ // Processing a couple of named actions that might be useful, see also
396
+ // `PDFLinkService.executeNamedAction`.
397
+ switch (event.action) {
398
+ case "Print":
399
+ this.triggerPrinting();
400
+ break;
401
+ case "SaveAs":
402
+ this.downloadOrSave();
403
+ break;
404
+ }
405
+ }
391
406
  onPageChanging({ pageNumber }) {
392
407
  __classPrivateFieldSet(this, _AnnotationEditorUIManager_currentPageIndex, pageNumber - 1, "f");
393
408
  }
@@ -407,6 +422,16 @@ export class AnnotationEditorUIManager {
407
422
  }
408
423
  return null;
409
424
  }
425
+ triggerPrinting() {
426
+ var _a;
427
+ (_a = this.pdfViewer) === null || _a === void 0 ? void 0 : _a.printFile();
428
+ }
429
+ downloadOrSave() {
430
+ var _a, _b;
431
+ (_a = this.pdfViewer) === null || _a === void 0 ? void 0 : _a.downloadFile({
432
+ fileName: (_b = this.pdfViewer) === null || _b === void 0 ? void 0 : _b.options.downloadFileName
433
+ });
434
+ }
410
435
  disableUserSelect(value = false) {
411
436
  var _a;
412
437
  (_a = __classPrivateFieldGet(this, _AnnotationEditorUIManager_viewer, "f")) === null || _a === void 0 ? void 0 : _a.classList.toggle("noUserSelect", value);
@@ -143,8 +143,8 @@ class AnnotationLayerBuilder {
143
143
  (_b = __classPrivateFieldGet(this, _AnnotationLayerBuilder_onAppend, "f")) === null || _b === void 0 ? void 0 : _b.call(this, div);
144
144
  this.annotationLayer = new AnnotationLayer({
145
145
  div,
146
- // accessibilityManager: this._accessibilityManager,
147
- accessibilityManager: null,
146
+ accessibilityManager: this._accessibilityManager,
147
+ // accessibilityManager: null,
148
148
  annotationCanvasMap: this._annotationCanvasMap,
149
149
  annotationEditorUIManager: this._annotationEditorUIManager,
150
150
  page: this.pdfPage,
@@ -154,9 +154,9 @@ class AnnotationLayerBuilder {
154
154
  annotations,
155
155
  // imageResourcesPath: this.imageResourcesPath,
156
156
  renderForms: this.renderForms,
157
- linkService: this.linkService
157
+ linkService: this.linkService,
158
158
  // downloadManager: this.downloadManager,
159
- // annotationStorage: this.annotationStorage,
159
+ annotationStorage: this.annotationStorage
160
160
  // enableScripting: this.enableScripting,
161
161
  // hasJSActions,
162
162
  // fieldObjects,
@@ -190,6 +190,16 @@ class AnnotationLayerBuilder {
190
190
  var _a;
191
191
  return !!((_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.hasEditableAnnotations());
192
192
  }
193
+ destroy() {
194
+ var _a, _b, _c;
195
+ this.cancel();
196
+ (_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.destroy();
197
+ this.annotationLayer = null;
198
+ (_b = __classPrivateFieldGet(this, _AnnotationLayerBuilder_eventAbortController, "f")) === null || _b === void 0 ? void 0 : _b.abort();
199
+ __classPrivateFieldSet(this, _AnnotationLayerBuilder_eventAbortController, null, "f");
200
+ (_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
201
+ this.div = null;
202
+ }
193
203
  }
194
204
  _AnnotationLayerBuilder_onAppend = new WeakMap(), _AnnotationLayerBuilder_eventAbortController = new WeakMap(), _AnnotationLayerBuilder_instances = new WeakSet(), _AnnotationLayerBuilder_updatePresentationModeState = function _AnnotationLayerBuilder_updatePresentationModeState(state) {
195
205
  if (!this.div) {