@react-pdf-kit/viewer 2.0.0-beta.1 → 2.0.0-beta.3

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 (129) hide show
  1. package/README.md +6 -6
  2. package/dist/ToolbarLayout.module-7a53aa2b.js +3557 -0
  3. package/dist/assets/style.css +1 -1
  4. package/dist/assets/style.js +11 -11
  5. package/dist/components/RPConfig.js +10 -1485
  6. package/dist/components/RPController.js +59 -59
  7. package/dist/components/RPPages.js +10 -12
  8. package/dist/components/RPProvider.js +35 -31
  9. package/dist/components/icons/DualPageIcon.js +6 -6
  10. package/dist/components/icons/SinglePageIcon.js +6 -6
  11. package/dist/components/layout/LayoutContainer.js +8 -10
  12. package/dist/components/layout/RPDefaultLayout.js +6 -8
  13. package/dist/components/layout/RPLayout.js +49 -51
  14. package/dist/components/layout/sidebar/RPSidebar.js +7 -9
  15. package/dist/components/layout/sidebar/Thumbnail.js +10 -12
  16. package/dist/components/layout/sidebar/Thumbnails.js +7 -9
  17. package/dist/components/layout/toolbar/DarkModeTool.js +1 -1
  18. package/dist/components/layout/toolbar/DocumentDialog.js +10 -12
  19. package/dist/components/layout/toolbar/DocumentProperties.js +2 -2
  20. package/dist/components/layout/toolbar/FileDownloadTool.js +7 -9
  21. package/dist/components/layout/toolbar/FileUploadTool.js +2 -2
  22. package/dist/components/layout/toolbar/FullScreenTool.js +2 -2
  23. package/dist/components/layout/toolbar/MenuItem.js +2 -2
  24. package/dist/components/layout/toolbar/MenuSeparator.js +2 -2
  25. package/dist/components/layout/toolbar/MostPageTool.js +10 -12
  26. package/dist/components/layout/toolbar/OtherTool.js +7 -9
  27. package/dist/components/layout/toolbar/Paginate.js +7 -9
  28. package/dist/components/layout/toolbar/PrintTool.js +7 -9
  29. package/dist/components/layout/toolbar/RPMenuItem.js +2 -2
  30. package/dist/components/layout/toolbar/RPMoreOptions.js +8 -10
  31. package/dist/components/layout/toolbar/RPToolbar.js +7 -9
  32. package/dist/components/layout/toolbar/RPToolbarEnd.js +7 -9
  33. package/dist/components/layout/toolbar/RotateTool.js +2 -2
  34. package/dist/components/layout/toolbar/ScrollModeTool.js +2 -2
  35. package/dist/components/layout/toolbar/SearchCloseButton.js +1 -1
  36. package/dist/components/layout/toolbar/SearchResultNavigator.js +7 -9
  37. package/dist/components/layout/toolbar/SearchTool.js +10 -12
  38. package/dist/components/layout/toolbar/SelectionModeTool.js +2 -2
  39. package/dist/components/layout/toolbar/ThumbnailTool.js +8 -10
  40. package/dist/components/layout/toolbar/ToolbarCustom.js +23 -25
  41. package/dist/components/layout/toolbar/ToolbarDefault.js +32 -34
  42. package/dist/components/layout/toolbar/ToolbarLayout.js +8 -10
  43. package/dist/components/layout/toolbar/ViewModeTool.js +4 -4
  44. package/dist/components/layout/toolbar/ZoomTool.js +7 -9
  45. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +8 -10
  46. package/dist/components/layout/toolbar/tools/DualPageTool.js +144 -0
  47. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +8 -10
  48. package/dist/components/layout/toolbar/tools/FileUploadTool.js +1 -1
  49. package/dist/components/layout/toolbar/tools/FullScreenTool.js +1 -1
  50. package/dist/components/layout/toolbar/tools/InputPageTool.js +8 -10
  51. package/dist/components/layout/toolbar/tools/NextPageTool.js +11 -13
  52. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +8 -10
  53. package/dist/components/layout/toolbar/tools/PrintTool.js +8 -10
  54. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +1 -1
  55. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +1 -1
  56. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +29 -0
  57. package/dist/components/layout/toolbar/tools/SinglePageTool.js +144 -0
  58. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +1 -1
  59. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +8 -10
  60. package/dist/components/layout/toolbar/tools/ZoomInTool.js +1 -1
  61. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +10 -12
  62. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +8 -10
  63. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +1 -1
  64. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +16 -18
  65. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +8 -10
  66. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
  67. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +8 -10
  68. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +11 -13
  69. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
  70. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +11 -13
  71. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +8 -10
  72. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +2 -2
  73. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +2 -2
  74. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +2 -2
  75. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +4 -4
  76. package/dist/components/page/AnnotationLayer.js +10 -12
  77. package/dist/components/page/CanvasLayer.js +10 -12
  78. package/dist/components/page/DualPage.js +7 -9
  79. package/dist/components/page/RPPage.js +10 -12
  80. package/dist/components/page/SinglePage.js +7 -9
  81. package/dist/components/page/TextHighlightLayer.js +10 -12
  82. package/dist/components/page/TextLayer.js +10 -12
  83. package/dist/components/ui/DropDown.js +2 -2
  84. package/dist/components/ui/LoadingIndicator.js +7 -9
  85. package/dist/components/ui/RPTooltip.js +430 -200
  86. package/dist/contexts/ElementPageContext.js +1 -1
  87. package/dist/contexts/PaginationContext.js +9 -11
  88. package/dist/contexts/PrintContext.js +9 -11
  89. package/dist/contexts/RPDocumentContext.js +27 -19
  90. package/dist/contexts/RenderQueueProvider.js +9 -11
  91. package/dist/contexts/SearchContext.js +9 -11
  92. package/dist/contexts/ThumbnailsContext.js +9 -11
  93. package/dist/floating-ui.react-dom-d22a10b4.js +1474 -0
  94. package/dist/index-3bf64864.js +1886 -0
  95. package/dist/main.js +98 -94
  96. package/dist/types/components/icons/DualPageIcon.d.ts +1 -1
  97. package/dist/types/components/icons/SinglePageIcon.d.ts +1 -1
  98. package/dist/types/components/layout/toolbar/tools/DualPageTool.d.ts +3 -0
  99. package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
  100. package/dist/types/components/layout/toolbar/tools/SinglePageTool.d.ts +3 -0
  101. package/dist/types/contexts/RenderQueueProvider.d.ts +2 -2
  102. package/dist/types/main.d.ts +4 -4
  103. package/dist/types/utils/annotations.d.ts +1 -1
  104. package/dist/types/utils/getElementPositionInPage.d.ts +2 -2
  105. package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
  106. package/dist/types/utils/hooks/usePrint.d.ts +3 -2
  107. package/dist/types/utils/hooks/useSearch.d.ts +1 -2
  108. package/dist/types/utils/renderPage.d.ts +2 -2
  109. package/dist/types/utils/types.d.ts +27 -4
  110. package/dist/utils/annotations.js +135 -180
  111. package/dist/utils/getWordPositionInPage.js +5 -5
  112. package/dist/utils/highlight.js +72 -72
  113. package/dist/utils/hooks/useCopyText.js +36 -0
  114. package/dist/utils/hooks/useFileDownload.js +10 -12
  115. package/dist/utils/hooks/useLicense.js +1 -1
  116. package/dist/utils/hooks/useLoadPdf.js +42 -39
  117. package/dist/utils/hooks/usePaginate.js +10 -12
  118. package/dist/utils/hooks/usePresentPage.js +10 -12
  119. package/dist/utils/hooks/usePrint.js +10 -12
  120. package/dist/utils/hooks/useScrollToPage.js +10 -12
  121. package/dist/utils/hooks/useSearch.js +10 -12
  122. package/dist/utils/hooks/useThumbnail.js +10 -12
  123. package/dist/utils/hooks/useVirtualReactWindow.js +10 -12
  124. package/dist/utils/injectPrintCSS.js +1 -1
  125. package/dist/utils/renderPage.js +12 -10
  126. package/package.json +21 -17
  127. package/dist/ToolbarLayout.module-37619c4b.js +0 -3548
  128. package/dist/index-808ea7bf.js +0 -1685
  129. package/dist/index-a48ec088.js +0 -1672
@@ -1,22 +1,22 @@
1
- import { sanitizeExternalUrl as _ } from "./sanitizeExternalUrl.js";
1
+ import { sanitizeExternalUrl as y } from "./sanitizeExternalUrl.js";
2
2
  import { AnnotationType as l } from "./types.js";
3
- import { dateFormatter as L } from "./dateFormatter.js";
3
+ import { dateFormatter as O } from "./dateFormatter.js";
4
4
  import "../th_TH-d627cd51.js";
5
- const T = ["click", "dblclick", "input", "change"], m = /* @__PURE__ */ new Map(), v = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
6
- function I(e, t) {
7
- const n = v(e, t);
8
- return m.has(n) ? m.get(n) ?? null : null;
5
+ const b = ["click", "dblclick", "input", "change", "mouseover"], m = /* @__PURE__ */ new Map(), N = (e, s) => `${e.loadingTask.docId}___${s.num}R${s.gen === 0 ? "" : s.gen}`;
6
+ function A(e, s) {
7
+ const t = N(e, s);
8
+ return m.has(t) ? m.get(t) ?? null : null;
9
9
  }
10
- const x = (e, t, n) => {
11
- m.set(v(e, t), n);
12
- }, A = (e, t) => {
13
- switch (t[1].name) {
10
+ const v = (e, s, t) => {
11
+ m.set(N(e, s), t);
12
+ }, g = (e, s) => {
13
+ switch (s[1].name) {
14
14
  case "XYZ":
15
15
  return {
16
- bottomOffset: (n, a) => t[3] === null ? a : t[3],
17
- leftOffset: (n, a) => t[2] === null ? 0 : t[2],
16
+ bottomOffset: (t, n) => s[3] === null ? n : s[3],
17
+ leftOffset: (t, n) => s[2] === null ? 0 : s[2],
18
18
  pageIndex: e,
19
- scaleTo: t[4]
19
+ scaleTo: s[4]
20
20
  };
21
21
  case "Fit":
22
22
  case "FitB":
@@ -29,7 +29,7 @@ const x = (e, t, n) => {
29
29
  case "FitH":
30
30
  case "FitBH":
31
31
  return {
32
- bottomOffset: t[2],
32
+ bottomOffset: s[2],
33
33
  leftOffset: 0,
34
34
  pageIndex: e,
35
35
  scaleTo: 1
@@ -42,121 +42,76 @@ const x = (e, t, n) => {
42
42
  scaleTo: 1
43
43
  };
44
44
  }
45
+ }, R = (e) => {
46
+ e && (() => {
47
+ const t = e == null ? void 0 : e.querySelectorAll(
48
+ '[data-l10n-id="pdfjs-annotation-date-time-string"]'
49
+ );
50
+ t == null || t.forEach((n) => {
51
+ const { date: a, time: o, dateObj: i } = JSON.parse(n.dataset.l10nArgs ?? "{}");
52
+ a && o ? n.textContent = `${a}, ${o}` : i && (n.textContent = O(i));
53
+ });
54
+ })();
45
55
  };
46
- async function E(e, t) {
47
- let n;
48
- if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
49
- const a = n[0], s = I(e, a);
50
- if (s === null) {
51
- const r = await e.getPageIndex(a);
52
- return x(e, a, r), await E(e, n);
56
+ async function h(e, s) {
57
+ let t;
58
+ if (typeof s == "string" ? t = await e.getDestination(s) : t = s, t && typeof t[0] == "object" && t[0] !== null) {
59
+ const n = t[0], a = A(e, n);
60
+ if (a === null) {
61
+ const o = await e.getPageIndex(n);
62
+ return v(e, n, o), await h(e, t);
53
63
  } else
54
- return A(s, n);
64
+ return g(a, t);
55
65
  } else
56
- return A(n[0], n);
66
+ return g(t[0], t);
57
67
  }
58
- const M = (e) => {
59
- const n = e.target.parentNode;
60
- if (!n)
61
- return;
62
- const a = new MutationObserver((s) => {
63
- s.forEach(() => {
64
- n.querySelectorAll(
65
- '[data-l10n-id="pdfjs-annotation-date-time-string"]'
66
- ).forEach((o) => {
67
- const c = o.getAttribute("data-l10n-args");
68
- if (c) {
69
- try {
70
- const { dateObj: i } = JSON.parse(c);
71
- i && (o.textContent = L(i));
72
- } catch {
73
- }
74
- a.disconnect();
75
- }
76
- });
77
- });
78
- });
79
- return a.observe(n, {
80
- childList: !0,
81
- // Watch for changes to child elements
82
- subtree: !0,
83
- // Watch all descendants, not just direct children
84
- attributes: !0
85
- // Watch for changes to attributes
86
- }), () => a.disconnect();
87
- };
88
- function H(e, t) {
89
- for (const n of T)
90
- e.addEventListener(n, t);
68
+ function C(e, s) {
69
+ for (const t of b)
70
+ e.addEventListener(t, s);
91
71
  }
92
- function P(e, t) {
93
- for (const n of T)
94
- e.removeEventListener(n, t);
72
+ function F(e, s) {
73
+ for (const t of b)
74
+ e.removeEventListener(t, s);
95
75
  }
96
- function U(e) {
97
- const { id: t, url: n, unsafeUrl: a } = e;
98
- new MutationObserver((r, o) => {
99
- const c = document.querySelector(`[data-annotation-id="${t}"]`);
76
+ function w(e) {
77
+ const { id: s, url: t, unsafeUrl: n } = e;
78
+ new MutationObserver((o, i) => {
79
+ const c = document.querySelector(`[data-annotation-id="${s}"]`);
100
80
  if (c) {
101
- const i = c.querySelector("a"), p = _((n || a) ?? "", "");
102
- i && (i == null || i.setAttribute("target", "_blank"), i == null || i.setAttribute("href", p), i == null || i.setAttribute("rel", "noopener noreferrer")), o.disconnect();
81
+ const r = c.querySelector("a"), T = y((t || n) ?? "", "");
82
+ r && (r == null || r.setAttribute("target", "_blank"), r == null || r.setAttribute("href", T), r == null || r.setAttribute("rel", "noopener noreferrer")), i.disconnect();
103
83
  }
104
84
  }).observe(document.body, { childList: !0, subtree: !0 });
105
85
  }
106
- function V(e, t, n) {
107
- const { rotation: a, scale: s } = t, r = a % 180 === 0;
86
+ function L(e, s, t) {
87
+ const { rotation: n, scale: a } = s, o = n % 180 === 0;
108
88
  if (e.fieldType === "Btn" && e.pushButton) {
109
- const o = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], i = document.createElement("canvas");
110
- i.setAttribute("width", ((r ? o : c) * s).toString()), i.setAttribute("height", ((r ? c : o) * s).toString()), n.set(e.id, i);
89
+ const i = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], r = document.createElement("canvas");
90
+ r.setAttribute("width", ((o ? i : c) * a).toString()), r.setAttribute("height", ((o ? c : i) * a).toString()), t.set(e.id, r);
111
91
  }
112
92
  }
113
- function B(e) {
114
- var r;
115
- let t = e;
116
- for (; t.tagName !== "SECTION"; )
117
- t = t.parentElement;
118
- const n = t.getAttribute("aria-haspopup") === "dialog", a = t.classList.contains("popupAnnotation");
119
- if (!n && !a)
120
- return;
121
- let s = t.id || t.getAttribute("aria-controls");
122
- if (s || (s = (r = t.firstChild) == null ? void 0 : r.id), s && t.parentElement) {
123
- const o = t.parentElement.querySelector(`[aria-controls="${s}"]`);
124
- o && new MutationObserver((i, p) => {
125
- const b = document.querySelectorAll(".popupDate");
126
- b.length > 0 && (b.forEach((g) => {
127
- if (g.innerHTML)
128
- return !1;
129
- const N = g.getAttribute("data-l10n-args");
130
- if (N) {
131
- const { date: h, time: y } = JSON.parse(N);
132
- h && y && (g.textContent = `${h}, ${y}`);
133
- }
134
- }), p.disconnect());
135
- }).observe(o, { childList: !0, subtree: !0 });
136
- }
137
- }
138
- function d(e, t, n) {
139
- const a = [];
140
- if (n)
141
- for (const s of n)
142
- s[e] === t && a.push(s);
143
- return a;
93
+ function d(e, s, t) {
94
+ const n = [];
95
+ if (t)
96
+ for (const a of t)
97
+ a[e] === s && n.push(a);
98
+ return n;
144
99
  }
145
- function u(e, t) {
146
- return { type: e, data: t };
100
+ function u(e, s) {
101
+ return { type: e, data: s };
147
102
  }
148
- async function w(e, t) {
103
+ async function _(e, s) {
149
104
  if (e.dest)
150
105
  if (typeof e.dest == "string") {
151
- const n = await E(t, e.dest);
106
+ const t = await h(s, e.dest);
152
107
  return u(l.INTERNAL_LINK, {
153
- referencedPage: n.pageIndex,
108
+ referencedPage: t.pageIndex,
154
109
  offset: null
155
110
  });
156
111
  } else {
157
- const n = await t.getPageIndex(e.dest[0]);
112
+ const t = await s.getPageIndex(e.dest[0]);
158
113
  return u(l.INTERNAL_LINK, {
159
- referencedPage: n,
114
+ referencedPage: t,
160
115
  offset: {
161
116
  left: e.dest[2],
162
117
  bottom: e.dest[3]
@@ -169,20 +124,20 @@ async function w(e, t) {
169
124
  unsafeUrl: e.unsafeUrl
170
125
  });
171
126
  }
172
- function O(e) {
173
- for (const t of e.getElementsByTagName("span")) {
174
- let n = t.textContent;
175
- const a = JSON.parse(t.dataset.l10nArgs ?? "{}");
176
- if (n)
177
- for (const s in a)
178
- n = n.replace(`{{${s}}}`, a[s]);
179
- t.textContent = n;
127
+ function p(e) {
128
+ for (const s of e.getElementsByTagName("span")) {
129
+ let t = s.textContent;
130
+ const n = JSON.parse(s.dataset.l10nArgs ?? "{}");
131
+ if (t)
132
+ for (const a in n)
133
+ t = t.replace(`{{${a}}}`, n[a]);
134
+ s.textContent = t;
180
135
  }
181
136
  }
182
- function S(e) {
137
+ function x(e) {
183
138
  return u(l.FILE_ATTACHMENT, e.file);
184
139
  }
185
- function f(e, t) {
140
+ function f(e, s) {
186
141
  switch (e.type) {
187
142
  case "textarea":
188
143
  case "text":
@@ -192,22 +147,22 @@ function f(e, t) {
192
147
  });
193
148
  case "select-one":
194
149
  case "select-multiple":
150
+ const t = [];
151
+ for (const a of e.options)
152
+ t.push({
153
+ value: a.value,
154
+ label: a.label
155
+ });
195
156
  const n = [];
196
- for (const s of e.options)
157
+ for (const a of e.selectedOptions)
197
158
  n.push({
198
- value: s.value,
199
- label: s.label
200
- });
201
- const a = [];
202
- for (const s of e.selectedOptions)
203
- a.push({
204
- value: s.value,
205
- label: s.label
159
+ value: a.value,
160
+ label: a.label
206
161
  });
207
162
  return u(l.FORM_SELECT, {
208
163
  fieldName: e.name,
209
- value: a,
210
- options: n
164
+ value: n,
165
+ options: t
211
166
  });
212
167
  case "checkbox":
213
168
  return u(l.FORM_CHECKBOX, {
@@ -217,80 +172,80 @@ function f(e, t) {
217
172
  case "radio":
218
173
  return u(l.FORM_RADIO, {
219
174
  fieldName: e.name,
220
- ...t
175
+ ...s
221
176
  });
222
177
  case "button":
223
178
  return u(l.FORM_BUTTON, {
224
179
  fieldName: e.name,
225
- ...t
180
+ ...s
226
181
  });
227
182
  }
228
183
  }
229
- async function $(e, t, n) {
230
- var s;
231
- let a = e.target.parentNode;
232
- if (a.tagName === "DIV" && (a = a.firstChild), B(a), typeof a.className != "object")
233
- if (a.className === "linkAnnotation" && e.type === "click") {
234
- const r = (s = a.dataset) == null ? void 0 : s.annotationId;
235
- if (r) {
236
- const o = d("id", r, n);
237
- if (o.length)
238
- return await w(o[0], t);
184
+ async function S(e, s, t) {
185
+ var a;
186
+ let n = e.target.parentNode;
187
+ if (n.tagName === "DIV" && (n = n.firstChild), typeof n.className != "object")
188
+ if (n.className === "linkAnnotation" && e.type === "click") {
189
+ const o = (a = n.dataset) == null ? void 0 : a.annotationId;
190
+ if (o) {
191
+ const i = d("id", o, t);
192
+ if (i.length)
193
+ return await _(i[0], s);
239
194
  }
240
195
  } else if (
241
196
  /* annotation.className.includes('popupAnnotation') || */
242
- a.className.includes("textAnnotation")
197
+ n.className.includes("textAnnotation")
243
198
  )
244
- O(a);
245
- else if (a.className.includes("fileAttachmentAnnotation")) {
246
- O(a);
247
- const r = a.dataset.annotationId;
248
- if (r && e.type === "dblclick")
249
- return S(d("id", r, n)[0]);
250
- } else if (a.className.includes("textWidgetAnnotation") && e.type === "input") {
251
- let r = a.getElementsByTagName("input")[0];
252
- return r || (r = a.getElementsByTagName("textarea")[0]), f(r);
199
+ p(n);
200
+ else if (n.className.includes("fileAttachmentAnnotation")) {
201
+ p(n);
202
+ const o = n.dataset.annotationId;
203
+ if (o && e.type === "dblclick")
204
+ return x(d("id", o, t)[0]);
205
+ } else if (n.className.includes("textWidgetAnnotation") && e.type === "input") {
206
+ let o = n.getElementsByTagName("input")[0];
207
+ return o || (o = n.getElementsByTagName("textarea")[0]), f(o);
253
208
  } else {
254
- if (a.className.includes("choiceWidgetAnnotation") && e.type === "input")
255
- return f(a.getElementsByTagName("select")[0]);
256
- if (a.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
257
- return f(a.getElementsByTagName("input")[0]);
258
- if (a.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
259
- const r = a.dataset.annotationId;
260
- if (r) {
261
- const o = d("id", r, n)[0], c = [];
262
- for (const i of d(
209
+ if (n.className.includes("choiceWidgetAnnotation") && e.type === "input")
210
+ return f(n.getElementsByTagName("select")[0]);
211
+ if (n.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
212
+ return f(n.getElementsByTagName("input")[0]);
213
+ if (n.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
214
+ const o = n.dataset.annotationId;
215
+ if (o) {
216
+ const i = d("id", o, t)[0], c = [];
217
+ for (const r of d(
263
218
  "fieldName",
264
- o.fieldName,
265
- n
219
+ i.fieldName,
220
+ t
266
221
  ))
267
- i.buttonValue && c.push(i.buttonValue);
268
- return f(a.getElementsByTagName("input")[0], {
269
- value: o.buttonValue,
270
- defaultValue: o.fieldValue,
222
+ r.buttonValue && c.push(r.buttonValue);
223
+ return f(n.getElementsByTagName("input")[0], {
224
+ value: i.buttonValue,
225
+ defaultValue: i.fieldValue,
271
226
  options: c
272
227
  });
273
228
  }
274
- } else if (a.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
275
- const r = a.dataset.annotationId;
276
- if (r) {
277
- const o = d("id", r, n)[0], { action: c } = o;
278
- return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: o } : o.resetForm ? f(
279
- { name: o.fieldName, type: "button" },
280
- { actions: o.actions, reset: !0 }
229
+ } else if (n.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
230
+ const o = n.dataset.annotationId;
231
+ if (o) {
232
+ const i = d("id", o, t)[0], { action: c } = i;
233
+ return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: i } : i.resetForm ? f(
234
+ { name: i.fieldName, type: "button" },
235
+ { actions: i.actions, reset: !0 }
281
236
  ) : f(
282
- { name: o.fieldName, type: "button" },
283
- { actions: o.actions, reset: !1 }
237
+ { name: i.fieldName, type: "button" },
238
+ { actions: i.actions, reset: !1 }
284
239
  );
285
240
  }
286
241
  }
287
242
  }
288
243
  }
289
244
  export {
290
- $ as annotationEventsHandler,
291
- M as annotationsEvents,
292
- H as bindLayerEvents,
293
- U as handleAnnotationLink,
294
- V as handleAnnotationWidget,
295
- P as unbindLayerEvents
245
+ S as annotationEventsHandler,
246
+ C as bindLayerEvents,
247
+ w as handleAnnotationLink,
248
+ L as handleAnnotationWidget,
249
+ R as insertDateText,
250
+ F as unbindLayerEvents
296
251
  };
@@ -1,5 +1,5 @@
1
1
  const a = (i, h, l, o, n) => {
2
- const c = l.height * o, s = l.width * o, y = l.top * o, w = l.left * o, d = {
2
+ const c = l.height * o, s = l.width * o, y = l.bottom * o, m = l.left * o, d = {
3
3
  width: n % 180 === 90 ? i.height : i.width,
4
4
  height: n % 180 === 90 ? i.width : i.height
5
5
  }, r = {
@@ -8,16 +8,16 @@ const a = (i, h, l, o, n) => {
8
8
  }, t = document.createElement("div");
9
9
  t.style.width = `${d.width}px`, t.style.height = `${d.height}px`, t.style.position = "absolute", t.style.transform = `rotate(${n}deg)`, t.style.transformOrigin = "center center", t.style.visibility = "hidden", t.style.left = "-99999px";
10
10
  const e = document.createElement("div");
11
- e.style.position = "absolute", e.style.width = `${s}px`, e.style.height = `${c}px`, e.style.position = "absolute", e.style.bottom = `${y}px`, e.style.left = `${w}px`, t.appendChild(e), h.appendChild(t);
12
- const p = t.getBoundingClientRect(), g = e.getBoundingClientRect();
11
+ e.style.position = "absolute", e.style.width = `${s}px`, e.style.height = `${c}px`, e.style.position = "absolute", e.style.bottom = `${y}px`, e.style.left = `${m}px`, t.appendChild(e), h.appendChild(t);
12
+ const g = t.getBoundingClientRect(), p = e.getBoundingClientRect();
13
13
  h.removeChild(t);
14
14
  const u = {
15
15
  top: h.clientHeight / 2,
16
16
  left: h.clientWidth / 2
17
17
  };
18
18
  return {
19
- leftInPage: g.left - p.left - u.left + r.width / 2,
20
- topInPage: g.top - p.top - u.top + r.height / 2
19
+ leftInPage: p.left - g.left - u.left + r.width / 2,
20
+ topInPage: p.top - g.top - u.top + r.height / 2
21
21
  };
22
22
  };
23
23
  export {