@cannyminds/dms-file-viewers 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-26SS5FLZ.js → chunk-4JX2MJLJ.js} +458 -387
- package/dist/chunk-4JX2MJLJ.js.map +1 -0
- package/dist/{chunk-IY5EEUCU.mjs → chunk-PCLERVB7.mjs} +375 -304
- package/dist/chunk-PCLERVB7.mjs.map +1 -0
- package/dist/components/viewers/AudioViewer.d.mts +1 -1
- package/dist/components/viewers/AudioViewer.d.ts +1 -1
- package/dist/components/viewers/DefaultViewer.d.mts +1 -1
- package/dist/components/viewers/DefaultViewer.d.ts +1 -1
- package/dist/components/viewers/ImageViewer.d.mts +1 -1
- package/dist/components/viewers/ImageViewer.d.ts +1 -1
- package/dist/components/viewers/PDFViewer.d.mts +5 -2
- package/dist/components/viewers/PDFViewer.d.ts +5 -2
- package/dist/components/viewers/PDFViewer.js +2 -2
- package/dist/components/viewers/PDFViewer.mjs +1 -1
- package/dist/components/viewers/TIFFViewer.d.mts +1 -1
- package/dist/components/viewers/TIFFViewer.d.ts +1 -1
- package/dist/components/viewers/TextViewer.d.mts +1 -1
- package/dist/components/viewers/TextViewer.d.ts +1 -1
- package/dist/components/viewers/VideoViewer.d.mts +1 -1
- package/dist/components/viewers/VideoViewer.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +19 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -23
- package/dist/index.mjs.map +1 -1
- package/dist/{types-DFkMK86Q.d.mts → types-BnnKCdrQ.d.mts} +2 -0
- package/dist/{types-DFkMK86Q.d.ts → types-BnnKCdrQ.d.ts} +2 -0
- package/package.json +1 -1
- package/dist/chunk-26SS5FLZ.js.map +0 -1
- package/dist/chunk-IY5EEUCU.mjs.map +0 -1
|
@@ -38,7 +38,8 @@ var StablePDFViewer = React.memo(({
|
|
|
38
38
|
onHighlighterClick,
|
|
39
39
|
onStampClick,
|
|
40
40
|
onSignatureClick,
|
|
41
|
-
permissions
|
|
41
|
+
permissions,
|
|
42
|
+
hideInternalLoading
|
|
42
43
|
}) => {
|
|
43
44
|
return /* @__PURE__ */ jsx(
|
|
44
45
|
HeadlessPDFViewer,
|
|
@@ -54,7 +55,8 @@ var StablePDFViewer = React.memo(({
|
|
|
54
55
|
onHighlighterClick,
|
|
55
56
|
onStampClick,
|
|
56
57
|
onSignatureClick,
|
|
57
|
-
permissions
|
|
58
|
+
permissions,
|
|
59
|
+
hideInternalLoading
|
|
58
60
|
}
|
|
59
61
|
);
|
|
60
62
|
});
|
|
@@ -108,6 +110,13 @@ var PDFToolbar = React2.memo(
|
|
|
108
110
|
showPrint,
|
|
109
111
|
showRotation,
|
|
110
112
|
showAnnotations,
|
|
113
|
+
// Destructure new props with defaults
|
|
114
|
+
showAnnotate = true,
|
|
115
|
+
disabledAnnotate = false,
|
|
116
|
+
showPrintOriginal = true,
|
|
117
|
+
showPrintWithAnnotations = true,
|
|
118
|
+
showDownloadOriginal = true,
|
|
119
|
+
showDownloadWithAnnotations = true,
|
|
111
120
|
isHighlighterActive,
|
|
112
121
|
isStampActive,
|
|
113
122
|
disabledRotateLeft,
|
|
@@ -118,6 +127,7 @@ var PDFToolbar = React2.memo(
|
|
|
118
127
|
disabledHistory,
|
|
119
128
|
disabledDownload,
|
|
120
129
|
disabledPrint,
|
|
130
|
+
disabledCopy,
|
|
121
131
|
disabledHighlighter,
|
|
122
132
|
disabledStamp,
|
|
123
133
|
disabledSignature,
|
|
@@ -136,9 +146,12 @@ var PDFToolbar = React2.memo(
|
|
|
136
146
|
onRotateLeft,
|
|
137
147
|
onRotateRight,
|
|
138
148
|
onDownloadClick,
|
|
149
|
+
onDownloadWithAnnotations,
|
|
150
|
+
onDownloadWithoutAnnotations,
|
|
139
151
|
onPrintClick,
|
|
140
152
|
onPrintWithAnnotations,
|
|
141
153
|
onPrintWithoutAnnotations,
|
|
154
|
+
onCopyClick,
|
|
142
155
|
onMetadataClick,
|
|
143
156
|
onPropertiesClick,
|
|
144
157
|
onTagsClick,
|
|
@@ -153,9 +166,11 @@ var PDFToolbar = React2.memo(
|
|
|
153
166
|
onSaveAnnotations
|
|
154
167
|
}) => {
|
|
155
168
|
const [isPrintMenuOpen, setIsPrintMenuOpen] = useState(false);
|
|
169
|
+
const [isDownloadMenuOpen, setIsDownloadMenuOpen] = useState(false);
|
|
156
170
|
const [isAnnotationMenuOpen, setIsAnnotationMenuOpen] = useState(false);
|
|
157
171
|
const [isViewMenuOpen, setIsViewMenuOpen] = useState(false);
|
|
158
172
|
const printMenuRef = useRef(null);
|
|
173
|
+
const downloadMenuRef = useRef(null);
|
|
159
174
|
const annotationMenuRef = useRef(null);
|
|
160
175
|
const viewMenuRef = useRef(null);
|
|
161
176
|
useEffect(() => {
|
|
@@ -163,6 +178,9 @@ var PDFToolbar = React2.memo(
|
|
|
163
178
|
if (printMenuRef.current && !printMenuRef.current.contains(event.target)) {
|
|
164
179
|
setIsPrintMenuOpen(false);
|
|
165
180
|
}
|
|
181
|
+
if (downloadMenuRef.current && !downloadMenuRef.current.contains(event.target)) {
|
|
182
|
+
setIsDownloadMenuOpen(false);
|
|
183
|
+
}
|
|
166
184
|
if (annotationMenuRef.current && !annotationMenuRef.current.contains(event.target)) {
|
|
167
185
|
setIsAnnotationMenuOpen(false);
|
|
168
186
|
}
|
|
@@ -181,12 +199,20 @@ var PDFToolbar = React2.memo(
|
|
|
181
199
|
setIsPrintMenuOpen(false);
|
|
182
200
|
onPrintWithoutAnnotations?.();
|
|
183
201
|
};
|
|
202
|
+
const handleDownloadWithAnnotations = () => {
|
|
203
|
+
setIsDownloadMenuOpen(false);
|
|
204
|
+
onDownloadWithAnnotations?.();
|
|
205
|
+
};
|
|
206
|
+
const handleDownloadWithoutAnnotations = () => {
|
|
207
|
+
setIsDownloadMenuOpen(false);
|
|
208
|
+
onDownloadWithoutAnnotations?.();
|
|
209
|
+
};
|
|
184
210
|
const [activeMode, setActiveMode] = useState("view");
|
|
185
211
|
return /* @__PURE__ */ jsxs("div", { className: "pdf-viewer-toolbar-container", children: [
|
|
186
212
|
/* @__PURE__ */ jsxs("div", { className: "pdf-viewer-toolbar", children: [
|
|
187
213
|
/* @__PURE__ */ jsxs("div", { className: "toolbar-left", children: [
|
|
188
214
|
showPageNavigation && /* @__PURE__ */ jsxs("div", { className: "toolbar-section", children: [
|
|
189
|
-
/* @__PURE__ */ jsx2(Tooltip, { title: "First Page", children: /* @__PURE__ */ jsx2(
|
|
215
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "First Page", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
190
216
|
"button",
|
|
191
217
|
{
|
|
192
218
|
className: "toolbar-button",
|
|
@@ -194,8 +220,8 @@ var PDFToolbar = React2.memo(
|
|
|
194
220
|
disabled: currentPage <= 1,
|
|
195
221
|
children: /* @__PURE__ */ jsx2(FirstPageIcon, { fontSize: "small" })
|
|
196
222
|
}
|
|
197
|
-
) }),
|
|
198
|
-
/* @__PURE__ */ jsx2(Tooltip, { title: "Previous Page", children: /* @__PURE__ */ jsx2(
|
|
223
|
+
) }) }),
|
|
224
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Previous Page", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
199
225
|
"button",
|
|
200
226
|
{
|
|
201
227
|
className: "toolbar-button",
|
|
@@ -203,24 +229,16 @@ var PDFToolbar = React2.memo(
|
|
|
203
229
|
disabled: currentPage <= 1,
|
|
204
230
|
children: /* @__PURE__ */ jsx2(ChevronLeftIcon, { fontSize: "small" })
|
|
205
231
|
}
|
|
206
|
-
) }),
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
onKeyPress: onPageInputKeyPress,
|
|
215
|
-
min: 1,
|
|
216
|
-
max: totalPages || void 0
|
|
217
|
-
}
|
|
218
|
-
),
|
|
219
|
-
showPageCount && /* @__PURE__ */ jsxs("span", { className: "page-info", children: [
|
|
220
|
-
"/ ",
|
|
221
|
-
totalPages || "..."
|
|
232
|
+
) }) }),
|
|
233
|
+
/* @__PURE__ */ jsxs("span", { className: "page-info", style: { display: "flex", alignItems: "center", margin: "0 8px", fontSize: "14px", fontWeight: 500 }, children: [
|
|
234
|
+
currentPage,
|
|
235
|
+
" ",
|
|
236
|
+
showPageCount && /* @__PURE__ */ jsxs("span", { style: { color: "#6b7280", marginLeft: "4px" }, children: [
|
|
237
|
+
"/ ",
|
|
238
|
+
totalPages || "..."
|
|
239
|
+
] })
|
|
222
240
|
] }),
|
|
223
|
-
/* @__PURE__ */ jsx2(Tooltip, { title: "Next Page", children: /* @__PURE__ */ jsx2(
|
|
241
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Next Page", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
224
242
|
"button",
|
|
225
243
|
{
|
|
226
244
|
className: "toolbar-button",
|
|
@@ -228,8 +246,8 @@ var PDFToolbar = React2.memo(
|
|
|
228
246
|
disabled: currentPage >= totalPages,
|
|
229
247
|
children: /* @__PURE__ */ jsx2(ChevronRightIcon, { fontSize: "small" })
|
|
230
248
|
}
|
|
231
|
-
) }),
|
|
232
|
-
/* @__PURE__ */ jsx2(Tooltip, { title: "Last Page", children: /* @__PURE__ */ jsx2(
|
|
249
|
+
) }) }),
|
|
250
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Last Page", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
233
251
|
"button",
|
|
234
252
|
{
|
|
235
253
|
className: "toolbar-button",
|
|
@@ -237,7 +255,7 @@ var PDFToolbar = React2.memo(
|
|
|
237
255
|
disabled: currentPage >= totalPages,
|
|
238
256
|
children: /* @__PURE__ */ jsx2(LastPageIcon, { fontSize: "small" })
|
|
239
257
|
}
|
|
240
|
-
) })
|
|
258
|
+
) }) })
|
|
241
259
|
] }),
|
|
242
260
|
showZoomControls && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
243
261
|
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
@@ -378,12 +396,16 @@ var PDFToolbar = React2.memo(
|
|
|
378
396
|
children: "View"
|
|
379
397
|
}
|
|
380
398
|
),
|
|
381
|
-
/* @__PURE__ */ jsxs(
|
|
399
|
+
showAnnotate && /* @__PURE__ */ jsxs(
|
|
382
400
|
"button",
|
|
383
401
|
{
|
|
384
402
|
className: `toolbar-tab ${activeMode === "annotate" ? "toolbar-tab-active" : ""}`,
|
|
385
|
-
onClick: () => setActiveMode("annotate"),
|
|
386
|
-
style: {
|
|
403
|
+
onClick: () => !disabledAnnotate && setActiveMode("annotate"),
|
|
404
|
+
style: {
|
|
405
|
+
position: "relative",
|
|
406
|
+
opacity: disabledAnnotate ? 0.5 : 1,
|
|
407
|
+
cursor: disabledAnnotate ? "not-allowed" : "pointer"
|
|
408
|
+
},
|
|
387
409
|
children: [
|
|
388
410
|
"Annotate",
|
|
389
411
|
hasUnsavedAnnotations && /* @__PURE__ */ jsx2("span", { style: {
|
|
@@ -402,47 +424,99 @@ var PDFToolbar = React2.memo(
|
|
|
402
424
|
/* @__PURE__ */ jsx2("div", { className: "toolbar-right", children: (hasUnsavedAnnotations || showDownload || showPrint || showMetadata || showProperties || showTags || showHistory) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
403
425
|
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
404
426
|
/* @__PURE__ */ jsxs("div", { className: "toolbar-section", children: [
|
|
405
|
-
showDownload && /* @__PURE__ */ jsx2(
|
|
406
|
-
|
|
407
|
-
{
|
|
408
|
-
|
|
409
|
-
onClick: onDownloadClick,
|
|
410
|
-
disabled: disabledDownload,
|
|
411
|
-
children: /* @__PURE__ */ jsx2(DownloadIcon, { fontSize: "small" })
|
|
412
|
-
}
|
|
413
|
-
) }),
|
|
414
|
-
showPrint && /* @__PURE__ */ jsxs("div", { className: "toolbar-dropdown-container", ref: printMenuRef, children: [
|
|
415
|
-
/* @__PURE__ */ jsx2(Tooltip, { title: "Print", children: /* @__PURE__ */ jsxs(
|
|
416
|
-
"button",
|
|
417
|
-
{
|
|
418
|
-
className: `toolbar-button toolbar-dropdown-button ${isPrintMenuOpen ? "toolbar-button-active" : ""}`,
|
|
419
|
-
onClick: () => setIsPrintMenuOpen(!isPrintMenuOpen),
|
|
420
|
-
children: [
|
|
421
|
-
/* @__PURE__ */ jsx2(PrintIcon, { fontSize: "small" }),
|
|
422
|
-
/* @__PURE__ */ jsx2(KeyboardArrowDownIcon, { fontSize: "small", style: { marginLeft: -4 } })
|
|
423
|
-
]
|
|
424
|
-
}
|
|
425
|
-
) }),
|
|
426
|
-
isPrintMenuOpen && /* @__PURE__ */ jsxs("div", { className: "toolbar-dropdown-menu", children: [
|
|
427
|
-
/* @__PURE__ */ jsx2(
|
|
427
|
+
showDownload && /* @__PURE__ */ jsx2("div", { className: "toolbar-dropdown-container", ref: downloadMenuRef, children: showDownloadOriginal && showDownloadWithAnnotations ? (
|
|
428
|
+
// RENDER DROPDOWN if BOTH are enabled
|
|
429
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
430
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Download", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsxs(
|
|
428
431
|
"button",
|
|
429
432
|
{
|
|
430
|
-
className:
|
|
431
|
-
onClick:
|
|
432
|
-
|
|
433
|
+
className: `toolbar-button toolbar-dropdown-button ${isDownloadMenuOpen ? "toolbar-button-active" : ""}`,
|
|
434
|
+
onClick: () => setIsDownloadMenuOpen(!isDownloadMenuOpen),
|
|
435
|
+
disabled: disabledDownload,
|
|
436
|
+
children: [
|
|
437
|
+
/* @__PURE__ */ jsx2(DownloadIcon, { fontSize: "small" }),
|
|
438
|
+
/* @__PURE__ */ jsx2(KeyboardArrowDownIcon, { fontSize: "small", style: { marginLeft: -4 } })
|
|
439
|
+
]
|
|
433
440
|
}
|
|
434
|
-
),
|
|
435
|
-
/* @__PURE__ */
|
|
441
|
+
) }) }),
|
|
442
|
+
isDownloadMenuOpen && /* @__PURE__ */ jsxs("div", { className: "toolbar-dropdown-menu toolbar-dropdown-menu-right", children: [
|
|
443
|
+
/* @__PURE__ */ jsx2(
|
|
444
|
+
"button",
|
|
445
|
+
{
|
|
446
|
+
className: "toolbar-dropdown-item",
|
|
447
|
+
onClick: handleDownloadWithoutAnnotations,
|
|
448
|
+
children: /* @__PURE__ */ jsx2("span", { children: "Download Document Only" })
|
|
449
|
+
}
|
|
450
|
+
),
|
|
451
|
+
/* @__PURE__ */ jsx2(
|
|
452
|
+
"button",
|
|
453
|
+
{
|
|
454
|
+
className: "toolbar-dropdown-item",
|
|
455
|
+
onClick: handleDownloadWithAnnotations,
|
|
456
|
+
children: /* @__PURE__ */ jsx2("span", { children: "Download with Annotations" })
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
] })
|
|
460
|
+
] })
|
|
461
|
+
) : (
|
|
462
|
+
// RENDER SINGLE BUTTON if ONLY ONE is enabled
|
|
463
|
+
(showDownloadOriginal || showDownloadWithAnnotations) && /* @__PURE__ */ jsx2(Tooltip, { title: "Download", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
464
|
+
"button",
|
|
465
|
+
{
|
|
466
|
+
className: "toolbar-button",
|
|
467
|
+
onClick: showDownloadOriginal ? handleDownloadWithoutAnnotations : handleDownloadWithAnnotations,
|
|
468
|
+
disabled: disabledDownload,
|
|
469
|
+
children: /* @__PURE__ */ jsx2(DownloadIcon, { fontSize: "small" })
|
|
470
|
+
}
|
|
471
|
+
) }) })
|
|
472
|
+
) }),
|
|
473
|
+
showPrint && /* @__PURE__ */ jsx2("div", { className: "toolbar-dropdown-container", ref: printMenuRef, children: showPrintOriginal && showPrintWithAnnotations ? (
|
|
474
|
+
// RENDER DROPDOWN if BOTH are enabled
|
|
475
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
476
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Print", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsxs(
|
|
436
477
|
"button",
|
|
437
478
|
{
|
|
438
|
-
className:
|
|
439
|
-
onClick:
|
|
440
|
-
|
|
479
|
+
className: `toolbar-button toolbar-dropdown-button ${isPrintMenuOpen ? "toolbar-button-active" : ""}`,
|
|
480
|
+
onClick: () => setIsPrintMenuOpen(!isPrintMenuOpen),
|
|
481
|
+
disabled: disabledPrint,
|
|
482
|
+
children: [
|
|
483
|
+
/* @__PURE__ */ jsx2(PrintIcon, { fontSize: "small" }),
|
|
484
|
+
/* @__PURE__ */ jsx2(KeyboardArrowDownIcon, { fontSize: "small", style: { marginLeft: -4 } })
|
|
485
|
+
]
|
|
441
486
|
}
|
|
442
|
-
)
|
|
487
|
+
) }) }),
|
|
488
|
+
isPrintMenuOpen && /* @__PURE__ */ jsxs("div", { className: "toolbar-dropdown-menu toolbar-dropdown-menu-right", children: [
|
|
489
|
+
/* @__PURE__ */ jsx2(
|
|
490
|
+
"button",
|
|
491
|
+
{
|
|
492
|
+
className: "toolbar-dropdown-item",
|
|
493
|
+
onClick: handlePrintWithoutAnnotations,
|
|
494
|
+
children: /* @__PURE__ */ jsx2("span", { children: "Print Document Only" })
|
|
495
|
+
}
|
|
496
|
+
),
|
|
497
|
+
/* @__PURE__ */ jsx2(
|
|
498
|
+
"button",
|
|
499
|
+
{
|
|
500
|
+
className: "toolbar-dropdown-item",
|
|
501
|
+
onClick: handlePrintWithAnnotations,
|
|
502
|
+
children: /* @__PURE__ */ jsx2("span", { children: "Print with Annotations" })
|
|
503
|
+
}
|
|
504
|
+
)
|
|
505
|
+
] })
|
|
443
506
|
] })
|
|
444
|
-
|
|
445
|
-
|
|
507
|
+
) : (
|
|
508
|
+
// RENDER SINGLE BUTTON if ONLY ONE is enabled
|
|
509
|
+
(showPrintOriginal || showPrintWithAnnotations) && /* @__PURE__ */ jsx2(Tooltip, { title: "Print", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
510
|
+
"button",
|
|
511
|
+
{
|
|
512
|
+
className: "toolbar-button",
|
|
513
|
+
onClick: showPrintOriginal ? handlePrintWithoutAnnotations : handlePrintWithAnnotations,
|
|
514
|
+
disabled: disabledPrint,
|
|
515
|
+
children: /* @__PURE__ */ jsx2(PrintIcon, { fontSize: "small" })
|
|
516
|
+
}
|
|
517
|
+
) }) })
|
|
518
|
+
) }),
|
|
519
|
+
showMetadata && /* @__PURE__ */ jsx2(Tooltip, { title: "Metadata", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
446
520
|
"button",
|
|
447
521
|
{
|
|
448
522
|
className: "toolbar-button",
|
|
@@ -450,8 +524,8 @@ var PDFToolbar = React2.memo(
|
|
|
450
524
|
disabled: disabledMetadata,
|
|
451
525
|
children: /* @__PURE__ */ jsx2(DescriptionIcon, { fontSize: "small" })
|
|
452
526
|
}
|
|
453
|
-
) }),
|
|
454
|
-
showProperties && /* @__PURE__ */ jsx2(Tooltip, { title: "Properties", children: /* @__PURE__ */ jsx2(
|
|
527
|
+
) }) }),
|
|
528
|
+
showProperties && /* @__PURE__ */ jsx2(Tooltip, { title: "Properties", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
455
529
|
"button",
|
|
456
530
|
{
|
|
457
531
|
className: "toolbar-button",
|
|
@@ -459,8 +533,8 @@ var PDFToolbar = React2.memo(
|
|
|
459
533
|
disabled: disabledProperties,
|
|
460
534
|
children: /* @__PURE__ */ jsx2(InfoIcon, { fontSize: "small" })
|
|
461
535
|
}
|
|
462
|
-
) }),
|
|
463
|
-
showTags && /* @__PURE__ */ jsx2(Tooltip, { title: "Tags", children: /* @__PURE__ */ jsx2(
|
|
536
|
+
) }) }),
|
|
537
|
+
showTags && /* @__PURE__ */ jsx2(Tooltip, { title: "Tags", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
464
538
|
"button",
|
|
465
539
|
{
|
|
466
540
|
className: "toolbar-button",
|
|
@@ -468,8 +542,8 @@ var PDFToolbar = React2.memo(
|
|
|
468
542
|
disabled: disabledTags,
|
|
469
543
|
children: /* @__PURE__ */ jsx2(LocalOffer, { fontSize: "small" })
|
|
470
544
|
}
|
|
471
|
-
) }),
|
|
472
|
-
showHistory && /* @__PURE__ */ jsx2(Tooltip, { title: "Version History", children: /* @__PURE__ */ jsx2(
|
|
545
|
+
) }) }),
|
|
546
|
+
showHistory && /* @__PURE__ */ jsx2(Tooltip, { title: "Version History", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
473
547
|
"button",
|
|
474
548
|
{
|
|
475
549
|
className: "toolbar-button",
|
|
@@ -477,12 +551,12 @@ var PDFToolbar = React2.memo(
|
|
|
477
551
|
disabled: disabledHistory,
|
|
478
552
|
children: /* @__PURE__ */ jsx2(HistoryIcon, { fontSize: "small" })
|
|
479
553
|
}
|
|
480
|
-
) })
|
|
554
|
+
) }) })
|
|
481
555
|
] })
|
|
482
556
|
] }) })
|
|
483
557
|
] }),
|
|
484
558
|
activeMode === "annotate" && showAnnotations && /* @__PURE__ */ jsxs("div", { className: "pdf-viewer-secondary-toolbar", children: [
|
|
485
|
-
/* @__PURE__ */ jsx2(Tooltip, { title: "Highlight", children: /* @__PURE__ */ jsx2(
|
|
559
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Highlight", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
486
560
|
"button",
|
|
487
561
|
{
|
|
488
562
|
className: `toolbar-button ${isHighlighterActive ? "toolbar-button-active" : ""}`,
|
|
@@ -490,8 +564,8 @@ var PDFToolbar = React2.memo(
|
|
|
490
564
|
disabled: disabledHighlighter,
|
|
491
565
|
children: /* @__PURE__ */ jsx2(HighlightIcon, { fontSize: "small" })
|
|
492
566
|
}
|
|
493
|
-
) }),
|
|
494
|
-
/* @__PURE__ */ jsx2(Tooltip, { title: "Stamp", children: /* @__PURE__ */ jsx2(
|
|
567
|
+
) }) }),
|
|
568
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Stamp", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
495
569
|
"button",
|
|
496
570
|
{
|
|
497
571
|
className: `toolbar-button ${isStampActive ? "toolbar-button-active" : ""}`,
|
|
@@ -499,8 +573,8 @@ var PDFToolbar = React2.memo(
|
|
|
499
573
|
disabled: disabledStamp,
|
|
500
574
|
children: /* @__PURE__ */ jsx2(ApprovalIcon, { fontSize: "small" })
|
|
501
575
|
}
|
|
502
|
-
) }),
|
|
503
|
-
/* @__PURE__ */ jsx2(Tooltip, { title: "Signature", children: /* @__PURE__ */ jsx2(
|
|
576
|
+
) }) }),
|
|
577
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Signature", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsx2(
|
|
504
578
|
"button",
|
|
505
579
|
{
|
|
506
580
|
className: "toolbar-button",
|
|
@@ -508,10 +582,10 @@ var PDFToolbar = React2.memo(
|
|
|
508
582
|
disabled: disabledSignature,
|
|
509
583
|
children: /* @__PURE__ */ jsx2(DrawIcon, { fontSize: "small" })
|
|
510
584
|
}
|
|
511
|
-
) }),
|
|
585
|
+
) }) }),
|
|
512
586
|
hasUnsavedAnnotations && canSaveAnnotations !== false && onSaveAnnotations && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
513
587
|
/* @__PURE__ */ jsx2("div", { style: { width: 1, height: 24, backgroundColor: "#e5e7eb", margin: "0 8px" } }),
|
|
514
|
-
/* @__PURE__ */ jsx2(Tooltip, { title: "Save Annotations", children: /* @__PURE__ */ jsxs(
|
|
588
|
+
/* @__PURE__ */ jsx2(Tooltip, { title: "Save Annotations", children: /* @__PURE__ */ jsx2("span", { children: /* @__PURE__ */ jsxs(
|
|
515
589
|
"button",
|
|
516
590
|
{
|
|
517
591
|
className: "toolbar-button",
|
|
@@ -528,7 +602,8 @@ var PDFToolbar = React2.memo(
|
|
|
528
602
|
backgroundColor: hasUnsavedAnnotations ? "#eff6ff" : "transparent",
|
|
529
603
|
fontSize: "14px",
|
|
530
604
|
fontWeight: 500,
|
|
531
|
-
width: "auto"
|
|
605
|
+
width: "auto",
|
|
606
|
+
cursor: isSavingAnnotations ? "not-allowed" : "pointer"
|
|
532
607
|
},
|
|
533
608
|
children: [
|
|
534
609
|
isSavingAnnotations ? /* @__PURE__ */ jsx2("svg", { width: "16", height: "16", viewBox: "0 0 24 24", style: { animation: "spin 1s linear infinite" }, children: /* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3", fill: "none", strokeDasharray: "31.4", strokeDashoffset: "10" }) }) : /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
@@ -539,7 +614,7 @@ var PDFToolbar = React2.memo(
|
|
|
539
614
|
/* @__PURE__ */ jsx2("span", { children: isSavingAnnotations ? "Saving..." : "Save" })
|
|
540
615
|
]
|
|
541
616
|
}
|
|
542
|
-
) })
|
|
617
|
+
) }) })
|
|
543
618
|
] })
|
|
544
619
|
] }),
|
|
545
620
|
activeMode === "redact" && showAnnotations && /* @__PURE__ */ jsx2("div", { className: "pdf-viewer-secondary-toolbar", children: /* @__PURE__ */ jsx2(Tooltip, { title: "Redact Text", children: /* @__PURE__ */ jsx2("button", { className: "toolbar-button", children: /* @__PURE__ */ jsx2(AutoFixHighIcon, { fontSize: "small" }) }) }) })
|
|
@@ -1246,6 +1321,8 @@ var PDFViewerContent = forwardRef(
|
|
|
1246
1321
|
onTagsClick,
|
|
1247
1322
|
onHistoryClick,
|
|
1248
1323
|
onDownloadClick,
|
|
1324
|
+
onDownloadWithAnnotations,
|
|
1325
|
+
onDownloadWithoutAnnotations,
|
|
1249
1326
|
onPrintClick,
|
|
1250
1327
|
initialSearchText,
|
|
1251
1328
|
initialSearchPages,
|
|
@@ -1257,16 +1334,25 @@ var PDFViewerContent = forwardRef(
|
|
|
1257
1334
|
onHighlighterClick,
|
|
1258
1335
|
onStampClick,
|
|
1259
1336
|
onSignatureClick,
|
|
1337
|
+
// New granular toolbar props
|
|
1338
|
+
showAnnotate,
|
|
1339
|
+
disabledAnnotate,
|
|
1340
|
+
showPrintOriginal,
|
|
1341
|
+
showPrintWithAnnotations,
|
|
1342
|
+
showDownloadOriginal,
|
|
1343
|
+
showDownloadWithAnnotations,
|
|
1260
1344
|
// Annotation save props
|
|
1261
1345
|
hasUnsavedAnnotations,
|
|
1262
1346
|
isSavingAnnotations,
|
|
1263
1347
|
canSaveAnnotations,
|
|
1264
|
-
onSaveAnnotations
|
|
1348
|
+
onSaveAnnotations,
|
|
1349
|
+
loading
|
|
1265
1350
|
} = props;
|
|
1266
1351
|
const [pdfBuffer, setPdfBuffer] = useState4(null);
|
|
1267
1352
|
const [state, setState] = useState4("idle");
|
|
1268
1353
|
const [error, setError] = useState4(null);
|
|
1269
1354
|
const pdfViewerRef = useRef3(null);
|
|
1355
|
+
const [isInternalReady, setIsInternalReady] = useState4(false);
|
|
1270
1356
|
const [internalHighlighterActive, setInternalHighlighterActive] = useState4(false);
|
|
1271
1357
|
const [internalStampActive, setInternalStampActive] = useState4(false);
|
|
1272
1358
|
const highlighterActive = isHighlighterActive !== void 0 ? isHighlighterActive : internalHighlighterActive;
|
|
@@ -1452,17 +1538,25 @@ var PDFViewerContent = forwardRef(
|
|
|
1452
1538
|
pdfViewerRef.current?.print?.print();
|
|
1453
1539
|
},
|
|
1454
1540
|
handlePrintWithAnnotations: async () => {
|
|
1455
|
-
console.log("\u{1F5A8}\uFE0F Print with Annotations clicked");
|
|
1456
|
-
console.log("pdfViewerRef.current:", pdfViewerRef.current);
|
|
1457
|
-
console.log("pdfViewerRef.current?.print:", pdfViewerRef.current?.print);
|
|
1458
1541
|
await pdfViewerRef.current?.print?.printWithAnnotations?.();
|
|
1459
1542
|
},
|
|
1460
1543
|
handlePrintWithoutAnnotations: async () => {
|
|
1461
|
-
console.log("\u{1F5A8}\uFE0F Print without Annotations clicked");
|
|
1462
|
-
console.log("pdfViewerRef.current:", pdfViewerRef.current);
|
|
1463
|
-
console.log("pdfViewerRef.current?.print:", pdfViewerRef.current?.print);
|
|
1464
1544
|
await pdfViewerRef.current?.print?.printWithoutAnnotations?.();
|
|
1465
1545
|
},
|
|
1546
|
+
handleDownloadWithAnnotations: async () => {
|
|
1547
|
+
if (onDownloadWithAnnotations) {
|
|
1548
|
+
onDownloadWithAnnotations();
|
|
1549
|
+
} else {
|
|
1550
|
+
await pdfViewerRef.current?.download?.downloadWithAnnotations?.(resolvedFileName);
|
|
1551
|
+
}
|
|
1552
|
+
},
|
|
1553
|
+
handleDownloadWithoutAnnotations: async () => {
|
|
1554
|
+
if (onDownloadWithoutAnnotations) {
|
|
1555
|
+
onDownloadWithoutAnnotations();
|
|
1556
|
+
} else {
|
|
1557
|
+
await pdfViewerRef.current?.download?.downloadWithoutAnnotations?.(resolvedFileName);
|
|
1558
|
+
}
|
|
1559
|
+
},
|
|
1466
1560
|
handleHighlighterClick: () => {
|
|
1467
1561
|
if (highlighterActive) {
|
|
1468
1562
|
pdfViewerRef.current?.annotation?.deactivateHighlighter();
|
|
@@ -1491,21 +1585,14 @@ var PDFViewerContent = forwardRef(
|
|
|
1491
1585
|
},
|
|
1492
1586
|
handleSignatureClick: () => {
|
|
1493
1587
|
},
|
|
1588
|
+
handleCopy: () => {
|
|
1589
|
+
pdfViewerRef.current?.selection.copy();
|
|
1590
|
+
},
|
|
1494
1591
|
handleToggleFullScreen
|
|
1495
1592
|
}),
|
|
1496
|
-
[isSidebarOpen, totalPages, handleToggleFullScreen, highlighterActive, stampActive]
|
|
1593
|
+
[isSidebarOpen, totalPages, handleToggleFullScreen, highlighterActive, stampActive, onDownloadWithAnnotations, onDownloadWithoutAnnotations]
|
|
1497
1594
|
);
|
|
1498
1595
|
useEffect4(() => {
|
|
1499
|
-
console.log(
|
|
1500
|
-
"came",
|
|
1501
|
-
initialSearchText,
|
|
1502
|
-
pdfViewerRef.current,
|
|
1503
|
-
hasExecutedInitialSearch.current,
|
|
1504
|
-
"state:",
|
|
1505
|
-
state,
|
|
1506
|
-
"totalPages:",
|
|
1507
|
-
totalPages
|
|
1508
|
-
);
|
|
1509
1596
|
if (!initialSearchText || hasExecutedInitialSearch.current) return;
|
|
1510
1597
|
const isPDFReady = state === "ready";
|
|
1511
1598
|
const isPagesInitialized = totalPages > 0;
|
|
@@ -1517,9 +1604,6 @@ var PDFViewerContent = forwardRef(
|
|
|
1517
1604
|
const SEARCH_INITIALIZATION_DELAY = 100;
|
|
1518
1605
|
setTimeout(() => {
|
|
1519
1606
|
if (!pdfViewerRef.current?.search?.searchText) {
|
|
1520
|
-
console.warn(
|
|
1521
|
-
"Search API became unavailable, skipping initial search"
|
|
1522
|
-
);
|
|
1523
1607
|
hasExecutedInitialSearch.current = false;
|
|
1524
1608
|
return;
|
|
1525
1609
|
}
|
|
@@ -1574,6 +1658,29 @@ var PDFViewerContent = forwardRef(
|
|
|
1574
1658
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
1575
1659
|
return () => observer.disconnect();
|
|
1576
1660
|
}, [state]);
|
|
1661
|
+
useEffect4(() => {
|
|
1662
|
+
if (state !== "ready") return;
|
|
1663
|
+
const checkInternalReadiness = async () => {
|
|
1664
|
+
if (!pdfViewerRef.current) return;
|
|
1665
|
+
try {
|
|
1666
|
+
const count = pdfViewerRef.current.navigation?.getTotalPages?.();
|
|
1667
|
+
if (count && count > 0) {
|
|
1668
|
+
setTotalPages(count);
|
|
1669
|
+
setIsInternalReady(true);
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
const docInfo = pdfViewerRef.current?.document?.getDocumentInfo?.();
|
|
1673
|
+
if (docInfo && docInfo.totalPages > 0) {
|
|
1674
|
+
setTotalPages(docInfo.totalPages);
|
|
1675
|
+
setIsInternalReady(true);
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1678
|
+
} catch (e) {
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
const pollInterval = setInterval(checkInternalReadiness, 100);
|
|
1682
|
+
return () => clearInterval(pollInterval);
|
|
1683
|
+
}, [state]);
|
|
1577
1684
|
useEffect4(() => {
|
|
1578
1685
|
if (state !== "ready" || totalPages > 0) return;
|
|
1579
1686
|
const initializePageCount = async () => {
|
|
@@ -1591,64 +1698,31 @@ var PDFViewerContent = forwardRef(
|
|
|
1591
1698
|
const viewer = await waitForViewer();
|
|
1592
1699
|
if (!viewer) return;
|
|
1593
1700
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1594
|
-
try {
|
|
1595
|
-
const count = viewer.navigation?.getTotalPages?.();
|
|
1596
|
-
if (count && count > 1) {
|
|
1597
|
-
setTotalPages(count);
|
|
1598
|
-
return;
|
|
1599
|
-
}
|
|
1600
|
-
} catch (e) {
|
|
1601
|
-
}
|
|
1602
|
-
try {
|
|
1603
|
-
const results = await viewer.search?.searchText?.("e");
|
|
1604
|
-
if (results?.results && results.results.length > 0) {
|
|
1605
|
-
const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
|
|
1606
|
-
const count = Math.max(...pageIndices) + 1;
|
|
1607
|
-
viewer.search?.stopSearch?.();
|
|
1608
|
-
setTotalPages(count);
|
|
1609
|
-
return;
|
|
1610
|
-
}
|
|
1611
|
-
} catch (error2) {
|
|
1612
|
-
}
|
|
1613
|
-
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
1614
|
-
try {
|
|
1615
|
-
const selectors = [
|
|
1616
|
-
"[data-page-index]",
|
|
1617
|
-
"[data-page-number]",
|
|
1618
|
-
".embedpdf-page",
|
|
1619
|
-
'[role="article"]',
|
|
1620
|
-
"canvas[data-page]",
|
|
1621
|
-
".react-pdf__Page"
|
|
1622
|
-
];
|
|
1623
|
-
for (const selector of selectors) {
|
|
1624
|
-
const pages = document.querySelectorAll(selector);
|
|
1625
|
-
if (pages.length > 0) {
|
|
1626
|
-
setTotalPages(pages.length);
|
|
1627
|
-
return;
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
} catch (error2) {
|
|
1631
|
-
}
|
|
1632
1701
|
try {
|
|
1633
1702
|
const count = viewer.navigation?.getTotalPages?.();
|
|
1634
1703
|
if (count && count > 0) {
|
|
1635
1704
|
setTotalPages(count);
|
|
1705
|
+
setIsInternalReady(true);
|
|
1636
1706
|
return;
|
|
1637
1707
|
}
|
|
1638
1708
|
} catch (e) {
|
|
1639
1709
|
}
|
|
1640
|
-
console.warn(
|
|
1641
|
-
"Could not determine total pages, using fallback value of 1"
|
|
1642
|
-
);
|
|
1643
|
-
setTotalPages(1);
|
|
1644
1710
|
};
|
|
1645
1711
|
initializePageCount();
|
|
1646
1712
|
}, [state, totalPages]);
|
|
1647
1713
|
useEffect4(() => {
|
|
1648
|
-
if (state === "ready"
|
|
1714
|
+
if (state === "ready") {
|
|
1649
1715
|
const updateInfo = () => {
|
|
1716
|
+
if (!pdfViewerRef.current) return;
|
|
1650
1717
|
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
1651
|
-
const
|
|
1718
|
+
const docInfo = pdfViewerRef.current?.document?.getDocumentInfo?.();
|
|
1719
|
+
const navTotal = pdfViewerRef.current?.navigation?.getTotalPages?.();
|
|
1720
|
+
let total = 0;
|
|
1721
|
+
if (docInfo && docInfo.totalPages > 0) {
|
|
1722
|
+
total = docInfo.totalPages;
|
|
1723
|
+
} else if (typeof navTotal === "number" && navTotal > 0) {
|
|
1724
|
+
total = navTotal;
|
|
1725
|
+
}
|
|
1652
1726
|
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
1653
1727
|
const currentSearchState = pdfViewerRef.current?.search.getSearchState();
|
|
1654
1728
|
setCurrentPage(current);
|
|
@@ -1660,7 +1734,8 @@ var PDFViewerContent = forwardRef(
|
|
|
1660
1734
|
}
|
|
1661
1735
|
};
|
|
1662
1736
|
updateInfo();
|
|
1663
|
-
const
|
|
1737
|
+
const pollInterval = totalPages === 0 ? 50 : 300;
|
|
1738
|
+
const interval = setInterval(updateInfo, pollInterval);
|
|
1664
1739
|
return () => clearInterval(interval);
|
|
1665
1740
|
}
|
|
1666
1741
|
}, [state, totalPages]);
|
|
@@ -1732,8 +1807,11 @@ var PDFViewerContent = forwardRef(
|
|
|
1732
1807
|
setSearchQuery("");
|
|
1733
1808
|
},
|
|
1734
1809
|
getSearchState: () => pdfViewerRef.current?.search.getSearchState() || null,
|
|
1735
|
-
getSelectedText: () =>
|
|
1810
|
+
getSelectedText: async () => {
|
|
1811
|
+
return await pdfViewerRef.current?.selection.getSelectedText() || "";
|
|
1812
|
+
},
|
|
1736
1813
|
clearSelection: () => pdfViewerRef.current?.selection.clearSelection(),
|
|
1814
|
+
copy: () => pdfViewerRef.current?.selection.copy(),
|
|
1737
1815
|
rotateForward: () => pdfViewerRef.current?.rotate?.rotateForward(),
|
|
1738
1816
|
rotateBackward: () => pdfViewerRef.current?.rotate?.rotateBackward(),
|
|
1739
1817
|
getRotation: () => pdfViewerRef.current?.rotate?.getRotation() || 0,
|
|
@@ -1744,6 +1822,12 @@ var PDFViewerContent = forwardRef(
|
|
|
1744
1822
|
printWithoutAnnotations: async () => {
|
|
1745
1823
|
await pdfViewerRef.current?.print?.printWithoutAnnotations?.();
|
|
1746
1824
|
},
|
|
1825
|
+
downloadWithAnnotations: async (filename) => {
|
|
1826
|
+
await pdfViewerRef.current?.download?.downloadWithAnnotations?.(filename);
|
|
1827
|
+
},
|
|
1828
|
+
downloadWithoutAnnotations: async (filename) => {
|
|
1829
|
+
await pdfViewerRef.current?.download?.downloadWithoutAnnotations?.(filename);
|
|
1830
|
+
},
|
|
1747
1831
|
get annotation() {
|
|
1748
1832
|
return pdfViewerRef.current?.annotation;
|
|
1749
1833
|
},
|
|
@@ -1802,7 +1886,6 @@ var PDFViewerContent = forwardRef(
|
|
|
1802
1886
|
setIsSearching(true);
|
|
1803
1887
|
try {
|
|
1804
1888
|
const results = await pdfViewerRef.current.search.searchText(keyword);
|
|
1805
|
-
console.log("Search completed:", results);
|
|
1806
1889
|
setIsSearching(false);
|
|
1807
1890
|
const hasValidResults = results?.results && Array.isArray(results.results) && results.results.length > 0;
|
|
1808
1891
|
if (hasValidResults) {
|
|
@@ -1973,44 +2056,31 @@ var PDFViewerContent = forwardRef(
|
|
|
1973
2056
|
setPasswordError("");
|
|
1974
2057
|
}
|
|
1975
2058
|
}, [passwordResolve]);
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
}
|
|
2002
|
-
),
|
|
2003
|
-
/* @__PURE__ */ jsx6("p", { children: "Loading PDF..." }),
|
|
2004
|
-
/* @__PURE__ */ jsx6("style", { children: `
|
|
2005
|
-
@keyframes spin {
|
|
2006
|
-
0% { transform: rotate(0deg); }
|
|
2007
|
-
100% { transform: rotate(360deg); }
|
|
2008
|
-
}
|
|
2009
|
-
` })
|
|
2010
|
-
]
|
|
2011
|
-
}
|
|
2012
|
-
);
|
|
2013
|
-
}
|
|
2059
|
+
const LoadingSpinner = ({ fileName: fileName2 }) => /* @__PURE__ */ jsxs5("div", { style: {
|
|
2060
|
+
position: "absolute",
|
|
2061
|
+
inset: 0,
|
|
2062
|
+
zIndex: 50,
|
|
2063
|
+
backgroundColor: "#fff",
|
|
2064
|
+
display: "flex",
|
|
2065
|
+
flexDirection: "column",
|
|
2066
|
+
alignItems: "center",
|
|
2067
|
+
justifyContent: "center"
|
|
2068
|
+
}, children: [
|
|
2069
|
+
/* @__PURE__ */ jsx6("div", { className: "dms-loading-spinner", style: {
|
|
2070
|
+
width: "40px",
|
|
2071
|
+
height: "40px",
|
|
2072
|
+
border: "3px solid #f3f3f3",
|
|
2073
|
+
borderTop: "3px solid #3498db",
|
|
2074
|
+
borderRadius: "50%",
|
|
2075
|
+
animation: "spin 1s linear infinite"
|
|
2076
|
+
} }),
|
|
2077
|
+
fileName2 && /* @__PURE__ */ jsxs5("p", { style: { marginTop: "16px", color: "#666", fontSize: "14px" }, children: [
|
|
2078
|
+
"Loading ",
|
|
2079
|
+
fileName2,
|
|
2080
|
+
"..."
|
|
2081
|
+
] }),
|
|
2082
|
+
/* @__PURE__ */ jsx6("style", { children: `@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }` })
|
|
2083
|
+
] });
|
|
2014
2084
|
if (state === "error" || error) {
|
|
2015
2085
|
return /* @__PURE__ */ jsx6(
|
|
2016
2086
|
"div",
|
|
@@ -2042,135 +2112,136 @@ var PDFViewerContent = forwardRef(
|
|
|
2042
2112
|
}
|
|
2043
2113
|
);
|
|
2044
2114
|
}
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
{
|
|
2049
|
-
style: {
|
|
2050
|
-
display: "flex",
|
|
2051
|
-
alignItems: "center",
|
|
2052
|
-
justifyContent: "center",
|
|
2053
|
-
height: "100%"
|
|
2054
|
-
},
|
|
2055
|
-
children: /* @__PURE__ */ jsx6("p", { children: "Preparing PDF..." })
|
|
2056
|
-
}
|
|
2057
|
-
);
|
|
2058
|
-
}
|
|
2059
|
-
return /* @__PURE__ */ jsxs5("div", { ref: containerRef, className: "pdf-viewer-container", children: [
|
|
2115
|
+
const isReady = pdfBuffer && state === "ready";
|
|
2116
|
+
const showOverlay = loading || !isReady || !isInternalReady;
|
|
2117
|
+
return /* @__PURE__ */ jsxs5("div", { ref: containerRef, className: "pdf-viewer-container", style: { position: "relative", height: "100%", width: "100%" }, children: [
|
|
2060
2118
|
/* @__PURE__ */ jsx6("style", { children: toolbarStyles }),
|
|
2061
|
-
/* @__PURE__ */ jsx6(
|
|
2062
|
-
/* @__PURE__ */
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
totalPages,
|
|
2067
|
-
zoom,
|
|
2068
|
-
isSidebarOpen,
|
|
2069
|
-
showPageNavigation,
|
|
2070
|
-
showPageCount,
|
|
2071
|
-
showZoomControls,
|
|
2072
|
-
showSearch,
|
|
2073
|
-
showRotation: !toolbar.isHidden("rotation"),
|
|
2074
|
-
showMetadata: !toolbar.isHidden("metadata"),
|
|
2075
|
-
showProperties: !toolbar.isHidden("properties"),
|
|
2076
|
-
showDownload: !toolbar.isHidden("download"),
|
|
2077
|
-
showPrint: !toolbar.isHidden("print"),
|
|
2078
|
-
showTags: !toolbar.isHidden("tags"),
|
|
2079
|
-
showHistory: !toolbar.isHidden("history"),
|
|
2080
|
-
disabledRotateLeft: toolbar.isDisabled("rotateLeft"),
|
|
2081
|
-
disabledRotateRight: false,
|
|
2082
|
-
disabledMetadata: toolbar.isDisabled("metadata"),
|
|
2083
|
-
disabledTags: toolbar.isDisabled("tags"),
|
|
2084
|
-
disabledProperties: toolbar.isDisabled("properties"),
|
|
2085
|
-
disabledHistory: toolbar.isDisabled("history"),
|
|
2086
|
-
disabledDownload: toolbar.isDisabled("download"),
|
|
2087
|
-
disabledPrint: toolbar.isDisabled("print"),
|
|
2088
|
-
onFirstPage: toolbarHandlers.handleFirstPage,
|
|
2089
|
-
onPreviousPage: toolbarHandlers.handlePreviousPage,
|
|
2090
|
-
onNextPage: toolbarHandlers.handleNextPage,
|
|
2091
|
-
onLastPage: toolbarHandlers.handleLastPage,
|
|
2092
|
-
onPageInput: toolbarHandlers.handlePageInput,
|
|
2093
|
-
onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
|
|
2094
|
-
onZoomIn: toolbarHandlers.handleZoomIn,
|
|
2095
|
-
onZoomOut: toolbarHandlers.handleZoomOut,
|
|
2096
|
-
onFitToWidth: toolbarHandlers.handleFitToWidth,
|
|
2097
|
-
onFitToPage: toolbarHandlers.handleFitToPage,
|
|
2098
|
-
onToggleSidebar: toolbarHandlers.toggleSidebar,
|
|
2099
|
-
onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
|
|
2100
|
-
onRotateLeft: toolbarHandlers.handleRotateLeft,
|
|
2101
|
-
onRotateRight: toolbarHandlers.handleRotateRight,
|
|
2102
|
-
onDownloadClick: toolbar.getHandler("download", onDownloadClick),
|
|
2103
|
-
onPrintClick: toolbar.getHandler("print", onPrintClick || toolbarHandlers.handlePrint),
|
|
2104
|
-
onPrintWithAnnotations: toolbarHandlers.handlePrintWithAnnotations,
|
|
2105
|
-
onPrintWithoutAnnotations: toolbarHandlers.handlePrintWithoutAnnotations,
|
|
2106
|
-
onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
|
|
2107
|
-
onPropertiesClick: toolbar.getHandler(
|
|
2108
|
-
"properties",
|
|
2109
|
-
onPropertiesClick
|
|
2110
|
-
),
|
|
2111
|
-
onTagsClick: toolbar.getHandler("tags", onTagsClick),
|
|
2112
|
-
onHistoryClick: toolbar.getHandler("history", onHistoryClick),
|
|
2113
|
-
showAnnotations,
|
|
2114
|
-
isHighlighterActive: highlighterActive,
|
|
2115
|
-
isStampActive: stampActive,
|
|
2116
|
-
disabledHighlighter: toolbar.isDisabled("highlighter"),
|
|
2117
|
-
disabledStamp: toolbar.isDisabled("stamp"),
|
|
2118
|
-
disabledSignature: toolbar.isDisabled("signature"),
|
|
2119
|
-
onHighlighterClick: toolbar.getHandler("highlighter", onHighlighterClick || toolbarHandlers.handleHighlighterClick),
|
|
2120
|
-
onStampClick: toolbar.getHandler("stamp", onStampClick || toolbarHandlers.handleStampClick),
|
|
2121
|
-
onSignatureClick: toolbar.getHandler("signature", onSignatureClick || toolbarHandlers.handleSignatureClick),
|
|
2122
|
-
hasUnsavedAnnotations,
|
|
2123
|
-
isSavingAnnotations,
|
|
2124
|
-
canSaveAnnotations,
|
|
2125
|
-
onSaveAnnotations
|
|
2126
|
-
}
|
|
2127
|
-
),
|
|
2128
|
-
/* @__PURE__ */ jsxs5("div", { className: "pdf-viewer-main", children: [
|
|
2129
|
-
/* @__PURE__ */ jsx6("div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ jsx6(
|
|
2130
|
-
StablePDFViewer,
|
|
2119
|
+
showOverlay && /* @__PURE__ */ jsx6(LoadingSpinner, { fileName: resolvedFileName }),
|
|
2120
|
+
/* @__PURE__ */ jsxs5("div", { style: { opacity: !showOverlay ? 1 : 0, height: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
2121
|
+
/* @__PURE__ */ jsx6(PDFHeader, { fileName: resolvedFileName, fileExtension }),
|
|
2122
|
+
/* @__PURE__ */ jsx6(
|
|
2123
|
+
PDFToolbar,
|
|
2131
2124
|
{
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2125
|
+
currentPage,
|
|
2126
|
+
totalPages,
|
|
2127
|
+
zoom,
|
|
2128
|
+
isSidebarOpen,
|
|
2129
|
+
showPageNavigation,
|
|
2130
|
+
showPageCount,
|
|
2131
|
+
showZoomControls,
|
|
2132
|
+
showSearch,
|
|
2133
|
+
showRotation: !toolbar.isHidden("rotation"),
|
|
2134
|
+
showMetadata: !toolbar.isHidden("metadata"),
|
|
2135
|
+
showProperties: !toolbar.isHidden("properties"),
|
|
2136
|
+
showDownload: !toolbar.isHidden("download"),
|
|
2137
|
+
showPrint: !toolbar.isHidden("print"),
|
|
2138
|
+
showTags: !toolbar.isHidden("tags"),
|
|
2139
|
+
showHistory: !toolbar.isHidden("history"),
|
|
2140
|
+
disabledRotateLeft: toolbar.isDisabled("rotateLeft"),
|
|
2141
|
+
disabledRotateRight: false,
|
|
2142
|
+
disabledMetadata: toolbar.isDisabled("metadata"),
|
|
2143
|
+
disabledTags: toolbar.isDisabled("tags"),
|
|
2144
|
+
disabledProperties: toolbar.isDisabled("properties"),
|
|
2145
|
+
disabledHistory: toolbar.isDisabled("history"),
|
|
2146
|
+
disabledDownload: toolbar.isDisabled("download"),
|
|
2147
|
+
disabledPrint: toolbar.isDisabled("print"),
|
|
2148
|
+
onFirstPage: toolbarHandlers.handleFirstPage,
|
|
2149
|
+
onPreviousPage: toolbarHandlers.handlePreviousPage,
|
|
2150
|
+
onNextPage: toolbarHandlers.handleNextPage,
|
|
2151
|
+
onLastPage: toolbarHandlers.handleLastPage,
|
|
2152
|
+
onPageInput: toolbarHandlers.handlePageInput,
|
|
2153
|
+
onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
|
|
2154
|
+
onZoomIn: toolbarHandlers.handleZoomIn,
|
|
2155
|
+
onZoomOut: toolbarHandlers.handleZoomOut,
|
|
2156
|
+
onFitToWidth: toolbarHandlers.handleFitToWidth,
|
|
2157
|
+
onFitToPage: toolbarHandlers.handleFitToPage,
|
|
2158
|
+
onToggleSidebar: toolbarHandlers.toggleSidebar,
|
|
2159
|
+
onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
|
|
2160
|
+
onRotateLeft: toolbarHandlers.handleRotateLeft,
|
|
2161
|
+
onRotateRight: toolbarHandlers.handleRotateRight,
|
|
2162
|
+
onDownloadClick: toolbar.getHandler("download", onDownloadClick),
|
|
2163
|
+
onDownloadWithAnnotations: toolbarHandlers.handleDownloadWithAnnotations,
|
|
2164
|
+
onDownloadWithoutAnnotations: toolbarHandlers.handleDownloadWithoutAnnotations,
|
|
2165
|
+
onPrintClick: toolbar.getHandler("print", onPrintClick || toolbarHandlers.handlePrint),
|
|
2166
|
+
onPrintWithAnnotations: toolbarHandlers.handlePrintWithAnnotations,
|
|
2167
|
+
onPrintWithoutAnnotations: toolbarHandlers.handlePrintWithoutAnnotations,
|
|
2168
|
+
onCopyClick: toolbarHandlers.handleCopy,
|
|
2169
|
+
onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
|
|
2170
|
+
onPropertiesClick: toolbar.getHandler(
|
|
2171
|
+
"properties",
|
|
2172
|
+
onPropertiesClick
|
|
2173
|
+
),
|
|
2174
|
+
onTagsClick: toolbar.getHandler("tags", onTagsClick),
|
|
2175
|
+
onHistoryClick: toolbar.getHandler("history", onHistoryClick),
|
|
2135
2176
|
showAnnotations,
|
|
2136
|
-
userDetails,
|
|
2137
|
-
annotationSelectionMenu,
|
|
2138
2177
|
isHighlighterActive: highlighterActive,
|
|
2139
2178
|
isStampActive: stampActive,
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2179
|
+
disabledHighlighter: toolbar.isDisabled("highlighter"),
|
|
2180
|
+
disabledStamp: toolbar.isDisabled("stamp"),
|
|
2181
|
+
disabledSignature: toolbar.isDisabled("signature"),
|
|
2182
|
+
onHighlighterClick: toolbar.getHandler("highlighter", onHighlighterClick || toolbarHandlers.handleHighlighterClick),
|
|
2183
|
+
onStampClick: toolbar.getHandler("stamp", onStampClick || toolbarHandlers.handleStampClick),
|
|
2184
|
+
onSignatureClick: toolbar.getHandler("signature", onSignatureClick || toolbarHandlers.handleSignatureClick),
|
|
2185
|
+
showAnnotate,
|
|
2186
|
+
disabledAnnotate,
|
|
2187
|
+
showPrintOriginal,
|
|
2188
|
+
showPrintWithAnnotations,
|
|
2189
|
+
showDownloadOriginal,
|
|
2190
|
+
showDownloadWithAnnotations,
|
|
2191
|
+
hasUnsavedAnnotations,
|
|
2192
|
+
isSavingAnnotations,
|
|
2193
|
+
canSaveAnnotations,
|
|
2194
|
+
onSaveAnnotations
|
|
2144
2195
|
}
|
|
2145
|
-
)
|
|
2196
|
+
),
|
|
2197
|
+
/* @__PURE__ */ jsxs5("div", { className: "pdf-viewer-main", children: [
|
|
2198
|
+
/* @__PURE__ */ jsx6("div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ jsx6(
|
|
2199
|
+
StablePDFViewer,
|
|
2200
|
+
{
|
|
2201
|
+
pdfBuffer: pdfBuffer || new ArrayBuffer(0),
|
|
2202
|
+
onPasswordRequest: handlePasswordRequest,
|
|
2203
|
+
pdfViewerRef,
|
|
2204
|
+
hideInternalLoading: true,
|
|
2205
|
+
showAnnotations,
|
|
2206
|
+
userDetails,
|
|
2207
|
+
annotationSelectionMenu,
|
|
2208
|
+
isHighlighterActive: highlighterActive,
|
|
2209
|
+
isStampActive: stampActive,
|
|
2210
|
+
onHighlighterClick: onHighlighterClick || toolbarHandlers.handleHighlighterClick,
|
|
2211
|
+
onStampClick: onStampClick || toolbarHandlers.handleStampClick,
|
|
2212
|
+
onSignatureClick: onSignatureClick || toolbarHandlers.handleSignatureClick,
|
|
2213
|
+
permissions: props.permissions
|
|
2214
|
+
}
|
|
2215
|
+
) }),
|
|
2216
|
+
/* @__PURE__ */ jsx6(
|
|
2217
|
+
SearchSidebar,
|
|
2218
|
+
{
|
|
2219
|
+
isOpen: isSidebarOpen,
|
|
2220
|
+
onClose: handleSidebarClose,
|
|
2221
|
+
onSearch: handleSidebarSearch,
|
|
2222
|
+
onSearchResultClick: handleSearchResultClick,
|
|
2223
|
+
onNextResult: handleNextSearchResult,
|
|
2224
|
+
onPreviousResult: handlePreviousSearchResult,
|
|
2225
|
+
currentResultIndex: currentSearchResultIndex,
|
|
2226
|
+
totalResults: totalSearchResults,
|
|
2227
|
+
searchKeyword: searchQuery,
|
|
2228
|
+
searchResults,
|
|
2229
|
+
isSearching
|
|
2230
|
+
}
|
|
2231
|
+
)
|
|
2232
|
+
] }),
|
|
2146
2233
|
/* @__PURE__ */ jsx6(
|
|
2147
|
-
|
|
2234
|
+
PasswordDialog,
|
|
2148
2235
|
{
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
currentResultIndex: currentSearchResultIndex,
|
|
2156
|
-
totalResults: totalSearchResults,
|
|
2157
|
-
searchKeyword: searchQuery,
|
|
2158
|
-
searchResults,
|
|
2159
|
-
isSearching
|
|
2236
|
+
open: isPasswordDialogOpen,
|
|
2237
|
+
fileName: resolvedFileName,
|
|
2238
|
+
onSubmit: handlePasswordSubmit,
|
|
2239
|
+
onCancel: handlePasswordCancel,
|
|
2240
|
+
error: passwordError,
|
|
2241
|
+
isLoading: isVerifyingPassword
|
|
2160
2242
|
}
|
|
2161
2243
|
)
|
|
2162
|
-
] })
|
|
2163
|
-
/* @__PURE__ */ jsx6(
|
|
2164
|
-
PasswordDialog,
|
|
2165
|
-
{
|
|
2166
|
-
open: isPasswordDialogOpen,
|
|
2167
|
-
fileName: resolvedFileName,
|
|
2168
|
-
onSubmit: handlePasswordSubmit,
|
|
2169
|
-
onCancel: handlePasswordCancel,
|
|
2170
|
-
error: passwordError,
|
|
2171
|
-
isLoading: isVerifyingPassword
|
|
2172
|
-
}
|
|
2173
|
-
)
|
|
2244
|
+
] })
|
|
2174
2245
|
] });
|
|
2175
2246
|
}
|
|
2176
2247
|
);
|
|
@@ -2185,4 +2256,4 @@ PDFViewer.displayName = "PDFViewer";
|
|
|
2185
2256
|
export {
|
|
2186
2257
|
PDFViewer
|
|
2187
2258
|
};
|
|
2188
|
-
//# sourceMappingURL=chunk-
|
|
2259
|
+
//# sourceMappingURL=chunk-PCLERVB7.mjs.map
|