@pdftools/four-heights-pdf-web-viewer 4.3.6

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 (367) hide show
  1. package/LICENSE.md +446 -0
  2. package/README.md +145 -0
  3. package/css/pdf-web-viewer.css +2407 -0
  4. package/doc/PdfWebViewer.pdf +0 -0
  5. package/es6/common/Checkbox.d.ts +9 -0
  6. package/es6/common/Checkbox.js +8 -0
  7. package/es6/common/Color.d.ts +23 -0
  8. package/es6/common/Color.js +118 -0
  9. package/es6/common/ColorPicker.d.ts +15 -0
  10. package/es6/common/ColorPicker.js +46 -0
  11. package/es6/common/Contextbar.d.ts +6 -0
  12. package/es6/common/Contextbar.js +19 -0
  13. package/es6/common/DragMoveHandler.d.ts +51 -0
  14. package/es6/common/DragMoveHandler.js +175 -0
  15. package/es6/common/Dropdown.d.ts +36 -0
  16. package/es6/common/Dropdown.js +76 -0
  17. package/es6/common/DropdownMenu.d.ts +9 -0
  18. package/es6/common/DropdownMenu.js +10 -0
  19. package/es6/common/DropdownSeparator.d.ts +3 -0
  20. package/es6/common/DropdownSeparator.js +6 -0
  21. package/es6/common/Icon.d.ts +13 -0
  22. package/es6/common/Icon.js +8 -0
  23. package/es6/common/Loader.d.ts +3 -0
  24. package/es6/common/Loader.js +6 -0
  25. package/es6/common/RangeSlider.d.ts +17 -0
  26. package/es6/common/RangeSlider.js +42 -0
  27. package/es6/common/StrokeStylePicker.d.ts +11 -0
  28. package/es6/common/StrokeStylePicker.js +20 -0
  29. package/es6/common/StrokeWidthPicker.d.ts +11 -0
  30. package/es6/common/StrokeWidthPicker.js +20 -0
  31. package/es6/common/Toolbar.d.ts +10 -0
  32. package/es6/common/Toolbar.js +6 -0
  33. package/es6/common/ToolbarButton.d.ts +14 -0
  34. package/es6/common/ToolbarButton.js +21 -0
  35. package/es6/common/ToolbarFileButton.d.ts +15 -0
  36. package/es6/common/ToolbarFileButton.js +27 -0
  37. package/es6/common/ToolbarItemGroup.d.ts +8 -0
  38. package/es6/common/ToolbarItemGroup.js +12 -0
  39. package/es6/common/ToolbarSeparator.d.ts +3 -0
  40. package/es6/common/ToolbarSeparator.js +6 -0
  41. package/es6/common/Tools.d.ts +10 -0
  42. package/es6/common/Tools.js +89 -0
  43. package/es6/common/TooltipManager.d.ts +12 -0
  44. package/es6/common/TooltipManager.js +54 -0
  45. package/es6/common/TranslationManager.d.ts +11 -0
  46. package/es6/common/TranslationManager.js +61 -0
  47. package/es6/common/classNames.d.ts +2 -0
  48. package/es6/common/classNames.js +18 -0
  49. package/es6/common/formatDate.d.ts +1 -0
  50. package/es6/common/formatDate.js +1 -0
  51. package/es6/common/icons.d.ts +13 -0
  52. package/es6/common/icons.js +412 -0
  53. package/es6/common/utils.d.ts +2 -0
  54. package/es6/common/utils.js +19 -0
  55. package/es6/custom/history.d.ts +2 -0
  56. package/es6/custom/history.js +59 -0
  57. package/es6/index.d.ts +5 -0
  58. package/es6/index.js +5 -0
  59. package/es6/lib/hyperapp/index.d.ts +108 -0
  60. package/es6/lib/hyperapp/index.js +327 -0
  61. package/es6/modules/CanvasLayer.d.ts +32 -0
  62. package/es6/modules/CanvasLayer.js +83 -0
  63. package/es6/modules/CanvasModule.d.ts +59 -0
  64. package/es6/modules/CanvasModule.js +98 -0
  65. package/es6/modules/eraser/EraserLayer.d.ts +13 -0
  66. package/es6/modules/eraser/EraserLayer.js +141 -0
  67. package/es6/modules/eraser/EraserModule.d.ts +19 -0
  68. package/es6/modules/eraser/EraserModule.js +34 -0
  69. package/es6/modules/eraser/EraserToolbar.d.ts +10 -0
  70. package/es6/modules/eraser/EraserToolbar.js +30 -0
  71. package/es6/modules/form-fields/CheckBoxWidget.d.ts +9 -0
  72. package/es6/modules/form-fields/CheckBoxWidget.js +45 -0
  73. package/es6/modules/form-fields/ComboBoxWidget.d.ts +22 -0
  74. package/es6/modules/form-fields/ComboBoxWidget.js +152 -0
  75. package/es6/modules/form-fields/EditFormFieldLayer.d.ts +17 -0
  76. package/es6/modules/form-fields/EditFormFieldLayer.js +238 -0
  77. package/es6/modules/form-fields/FormFieldModule.d.ts +15 -0
  78. package/es6/modules/form-fields/FormFieldModule.js +27 -0
  79. package/es6/modules/form-fields/ListBoxWidget.d.ts +9 -0
  80. package/es6/modules/form-fields/ListBoxWidget.js +73 -0
  81. package/es6/modules/form-fields/RadioButtonWidget.d.ts +9 -0
  82. package/es6/modules/form-fields/RadioButtonWidget.js +45 -0
  83. package/es6/modules/form-fields/SelectListWidget.d.ts +9 -0
  84. package/es6/modules/form-fields/SelectListWidget.js +45 -0
  85. package/es6/modules/form-fields/TextBoxWidget.d.ts +9 -0
  86. package/es6/modules/form-fields/TextBoxWidget.js +53 -0
  87. package/es6/modules/form-fields/WidgetBase.d.ts +23 -0
  88. package/es6/modules/form-fields/WidgetBase.js +29 -0
  89. package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.d.ts +19 -0
  90. package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.js +181 -0
  91. package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.d.ts +21 -0
  92. package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.js +37 -0
  93. package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.d.ts +20 -0
  94. package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.js +211 -0
  95. package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.d.ts +50 -0
  96. package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.js +118 -0
  97. package/es6/modules/freetext-annotation/FreetextAnnotationModule.d.ts +28 -0
  98. package/es6/modules/freetext-annotation/FreetextAnnotationModule.js +58 -0
  99. package/es6/modules/freetext-annotation/RichTextEditor.d.ts +31 -0
  100. package/es6/modules/freetext-annotation/RichTextEditor.js +223 -0
  101. package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.d.ts +31 -0
  102. package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.js +289 -0
  103. package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.d.ts +20 -0
  104. package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.js +52 -0
  105. package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.d.ts +15 -0
  106. package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.js +104 -0
  107. package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.d.ts +15 -0
  108. package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.js +28 -0
  109. package/es6/modules/highlight-annotation/HighlightAnnotationModule.d.ts +27 -0
  110. package/es6/modules/highlight-annotation/HighlightAnnotationModule.js +54 -0
  111. package/es6/modules/image-annotations/ImageAnnotationModule.d.ts +23 -0
  112. package/es6/modules/image-annotations/ImageAnnotationModule.js +169 -0
  113. package/es6/modules/index.d.ts +13 -0
  114. package/es6/modules/index.js +13 -0
  115. package/es6/modules/ink-annotation/AddInkAnnotationLayer.d.ts +40 -0
  116. package/es6/modules/ink-annotation/AddInkAnnotationLayer.js +503 -0
  117. package/es6/modules/ink-annotation/AddInkAnnotationToolbar.d.ts +30 -0
  118. package/es6/modules/ink-annotation/AddInkAnnotationToolbar.js +53 -0
  119. package/es6/modules/ink-annotation/EditInkAnnotationLayer.d.ts +20 -0
  120. package/es6/modules/ink-annotation/EditInkAnnotationLayer.js +137 -0
  121. package/es6/modules/ink-annotation/EditInkAnnotationToolbar.d.ts +25 -0
  122. package/es6/modules/ink-annotation/EditInkAnnotationToolbar.js +47 -0
  123. package/es6/modules/ink-annotation/InkAnnotationModule.d.ts +27 -0
  124. package/es6/modules/ink-annotation/InkAnnotationModule.js +50 -0
  125. package/es6/modules/popup/Popup.d.ts +64 -0
  126. package/es6/modules/popup/Popup.js +360 -0
  127. package/es6/modules/popup/PopupLayer.d.ts +31 -0
  128. package/es6/modules/popup/PopupLayer.js +509 -0
  129. package/es6/modules/popup/PopupModule.d.ts +16 -0
  130. package/es6/modules/popup/PopupModule.js +25 -0
  131. package/es6/modules/print-service/PrintServiceDialog.d.ts +30 -0
  132. package/es6/modules/print-service/PrintServiceDialog.js +134 -0
  133. package/es6/modules/print-service/PrintServiceLayer.d.ts +24 -0
  134. package/es6/modules/print-service/PrintServiceLayer.js +310 -0
  135. package/es6/modules/print-service/PrintServiceModule.d.ts +18 -0
  136. package/es6/modules/print-service/PrintServiceModule.js +30 -0
  137. package/es6/modules/shape-annotations/AddShapeAnnotationLayer.d.ts +24 -0
  138. package/es6/modules/shape-annotations/AddShapeAnnotationLayer.js +210 -0
  139. package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.d.ts +26 -0
  140. package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.js +69 -0
  141. package/es6/modules/shape-annotations/EditShapeAnnotationLayer.d.ts +19 -0
  142. package/es6/modules/shape-annotations/EditShapeAnnotationLayer.js +148 -0
  143. package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.d.ts +24 -0
  144. package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.js +57 -0
  145. package/es6/modules/shape-annotations/ShapeAnnotationModule.d.ts +28 -0
  146. package/es6/modules/shape-annotations/ShapeAnnotationModule.js +50 -0
  147. package/es6/modules/stamp-annotation/AddStampAnnotationLayer.d.ts +19 -0
  148. package/es6/modules/stamp-annotation/AddStampAnnotationLayer.js +257 -0
  149. package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.d.ts +17 -0
  150. package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.js +68 -0
  151. package/es6/modules/stamp-annotation/StampAnnotationModule.d.ts +20 -0
  152. package/es6/modules/stamp-annotation/StampAnnotationModule.js +35 -0
  153. package/es6/modules/text-annotation/AddTextAnnotationLayer.d.ts +14 -0
  154. package/es6/modules/text-annotation/AddTextAnnotationLayer.js +132 -0
  155. package/es6/modules/text-annotation/AddTextAnnotationToolbar.d.ts +15 -0
  156. package/es6/modules/text-annotation/AddTextAnnotationToolbar.js +27 -0
  157. package/es6/modules/text-annotation/TextAnnotationModule.d.ts +19 -0
  158. package/es6/modules/text-annotation/TextAnnotationModule.js +34 -0
  159. package/es6/pdf-viewer-api/ImageContainer.d.ts +10 -0
  160. package/es6/pdf-viewer-api/ImageContainer.js +43 -0
  161. package/es6/pdf-viewer-api/PdfViewerApi.d.ts +463 -0
  162. package/es6/pdf-viewer-api/PdfViewerApi.js +732 -0
  163. package/es6/pdf-viewer-api/PdfViewingWrapper.d.ts +178 -0
  164. package/es6/pdf-viewer-api/PdfViewingWrapper.js +2037 -0
  165. package/es6/pdf-viewer-api/annotationDefaultBehaviors.d.ts +3 -0
  166. package/es6/pdf-viewer-api/annotationDefaultBehaviors.js +30 -0
  167. package/es6/pdf-viewer-api/enums.d.ts +100 -0
  168. package/es6/pdf-viewer-api/enums.js +113 -0
  169. package/es6/pdf-viewer-api/index.d.ts +3 -0
  170. package/es6/pdf-viewer-api/index.js +3 -0
  171. package/es6/pdf-viewer-api/types.d.ts +284 -0
  172. package/es6/pdf-viewer-api/types.js +6 -0
  173. package/es6/pdf-viewer-canvas/CanvasEvents.d.ts +76 -0
  174. package/es6/pdf-viewer-canvas/CanvasEvents.js +345 -0
  175. package/es6/pdf-viewer-canvas/PdfViewerCanvas.d.ts +175 -0
  176. package/es6/pdf-viewer-canvas/PdfViewerCanvas.js +1226 -0
  177. package/es6/pdf-viewer-canvas/state/annotations.d.ts +36 -0
  178. package/es6/pdf-viewer-canvas/state/annotations.js +157 -0
  179. package/es6/pdf-viewer-canvas/state/appState.d.ts +10 -0
  180. package/es6/pdf-viewer-canvas/state/appState.js +60 -0
  181. package/es6/pdf-viewer-canvas/state/canvas.d.ts +31 -0
  182. package/es6/pdf-viewer-canvas/state/canvas.js +41 -0
  183. package/es6/pdf-viewer-canvas/state/document.d.ts +50 -0
  184. package/es6/pdf-viewer-canvas/state/document.js +99 -0
  185. package/es6/pdf-viewer-canvas/state/pointer.d.ts +31 -0
  186. package/es6/pdf-viewer-canvas/state/pointer.js +31 -0
  187. package/es6/pdf-viewer-canvas/state/scroll.d.ts +22 -0
  188. package/es6/pdf-viewer-canvas/state/scroll.js +25 -0
  189. package/es6/pdf-viewer-canvas/state/search.d.ts +36 -0
  190. package/es6/pdf-viewer-canvas/state/search.js +27 -0
  191. package/es6/pdf-viewer-canvas/state/store.d.ts +39 -0
  192. package/es6/pdf-viewer-canvas/state/store.js +52 -0
  193. package/es6/pdf-viewer-canvas/state/viewer.d.ts +91 -0
  194. package/es6/pdf-viewer-canvas/state/viewer.js +175 -0
  195. package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.d.ts +28 -0
  196. package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.js +452 -0
  197. package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.d.ts +9 -0
  198. package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.js +25 -0
  199. package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.d.ts +10 -0
  200. package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.js +149 -0
  201. package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.d.ts +48 -0
  202. package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.js +308 -0
  203. package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.d.ts +19 -0
  204. package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.js +289 -0
  205. package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.d.ts +31 -0
  206. package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.js +106 -0
  207. package/es6/pdf-viewer-canvas/view-layers/canvasShapes.d.ts +11 -0
  208. package/es6/pdf-viewer-canvas/view-layers/canvasShapes.js +149 -0
  209. package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.d.ts +3 -0
  210. package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.js +10 -0
  211. package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.d.ts +52 -0
  212. package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.js +377 -0
  213. package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.d.ts +47 -0
  214. package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.js +102 -0
  215. package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.d.ts +14 -0
  216. package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.js +36 -0
  217. package/es6/pdf-viewing/PdfViewing.d.ts +4865 -0
  218. package/es6/pdf-viewing/PdfViewing.js +9611 -0
  219. package/es6/pdf-web-viewer/PdfWebViewer.d.ts +372 -0
  220. package/es6/pdf-web-viewer/PdfWebViewer.js +1386 -0
  221. package/es6/pdf-web-viewer/UserSettings.d.ts +8 -0
  222. package/es6/pdf-web-viewer/UserSettings.js +40 -0
  223. package/es6/pdf-web-viewer/WebViewerOptions.d.ts +387 -0
  224. package/es6/pdf-web-viewer/WebViewerOptions.js +582 -0
  225. package/es6/pdf-web-viewer/state/index.d.ts +80 -0
  226. package/es6/pdf-web-viewer/state/index.js +98 -0
  227. package/es6/pdf-web-viewer/state/layout.d.ts +24 -0
  228. package/es6/pdf-web-viewer/state/layout.js +21 -0
  229. package/es6/pdf-web-viewer/state/mobile.d.ts +16 -0
  230. package/es6/pdf-web-viewer/state/mobile.js +11 -0
  231. package/es6/pdf-web-viewer/state/navigationPanel.d.ts +61 -0
  232. package/es6/pdf-web-viewer/state/navigationPanel.js +84 -0
  233. package/es6/pdf-web-viewer/state/passwordForm.d.ts +18 -0
  234. package/es6/pdf-web-viewer/state/passwordForm.js +21 -0
  235. package/es6/pdf-web-viewer/state/pdfDocument.d.ts +31 -0
  236. package/es6/pdf-web-viewer/state/pdfDocument.js +41 -0
  237. package/es6/pdf-web-viewer/state/search.d.ts +29 -0
  238. package/es6/pdf-web-viewer/state/search.js +23 -0
  239. package/es6/pdf-web-viewer/views/App.d.ts +4 -0
  240. package/es6/pdf-web-viewer/views/App.js +19 -0
  241. package/es6/pdf-web-viewer/views/CustomButtons.d.ts +9 -0
  242. package/es6/pdf-web-viewer/views/CustomButtons.js +18 -0
  243. package/es6/pdf-web-viewer/views/DropZone.d.ts +9 -0
  244. package/es6/pdf-web-viewer/views/DropZone.js +53 -0
  245. package/es6/pdf-web-viewer/views/Layout.d.ts +4 -0
  246. package/es6/pdf-web-viewer/views/Layout.js +22 -0
  247. package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.d.ts +4 -0
  248. package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.js +21 -0
  249. package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.d.ts +4 -0
  250. package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.js +35 -0
  251. package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.d.ts +4 -0
  252. package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.js +22 -0
  253. package/es6/pdf-web-viewer/views/appbar/AppBar.d.ts +4 -0
  254. package/es6/pdf-web-viewer/views/appbar/AppBar.js +26 -0
  255. package/es6/pdf-web-viewer/views/appbar/DocumentBar.d.ts +4 -0
  256. package/es6/pdf-web-viewer/views/appbar/DocumentBar.js +36 -0
  257. package/es6/pdf-web-viewer/views/appbar/Menu.d.ts +4 -0
  258. package/es6/pdf-web-viewer/views/appbar/Menu.js +80 -0
  259. package/es6/pdf-web-viewer/views/appbar/NavigationBar.d.ts +4 -0
  260. package/es6/pdf-web-viewer/views/appbar/NavigationBar.js +74 -0
  261. package/es6/pdf-web-viewer/views/appbar/SearchBar.d.ts +4 -0
  262. package/es6/pdf-web-viewer/views/appbar/SearchBar.js +83 -0
  263. package/es6/pdf-web-viewer/views/appbar/SearchOptions.d.ts +10 -0
  264. package/es6/pdf-web-viewer/views/appbar/SearchOptions.js +55 -0
  265. package/es6/pdf-web-viewer/views/appbar/ViewBar.d.ts +4 -0
  266. package/es6/pdf-web-viewer/views/appbar/ViewBar.js +52 -0
  267. package/es6/pdf-web-viewer/views/appbar/ZoomBar.d.ts +4 -0
  268. package/es6/pdf-web-viewer/views/appbar/ZoomBar.js +18 -0
  269. package/es6/pdf-web-viewer/views/modal/ApplicationError.d.ts +4 -0
  270. package/es6/pdf-web-viewer/views/modal/ApplicationError.js +25 -0
  271. package/es6/pdf-web-viewer/views/modal/LoadApplication.d.ts +3 -0
  272. package/es6/pdf-web-viewer/views/modal/LoadApplication.js +6 -0
  273. package/es6/pdf-web-viewer/views/modal/LoadFile.d.ts +3 -0
  274. package/es6/pdf-web-viewer/views/modal/LoadFile.js +10 -0
  275. package/es6/pdf-web-viewer/views/modal/Modal.d.ts +4 -0
  276. package/es6/pdf-web-viewer/views/modal/Modal.js +39 -0
  277. package/es6/pdf-web-viewer/views/modal/OpenFile.d.ts +4 -0
  278. package/es6/pdf-web-viewer/views/modal/OpenFile.js +30 -0
  279. package/es6/pdf-web-viewer/views/modal/OpenFileError.d.ts +4 -0
  280. package/es6/pdf-web-viewer/views/modal/OpenFileError.js +13 -0
  281. package/es6/pdf-web-viewer/views/modal/PasswordForm.d.ts +4 -0
  282. package/es6/pdf-web-viewer/views/modal/PasswordForm.js +54 -0
  283. package/es6/pdf-web-viewer/views/modal/SaveFile.d.ts +4 -0
  284. package/es6/pdf-web-viewer/views/modal/SaveFile.js +10 -0
  285. package/es6/pdf-web-viewer/views/modal/UnsavedChanges.d.ts +4 -0
  286. package/es6/pdf-web-viewer/views/modal/UnsavedChanges.js +32 -0
  287. package/es6/pdf-web-viewer/views/navigation/AnnotationList.d.ts +8 -0
  288. package/es6/pdf-web-viewer/views/navigation/AnnotationList.js +26 -0
  289. package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.d.ts +8 -0
  290. package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.js +158 -0
  291. package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.d.ts +4 -0
  292. package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.js +11 -0
  293. package/es6/pdf-web-viewer/views/navigation/NavigationPanel.d.ts +4 -0
  294. package/es6/pdf-web-viewer/views/navigation/NavigationPanel.js +50 -0
  295. package/es6/pdf-web-viewer/views/navigation/OutlineList.d.ts +12 -0
  296. package/es6/pdf-web-viewer/views/navigation/OutlineList.js +19 -0
  297. package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.d.ts +4 -0
  298. package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.js +10 -0
  299. package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.d.ts +16 -0
  300. package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.js +32 -0
  301. package/package.json +24 -0
  302. package/pdfwebviewer/PdfViewing.data +0 -0
  303. package/pdfwebviewer/PdfViewing_Main.js +1 -0
  304. package/pdfwebviewer/PdfViewing_Main.wasm +0 -0
  305. package/pdfwebviewer/PdfViewing_Worker.js +1 -0
  306. package/pdfwebviewer/PdfViewing_Worker.wasm +0 -0
  307. package/pdfwebviewer/pdf-web-viewer.css +2407 -0
  308. package/pdfwebviewer/pdf-web-viewer.development.js +25955 -0
  309. package/pdfwebviewer/pdf-web-viewer.min.js +1 -0
  310. package/pdfwebviewer/translations.de.json +151 -0
  311. package/pdfwebviewer/translations.en.json +151 -0
  312. package/pdfwebviewer/translations.fr.json +151 -0
  313. package/pdfwebviewer/translations.it.json +151 -0
  314. package/scss/common/_breakpoints.scss +44 -0
  315. package/scss/common/_buttons.scss +42 -0
  316. package/scss/common/_colorpicker.scss +89 -0
  317. package/scss/common/_common.scss +21 -0
  318. package/scss/common/_contextbar.scss +44 -0
  319. package/scss/common/_dropdown.scss +176 -0
  320. package/scss/common/_icon.scss +9 -0
  321. package/scss/common/_index.scss +19 -0
  322. package/scss/common/_loader.scss +30 -0
  323. package/scss/common/_rangeslider.scss +24 -0
  324. package/scss/common/_scrollbars.scss +64 -0
  325. package/scss/common/_stroke-style-picker.scss +64 -0
  326. package/scss/common/_stroke-width-picker.scss +23 -0
  327. package/scss/common/_toolbar.scss +117 -0
  328. package/scss/common/_tooltip.scss +39 -0
  329. package/scss/modules/_eraser.scss +28 -0
  330. package/scss/modules/_forms.scss +56 -0
  331. package/scss/modules/_highlightannotation.scss +12 -0
  332. package/scss/modules/_index.scss +5 -0
  333. package/scss/modules/_inkannotation.scss +41 -0
  334. package/scss/modules/_stampannotation.scss +19 -0
  335. package/scss/pdf-viewer-canvas/_annotationborder.scss +107 -0
  336. package/scss/pdf-viewer-canvas/_busy-loader.scss +53 -0
  337. package/scss/pdf-viewer-canvas/_freetexteditor.scss +28 -0
  338. package/scss/pdf-viewer-canvas/_index.scss +7 -0
  339. package/scss/pdf-viewer-canvas/_layout.scss +52 -0
  340. package/scss/pdf-viewer-canvas/_popup.scss +217 -0
  341. package/scss/pdf-viewer-canvas/_printservice.scss +171 -0
  342. package/scss/pdf-viewer-canvas/_textselection.scss +17 -0
  343. package/scss/pdf-web-viewer/_annotationbar.scss +47 -0
  344. package/scss/pdf-web-viewer/_index.scss +8 -0
  345. package/scss/pdf-web-viewer/_layout.scss +63 -0
  346. package/scss/pdf-web-viewer/_modal.scss +186 -0
  347. package/scss/pdf-web-viewer/_navigationpanel.scss +398 -0
  348. package/scss/pdf-web-viewer/_searchbar.scss +47 -0
  349. package/scss/pdf-web-viewer/_toolbar.scss +134 -0
  350. package/scss/pdf-web-viewer/_viewer.scss +54 -0
  351. package/scss/pdf-web-viewer.scss +1 -0
  352. package/scss/themes/default/_light.scss +32 -0
  353. package/scss/themes/default/_mixins.scss +129 -0
  354. package/scss/themes/default/_theme.scss +161 -0
  355. package/scss/themes/pdf-web-viewer.scss +1 -0
  356. package/umd/pdf-web-viewer.development.js +25955 -0
  357. package/umd/pdf-web-viewer.development.js.map +1 -0
  358. package/umd/pdf-web-viewer.min.js +1 -0
  359. package/wasm/PdfViewing.data +0 -0
  360. package/wasm/PdfViewing_Main.js +1 -0
  361. package/wasm/PdfViewing_Main.wasm +0 -0
  362. package/wasm/PdfViewing_Worker.js +1 -0
  363. package/wasm/PdfViewing_Worker.wasm +0 -0
  364. package/wasm/translations.de.json +151 -0
  365. package/wasm/translations.en.json +151 -0
  366. package/wasm/translations.fr.json +151 -0
  367. package/wasm/translations.it.json +151 -0
@@ -0,0 +1,98 @@
1
+ export var CanvasModuleType;
2
+ (function (CanvasModuleType) {
3
+ CanvasModuleType[CanvasModuleType["Tool"] = 0] = "Tool";
4
+ CanvasModuleType[CanvasModuleType["Layer"] = 1] = "Layer";
5
+ })(CanvasModuleType || (CanvasModuleType = {}));
6
+ export class CanvasModule {
7
+ constructor() {
8
+ this.canvasLayers = {};
9
+ this.store = null;
10
+ this.pdfApi = null;
11
+ this.pdfViewerCanvas = null;
12
+ this.options = null;
13
+ this.name = null;
14
+ this.containerElement = null;
15
+ this.createCanvasLayer = this.createCanvasLayer.bind(this);
16
+ this.removeCanvasLayer = this.removeCanvasLayer.bind(this);
17
+ }
18
+ register(containerElement, store, pdfApi, pdfViewerCanvas, options) {
19
+ this.containerElement = containerElement;
20
+ this.store = store;
21
+ this.pdfApi = pdfApi;
22
+ this.pdfViewerCanvas = pdfViewerCanvas;
23
+ this.options = options;
24
+ return this.onRegister();
25
+ }
26
+ render(timestamp, state) {
27
+ const keys = Object.keys(this.canvasLayers);
28
+ for (let i = 0; i < keys.length; i++) {
29
+ this.canvasLayers[keys[i]].render(timestamp, state);
30
+ }
31
+ }
32
+ deactivate() {
33
+ const keys = Object.keys(this.canvasLayers);
34
+ for (let i = 0; i < keys.length; i++) {
35
+ const name = keys[i];
36
+ this.canvasLayers[name].onRemove();
37
+ delete this.canvasLayers[name];
38
+ }
39
+ }
40
+ resize(width, height) {
41
+ const keys = Object.keys(this.canvasLayers);
42
+ for (let i = 0; i < keys.length; i++) {
43
+ this.canvasLayers[keys[i]].resize(width, height);
44
+ }
45
+ }
46
+ getCanvasSize() {
47
+ const rect = {
48
+ width: 0,
49
+ height: 0,
50
+ };
51
+ if (this.containerElement !== null) {
52
+ const clientRect = this.containerElement.getBoundingClientRect();
53
+ rect.width = clientRect.width;
54
+ rect.height = clientRect.height;
55
+ }
56
+ return rect;
57
+ }
58
+ onSave() {
59
+ const promise = new Promise((resolve, reject) => {
60
+ const keys = Object.keys(this.canvasLayers);
61
+ const promises = [];
62
+ for (let i = 0; i < keys.length; i++) {
63
+ promises.push(this.canvasLayers[keys[i]].onSave());
64
+ }
65
+ Promise.all(promises)
66
+ .then(() => {
67
+ resolve();
68
+ })
69
+ .catch((error) => {
70
+ reject('OnSave failed on a canvas layer: ' + error);
71
+ });
72
+ });
73
+ return promise;
74
+ }
75
+ createCanvasLayer(name, canvasLayer, args) {
76
+ if (this.containerElement &&
77
+ this.store &&
78
+ this.pdfApi &&
79
+ this.pdfViewerCanvas &&
80
+ this.options) {
81
+ if (this.canvasLayers[name]) {
82
+ throw new Error('duplicate canvas layer name');
83
+ }
84
+ const layer = new canvasLayer(this, name, this.containerElement, this.store, this.pdfApi, this.pdfViewerCanvas, this.options);
85
+ this.canvasLayers[name] = layer;
86
+ layer.onCreate(args);
87
+ }
88
+ else {
89
+ throw new Error('canvas layer is not registered');
90
+ }
91
+ }
92
+ removeCanvasLayer(name) {
93
+ if (this.canvasLayers[name]) {
94
+ this.canvasLayers[name].onRemove();
95
+ delete this.canvasLayers[name];
96
+ }
97
+ }
98
+ }
@@ -0,0 +1,13 @@
1
+ import { CanvasLayer } from '../CanvasLayer';
2
+ import { ViewerCanvasState } from '../../pdf-viewer-canvas/state/store';
3
+ export declare class EraserLayer extends CanvasLayer {
4
+ private context;
5
+ private eraserRadius;
6
+ onCreate(args?: any): void;
7
+ onRemove(): void;
8
+ onSave(): Promise<void>;
9
+ render(timestamp: number, state: ViewerCanvasState): void;
10
+ private setEraserRadius;
11
+ private deleteFirstInkLineCloseToPoint;
12
+ private updateInkAnnotation;
13
+ }
@@ -0,0 +1,141 @@
1
+ import { CanvasLayer } from '../CanvasLayer';
2
+ import { PdfItemType } from '../../pdf-viewer-api/';
3
+ import { CursorStyle } from '../../pdf-viewer-canvas/state/viewer';
4
+ import { createEraserToolbar } from './EraserToolbar';
5
+ const moduleLayerName = 'EraserTool';
6
+ export class EraserLayer extends CanvasLayer {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.context = null;
10
+ this.eraserRadius = this.options.annotation.eraserRadius;
11
+ }
12
+ onCreate(args) {
13
+ this.setEraserRadius = this.setEraserRadius.bind(this);
14
+ this.remove = this.remove.bind(this);
15
+ this.context = this.createCanvas();
16
+ const toolbarElement = this.module.toolbarElement;
17
+ createEraserToolbar({
18
+ radius: this.eraserRadius,
19
+ onRadiusChanged: this.setEraserRadius,
20
+ onCancel: this.remove,
21
+ }, toolbarElement);
22
+ this.store.viewer.beginModule(moduleLayerName);
23
+ }
24
+ onRemove() {
25
+ this.removeCanvasElements();
26
+ this.context = null;
27
+ /* tslint:disable-next-line:align */
28
+ const toolbarElement = this.module.toolbarElement;
29
+ toolbarElement.innerHTML = '';
30
+ this.store.viewer.endModule(moduleLayerName);
31
+ }
32
+ onSave() {
33
+ return new Promise((resolve) => {
34
+ return resolve();
35
+ });
36
+ }
37
+ render(timestamp, state) {
38
+ var _a;
39
+ if (state.viewer.modeChanged && state.viewer.selectedModuleName !== moduleLayerName) {
40
+ this.remove();
41
+ return;
42
+ }
43
+ const pointerPos = {
44
+ x: state.pointer.x.devicePixels,
45
+ y: state.pointer.y.devicePixels,
46
+ };
47
+ const pointerPdfPos = this.pdfApi.transformScreenPointToPdfPoint(pointerPos);
48
+ const cursorStyle = pointerPdfPos.isOnPage ? CursorStyle.NONE : CursorStyle.NOT_ALLOWED;
49
+ this.store.viewer.setCursorStyle(cursorStyle);
50
+ const ctx = this.context;
51
+ if (ctx) {
52
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
53
+ if (pointerPdfPos.isOnPage) {
54
+ ctx.save();
55
+ ctx.lineWidth = 1;
56
+ if (this.eraserRadius >= 8) {
57
+ ctx.setLineDash([4 * devicePixelRatio, 4 * devicePixelRatio]);
58
+ }
59
+ ctx.beginPath();
60
+ ctx.arc(pointerPos.x, pointerPos.y, (this.eraserRadius * devicePixelRatio) / 2, 0, 2 * Math.PI);
61
+ ctx.stroke();
62
+ ctx.restore();
63
+ }
64
+ }
65
+ if (!pointerPdfPos.isOnPage || state.pointer.action !== 'click') {
66
+ return;
67
+ }
68
+ const inkAnnotations = (_a = this.pdfApi
69
+ .getAnnotationsOnPoint(pointerPos)) === null || _a === void 0 ? void 0 : _a.filter((a) => a.itemType === PdfItemType.INK);
70
+ if (!inkAnnotations) {
71
+ return;
72
+ }
73
+ const annot = this.deleteFirstInkLineCloseToPoint(inkAnnotations, pointerPdfPos.pdfPoint);
74
+ if (annot) {
75
+ this.updateInkAnnotation(annot);
76
+ }
77
+ }
78
+ setEraserRadius(radius) {
79
+ this.options.annotation.eraserRadius = radius;
80
+ this.eraserRadius = radius;
81
+ }
82
+ deleteFirstInkLineCloseToPoint(inkAnnotations, pdfPoint) {
83
+ if (!this.context) {
84
+ return null;
85
+ }
86
+ const ctx = this.context;
87
+ ctx.save();
88
+ for (let inkAnnotation of inkAnnotations) {
89
+ ctx.lineWidth = Math.max(inkAnnotation.border.width, this.eraserRadius * devicePixelRatio);
90
+ ctx.lineCap = 'round';
91
+ for (let inkLine of inkAnnotation.inkList) {
92
+ const path = new Path2D();
93
+ let isFirstPoint = true;
94
+ for (let point of inkLine) {
95
+ if (isFirstPoint) {
96
+ path.moveTo(point.x, point.y);
97
+ isFirstPoint = false;
98
+ }
99
+ else {
100
+ path.lineTo(point.x, point.y);
101
+ }
102
+ }
103
+ const isPointInStroke = ctx.isPointInStroke(path, pdfPoint.pdfX, pdfPoint.pdfY);
104
+ if (isPointInStroke) {
105
+ inkAnnotation.inkList.splice(inkAnnotation.inkList.indexOf(inkLine), 1);
106
+ return inkAnnotation;
107
+ }
108
+ }
109
+ }
110
+ ctx.restore();
111
+ return null;
112
+ }
113
+ updateInkAnnotation(inkAnnotation) {
114
+ return new Promise((resolve, reject) => {
115
+ if (inkAnnotation.inkList.length) {
116
+ this.pdfApi
117
+ .updateItem(inkAnnotation)
118
+ .then((item) => {
119
+ this.store.annotations.updateAnnotation(item);
120
+ resolve();
121
+ })
122
+ .catch((err) => {
123
+ console.error(err);
124
+ reject();
125
+ });
126
+ }
127
+ else {
128
+ const id = inkAnnotation.id;
129
+ this.pdfApi
130
+ .deleteItem(inkAnnotation)
131
+ .then(() => {
132
+ resolve();
133
+ })
134
+ .catch((err) => {
135
+ console.error(err);
136
+ reject();
137
+ });
138
+ }
139
+ });
140
+ }
141
+ }
@@ -0,0 +1,19 @@
1
+ import { CanvasModule, CanvasModuleType } from '../CanvasModule';
2
+ export declare class EraserModule extends CanvasModule {
3
+ toolbarElement: HTMLElement | null;
4
+ static moduleInfo: {
5
+ name: string;
6
+ moduleType: CanvasModuleType;
7
+ requiredFeatures: {
8
+ annotate: boolean;
9
+ fillFormFields: boolean;
10
+ };
11
+ translationKey: string;
12
+ icon: string;
13
+ };
14
+ constructor();
15
+ onRegister(): {
16
+ toolbar: HTMLElement;
17
+ };
18
+ activate(): void;
19
+ }
@@ -0,0 +1,34 @@
1
+ import { CanvasModule, CanvasModuleType } from '../CanvasModule';
2
+ import { EraserLayer } from './EraserLayer';
3
+ export class EraserModule extends CanvasModule {
4
+ constructor() {
5
+ super();
6
+ this.toolbarElement = null;
7
+ this.name = EraserModule.moduleInfo.name;
8
+ this.activate = this.activate.bind(this);
9
+ }
10
+ onRegister() {
11
+ this.toolbarElement = document.createElement('div');
12
+ return {
13
+ toolbar: this.toolbarElement,
14
+ };
15
+ }
16
+ activate() {
17
+ if (!this.canvasLayers['add']) {
18
+ this.createCanvasLayer('add', EraserLayer);
19
+ }
20
+ else {
21
+ this.removeCanvasLayer('add');
22
+ }
23
+ }
24
+ }
25
+ EraserModule.moduleInfo = {
26
+ name: 'EraserModule',
27
+ moduleType: CanvasModuleType.Tool,
28
+ requiredFeatures: {
29
+ annotate: true,
30
+ fillFormFields: false,
31
+ },
32
+ translationKey: 'eraser.begin',
33
+ icon: 'eraser',
34
+ };
@@ -0,0 +1,10 @@
1
+ export interface EraserToolbarProps {
2
+ radius: number;
3
+ onRadiusChanged(width: number): void;
4
+ onCancel(): void;
5
+ }
6
+ export interface EraserToolbarActions {
7
+ setRadius(radius: number): void;
8
+ setCancel(): void;
9
+ }
10
+ export declare const createEraserToolbar: (props: EraserToolbarProps, element: HTMLElement) => EraserToolbarActions;
@@ -0,0 +1,30 @@
1
+ import { app, h } from '../../lib/hyperapp';
2
+ import { translationManager } from '../../common/TranslationManager';
3
+ import { Toolbar } from '../../common/Toolbar';
4
+ import { ToolbarItemGroup } from '../../common/ToolbarItemGroup';
5
+ import { ToolbarButton } from '../../common/ToolbarButton';
6
+ import { icons } from '../../common/icons';
7
+ import { ToolbarSeparator } from '../../common/ToolbarSeparator';
8
+ import { RangeSlider } from '../../common/RangeSlider';
9
+ export const createEraserToolbar = (props, element) => {
10
+ const state = {
11
+ radius: props.radius,
12
+ };
13
+ const actions = {
14
+ setRadius: (radius) => ($state) => {
15
+ props.onRadiusChanged(radius);
16
+ return Object.assign(Object.assign({}, $state), { radius });
17
+ },
18
+ setCancel: () => ($state) => {
19
+ return Object.assign({}, $state);
20
+ },
21
+ };
22
+ const App = () => h(EraserToolbar, null);
23
+ const EraserToolbar = ({}) => ($state, $actions) => (h(Toolbar, { allowWrap: true, alignCenter: true },
24
+ h(ToolbarItemGroup, null,
25
+ h(RangeSlider, { tooltip: translationManager.getText('eraser.eraserWidth'), min: 2, max: 50, step: 1, value: $state.radius, text: `${$state.radius}px`, icon: icons.circleDashed, onChange: $actions.setRadius, className: "pwv-opacityslider" })),
26
+ h(ToolbarItemGroup, { pushRight: true },
27
+ h(ToolbarSeparator, null),
28
+ h(ToolbarButton, { icon: icons.close, onClick: props.onCancel }))));
29
+ return app(state, actions, App, element);
30
+ };
@@ -0,0 +1,9 @@
1
+ import { WidgetBase } from './WidgetBase';
2
+ export declare class CheckBoxWidget extends WidgetBase {
3
+ createFormField(): HTMLLabelElement;
4
+ onRemove(): void;
5
+ setFocus(): void;
6
+ private handleOnKeyDown;
7
+ private handleOnBlur;
8
+ private handleOnChange;
9
+ }
@@ -0,0 +1,45 @@
1
+ import { WidgetBase } from './WidgetBase';
2
+ export class CheckBoxWidget extends WidgetBase {
3
+ createFormField() {
4
+ const formField = document.createElement('label');
5
+ formField.classList.add('pwv-formField__CheckBox');
6
+ formField.style.overflow = 'hidden';
7
+ const checkbox = document.createElement('input');
8
+ checkbox.type = 'checkbox';
9
+ checkbox.checked = this.widget.selected;
10
+ checkbox.style.position = 'absolute';
11
+ checkbox.style.top = '-20px';
12
+ checkbox.style.left = '-20px';
13
+ formField.appendChild(checkbox);
14
+ this.handleOnChange = this.handleOnChange.bind(this);
15
+ this.handleOnKeyDown = this.handleOnKeyDown.bind(this);
16
+ this.handleOnBlur = this.handleOnBlur.bind(this);
17
+ formField.addEventListener('change', this.handleOnChange);
18
+ formField.addEventListener('keydown', this.handleOnKeyDown);
19
+ formField.addEventListener('blur', this.handleOnBlur);
20
+ return formField;
21
+ }
22
+ onRemove() {
23
+ this.editorElement.removeEventListener('change', this.handleOnChange);
24
+ this.editorElement.removeEventListener('keydown', this.handleOnKeyDown);
25
+ this.editorElement.removeEventListener('blur', this.handleOnBlur);
26
+ }
27
+ setFocus() {
28
+ this.editorElement.focus();
29
+ }
30
+ handleOnKeyDown(e) {
31
+ if (e.code === 'Tab') {
32
+ this.onTab(e.shiftKey);
33
+ }
34
+ else if (e.code === 'Escape') {
35
+ this.onBlur();
36
+ }
37
+ }
38
+ handleOnBlur(e) {
39
+ this.onBlur();
40
+ }
41
+ handleOnChange(e) {
42
+ this.widget.push();
43
+ this.saveWidget();
44
+ }
45
+ }
@@ -0,0 +1,22 @@
1
+ import { WidgetBase } from './WidgetBase';
2
+ export declare class ComboBoxWidget extends WidgetBase {
3
+ private input;
4
+ private dataList;
5
+ private btnClear;
6
+ private btnClearPressed;
7
+ private hasPendingChanges;
8
+ private saveThrottlingTimer;
9
+ createFormField(): HTMLDivElement;
10
+ onRemove(): void;
11
+ setFocus(): void;
12
+ private updateBtnVisibility;
13
+ private updateWidget;
14
+ private inputOnFocus;
15
+ private inputOnBlur;
16
+ private inputOnInput;
17
+ private inputOnChange;
18
+ private inputOnKeyDown;
19
+ private btnOnClick;
20
+ private btnOnMouseDown;
21
+ private btnOnMouseUp;
22
+ }
@@ -0,0 +1,152 @@
1
+ import { WidgetBase } from './WidgetBase';
2
+ export class ComboBoxWidget extends WidgetBase {
3
+ constructor() {
4
+ super(...arguments);
5
+ this.btnClearPressed = false;
6
+ this.hasPendingChanges = false;
7
+ this.saveThrottlingTimer = undefined;
8
+ }
9
+ createFormField() {
10
+ // bind events
11
+ this.inputOnFocus = this.inputOnFocus.bind(this);
12
+ this.inputOnBlur = this.inputOnBlur.bind(this);
13
+ this.inputOnInput = this.inputOnInput.bind(this);
14
+ this.inputOnChange = this.inputOnChange.bind(this);
15
+ this.inputOnKeyDown = this.inputOnKeyDown.bind(this);
16
+ this.btnOnClick = this.btnOnClick.bind(this);
17
+ this.btnOnMouseDown = this.btnOnMouseDown.bind(this);
18
+ this.btnOnMouseUp = this.btnOnMouseUp.bind(this);
19
+ // form field
20
+ const formField = document.createElement('div');
21
+ formField.classList.add('pwv-formField__ComboBox');
22
+ // datalist
23
+ this.dataList = document.createElement('datalist');
24
+ this.dataList.id = Math.random().toString(36).substring(2, 8);
25
+ for (let i = 0; i < this.widget.options.size; i++) {
26
+ const value = this.widget.options.get(i);
27
+ const item = document.createElement('option');
28
+ item.value = value;
29
+ item.textContent = value;
30
+ this.dataList.appendChild(item);
31
+ }
32
+ // input
33
+ this.input = document.createElement('input');
34
+ this.input.setAttribute('list', this.dataList.id);
35
+ this.input.style.border = 'none';
36
+ this.input.style.boxSizing = 'border-box';
37
+ this.input.style.width = '100%';
38
+ this.input.style.maxWidth = '100%';
39
+ this.input.value =
40
+ this.widget.chosen !== null
41
+ ? this.widget.options.get(this.widget.chosen)
42
+ : this.widget.customEntry;
43
+ this.input.addEventListener('focus', this.inputOnFocus);
44
+ this.input.addEventListener('blur', this.inputOnBlur);
45
+ this.input.addEventListener('input', this.inputOnInput);
46
+ this.input.addEventListener('change', this.inputOnChange);
47
+ this.input.addEventListener('keydown', this.inputOnKeyDown);
48
+ // clear button
49
+ this.btnClear = document.createElement('button');
50
+ this.btnClear.tabIndex = -1;
51
+ const icon = document.createElement('span');
52
+ icon.classList.add('pwv-icon');
53
+ const iconSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
54
+ iconSvg.setAttribute('viewBox', '0 0 320 512');
55
+ const iconPath = document.createElementNS('http://www.w3.org/2000/svg', 'path');
56
+ iconPath.setAttribute('d', 'M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z');
57
+ iconPath.setAttribute('stroke-width', '1px');
58
+ iconPath.setAttribute('shape-rendering', 'optimizeQuality');
59
+ iconSvg.appendChild(iconPath);
60
+ icon.appendChild(iconSvg);
61
+ this.btnClear.appendChild(icon);
62
+ this.btnClear.addEventListener('mousedown', this.btnOnMouseDown);
63
+ this.btnClear.addEventListener('mouseup', this.btnOnMouseUp);
64
+ this.btnClear.addEventListener('mouseleave', this.btnOnMouseUp);
65
+ this.btnClear.addEventListener('click', this.btnOnClick);
66
+ formField.appendChild(this.input);
67
+ formField.appendChild(this.dataList);
68
+ formField.appendChild(this.btnClear);
69
+ return formField;
70
+ }
71
+ onRemove() {
72
+ if (this.saveThrottlingTimer) {
73
+ window.clearTimeout(this.saveThrottlingTimer);
74
+ }
75
+ if (this.hasPendingChanges) {
76
+ this.saveWidget();
77
+ }
78
+ this.input.removeEventListener('focus', this.inputOnFocus);
79
+ this.input.removeEventListener('blur', this.inputOnBlur);
80
+ this.input.removeEventListener('input', this.inputOnInput);
81
+ this.input.removeEventListener('change', this.inputOnChange);
82
+ this.input.removeEventListener('keydown', this.inputOnKeyDown);
83
+ this.btnClear.removeEventListener('mousedown', this.btnOnMouseDown);
84
+ this.btnClear.removeEventListener('mouseup', this.btnOnMouseUp);
85
+ this.btnClear.removeEventListener('mouseleave', this.btnOnMouseUp);
86
+ this.btnClear.removeEventListener('click', this.btnOnClick);
87
+ }
88
+ setFocus() {
89
+ this.input.focus();
90
+ }
91
+ updateBtnVisibility() {
92
+ if (this.btnClear) {
93
+ this.btnClear.style.display = this.input.value === '' ? 'none' : 'flex';
94
+ }
95
+ }
96
+ updateWidget() {
97
+ const { value, list } = this.input;
98
+ const options = list.options;
99
+ const chosen = [...options].findIndex((i) => i.value === value);
100
+ if (chosen >= 0) {
101
+ this.widget.chosen = chosen;
102
+ }
103
+ else {
104
+ this.widget.customEntry = value;
105
+ }
106
+ if (this.saveThrottlingTimer) {
107
+ window.clearTimeout(this.saveThrottlingTimer);
108
+ }
109
+ this.saveThrottlingTimer = window.setTimeout(() => {
110
+ this.saveWidget();
111
+ this.hasPendingChanges = false;
112
+ }, 500);
113
+ }
114
+ inputOnFocus(e) {
115
+ this.updateBtnVisibility();
116
+ }
117
+ inputOnBlur(e) {
118
+ if (!this.btnClearPressed) {
119
+ this.saveWidget();
120
+ this.hasPendingChanges = false;
121
+ this.onBlur();
122
+ }
123
+ }
124
+ inputOnInput(e) {
125
+ this.updateBtnVisibility();
126
+ this.updateWidget();
127
+ }
128
+ inputOnChange(e) {
129
+ this.updateBtnVisibility();
130
+ }
131
+ inputOnKeyDown(e) {
132
+ if (e.code === 'Tab') {
133
+ this.onTab(e.shiftKey);
134
+ }
135
+ else if (e.code === 'Escape') {
136
+ this.input.blur();
137
+ }
138
+ }
139
+ btnOnClick(e) {
140
+ this.input.value = '';
141
+ this.updateWidget();
142
+ this.updateBtnVisibility();
143
+ this.input.focus();
144
+ }
145
+ btnOnMouseDown(e) {
146
+ this.btnClearPressed = true;
147
+ }
148
+ btnOnMouseUp(e) {
149
+ this.input.focus();
150
+ this.btnClearPressed = false;
151
+ }
152
+ }
@@ -0,0 +1,17 @@
1
+ import { CanvasLayer } from '../CanvasLayer';
2
+ import { ViewerCanvasState } from '../../pdf-viewer-canvas/state/store';
3
+ export declare class EditFormFieldLayer extends CanvasLayer {
4
+ private widgetAnnotation;
5
+ private formFieldElement;
6
+ private hasFocus;
7
+ private widgetEditor;
8
+ onCreate(args: any): void;
9
+ cancel(): void;
10
+ onSave(): Promise<void>;
11
+ close(): void;
12
+ onRemove(): void;
13
+ render(timestamp: number, state: ViewerCanvasState): void;
14
+ private updateFormFieldElementPosition;
15
+ private selectNextFormField;
16
+ private blur;
17
+ }