@cannyminds/dms-file-viewers 0.5.0 → 0.6.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-DOOYIHGW.js → chunk-56PP5GHZ.js} +70 -18
- package/dist/chunk-56PP5GHZ.js.map +1 -0
- package/dist/{chunk-7BLEPGZ4.mjs → chunk-7AUCINV2.mjs} +70 -18
- package/dist/chunk-7AUCINV2.mjs.map +1 -0
- package/dist/chunk-A2MSWOEM.js +159 -0
- package/dist/chunk-A2MSWOEM.js.map +1 -0
- package/dist/{chunk-SBEFC7HP.js → chunk-CQ3HSM5S.js} +70 -18
- package/dist/chunk-CQ3HSM5S.js.map +1 -0
- package/dist/{chunk-QELOFQEB.js → chunk-D7LXG67Z.js} +135 -234
- package/dist/chunk-D7LXG67Z.js.map +1 -0
- package/dist/chunk-EAM7CURM.js +334 -0
- package/dist/chunk-EAM7CURM.js.map +1 -0
- package/dist/{chunk-SNEIVT4R.js → chunk-ETHSDRF5.js} +70 -18
- package/dist/chunk-ETHSDRF5.js.map +1 -0
- package/dist/{chunk-RE4XRGSV.js → chunk-FA5L62Y5.js} +52 -32
- package/dist/chunk-FA5L62Y5.js.map +1 -0
- package/dist/chunk-GMDRDOWP.mjs +159 -0
- package/dist/chunk-GMDRDOWP.mjs.map +1 -0
- package/dist/{chunk-4DJJINTB.mjs → chunk-KBST5Z5H.mjs} +69 -17
- package/dist/chunk-KBST5Z5H.mjs.map +1 -0
- package/dist/{chunk-WP55NYFS.js → chunk-LQVHD4FS.js} +71 -19
- package/dist/chunk-LQVHD4FS.js.map +1 -0
- package/dist/chunk-M57PSU4O.mjs +36 -0
- package/dist/chunk-M57PSU4O.mjs.map +1 -0
- package/dist/{chunk-YHMHDPLQ.mjs → chunk-PFJKVNUA.mjs} +69 -17
- package/dist/chunk-PFJKVNUA.mjs.map +1 -0
- package/dist/{chunk-677DWENS.mjs → chunk-THFHTTQX.mjs} +64 -17
- package/dist/chunk-THFHTTQX.mjs.map +1 -0
- package/dist/chunk-U4W524VZ.mjs +334 -0
- package/dist/chunk-U4W524VZ.mjs.map +1 -0
- package/dist/{chunk-77UARJVQ.js → chunk-UUM656JE.js} +66 -19
- package/dist/chunk-UUM656JE.js.map +1 -0
- package/dist/{chunk-QQDQJ7TS.mjs → chunk-VJFXCN5Z.mjs} +50 -30
- package/dist/chunk-VJFXCN5Z.mjs.map +1 -0
- package/dist/{chunk-BHMFZTZ7.mjs → chunk-WNZHGFNC.mjs} +69 -17
- package/dist/chunk-WNZHGFNC.mjs.map +1 -0
- package/dist/chunk-YEPEMLM3.js +36 -0
- package/dist/chunk-YEPEMLM3.js.map +1 -0
- package/dist/{chunk-K5SKH4SD.mjs → chunk-ZKGWS327.mjs} +70 -169
- package/dist/chunk-ZKGWS327.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/AudioViewer.js +4 -3
- package/dist/components/viewers/AudioViewer.js.map +1 -1
- package/dist/components/viewers/AudioViewer.mjs +3 -2
- package/dist/components/viewers/DefaultViewer.d.mts +1 -1
- package/dist/components/viewers/DefaultViewer.d.ts +1 -1
- package/dist/components/viewers/DefaultViewer.js +4 -3
- package/dist/components/viewers/DefaultViewer.js.map +1 -1
- package/dist/components/viewers/DefaultViewer.mjs +3 -2
- package/dist/components/viewers/ImageViewer.d.mts +1 -1
- package/dist/components/viewers/ImageViewer.d.ts +1 -1
- package/dist/components/viewers/ImageViewer.js +4 -4
- package/dist/components/viewers/ImageViewer.mjs +3 -3
- package/dist/components/viewers/PDFViewer.d.mts +1 -1
- package/dist/components/viewers/PDFViewer.d.ts +1 -1
- package/dist/components/viewers/PDFViewer.js +5 -3
- package/dist/components/viewers/PDFViewer.js.map +1 -1
- package/dist/components/viewers/PDFViewer.mjs +4 -2
- package/dist/components/viewers/TIFFViewer.d.mts +1 -1
- package/dist/components/viewers/TIFFViewer.d.ts +1 -1
- package/dist/components/viewers/TIFFViewer.js +4 -3
- package/dist/components/viewers/TIFFViewer.js.map +1 -1
- package/dist/components/viewers/TIFFViewer.mjs +3 -2
- package/dist/components/viewers/TextViewer.d.mts +1 -1
- package/dist/components/viewers/TextViewer.d.ts +1 -1
- package/dist/components/viewers/TextViewer.js +4 -3
- package/dist/components/viewers/TextViewer.js.map +1 -1
- package/dist/components/viewers/TextViewer.mjs +3 -2
- package/dist/components/viewers/VideoViewer.d.mts +1 -1
- package/dist/components/viewers/VideoViewer.d.ts +1 -1
- package/dist/components/viewers/VideoViewer.js +4 -3
- package/dist/components/viewers/VideoViewer.js.map +1 -1
- package/dist/components/viewers/VideoViewer.mjs +3 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{types-C6IEfcTM.d.mts → types-BmZB9kkJ.d.mts} +13 -1
- package/dist/{types-C6IEfcTM.d.ts → types-BmZB9kkJ.d.ts} +13 -1
- package/package.json +1 -1
- package/dist/chunk-4DJJINTB.mjs.map +0 -1
- package/dist/chunk-677DWENS.mjs.map +0 -1
- package/dist/chunk-6ZBHO5SP.js +0 -294
- package/dist/chunk-6ZBHO5SP.js.map +0 -1
- package/dist/chunk-77UARJVQ.js.map +0 -1
- package/dist/chunk-7BLEPGZ4.mjs.map +0 -1
- package/dist/chunk-BHMFZTZ7.mjs.map +0 -1
- package/dist/chunk-DOOYIHGW.js.map +0 -1
- package/dist/chunk-K5SKH4SD.mjs.map +0 -1
- package/dist/chunk-QELOFQEB.js.map +0 -1
- package/dist/chunk-QQDQJ7TS.mjs.map +0 -1
- package/dist/chunk-RE4XRGSV.js.map +0 -1
- package/dist/chunk-SBEFC7HP.js.map +0 -1
- package/dist/chunk-SNEIVT4R.js.map +0 -1
- package/dist/chunk-UX6U3H7J.mjs +0 -294
- package/dist/chunk-UX6U3H7J.mjs.map +0 -1
- package/dist/chunk-WP55NYFS.js.map +0 -1
- package/dist/chunk-YHMHDPLQ.mjs.map +0 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _chunkA2MSWOEMjs = require('./chunk-A2MSWOEM.js');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
var _chunkYEPEMLM3js = require('./chunk-YEPEMLM3.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkFA5L62Y5js = require('./chunk-FA5L62Y5.js');
|
|
6
12
|
|
|
7
13
|
// src/components/viewers/PDFViewer.tsx
|
|
8
14
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
@@ -39,6 +45,7 @@ var _ZoomOut = require('@mui/icons-material/ZoomOut'); var _ZoomOut2 = _interopR
|
|
|
39
45
|
var _FitScreen = require('@mui/icons-material/FitScreen'); var _FitScreen2 = _interopRequireDefault(_FitScreen);
|
|
40
46
|
var _AspectRatio = require('@mui/icons-material/AspectRatio'); var _AspectRatio2 = _interopRequireDefault(_AspectRatio);
|
|
41
47
|
var _Search = require('@mui/icons-material/Search'); var _Search2 = _interopRequireDefault(_Search);
|
|
48
|
+
var _Fullscreen = require('@mui/icons-material/Fullscreen'); var _Fullscreen2 = _interopRequireDefault(_Fullscreen);
|
|
42
49
|
var _Download = require('@mui/icons-material/Download'); var _Download2 = _interopRequireDefault(_Download);
|
|
43
50
|
var _Print = require('@mui/icons-material/Print'); var _Print2 = _interopRequireDefault(_Print);
|
|
44
51
|
var _Info = require('@mui/icons-material/Info'); var _Info2 = _interopRequireDefault(_Info);
|
|
@@ -57,6 +64,10 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
57
64
|
showProperties,
|
|
58
65
|
showDownload,
|
|
59
66
|
showPrint,
|
|
67
|
+
disabledMetadata,
|
|
68
|
+
disabledProperties,
|
|
69
|
+
disabledDownload,
|
|
70
|
+
disabledPrint,
|
|
60
71
|
onFirstPage,
|
|
61
72
|
onPreviousPage,
|
|
62
73
|
onNextPage,
|
|
@@ -68,6 +79,7 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
68
79
|
onFitToWidth,
|
|
69
80
|
onFitToPage,
|
|
70
81
|
onToggleSidebar,
|
|
82
|
+
onToggleFullScreen,
|
|
71
83
|
onDownloadClick,
|
|
72
84
|
onPrintClick,
|
|
73
85
|
onMetadataClick,
|
|
@@ -196,6 +208,16 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
196
208
|
}
|
|
197
209
|
) })
|
|
198
210
|
] }),
|
|
211
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
213
|
+
"button",
|
|
214
|
+
{
|
|
215
|
+
className: "toolbar-button",
|
|
216
|
+
onClick: onToggleFullScreen,
|
|
217
|
+
title: "Fullscreen",
|
|
218
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Fullscreen2.default, { fontSize: "small" })
|
|
219
|
+
}
|
|
220
|
+
) }),
|
|
199
221
|
(showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
200
222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
201
223
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
@@ -204,6 +226,7 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
204
226
|
{
|
|
205
227
|
className: "toolbar-button",
|
|
206
228
|
onClick: onDownloadClick,
|
|
229
|
+
disabled: disabledDownload,
|
|
207
230
|
title: "Download PDF",
|
|
208
231
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
|
|
209
232
|
}
|
|
@@ -213,6 +236,7 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
213
236
|
{
|
|
214
237
|
className: "toolbar-button",
|
|
215
238
|
onClick: onPrintClick,
|
|
239
|
+
disabled: disabledPrint,
|
|
216
240
|
title: "Print PDF",
|
|
217
241
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" })
|
|
218
242
|
}
|
|
@@ -222,8 +246,9 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
222
246
|
{
|
|
223
247
|
className: "toolbar-button",
|
|
224
248
|
onClick: onMetadataClick,
|
|
249
|
+
disabled: disabledMetadata,
|
|
225
250
|
title: "Document Metadata",
|
|
226
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
251
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
|
|
227
252
|
}
|
|
228
253
|
),
|
|
229
254
|
showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -231,8 +256,9 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
231
256
|
{
|
|
232
257
|
className: "toolbar-button",
|
|
233
258
|
onClick: onPropertiesClick,
|
|
259
|
+
disabled: disabledProperties,
|
|
234
260
|
title: "Document Properties",
|
|
235
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
261
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
|
|
236
262
|
}
|
|
237
263
|
)
|
|
238
264
|
] })
|
|
@@ -246,7 +272,7 @@ PDFToolbar.displayName = "PDFToolbar";
|
|
|
246
272
|
|
|
247
273
|
var PDFHeader = _react2.default.memo(({ fileName, fileExtension }) => {
|
|
248
274
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-header", children: [
|
|
249
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFA5L62Y5js.FileIcon_default, { ext: fileExtension, size: 26 }),
|
|
250
276
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "header-file-name", title: fileName, children: fileName })
|
|
251
277
|
] });
|
|
252
278
|
});
|
|
@@ -892,159 +918,6 @@ var PasswordDialog = ({
|
|
|
892
918
|
);
|
|
893
919
|
};
|
|
894
920
|
|
|
895
|
-
// src/components/viewers/pdf/PDFStyles.tsx
|
|
896
|
-
var toolbarStyles = `
|
|
897
|
-
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;500;600;700&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');
|
|
898
|
-
|
|
899
|
-
* {
|
|
900
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
901
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
902
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
903
|
-
'Arial Unicode MS', sans-serif !important;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
/* Target PDF.js text layer */
|
|
907
|
-
.textLayer,
|
|
908
|
-
.textLayer span,
|
|
909
|
-
.textLayer div,
|
|
910
|
-
[class*="pdf"],
|
|
911
|
-
[class*="page"],
|
|
912
|
-
canvas + div,
|
|
913
|
-
.embedpdf-viewport *,
|
|
914
|
-
[data-pdf-viewer] *,
|
|
915
|
-
[role="document"] * {
|
|
916
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
917
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
918
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
919
|
-
'Arial Unicode MS', sans-serif !important;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
.pdf-viewer-header {
|
|
923
|
-
display: flex;
|
|
924
|
-
align-items: center;
|
|
925
|
-
justify-content: flex-start;
|
|
926
|
-
gap: 8px;
|
|
927
|
-
padding: 3px 16px 0 16px;
|
|
928
|
-
background: #fff;
|
|
929
|
-
min-height: 36px;
|
|
930
|
-
}
|
|
931
|
-
.header-file-name {
|
|
932
|
-
font-size: 12px;
|
|
933
|
-
font-weight: 500;
|
|
934
|
-
color: #424242;
|
|
935
|
-
white-space: nowrap;
|
|
936
|
-
overflow: hidden;
|
|
937
|
-
text-overflow: ellipsis;
|
|
938
|
-
max-width: 400px;
|
|
939
|
-
}
|
|
940
|
-
.pdf-viewer-toolbar {
|
|
941
|
-
display: flex;
|
|
942
|
-
align-items: center;
|
|
943
|
-
justify-content: center;
|
|
944
|
-
padding: 0 16px 6px 16px;
|
|
945
|
-
background: #fff;
|
|
946
|
-
gap: 12px;
|
|
947
|
-
flex-wrap: wrap;
|
|
948
|
-
min-height: 44px;
|
|
949
|
-
}
|
|
950
|
-
.toolbar-section {
|
|
951
|
-
display: flex;
|
|
952
|
-
align-items: center;
|
|
953
|
-
gap: 8px;
|
|
954
|
-
}
|
|
955
|
-
.toolbar-separator {
|
|
956
|
-
width: 1px;
|
|
957
|
-
height: 24px;
|
|
958
|
-
background: #e0e0e0;
|
|
959
|
-
margin: 0 4px;
|
|
960
|
-
}
|
|
961
|
-
.toolbar-button {
|
|
962
|
-
padding: 8px;
|
|
963
|
-
border: none;
|
|
964
|
-
background: transparent;
|
|
965
|
-
cursor: pointer;
|
|
966
|
-
border-radius: 4px;
|
|
967
|
-
display: flex;
|
|
968
|
-
align-items: center;
|
|
969
|
-
justify-content: center;
|
|
970
|
-
transition: background 0.2s;
|
|
971
|
-
}
|
|
972
|
-
.toolbar-button:hover:not(:disabled) {
|
|
973
|
-
background: #f5f5f5;
|
|
974
|
-
}
|
|
975
|
-
.toolbar-button:disabled {
|
|
976
|
-
opacity: 0.4;
|
|
977
|
-
cursor: not-allowed;
|
|
978
|
-
}
|
|
979
|
-
.toolbar-button svg {
|
|
980
|
-
width: 20px;
|
|
981
|
-
height: 20px;
|
|
982
|
-
display: block;
|
|
983
|
-
}
|
|
984
|
-
.page-input {
|
|
985
|
-
width: 60px;
|
|
986
|
-
padding: 4px 8px;
|
|
987
|
-
border: 1px solid #e0e0e0;
|
|
988
|
-
border-radius: 4px;
|
|
989
|
-
text-align: center;
|
|
990
|
-
font-size: 14px;
|
|
991
|
-
}
|
|
992
|
-
.page-info {
|
|
993
|
-
font-size: 14px;
|
|
994
|
-
color: #666;
|
|
995
|
-
white-space: nowrap;
|
|
996
|
-
}
|
|
997
|
-
.zoom-display {
|
|
998
|
-
min-width: 60px;
|
|
999
|
-
text-align: center;
|
|
1000
|
-
font-size: 14px;
|
|
1001
|
-
color: #666;
|
|
1002
|
-
}
|
|
1003
|
-
.search-input {
|
|
1004
|
-
padding: 4px 8px;
|
|
1005
|
-
border: 1px solid #e0e0e0;
|
|
1006
|
-
border-radius: 4px;
|
|
1007
|
-
font-size: 14px;
|
|
1008
|
-
min-width: 200px;
|
|
1009
|
-
}
|
|
1010
|
-
.pdf-viewer-content {
|
|
1011
|
-
flex: 1;
|
|
1012
|
-
overflow: hidden;
|
|
1013
|
-
position: relative;
|
|
1014
|
-
user-select: text;
|
|
1015
|
-
-webkit-user-select: text;
|
|
1016
|
-
-moz-user-select: text;
|
|
1017
|
-
-ms-user-select: text;
|
|
1018
|
-
}
|
|
1019
|
-
.pdf-viewer-container {
|
|
1020
|
-
display: flex;
|
|
1021
|
-
flex-direction: column;
|
|
1022
|
-
height: 100%;
|
|
1023
|
-
width: 100%;
|
|
1024
|
-
}
|
|
1025
|
-
.pdf-viewer-main {
|
|
1026
|
-
display: flex;
|
|
1027
|
-
flex: 1;
|
|
1028
|
-
overflow: hidden;
|
|
1029
|
-
position: relative;
|
|
1030
|
-
}
|
|
1031
|
-
.pdf-viewer-viewer-area {
|
|
1032
|
-
flex: 1;
|
|
1033
|
-
overflow: hidden;
|
|
1034
|
-
position: relative;
|
|
1035
|
-
user-select: text;
|
|
1036
|
-
-webkit-user-select: text;
|
|
1037
|
-
-moz-user-select: text;
|
|
1038
|
-
-ms-user-select: text;
|
|
1039
|
-
}
|
|
1040
|
-
.pdf-viewer-viewer-area * {
|
|
1041
|
-
user-select: text !important;
|
|
1042
|
-
-webkit-user-select: text !important;
|
|
1043
|
-
-moz-user-select: text !important;
|
|
1044
|
-
-ms-user-select: text !important;
|
|
1045
|
-
}
|
|
1046
|
-
`;
|
|
1047
|
-
|
|
1048
921
|
// src/components/viewers/PDFViewer.tsx
|
|
1049
922
|
|
|
1050
923
|
var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
@@ -1082,7 +955,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1082
955
|
return "document.pdf";
|
|
1083
956
|
}, [file, fileName]);
|
|
1084
957
|
const fileExtension = _react.useMemo.call(void 0,
|
|
1085
|
-
() =>
|
|
958
|
+
() => _chunkYEPEMLM3js.getFileExtension.call(void 0, resolvedFileName),
|
|
1086
959
|
[resolvedFileName]
|
|
1087
960
|
);
|
|
1088
961
|
const [currentPage, setCurrentPage] = _react.useState.call(void 0, 1);
|
|
@@ -1096,72 +969,94 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1096
969
|
const [currentSearchResultIndex, setCurrentSearchResultIndex] = _react.useState.call(void 0, 0);
|
|
1097
970
|
const [totalSearchResults, setTotalSearchResults] = _react.useState.call(void 0, 0);
|
|
1098
971
|
const [autoExecuteSearch, setAutoExecuteSearch] = _react.useState.call(void 0, !!initialSearchText);
|
|
972
|
+
const [isFullScreen, setIsFullScreen] = _react.useState.call(void 0, false);
|
|
973
|
+
const containerRef = _react.useRef.call(void 0, null);
|
|
1099
974
|
const [isPasswordDialogOpen, setIsPasswordDialogOpen] = _react.useState.call(void 0, false);
|
|
1100
975
|
const [passwordError, setPasswordError] = _react.useState.call(void 0, "");
|
|
1101
976
|
const [passwordResolve, setPasswordResolve] = _react.useState.call(void 0, null);
|
|
1102
977
|
const hasExecutedInitialSearch = _react.useRef.call(void 0, false);
|
|
978
|
+
const handleToggleFullScreen = _react.useCallback.call(void 0, () => {
|
|
979
|
+
if (!isFullScreen && _optionalChain([containerRef, 'access', _ => _.current, 'optionalAccess', _2 => _2.requestFullscreen])) {
|
|
980
|
+
containerRef.current.requestFullscreen();
|
|
981
|
+
setIsFullScreen(true);
|
|
982
|
+
} else if (isFullScreen && document.exitFullscreen) {
|
|
983
|
+
document.exitFullscreen();
|
|
984
|
+
setIsFullScreen(false);
|
|
985
|
+
}
|
|
986
|
+
}, [isFullScreen]);
|
|
987
|
+
const toolbar = _chunkFA5L62Y5js.mergeToolbarConfig.call(void 0, {
|
|
988
|
+
showDownload,
|
|
989
|
+
showPrint,
|
|
990
|
+
showMetadata,
|
|
991
|
+
showProperties,
|
|
992
|
+
onDownloadClick,
|
|
993
|
+
onPrintClick,
|
|
994
|
+
onMetadataClick,
|
|
995
|
+
onPropertiesClick,
|
|
996
|
+
toolbarActions: props.toolbarActions
|
|
997
|
+
});
|
|
1103
998
|
const toolbarHandlers = _react.useMemo.call(void 0, () => ({
|
|
1104
999
|
handleZoomIn: () => {
|
|
1105
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1000
|
+
_optionalChain([pdfViewerRef, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.zoom, 'access', _5 => _5.zoomIn, 'call', _6 => _6()]);
|
|
1106
1001
|
requestAnimationFrame(() => {
|
|
1107
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1002
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _7 => _7.current, 'optionalAccess', _8 => _8.zoom, 'access', _9 => _9.getZoom, 'call', _10 => _10()]);
|
|
1108
1003
|
if (typeof zoomValue === "number") {
|
|
1109
1004
|
setZoom(Math.round(zoomValue * 100));
|
|
1110
1005
|
}
|
|
1111
1006
|
});
|
|
1112
1007
|
},
|
|
1113
1008
|
handleZoomOut: () => {
|
|
1114
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1009
|
+
_optionalChain([pdfViewerRef, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.zoom, 'access', _13 => _13.zoomOut, 'call', _14 => _14()]);
|
|
1115
1010
|
requestAnimationFrame(() => {
|
|
1116
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1011
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.zoom, 'access', _17 => _17.getZoom, 'call', _18 => _18()]);
|
|
1117
1012
|
if (typeof zoomValue === "number") {
|
|
1118
1013
|
setZoom(Math.round(zoomValue * 100));
|
|
1119
1014
|
}
|
|
1120
1015
|
});
|
|
1121
1016
|
},
|
|
1122
1017
|
handleFitToWidth: () => {
|
|
1123
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1018
|
+
_optionalChain([pdfViewerRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.zoom, 'access', _21 => _21.fitToWidth, 'call', _22 => _22()]);
|
|
1124
1019
|
requestAnimationFrame(() => {
|
|
1125
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1020
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.zoom, 'access', _25 => _25.getZoom, 'call', _26 => _26()]);
|
|
1126
1021
|
if (typeof zoomValue === "number") {
|
|
1127
1022
|
setZoom(Math.round(zoomValue * 100));
|
|
1128
1023
|
}
|
|
1129
1024
|
});
|
|
1130
1025
|
},
|
|
1131
1026
|
handleFitToPage: () => {
|
|
1132
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1027
|
+
_optionalChain([pdfViewerRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.zoom, 'access', _29 => _29.fitToPage, 'call', _30 => _30()]);
|
|
1133
1028
|
requestAnimationFrame(() => {
|
|
1134
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1029
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.zoom, 'access', _33 => _33.getZoom, 'call', _34 => _34()]);
|
|
1135
1030
|
if (typeof zoomValue === "number") {
|
|
1136
1031
|
setZoom(Math.round(zoomValue * 100));
|
|
1137
1032
|
}
|
|
1138
1033
|
});
|
|
1139
1034
|
},
|
|
1140
1035
|
handlePreviousPage: () => {
|
|
1141
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1036
|
+
_optionalChain([pdfViewerRef, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.navigation, 'access', _37 => _37.previousPage, 'call', _38 => _38()]);
|
|
1142
1037
|
requestAnimationFrame(() => {
|
|
1143
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1038
|
+
const current = _optionalChain([pdfViewerRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.navigation, 'access', _41 => _41.getCurrentPage, 'call', _42 => _42()]) || 1;
|
|
1144
1039
|
setCurrentPage(current);
|
|
1145
1040
|
});
|
|
1146
1041
|
},
|
|
1147
1042
|
handleNextPage: () => {
|
|
1148
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1043
|
+
_optionalChain([pdfViewerRef, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.navigation, 'access', _45 => _45.nextPage, 'call', _46 => _46()]);
|
|
1149
1044
|
requestAnimationFrame(() => {
|
|
1150
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1045
|
+
const current = _optionalChain([pdfViewerRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.navigation, 'access', _49 => _49.getCurrentPage, 'call', _50 => _50()]) || 1;
|
|
1151
1046
|
setCurrentPage(current);
|
|
1152
1047
|
});
|
|
1153
1048
|
},
|
|
1154
1049
|
handleFirstPage: () => {
|
|
1155
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1050
|
+
_optionalChain([pdfViewerRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.navigation, 'access', _53 => _53.goToFirstPage, 'call', _54 => _54()]);
|
|
1156
1051
|
requestAnimationFrame(() => {
|
|
1157
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1052
|
+
const current = _optionalChain([pdfViewerRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.navigation, 'access', _57 => _57.getCurrentPage, 'call', _58 => _58()]) || 1;
|
|
1158
1053
|
setCurrentPage(current);
|
|
1159
1054
|
});
|
|
1160
1055
|
},
|
|
1161
1056
|
handleLastPage: () => {
|
|
1162
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1057
|
+
_optionalChain([pdfViewerRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.navigation, 'access', _61 => _61.goToLastPage, 'call', _62 => _62()]);
|
|
1163
1058
|
requestAnimationFrame(() => {
|
|
1164
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1059
|
+
const current = _optionalChain([pdfViewerRef, 'access', _63 => _63.current, 'optionalAccess', _64 => _64.navigation, 'access', _65 => _65.getCurrentPage, 'call', _66 => _66()]) || 1;
|
|
1165
1060
|
setCurrentPage(current);
|
|
1166
1061
|
});
|
|
1167
1062
|
},
|
|
@@ -1173,7 +1068,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1173
1068
|
}
|
|
1174
1069
|
const page = parseInt(value, 10);
|
|
1175
1070
|
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1176
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1071
|
+
_optionalChain([pdfViewerRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.navigation, 'access', _69 => _69.goToPage, 'call', _70 => _70(page)]);
|
|
1177
1072
|
setCurrentPage(page);
|
|
1178
1073
|
}
|
|
1179
1074
|
},
|
|
@@ -1182,12 +1077,13 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1182
1077
|
const value = e.target.value;
|
|
1183
1078
|
const page = parseInt(value, 10);
|
|
1184
1079
|
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1185
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1080
|
+
_optionalChain([pdfViewerRef, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.navigation, 'access', _73 => _73.goToPage, 'call', _74 => _74(page)]);
|
|
1186
1081
|
setCurrentPage(page);
|
|
1187
1082
|
}
|
|
1188
1083
|
}
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1084
|
+
},
|
|
1085
|
+
handleToggleFullScreen
|
|
1086
|
+
}), [isSidebarOpen, totalPages, handleToggleFullScreen]);
|
|
1191
1087
|
_react.useEffect.call(void 0, () => {
|
|
1192
1088
|
console.log("came", initialSearchText, pdfViewerRef.current, hasExecutedInitialSearch.current);
|
|
1193
1089
|
if (pdfViewerRef.current && !hasExecutedInitialSearch.current && initialSearchText) {
|
|
@@ -1198,8 +1094,8 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1198
1094
|
setAutoExecuteSearch(false);
|
|
1199
1095
|
pdfViewerRef.current.search.searchText(initialSearchText).then((results) => {
|
|
1200
1096
|
console.log("results", results);
|
|
1201
|
-
if (_optionalChain([results, 'optionalAccess',
|
|
1202
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1097
|
+
if (_optionalChain([results, 'optionalAccess', _75 => _75.results, 'optionalAccess', _76 => _76.length]) > 0) {
|
|
1098
|
+
_optionalChain([pdfViewerRef, 'access', _77 => _77.current, 'optionalAccess', _78 => _78.navigation, 'access', _79 => _79.goToPage, 'call', _80 => _80(results.results[0].pageIndex + 1)]);
|
|
1203
1099
|
}
|
|
1204
1100
|
});
|
|
1205
1101
|
}
|
|
@@ -1251,7 +1147,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1251
1147
|
if (!viewer) return;
|
|
1252
1148
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1253
1149
|
try {
|
|
1254
|
-
const count = _optionalChain([viewer, 'access',
|
|
1150
|
+
const count = _optionalChain([viewer, 'access', _81 => _81.navigation, 'optionalAccess', _82 => _82.getTotalPages, 'optionalCall', _83 => _83()]);
|
|
1255
1151
|
if (count && count > 1) {
|
|
1256
1152
|
setTotalPages(count);
|
|
1257
1153
|
return;
|
|
@@ -1259,11 +1155,11 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1259
1155
|
} catch (e) {
|
|
1260
1156
|
}
|
|
1261
1157
|
try {
|
|
1262
|
-
const results = await _optionalChain([viewer, 'access',
|
|
1263
|
-
if (_optionalChain([results, 'optionalAccess',
|
|
1158
|
+
const results = await _optionalChain([viewer, 'access', _84 => _84.search, 'optionalAccess', _85 => _85.searchText, 'optionalCall', _86 => _86("e")]);
|
|
1159
|
+
if (_optionalChain([results, 'optionalAccess', _87 => _87.results]) && results.results.length > 0) {
|
|
1264
1160
|
const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
|
|
1265
1161
|
const count = Math.max(...pageIndices) + 1;
|
|
1266
|
-
_optionalChain([viewer, 'access',
|
|
1162
|
+
_optionalChain([viewer, 'access', _88 => _88.search, 'optionalAccess', _89 => _89.stopSearch, 'optionalCall', _90 => _90()]);
|
|
1267
1163
|
setTotalPages(count);
|
|
1268
1164
|
return;
|
|
1269
1165
|
}
|
|
@@ -1294,10 +1190,10 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1294
1190
|
_react.useEffect.call(void 0, () => {
|
|
1295
1191
|
if (state === "ready" && pdfViewerRef.current) {
|
|
1296
1192
|
const updateInfo = () => {
|
|
1297
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1298
|
-
const total = _optionalChain([pdfViewerRef, 'access',
|
|
1299
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1300
|
-
const currentSearchState = _optionalChain([pdfViewerRef, 'access',
|
|
1193
|
+
const current = _optionalChain([pdfViewerRef, 'access', _91 => _91.current, 'optionalAccess', _92 => _92.navigation, 'access', _93 => _93.getCurrentPage, 'call', _94 => _94()]) || 1;
|
|
1194
|
+
const total = _optionalChain([pdfViewerRef, 'access', _95 => _95.current, 'optionalAccess', _96 => _96.navigation, 'access', _97 => _97.getTotalPages, 'call', _98 => _98()]) || 0;
|
|
1195
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _99 => _99.current, 'optionalAccess', _100 => _100.zoom, 'access', _101 => _101.getZoom, 'call', _102 => _102()]);
|
|
1196
|
+
const currentSearchState = _optionalChain([pdfViewerRef, 'access', _103 => _103.current, 'optionalAccess', _104 => _104.search, 'access', _105 => _105.getSearchState, 'call', _106 => _106()]);
|
|
1301
1197
|
setCurrentPage(current);
|
|
1302
1198
|
if (total > 0 && total !== totalPages) {
|
|
1303
1199
|
setTotalPages(total);
|
|
@@ -1313,80 +1209,80 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1313
1209
|
}, [state, totalPages]);
|
|
1314
1210
|
_react.useImperativeHandle.call(void 0, ref, () => ({
|
|
1315
1211
|
zoomIn: () => {
|
|
1316
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1212
|
+
_optionalChain([pdfViewerRef, 'access', _107 => _107.current, 'optionalAccess', _108 => _108.zoom, 'access', _109 => _109.zoomIn, 'call', _110 => _110()]);
|
|
1317
1213
|
updateZoomDisplay();
|
|
1318
1214
|
},
|
|
1319
1215
|
zoomOut: () => {
|
|
1320
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1216
|
+
_optionalChain([pdfViewerRef, 'access', _111 => _111.current, 'optionalAccess', _112 => _112.zoom, 'access', _113 => _113.zoomOut, 'call', _114 => _114()]);
|
|
1321
1217
|
updateZoomDisplay();
|
|
1322
1218
|
},
|
|
1323
1219
|
setZoom: (level) => {
|
|
1324
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1220
|
+
_optionalChain([pdfViewerRef, 'access', _115 => _115.current, 'optionalAccess', _116 => _116.zoom, 'access', _117 => _117.setZoom, 'call', _118 => _118(level)]);
|
|
1325
1221
|
updateZoomDisplay();
|
|
1326
1222
|
},
|
|
1327
1223
|
resetZoom: () => {
|
|
1328
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1224
|
+
_optionalChain([pdfViewerRef, 'access', _119 => _119.current, 'optionalAccess', _120 => _120.zoom, 'access', _121 => _121.resetZoom, 'call', _122 => _122()]);
|
|
1329
1225
|
updateZoomDisplay();
|
|
1330
1226
|
},
|
|
1331
1227
|
getZoom: () => {
|
|
1332
|
-
const zoom2 = _optionalChain([pdfViewerRef, 'access',
|
|
1228
|
+
const zoom2 = _optionalChain([pdfViewerRef, 'access', _123 => _123.current, 'optionalAccess', _124 => _124.zoom, 'access', _125 => _125.getZoom, 'call', _126 => _126()]);
|
|
1333
1229
|
return typeof zoom2 === "number" ? zoom2 : 1;
|
|
1334
1230
|
},
|
|
1335
1231
|
goToPage: (page) => {
|
|
1336
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1232
|
+
_optionalChain([pdfViewerRef, 'access', _127 => _127.current, 'optionalAccess', _128 => _128.navigation, 'access', _129 => _129.goToPage, 'call', _130 => _130(page)]);
|
|
1337
1233
|
setCurrentPage(page);
|
|
1338
1234
|
},
|
|
1339
|
-
getCurrentPage: () => _optionalChain([pdfViewerRef, 'access',
|
|
1340
|
-
getTotalPages: () => _optionalChain([pdfViewerRef, 'access',
|
|
1235
|
+
getCurrentPage: () => _optionalChain([pdfViewerRef, 'access', _131 => _131.current, 'optionalAccess', _132 => _132.navigation, 'access', _133 => _133.getCurrentPage, 'call', _134 => _134()]) || 1,
|
|
1236
|
+
getTotalPages: () => _optionalChain([pdfViewerRef, 'access', _135 => _135.current, 'optionalAccess', _136 => _136.navigation, 'access', _137 => _137.getTotalPages, 'call', _138 => _138()]) || 0,
|
|
1341
1237
|
nextPage: () => {
|
|
1342
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1238
|
+
_optionalChain([pdfViewerRef, 'access', _139 => _139.current, 'optionalAccess', _140 => _140.navigation, 'access', _141 => _141.nextPage, 'call', _142 => _142()]);
|
|
1343
1239
|
updatePageDisplay();
|
|
1344
1240
|
},
|
|
1345
1241
|
previousPage: () => {
|
|
1346
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1242
|
+
_optionalChain([pdfViewerRef, 'access', _143 => _143.current, 'optionalAccess', _144 => _144.navigation, 'access', _145 => _145.previousPage, 'call', _146 => _146()]);
|
|
1347
1243
|
updatePageDisplay();
|
|
1348
1244
|
},
|
|
1349
1245
|
goToFirstPage: () => {
|
|
1350
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1246
|
+
_optionalChain([pdfViewerRef, 'access', _147 => _147.current, 'optionalAccess', _148 => _148.navigation, 'access', _149 => _149.goToFirstPage, 'call', _150 => _150()]);
|
|
1351
1247
|
updatePageDisplay();
|
|
1352
1248
|
},
|
|
1353
1249
|
goToLastPage: () => {
|
|
1354
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1250
|
+
_optionalChain([pdfViewerRef, 'access', _151 => _151.current, 'optionalAccess', _152 => _152.navigation, 'access', _153 => _153.goToLastPage, 'call', _154 => _154()]);
|
|
1355
1251
|
updatePageDisplay();
|
|
1356
1252
|
},
|
|
1357
1253
|
searchText: async (keyword) => {
|
|
1358
1254
|
setIsSearching(true);
|
|
1359
|
-
const results = await _optionalChain([pdfViewerRef, 'access',
|
|
1255
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _155 => _155.current, 'optionalAccess', _156 => _156.search, 'access', _157 => _157.searchText, 'call', _158 => _158(keyword)]);
|
|
1360
1256
|
setIsSearching(false);
|
|
1361
1257
|
setSearchQuery(keyword);
|
|
1362
1258
|
return results;
|
|
1363
1259
|
},
|
|
1364
1260
|
nextResult: () => {
|
|
1365
|
-
const index = _optionalChain([pdfViewerRef, 'access',
|
|
1261
|
+
const index = _optionalChain([pdfViewerRef, 'access', _159 => _159.current, 'optionalAccess', _160 => _160.search, 'access', _161 => _161.nextResult, 'call', _162 => _162()]) || -1;
|
|
1366
1262
|
return index;
|
|
1367
1263
|
},
|
|
1368
1264
|
previousResult: () => {
|
|
1369
|
-
const index = _optionalChain([pdfViewerRef, 'access',
|
|
1265
|
+
const index = _optionalChain([pdfViewerRef, 'access', _163 => _163.current, 'optionalAccess', _164 => _164.search, 'access', _165 => _165.previousResult, 'call', _166 => _166()]) || -1;
|
|
1370
1266
|
return index;
|
|
1371
1267
|
},
|
|
1372
|
-
goToResult: (index) => _optionalChain([pdfViewerRef, 'access',
|
|
1268
|
+
goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _167 => _167.current, 'optionalAccess', _168 => _168.search, 'access', _169 => _169.goToResult, 'call', _170 => _170(index)]) || -1,
|
|
1373
1269
|
stopSearch: () => {
|
|
1374
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1270
|
+
_optionalChain([pdfViewerRef, 'access', _171 => _171.current, 'optionalAccess', _172 => _172.search, 'access', _173 => _173.stopSearch, 'call', _174 => _174()]);
|
|
1375
1271
|
setSearchQuery("");
|
|
1376
1272
|
},
|
|
1377
|
-
getSearchState: () => _optionalChain([pdfViewerRef, 'access',
|
|
1378
|
-
getSelectedText: () => _optionalChain([pdfViewerRef, 'access',
|
|
1379
|
-
clearSelection: () => _optionalChain([pdfViewerRef, 'access',
|
|
1273
|
+
getSearchState: () => _optionalChain([pdfViewerRef, 'access', _175 => _175.current, 'optionalAccess', _176 => _176.search, 'access', _177 => _177.getSearchState, 'call', _178 => _178()]) || null,
|
|
1274
|
+
getSelectedText: () => _optionalChain([pdfViewerRef, 'access', _179 => _179.current, 'optionalAccess', _180 => _180.selection, 'access', _181 => _181.getSelectedText, 'call', _182 => _182()]) || "",
|
|
1275
|
+
clearSelection: () => _optionalChain([pdfViewerRef, 'access', _183 => _183.current, 'optionalAccess', _184 => _184.selection, 'access', _185 => _185.clearSelection, 'call', _186 => _186()])
|
|
1380
1276
|
}), []);
|
|
1381
1277
|
const updatePageDisplay = () => {
|
|
1382
1278
|
requestAnimationFrame(() => {
|
|
1383
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1279
|
+
const current = _optionalChain([pdfViewerRef, 'access', _187 => _187.current, 'optionalAccess', _188 => _188.navigation, 'access', _189 => _189.getCurrentPage, 'call', _190 => _190()]) || 1;
|
|
1384
1280
|
setCurrentPage(current);
|
|
1385
1281
|
});
|
|
1386
1282
|
};
|
|
1387
1283
|
const updateZoomDisplay = () => {
|
|
1388
1284
|
requestAnimationFrame(() => {
|
|
1389
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1285
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _191 => _191.current, 'optionalAccess', _192 => _192.zoom, 'access', _193 => _193.getZoom, 'call', _194 => _194()]);
|
|
1390
1286
|
if (typeof zoomValue === "number") {
|
|
1391
1287
|
setZoom(Math.round(zoomValue * 100));
|
|
1392
1288
|
}
|
|
@@ -1395,7 +1291,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1395
1291
|
const handleSearch = async () => {
|
|
1396
1292
|
if (searchQuery.trim()) {
|
|
1397
1293
|
setIsSearching(true);
|
|
1398
|
-
const results = await _optionalChain([pdfViewerRef, 'access',
|
|
1294
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _195 => _195.current, 'optionalAccess', _196 => _196.search, 'access', _197 => _197.searchText, 'call', _198 => _198(searchQuery)]);
|
|
1399
1295
|
setIsSearching(false);
|
|
1400
1296
|
if (results && results.results) {
|
|
1401
1297
|
const formattedResults = results.results.map((result, index) => {
|
|
@@ -1443,7 +1339,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1443
1339
|
setSearchQuery(keyword);
|
|
1444
1340
|
if (keyword.trim()) {
|
|
1445
1341
|
setIsSearching(true);
|
|
1446
|
-
const results = await _optionalChain([pdfViewerRef, 'access',
|
|
1342
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _199 => _199.current, 'optionalAccess', _200 => _200.search, 'access', _201 => _201.searchText, 'call', _202 => _202(keyword)]);
|
|
1447
1343
|
setIsSearching(false);
|
|
1448
1344
|
if (results && results.results && results.results.length > 0) {
|
|
1449
1345
|
const formattedResults = results.results.map((result, index) => {
|
|
@@ -1474,7 +1370,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1474
1370
|
setCurrentSearchResultIndex(0);
|
|
1475
1371
|
if (formattedResults.length > 0) {
|
|
1476
1372
|
const firstPageNumber = formattedResults[0].pageNumber;
|
|
1477
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1373
|
+
_optionalChain([pdfViewerRef, 'access', _203 => _203.current, 'optionalAccess', _204 => _204.navigation, 'access', _205 => _205.goToPage, 'call', _206 => _206(firstPageNumber)]);
|
|
1478
1374
|
setCurrentPage(firstPageNumber);
|
|
1479
1375
|
}
|
|
1480
1376
|
} else if (pageNumbers && pageNumbers.length > 0) {
|
|
@@ -1487,7 +1383,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1487
1383
|
setSearchResults(fallbackResults);
|
|
1488
1384
|
setTotalSearchResults(fallbackResults.length);
|
|
1489
1385
|
setCurrentSearchResultIndex(0);
|
|
1490
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1386
|
+
_optionalChain([pdfViewerRef, 'access', _207 => _207.current, 'optionalAccess', _208 => _208.navigation, 'access', _209 => _209.goToPage, 'call', _210 => _210(pageNumbers[0])]);
|
|
1491
1387
|
setCurrentPage(pageNumbers[0]);
|
|
1492
1388
|
} else {
|
|
1493
1389
|
setSearchResults([]);
|
|
@@ -1496,25 +1392,25 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1496
1392
|
}
|
|
1497
1393
|
} else {
|
|
1498
1394
|
setSearchResults([]);
|
|
1499
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1395
|
+
_optionalChain([pdfViewerRef, 'access', _211 => _211.current, 'optionalAccess', _212 => _212.search, 'access', _213 => _213.stopSearch, 'call', _214 => _214()]);
|
|
1500
1396
|
setTotalSearchResults(0);
|
|
1501
1397
|
setCurrentSearchResultIndex(0);
|
|
1502
1398
|
}
|
|
1503
1399
|
};
|
|
1504
1400
|
const handleSearchResultClick = (pageNumber, resultIndex) => {
|
|
1505
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1401
|
+
_optionalChain([pdfViewerRef, 'access', _215 => _215.current, 'optionalAccess', _216 => _216.navigation, 'access', _217 => _217.goToPage, 'call', _218 => _218(pageNumber)]);
|
|
1506
1402
|
setCurrentSearchResultIndex(resultIndex);
|
|
1507
1403
|
setCurrentPage(pageNumber);
|
|
1508
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1404
|
+
_optionalChain([pdfViewerRef, 'access', _219 => _219.current, 'optionalAccess', _220 => _220.search, 'access', _221 => _221.goToResult, 'call', _222 => _222(resultIndex)]);
|
|
1509
1405
|
};
|
|
1510
1406
|
const handleNextSearchResult = () => {
|
|
1511
1407
|
if (currentSearchResultIndex < totalSearchResults - 1) {
|
|
1512
1408
|
const nextIndex = currentSearchResultIndex + 1;
|
|
1513
1409
|
setCurrentSearchResultIndex(nextIndex);
|
|
1514
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1410
|
+
_optionalChain([pdfViewerRef, 'access', _223 => _223.current, 'optionalAccess', _224 => _224.search, 'access', _225 => _225.nextResult, 'call', _226 => _226()]);
|
|
1515
1411
|
if (searchResults[nextIndex]) {
|
|
1516
1412
|
const pageNumber = searchResults[nextIndex].pageNumber;
|
|
1517
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1413
|
+
_optionalChain([pdfViewerRef, 'access', _227 => _227.current, 'optionalAccess', _228 => _228.navigation, 'access', _229 => _229.goToPage, 'call', _230 => _230(pageNumber)]);
|
|
1518
1414
|
setCurrentPage(pageNumber);
|
|
1519
1415
|
}
|
|
1520
1416
|
}
|
|
@@ -1523,10 +1419,10 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1523
1419
|
if (currentSearchResultIndex > 0) {
|
|
1524
1420
|
const prevIndex = currentSearchResultIndex - 1;
|
|
1525
1421
|
setCurrentSearchResultIndex(prevIndex);
|
|
1526
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1422
|
+
_optionalChain([pdfViewerRef, 'access', _231 => _231.current, 'optionalAccess', _232 => _232.search, 'access', _233 => _233.previousResult, 'call', _234 => _234()]);
|
|
1527
1423
|
if (searchResults[prevIndex]) {
|
|
1528
1424
|
const pageNumber = searchResults[prevIndex].pageNumber;
|
|
1529
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1425
|
+
_optionalChain([pdfViewerRef, 'access', _235 => _235.current, 'optionalAccess', _236 => _236.navigation, 'access', _237 => _237.goToPage, 'call', _238 => _238(pageNumber)]);
|
|
1530
1426
|
setCurrentPage(pageNumber);
|
|
1531
1427
|
}
|
|
1532
1428
|
}
|
|
@@ -1557,12 +1453,12 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1557
1453
|
}
|
|
1558
1454
|
setPdfBuffer(arrayBuffer);
|
|
1559
1455
|
setState("ready");
|
|
1560
|
-
_optionalChain([onLoad, 'optionalCall',
|
|
1456
|
+
_optionalChain([onLoad, 'optionalCall', _239 => _239()]);
|
|
1561
1457
|
} catch (err) {
|
|
1562
1458
|
const errorMessage = err.message || "Failed to load PDF";
|
|
1563
1459
|
setState("error");
|
|
1564
1460
|
setError(errorMessage);
|
|
1565
|
-
_optionalChain([onError, 'optionalCall',
|
|
1461
|
+
_optionalChain([onError, 'optionalCall', _240 => _240(err)]);
|
|
1566
1462
|
}
|
|
1567
1463
|
};
|
|
1568
1464
|
loadPDF();
|
|
@@ -1643,8 +1539,8 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1643
1539
|
height: "100%"
|
|
1644
1540
|
}, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Preparing PDF..." }) });
|
|
1645
1541
|
}
|
|
1646
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-container", children: [
|
|
1647
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: toolbarStyles }),
|
|
1542
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: containerRef, className: "pdf-viewer-container", children: [
|
|
1543
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: _chunkA2MSWOEMjs.toolbarStyles }),
|
|
1648
1544
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1649
1545
|
PDFHeader,
|
|
1650
1546
|
{
|
|
@@ -1663,10 +1559,14 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1663
1559
|
showPageCount,
|
|
1664
1560
|
showZoomControls,
|
|
1665
1561
|
showSearch,
|
|
1666
|
-
showMetadata,
|
|
1667
|
-
showProperties,
|
|
1668
|
-
showDownload,
|
|
1669
|
-
showPrint,
|
|
1562
|
+
showMetadata: !toolbar.isHidden("metadata"),
|
|
1563
|
+
showProperties: !toolbar.isHidden("properties"),
|
|
1564
|
+
showDownload: !toolbar.isHidden("download"),
|
|
1565
|
+
showPrint: !toolbar.isHidden("print"),
|
|
1566
|
+
disabledMetadata: toolbar.isDisabled("metadata"),
|
|
1567
|
+
disabledProperties: toolbar.isDisabled("properties"),
|
|
1568
|
+
disabledDownload: toolbar.isDisabled("download"),
|
|
1569
|
+
disabledPrint: toolbar.isDisabled("print"),
|
|
1670
1570
|
onFirstPage: toolbarHandlers.handleFirstPage,
|
|
1671
1571
|
onPreviousPage: toolbarHandlers.handlePreviousPage,
|
|
1672
1572
|
onNextPage: toolbarHandlers.handleNextPage,
|
|
@@ -1678,10 +1578,11 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1678
1578
|
onFitToWidth: toolbarHandlers.handleFitToWidth,
|
|
1679
1579
|
onFitToPage: toolbarHandlers.handleFitToPage,
|
|
1680
1580
|
onToggleSidebar: toolbarHandlers.toggleSidebar,
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1581
|
+
onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
|
|
1582
|
+
onDownloadClick: toolbar.getHandler("download", onDownloadClick),
|
|
1583
|
+
onPrintClick: toolbar.getHandler("print", onPrintClick),
|
|
1584
|
+
onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
|
|
1585
|
+
onPropertiesClick: toolbar.getHandler("properties", onPropertiesClick)
|
|
1685
1586
|
}
|
|
1686
1587
|
),
|
|
1687
1588
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-main", children: [
|
|
@@ -1731,4 +1632,4 @@ PDFViewer.displayName = "PDFViewer";
|
|
|
1731
1632
|
|
|
1732
1633
|
|
|
1733
1634
|
exports.PDFViewer = PDFViewer;
|
|
1734
|
-
//# sourceMappingURL=chunk-
|
|
1635
|
+
//# sourceMappingURL=chunk-D7LXG67Z.js.map
|