@react-pdf-kit/viewer 2.0.0-beta.1 → 2.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/Combination-54a77a7a.js +701 -0
- package/dist/MostPageTool.module-13578ad6.js +6 -0
- package/dist/OtherTool.module-a4be5f1f.js +6 -0
- package/dist/Paginate.module-206a7d7d.js +8 -0
- package/dist/PaginationContext-9217cab4.js +201 -0
- package/dist/{LayoutWrapper-6224491f.js → RPLayout.module-967bf4bc.js} +3 -9
- package/dist/RPToolbar.module-27d7fe77.js +10 -0
- package/dist/SearchTool.module-99f60dc7.js +16 -0
- package/dist/ToolbarLayout.module-1fee0a18.js +11 -0
- package/dist/ZoomTool.module-7082af8c.js +12 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +32 -31
- package/dist/components/RPConfig.js +10 -1485
- package/dist/components/RPController.js +77 -148
- package/dist/components/RPPages.js +981 -124
- package/dist/components/RPProvider.js +56 -118
- package/dist/components/icons/DualPageIcon.js +6 -6
- package/dist/components/icons/SinglePageIcon.js +6 -6
- package/dist/components/layout/LayoutContainer.js +31 -138
- package/dist/components/layout/LayoutWrapper.js +8 -4
- package/dist/components/layout/RPDefaultLayout.js +162 -88
- package/dist/components/layout/RPLayout.js +119 -107
- package/dist/components/layout/sidebar/RPSidebar.js +83 -113
- package/dist/components/layout/sidebar/Thumbnail.js +120 -126
- package/dist/components/layout/sidebar/Thumbnails.js +56 -121
- package/dist/components/layout/toolbar/DarkModeTool.js +6 -4
- package/dist/components/layout/toolbar/DocumentDialog.js +304 -132
- package/dist/components/layout/toolbar/DocumentProperties.js +12 -9
- package/dist/components/layout/toolbar/FileDownloadTool.js +34 -126
- package/dist/components/layout/toolbar/FileUploadTool.js +8 -5
- package/dist/components/layout/toolbar/FullScreenTool.js +16 -13
- package/dist/components/layout/toolbar/MenuItem.js +11 -8
- package/dist/components/layout/toolbar/MenuSeparator.js +8 -5
- package/dist/components/layout/toolbar/MostPageTool.js +64 -125
- package/dist/components/layout/toolbar/OtherTool.js +162 -114
- package/dist/components/layout/toolbar/Paginate.js +113 -117
- package/dist/components/layout/toolbar/PrintTool.js +55 -125
- package/dist/components/layout/toolbar/RPMenuItem.js +14 -11
- package/dist/components/layout/toolbar/RPMoreOptions.js +66 -121
- package/dist/components/layout/toolbar/RPToolbar.js +89 -81
- package/dist/components/layout/toolbar/RPToolbarEnd.js +68 -90
- package/dist/components/layout/toolbar/RotateTool.js +12 -9
- package/dist/components/layout/toolbar/ScrollModeTool.js +14 -11
- package/dist/components/layout/toolbar/SearchCloseButton.js +23 -9
- package/dist/components/layout/toolbar/SearchResultNavigator.js +53 -106
- package/dist/components/layout/toolbar/SearchTool.js +222 -121
- package/dist/components/layout/toolbar/SelectionModeTool.js +8 -5
- package/dist/components/layout/toolbar/ThumbnailTool.js +15 -124
- package/dist/components/layout/toolbar/ToolbarCustom.js +44 -130
- package/dist/components/layout/toolbar/ToolbarDefault.js +122 -120
- package/dist/components/layout/toolbar/ToolbarLayout.js +85 -83
- package/dist/components/layout/toolbar/ViewModeTool.js +10 -7
- package/dist/components/layout/toolbar/ZoomTool.js +128 -120
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +17 -123
- package/dist/components/layout/toolbar/tools/DualPageTool.js +26 -0
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +10 -121
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +6 -4
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +13 -11
- package/dist/components/layout/toolbar/tools/InputPageTool.js +19 -112
- package/dist/components/layout/toolbar/tools/NextPageTool.js +30 -123
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +16 -109
- package/dist/components/layout/toolbar/tools/PrintTool.js +12 -123
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +6 -4
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +6 -4
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +31 -0
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +26 -0
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +6 -4
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +17 -128
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +6 -4
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +22 -137
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +26 -123
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +6 -4
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +95 -105
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +16 -125
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +8 -5
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +10 -117
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +12 -120
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +10 -7
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +36 -125
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +16 -123
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +14 -11
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +15 -12
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +18 -15
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +10 -7
- package/dist/components/page/AnnotationLayer.js +122 -126
- package/dist/components/page/CanvasLayer.js +54 -125
- package/dist/components/page/DualPage.js +68 -111
- package/dist/components/page/RPPage.js +126 -125
- package/dist/components/page/SinglePage.js +58 -111
- package/dist/components/page/TextHighlightLayer.js +184 -128
- package/dist/components/page/TextLayer.js +184 -125
- package/dist/components/ui/Checkbox.js +25 -24
- package/dist/components/ui/DropDown.js +11 -8
- package/dist/components/ui/LoadingIndicator.js +34 -129
- package/dist/components/ui/RPTooltip.js +412 -196
- package/dist/contexts/ElementPageContext.js +1 -1
- package/dist/contexts/FullScreenContext.js +17 -10
- package/dist/contexts/LocalizationContext.js +24 -29
- package/dist/contexts/PaginationContext.js +14 -119
- package/dist/contexts/PrintContext.js +67 -133
- package/dist/contexts/RPDocumentContext.js +32 -24
- package/dist/contexts/RenderQueueProvider.js +47 -119
- package/dist/contexts/SearchContext.js +65 -113
- package/dist/contexts/ThumbnailsContext.js +32 -133
- package/dist/contexts/ZoomContext.js +22 -22
- package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
- package/dist/index-4baea9b5.js +1198 -0
- package/dist/index-655864a7.js +27 -0
- package/dist/{index-c9a2990a.js → index-c0faa594.js} +64 -87
- package/dist/index-e3ee9457.js +150 -0
- package/dist/main.js +193 -142
- package/dist/types/components/icons/DualPageIcon.d.ts +1 -1
- package/dist/types/components/icons/SinglePageIcon.d.ts +1 -1
- package/dist/types/components/layout/toolbar/tools/DualPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/SelectionModeSwitcherTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/SinglePageTool.d.ts +3 -0
- package/dist/types/contexts/RenderQueueProvider.d.ts +2 -2
- package/dist/types/main.d.ts +5 -5
- package/dist/types/utils/annotations.d.ts +2 -1
- package/dist/types/utils/getElementPositionInPage.d.ts +2 -2
- package/dist/types/utils/hooks/useCopyText.d.ts +1 -0
- package/dist/types/utils/hooks/usePrint.d.ts +3 -2
- package/dist/types/utils/hooks/useSearch.d.ts +1 -2
- package/dist/types/utils/renderPage.d.ts +2 -2
- package/dist/types/utils/types.d.ts +27 -4
- package/dist/utils/annotations.js +128 -142
- package/dist/utils/getWordPositionInPage.js +5 -5
- package/dist/utils/highlight.js +72 -72
- package/dist/utils/hooks/useCopyText.js +36 -0
- package/dist/utils/hooks/useFileDownload.js +20 -129
- package/dist/utils/hooks/useHighlight.js +28 -28
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +42 -39
- package/dist/utils/hooks/useLoadWorker.js +9 -6
- package/dist/utils/hooks/useLocalization.js +13 -13
- package/dist/utils/hooks/usePaginate.js +21 -126
- package/dist/utils/hooks/usePresentPage.js +75 -127
- package/dist/utils/hooks/usePrint.js +173 -130
- package/dist/utils/hooks/useScrollToPage.js +15 -120
- package/dist/utils/hooks/useSearch.js +132 -126
- package/dist/utils/hooks/useThumbnail.js +47 -130
- package/dist/utils/hooks/useVirtualReactWindow.js +64 -128
- package/dist/utils/injectPrintCSS.js +1 -1
- package/dist/utils/renderPage.js +12 -10
- package/package.json +26 -23
- package/dist/SearchCloseButton-08d57275.js +0 -33
- package/dist/ToolbarLayout.module-37619c4b.js +0 -3548
- package/dist/index-808ea7bf.js +0 -1685
- package/dist/index-a48ec088.js +0 -1672
|
@@ -224,10 +224,11 @@ export interface DarkModeProps {
|
|
|
224
224
|
export interface DarkMode extends DarkModeProps {
|
|
225
225
|
onDarkModeChange: (value: boolean) => void;
|
|
226
226
|
}
|
|
227
|
-
export interface
|
|
227
|
+
export interface RenderOptions {
|
|
228
228
|
scale?: number;
|
|
229
229
|
rotate?: number;
|
|
230
230
|
renderForms?: boolean;
|
|
231
|
+
interactiveForm?: boolean;
|
|
231
232
|
}
|
|
232
233
|
export interface License {
|
|
233
234
|
validating?: boolean;
|
|
@@ -321,13 +322,18 @@ export interface PreparePrintProgress {
|
|
|
321
322
|
totalPages: number;
|
|
322
323
|
percentage: number;
|
|
323
324
|
}
|
|
325
|
+
export interface PrintConfiguration {
|
|
326
|
+
visibleDefaultProgress?: boolean;
|
|
327
|
+
}
|
|
328
|
+
export type PrintOptions = PrintConfiguration | React.MouseEvent<{}>;
|
|
324
329
|
export interface PrintToolProps {
|
|
325
|
-
print: () => void
|
|
330
|
+
print: (options?: PrintOptions) => Promise<void>;
|
|
326
331
|
cancel: () => void;
|
|
327
332
|
setOnProgress: (callback: (progress: PreparePrintProgress) => void) => void;
|
|
328
333
|
setOnComplete: (callback: () => void) => void;
|
|
329
334
|
setOnError: (callback: (error: Error) => void) => void;
|
|
330
335
|
progress: PreparePrintProgress;
|
|
336
|
+
showDefaultProgress?: boolean;
|
|
331
337
|
}
|
|
332
338
|
export interface ThumbnailToolProps {
|
|
333
339
|
onClick: () => void;
|
|
@@ -474,6 +480,7 @@ export interface RPControllerProps extends PropsWithChildren, DarkModeProviderPr
|
|
|
474
480
|
localization?: LocalizationMap;
|
|
475
481
|
downloadFilename?: string;
|
|
476
482
|
initialSelectionMode?: SelectionMode;
|
|
483
|
+
interactiveForm?: boolean;
|
|
477
484
|
}
|
|
478
485
|
export interface RPConfigProps extends Omit<ConfigContextType, 'workerUrlAdded'>, RPThemeContextType, PropsWithChildren {
|
|
479
486
|
workerUrl?: string;
|
|
@@ -508,6 +515,7 @@ export interface ZoomContextType {
|
|
|
508
515
|
export type ZoomProps = Omit<ZoomContextType, 'currentZoom'>;
|
|
509
516
|
export type InitialStateContextType = {
|
|
510
517
|
instanceId: string;
|
|
518
|
+
interactiveForm?: boolean;
|
|
511
519
|
} & ZoomProviderProps & PageProviderProps & ViewModeInitialProps & ScrollModeInitialProps & RotateProviderProps;
|
|
512
520
|
export interface ZoomProviderProps {
|
|
513
521
|
initialScale?: number | ZoomLevel;
|
|
@@ -541,6 +549,12 @@ export interface ScrollModeInitialProps {
|
|
|
541
549
|
initialScrollMode?: ScrollMode;
|
|
542
550
|
}
|
|
543
551
|
export interface RectPosition {
|
|
552
|
+
left: number;
|
|
553
|
+
bottom: number;
|
|
554
|
+
width: number;
|
|
555
|
+
height: number;
|
|
556
|
+
}
|
|
557
|
+
export interface ElementPosition {
|
|
544
558
|
left: number;
|
|
545
559
|
top: number;
|
|
546
560
|
width: number;
|
|
@@ -611,8 +625,7 @@ export interface SearchContextType {
|
|
|
611
625
|
prevMatch: () => void;
|
|
612
626
|
searchOptions: SearchOptions;
|
|
613
627
|
setSearchOptions: Dispatch<SetStateAction<SearchOptions>>;
|
|
614
|
-
|
|
615
|
-
setCurrentMatchElement: Dispatch<SetStateAction<HTMLElement | null>>;
|
|
628
|
+
setCurrentMatchPosition: Dispatch<React.SetStateAction<number>>;
|
|
616
629
|
}
|
|
617
630
|
export declare enum SelectionMode {
|
|
618
631
|
TEXT = "TEXT",
|
|
@@ -631,6 +644,9 @@ export interface LoadPDFOptions {
|
|
|
631
644
|
onLoaded?: (pdfDocument: PDFDocumentProxy) => void;
|
|
632
645
|
onLoadProgress?: (progress: number) => void;
|
|
633
646
|
loaderImage?: LoaderImage;
|
|
647
|
+
disableAutoFetch?: boolean;
|
|
648
|
+
disableStream?: boolean;
|
|
649
|
+
rangeChunkSize?: number;
|
|
634
650
|
}
|
|
635
651
|
export interface ScrollPosition {
|
|
636
652
|
left: number;
|
|
@@ -720,6 +736,13 @@ export interface ThemeSwitcherIcons {
|
|
|
720
736
|
export interface ThemeSwitcherToolProps {
|
|
721
737
|
icons?: ThemeSwitcherIcons;
|
|
722
738
|
}
|
|
739
|
+
export interface SelectionModeSwitcherIcons {
|
|
740
|
+
textSelectionIcon?: React.ReactNode;
|
|
741
|
+
handModeIcon?: React.ReactNode;
|
|
742
|
+
}
|
|
743
|
+
export interface SelectionModeSwitcherToolProps {
|
|
744
|
+
icons?: SelectionModeSwitcherIcons;
|
|
745
|
+
}
|
|
723
746
|
export interface ToolbarSection {
|
|
724
747
|
component: React.ReactNode;
|
|
725
748
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { sanitizeExternalUrl as
|
|
1
|
+
import { sanitizeExternalUrl as I } from "./sanitizeExternalUrl.js";
|
|
2
2
|
import { AnnotationType as l } from "./types.js";
|
|
3
|
-
import { dateFormatter as
|
|
3
|
+
import { dateFormatter as B } from "./dateFormatter.js";
|
|
4
4
|
import "../th_TH-d627cd51.js";
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
const n =
|
|
8
|
-
return
|
|
5
|
+
const v = ["click", "dblclick", "input", "change", "mouseover"], g = /* @__PURE__ */ new Map(), x = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
|
|
6
|
+
function C(e, t) {
|
|
7
|
+
const n = x(e, t);
|
|
8
|
+
return g.has(n) ? g.get(n) ?? null : null;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
},
|
|
10
|
+
const S = (e, t, n) => {
|
|
11
|
+
g.set(x(e, t), n);
|
|
12
|
+
}, T = (e, t) => {
|
|
13
13
|
switch (t[1].name) {
|
|
14
14
|
case "XYZ":
|
|
15
15
|
return {
|
|
16
|
-
bottomOffset: (n,
|
|
17
|
-
leftOffset: (n,
|
|
16
|
+
bottomOffset: (n, s) => t[3] === null ? s : t[3],
|
|
17
|
+
leftOffset: (n, s) => t[2] === null ? 0 : t[2],
|
|
18
18
|
pageIndex: e,
|
|
19
19
|
scaleTo: t[4]
|
|
20
20
|
};
|
|
@@ -42,110 +42,95 @@ const x = (e, t, n) => {
|
|
|
42
42
|
scaleTo: 1
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
}, M = (e) => {
|
|
46
|
+
e && (() => {
|
|
47
|
+
const n = e == null ? void 0 : e.querySelectorAll(
|
|
48
|
+
'[data-l10n-id="pdfjs-annotation-date-time-string"]'
|
|
49
|
+
);
|
|
50
|
+
n == null || n.forEach((s) => {
|
|
51
|
+
const { date: a, time: o, dateObj: i } = JSON.parse(s.dataset.l10nArgs ?? "{}");
|
|
52
|
+
a && o ? s.textContent = `${a}, ${o}` : i && (s.textContent = B(i));
|
|
53
|
+
});
|
|
54
|
+
})();
|
|
45
55
|
};
|
|
46
56
|
async function E(e, t) {
|
|
47
57
|
let n;
|
|
48
58
|
if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
return
|
|
59
|
+
const s = n[0], a = C(e, s);
|
|
60
|
+
if (a === null) {
|
|
61
|
+
const o = await e.getPageIndex(s);
|
|
62
|
+
return S(e, s, o), await E(e, n);
|
|
53
63
|
} else
|
|
54
|
-
return
|
|
64
|
+
return T(a, n);
|
|
55
65
|
} else
|
|
56
|
-
return
|
|
66
|
+
return T(n[0], n);
|
|
57
67
|
}
|
|
58
|
-
|
|
59
|
-
const n
|
|
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)
|
|
68
|
+
function P(e, t) {
|
|
69
|
+
for (const n of v)
|
|
90
70
|
e.addEventListener(n, t);
|
|
91
71
|
}
|
|
92
|
-
function
|
|
93
|
-
for (const n of
|
|
72
|
+
function $(e, t) {
|
|
73
|
+
for (const n of v)
|
|
94
74
|
e.removeEventListener(n, t);
|
|
95
75
|
}
|
|
96
|
-
function
|
|
97
|
-
const { id: t, url: n, unsafeUrl:
|
|
98
|
-
new MutationObserver((
|
|
76
|
+
function D(e) {
|
|
77
|
+
const { id: t, url: n, unsafeUrl: s } = e;
|
|
78
|
+
new MutationObserver((o, i) => {
|
|
99
79
|
const c = document.querySelector(`[data-annotation-id="${t}"]`);
|
|
100
80
|
if (c) {
|
|
101
|
-
const
|
|
102
|
-
|
|
81
|
+
const r = c.querySelector("a"), p = I((n || s) ?? "", "");
|
|
82
|
+
r && (r == null || r.setAttribute("target", "_blank"), r == null || r.setAttribute("href", p), r == null || r.setAttribute("rel", "noopener noreferrer")), i.disconnect();
|
|
103
83
|
}
|
|
104
84
|
}).observe(document.body, { childList: !0, subtree: !0 });
|
|
105
85
|
}
|
|
106
|
-
function
|
|
107
|
-
const { rotation:
|
|
86
|
+
function U(e, t, n) {
|
|
87
|
+
const { rotation: s, scale: a } = t, o = s % 180 === 0;
|
|
108
88
|
if (e.fieldType === "Btn" && e.pushButton) {
|
|
109
|
-
const
|
|
110
|
-
|
|
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()), n.set(e.id, r);
|
|
111
91
|
}
|
|
112
92
|
}
|
|
113
|
-
function
|
|
114
|
-
var
|
|
93
|
+
function V(e) {
|
|
94
|
+
var o;
|
|
115
95
|
let t = e;
|
|
116
96
|
for (; t.tagName !== "SECTION"; )
|
|
117
97
|
t = t.parentElement;
|
|
118
|
-
const n = t.getAttribute("aria-haspopup") === "dialog",
|
|
119
|
-
if (!n && !
|
|
98
|
+
const n = t.getAttribute("aria-haspopup") === "dialog", s = t.classList.contains("popupAnnotation");
|
|
99
|
+
if (!n && !s)
|
|
120
100
|
return;
|
|
121
|
-
let
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
124
|
-
|
|
101
|
+
let a = t.id || t.getAttribute("aria-controls");
|
|
102
|
+
if (a || (a = (o = t.firstChild) == null ? void 0 : o.id), a && t.parentElement) {
|
|
103
|
+
const i = t.parentElement.querySelector(`[aria-controls="${a}"]`);
|
|
104
|
+
i && new MutationObserver((r, p) => {
|
|
125
105
|
const b = document.querySelectorAll(".popupDate");
|
|
126
|
-
b.length > 0 && (b.forEach((
|
|
127
|
-
if (
|
|
106
|
+
b.length > 0 && (b.forEach((m) => {
|
|
107
|
+
if (m.innerHTML)
|
|
128
108
|
return !1;
|
|
129
|
-
const N =
|
|
109
|
+
const N = m.getAttribute("data-l10n-args");
|
|
130
110
|
if (N) {
|
|
131
|
-
const { date: h, time:
|
|
132
|
-
h &&
|
|
111
|
+
const { date: h, time: O, dateObj: A } = JSON.parse(N);
|
|
112
|
+
if (h && O)
|
|
113
|
+
m.textContent = `${h}, ${O}`;
|
|
114
|
+
else if (A) {
|
|
115
|
+
const _ = new Date(A);
|
|
116
|
+
m.textContent = _.toLocaleString();
|
|
117
|
+
}
|
|
133
118
|
}
|
|
134
119
|
}), p.disconnect());
|
|
135
|
-
}).observe(
|
|
120
|
+
}).observe(i, { childList: !0, subtree: !0 });
|
|
136
121
|
}
|
|
137
122
|
}
|
|
138
123
|
function d(e, t, n) {
|
|
139
|
-
const
|
|
124
|
+
const s = [];
|
|
140
125
|
if (n)
|
|
141
|
-
for (const
|
|
142
|
-
|
|
143
|
-
return
|
|
126
|
+
for (const a of n)
|
|
127
|
+
a[e] === t && s.push(a);
|
|
128
|
+
return s;
|
|
144
129
|
}
|
|
145
130
|
function u(e, t) {
|
|
146
131
|
return { type: e, data: t };
|
|
147
132
|
}
|
|
148
|
-
async function
|
|
133
|
+
async function k(e, t) {
|
|
149
134
|
if (e.dest)
|
|
150
135
|
if (typeof e.dest == "string") {
|
|
151
136
|
const n = await E(t, e.dest);
|
|
@@ -169,17 +154,17 @@ async function w(e, t) {
|
|
|
169
154
|
unsafeUrl: e.unsafeUrl
|
|
170
155
|
});
|
|
171
156
|
}
|
|
172
|
-
function
|
|
157
|
+
function y(e) {
|
|
173
158
|
for (const t of e.getElementsByTagName("span")) {
|
|
174
159
|
let n = t.textContent;
|
|
175
|
-
const
|
|
160
|
+
const s = JSON.parse(t.dataset.l10nArgs ?? "{}");
|
|
176
161
|
if (n)
|
|
177
|
-
for (const
|
|
178
|
-
n = n.replace(`{{${
|
|
162
|
+
for (const a in s)
|
|
163
|
+
n = n.replace(`{{${a}}}`, s[a]);
|
|
179
164
|
t.textContent = n;
|
|
180
165
|
}
|
|
181
166
|
}
|
|
182
|
-
function
|
|
167
|
+
function w(e) {
|
|
183
168
|
return u(l.FILE_ATTACHMENT, e.file);
|
|
184
169
|
}
|
|
185
170
|
function f(e, t) {
|
|
@@ -193,20 +178,20 @@ function f(e, t) {
|
|
|
193
178
|
case "select-one":
|
|
194
179
|
case "select-multiple":
|
|
195
180
|
const n = [];
|
|
196
|
-
for (const
|
|
181
|
+
for (const a of e.options)
|
|
197
182
|
n.push({
|
|
198
|
-
value:
|
|
199
|
-
label:
|
|
183
|
+
value: a.value,
|
|
184
|
+
label: a.label
|
|
200
185
|
});
|
|
201
|
-
const
|
|
202
|
-
for (const
|
|
203
|
-
|
|
204
|
-
value:
|
|
205
|
-
label:
|
|
186
|
+
const s = [];
|
|
187
|
+
for (const a of e.selectedOptions)
|
|
188
|
+
s.push({
|
|
189
|
+
value: a.value,
|
|
190
|
+
label: a.label
|
|
206
191
|
});
|
|
207
192
|
return u(l.FORM_SELECT, {
|
|
208
193
|
fieldName: e.name,
|
|
209
|
-
value:
|
|
194
|
+
value: s,
|
|
210
195
|
options: n
|
|
211
196
|
});
|
|
212
197
|
case "checkbox":
|
|
@@ -226,71 +211,72 @@ function f(e, t) {
|
|
|
226
211
|
});
|
|
227
212
|
}
|
|
228
213
|
}
|
|
229
|
-
async function
|
|
230
|
-
var
|
|
231
|
-
let
|
|
232
|
-
if (
|
|
233
|
-
if (
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
return await
|
|
214
|
+
async function j(e, t, n) {
|
|
215
|
+
var a;
|
|
216
|
+
let s = e.target.parentNode;
|
|
217
|
+
if (s.tagName === "DIV" && (s = s.firstChild), typeof s.className != "object")
|
|
218
|
+
if (s.className === "linkAnnotation" && e.type === "click") {
|
|
219
|
+
const o = (a = s.dataset) == null ? void 0 : a.annotationId;
|
|
220
|
+
if (o) {
|
|
221
|
+
const i = d("id", o, n);
|
|
222
|
+
if (i.length)
|
|
223
|
+
return await k(i[0], t);
|
|
239
224
|
}
|
|
240
225
|
} else if (
|
|
241
226
|
/* annotation.className.includes('popupAnnotation') || */
|
|
242
|
-
|
|
227
|
+
s.className.includes("textAnnotation")
|
|
243
228
|
)
|
|
244
|
-
|
|
245
|
-
else if (
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
249
|
-
return
|
|
250
|
-
} else if (
|
|
251
|
-
let
|
|
252
|
-
return
|
|
229
|
+
y(s);
|
|
230
|
+
else if (s.className.includes("fileAttachmentAnnotation")) {
|
|
231
|
+
y(s);
|
|
232
|
+
const o = s.dataset.annotationId;
|
|
233
|
+
if (o && e.type === "dblclick")
|
|
234
|
+
return w(d("id", o, n)[0]);
|
|
235
|
+
} else if (s.className.includes("textWidgetAnnotation") && e.type === "input") {
|
|
236
|
+
let o = s.getElementsByTagName("input")[0];
|
|
237
|
+
return o || (o = s.getElementsByTagName("textarea")[0]), f(o);
|
|
253
238
|
} else {
|
|
254
|
-
if (
|
|
255
|
-
return f(
|
|
256
|
-
if (
|
|
257
|
-
return f(
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
261
|
-
const
|
|
262
|
-
for (const
|
|
239
|
+
if (s.className.includes("choiceWidgetAnnotation") && e.type === "input")
|
|
240
|
+
return f(s.getElementsByTagName("select")[0]);
|
|
241
|
+
if (s.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
|
|
242
|
+
return f(s.getElementsByTagName("input")[0]);
|
|
243
|
+
if (s.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
|
|
244
|
+
const o = s.dataset.annotationId;
|
|
245
|
+
if (o) {
|
|
246
|
+
const i = d("id", o, n)[0], c = [];
|
|
247
|
+
for (const r of d(
|
|
263
248
|
"fieldName",
|
|
264
|
-
|
|
249
|
+
i.fieldName,
|
|
265
250
|
n
|
|
266
251
|
))
|
|
267
|
-
|
|
268
|
-
return f(
|
|
269
|
-
value:
|
|
270
|
-
defaultValue:
|
|
252
|
+
r.buttonValue && c.push(r.buttonValue);
|
|
253
|
+
return f(s.getElementsByTagName("input")[0], {
|
|
254
|
+
value: i.buttonValue,
|
|
255
|
+
defaultValue: i.fieldValue,
|
|
271
256
|
options: c
|
|
272
257
|
});
|
|
273
258
|
}
|
|
274
|
-
} else if (
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
const
|
|
278
|
-
return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data:
|
|
279
|
-
{ name:
|
|
280
|
-
{ actions:
|
|
259
|
+
} else if (s.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
|
|
260
|
+
const o = s.dataset.annotationId;
|
|
261
|
+
if (o) {
|
|
262
|
+
const i = d("id", o, n)[0], { action: c } = i;
|
|
263
|
+
return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: i } : i.resetForm ? f(
|
|
264
|
+
{ name: i.fieldName, type: "button" },
|
|
265
|
+
{ actions: i.actions, reset: !0 }
|
|
281
266
|
) : f(
|
|
282
|
-
{ name:
|
|
283
|
-
{ actions:
|
|
267
|
+
{ name: i.fieldName, type: "button" },
|
|
268
|
+
{ actions: i.actions, reset: !1 }
|
|
284
269
|
);
|
|
285
270
|
}
|
|
286
271
|
}
|
|
287
272
|
}
|
|
288
273
|
}
|
|
289
274
|
export {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
U as
|
|
294
|
-
V as
|
|
295
|
-
|
|
275
|
+
j as annotationEventsHandler,
|
|
276
|
+
P as bindLayerEvents,
|
|
277
|
+
D as handleAnnotationLink,
|
|
278
|
+
U as handleAnnotationWidget,
|
|
279
|
+
V as handleAriaHasPopup,
|
|
280
|
+
M as insertDateText,
|
|
281
|
+
$ as unbindLayerEvents
|
|
296
282
|
};
|
|
@@ -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.
|
|
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 = `${
|
|
12
|
-
const
|
|
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:
|
|
20
|
-
topInPage:
|
|
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 {
|