pdf-tsx 0.10.0 → 0.12.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/README.md +51 -4
- package/dist/cjs/components/PDFViewer.cjs +1 -1
- package/dist/cjs/components/PDFViewer.module.cjs +1 -1
- package/dist/cjs/components/features/PDFAnnotations.cjs +1 -1
- package/dist/cjs/components/features/PDFAnnotations.module.cjs +1 -1
- package/dist/cjs/components/features/PDFAttachments.cjs +1 -1
- package/dist/cjs/components/features/PDFChangeFile.cjs +1 -1
- package/dist/cjs/components/features/PDFDownloadButton.cjs +1 -1
- package/dist/cjs/components/features/PDFNavigation.cjs +1 -1
- package/dist/cjs/components/features/PDFNavigation.module.cjs +1 -1
- package/dist/cjs/components/features/PDFOutline.cjs +1 -1
- package/dist/cjs/components/features/PDFPageFit.cjs +1 -1
- package/dist/cjs/components/features/PDFPrintButton.cjs +1 -1
- package/dist/cjs/components/features/PDFRotationControl.cjs +1 -1
- package/dist/cjs/components/features/PDFSearch.cjs +1 -1
- package/dist/cjs/components/features/PDFSidebarToggle.cjs +1 -1
- package/dist/cjs/components/features/PDFSignatures.cjs +1 -1
- package/dist/cjs/components/features/PDFThemeToggle.cjs +1 -1
- package/dist/cjs/components/features/PDFThumbnails.cjs +1 -1
- package/dist/cjs/components/features/PDFZoomControls.cjs +1 -1
- package/dist/cjs/components/ui/PDFToolbar.cjs +1 -1
- package/dist/cjs/components/ui/PDFToolbarSeparator.cjs +1 -0
- package/dist/cjs/components/ui/PDFToolbarSeparator.module.cjs +1 -0
- package/dist/cjs/context/LabelsContext.cjs +1 -0
- package/dist/cjs/context/labelsContextValue.cjs +1 -0
- package/dist/cjs/hooks/useAnnotationLayer.cjs +1 -1
- package/dist/cjs/hooks/useAnnotations.cjs +1 -1
- package/dist/cjs/hooks/useLabels.cjs +1 -0
- package/dist/cjs/hooks/usePDFLoader.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/labels.cjs +1 -0
- package/dist/cjs/pdf-tsx.css +1 -1
- package/dist/cjs/theme.cjs +1 -1
- package/dist/components/PDFViewer.d.ts +1 -0
- package/dist/components/features/PDFChangeFile.d.ts +1 -1
- package/dist/components/features/PDFDownloadButton.d.ts +1 -1
- package/dist/components/features/PDFNavigation.d.ts +1 -1
- package/dist/components/features/PDFPageFit.d.ts +1 -1
- package/dist/components/features/PDFPrintButton.d.ts +1 -1
- package/dist/components/features/PDFRotationControl.d.ts +1 -1
- package/dist/components/features/PDFSearch.d.ts +3 -2
- package/dist/components/features/PDFSidebarToggle.d.ts +1 -1
- package/dist/components/features/PDFThemeToggle.d.ts +1 -1
- package/dist/components/features/PDFZoomControls.d.ts +1 -1
- package/dist/components/ui/PDFToolbarSeparator.d.ts +1 -0
- package/dist/context/LabelsContext.d.ts +7 -0
- package/dist/context/labelsContextValue.d.ts +2 -0
- package/dist/es/components/PDFViewer.js +311 -193
- package/dist/es/components/PDFViewer.module.js +21 -15
- package/dist/es/components/features/PDFAnnotations.js +132 -62
- package/dist/es/components/features/PDFAnnotations.module.js +12 -12
- package/dist/es/components/features/PDFAttachments.js +42 -41
- package/dist/es/components/features/PDFChangeFile.js +17 -16
- package/dist/es/components/features/PDFDownloadButton.js +15 -14
- package/dist/es/components/features/PDFNavigation.js +39 -38
- package/dist/es/components/features/PDFNavigation.module.js +3 -3
- package/dist/es/components/features/PDFOutline.js +46 -45
- package/dist/es/components/features/PDFPageFit.js +19 -18
- package/dist/es/components/features/PDFPrintButton.js +14 -13
- package/dist/es/components/features/PDFRotationControl.js +12 -11
- package/dist/es/components/features/PDFSearch.js +71 -55
- package/dist/es/components/features/PDFSidebarToggle.js +13 -12
- package/dist/es/components/features/PDFSignatures.js +87 -84
- package/dist/es/components/features/PDFThemeToggle.js +12 -11
- package/dist/es/components/features/PDFThumbnails.js +33 -32
- package/dist/es/components/features/PDFZoomControls.js +23 -22
- package/dist/es/components/ui/PDFToolbar.js +56 -55
- package/dist/es/components/ui/PDFToolbarSeparator.js +13 -0
- package/dist/es/components/ui/PDFToolbarSeparator.module.js +3 -0
- package/dist/es/context/LabelsContext.js +14 -0
- package/dist/es/context/labelsContextValue.js +5 -0
- package/dist/es/hooks/useAnnotationLayer.js +37 -20
- package/dist/es/hooks/useAnnotations.js +5 -3
- package/dist/es/hooks/useLabels.js +9 -0
- package/dist/es/hooks/usePDFLoader.js +6 -2
- package/dist/es/index.js +22 -20
- package/dist/es/labels.js +124 -0
- package/dist/es/pdf-tsx.css +1 -1
- package/dist/es/theme.js +6 -3
- package/dist/hooks/useAnnotationLayer.d.ts +15 -1
- package/dist/hooks/useLabels.d.ts +2 -0
- package/dist/hooks/usePDFLoader.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/labels.d.ts +51 -0
- package/dist/theme.d.ts +1 -0
- package/package.json +2 -1
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
appLayout: "
|
|
3
|
-
body: "
|
|
4
|
-
toolbar: "
|
|
5
|
-
scrollContainer: "
|
|
6
|
-
pageWrapper: "
|
|
7
|
-
pageCanvas: "
|
|
8
|
-
textLayer: "
|
|
9
|
-
markedContent: "
|
|
10
|
-
endOfContent: "
|
|
11
|
-
selecting: "
|
|
12
|
-
|
|
13
|
-
spin: "
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
appLayout: "_appLayout_jb06o_1",
|
|
3
|
+
body: "_body_jb06o_9",
|
|
4
|
+
toolbar: "_toolbar_jb06o_17",
|
|
5
|
+
scrollContainer: "_scrollContainer_jb06o_29",
|
|
6
|
+
pageWrapper: "_pageWrapper_jb06o_40",
|
|
7
|
+
pageCanvas: "_pageCanvas_jb06o_45",
|
|
8
|
+
textLayer: "_textLayer_jb06o_54",
|
|
9
|
+
markedContent: "_markedContent_jb06o_80",
|
|
10
|
+
endOfContent: "_endOfContent_jb06o_95",
|
|
11
|
+
selecting: "_selecting_jb06o_104",
|
|
12
|
+
documentLoading: "_documentLoading_jb06o_124",
|
|
13
|
+
spin: "_spin_jb06o_1",
|
|
14
|
+
pageSkeleton: "_pageSkeleton_jb06o_144",
|
|
15
|
+
highlightOverlay: "_highlightOverlay_jb06o_173",
|
|
16
|
+
linkOverlay: "_linkOverlay_jb06o_182",
|
|
17
|
+
searchMatchOverlay: "_searchMatchOverlay_jb06o_189",
|
|
18
|
+
noteOverlay: "_noteOverlay_jb06o_197",
|
|
19
|
+
noteIconOverlay: "_noteIconOverlay_jb06o_204",
|
|
20
|
+
notePopover: "_notePopover_jb06o_221",
|
|
21
|
+
notePopoverTitle: "_notePopoverTitle_jb06o_234",
|
|
22
|
+
notePopoverContent: "_notePopoverContent_jb06o_241"
|
|
17
23
|
};
|
|
18
24
|
//#endregion
|
|
19
25
|
export { e as default };
|
|
@@ -1,93 +1,163 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
2
|
import { computeFit as t } from "../../utils/pdfFit.js";
|
|
3
|
-
import {
|
|
4
|
-
import r from "
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
3
|
+
import { useLabels as n } from "../../hooks/useLabels.js";
|
|
4
|
+
import { useAnnotations as r } from "../../hooks/useAnnotations.js";
|
|
5
|
+
import i from "./PDFAnnotations.module.js";
|
|
6
|
+
import { memo as a, useCallback as o, useMemo as s } from "react";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/features/PDFAnnotations.tsx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Stamp: "Timbro",
|
|
19
|
-
FileAttachment: "Allegato"
|
|
20
|
-
}, u = i(function({ ann: e, onNavigate: t }) {
|
|
21
|
-
let n = l[e.subtype] ?? e.subtype, i = a(() => t(e), [t, e]);
|
|
22
|
-
return /* @__PURE__ */ c("div", {
|
|
23
|
-
className: `${r.card} ${e.rect ? r.cardClickable : ""}`,
|
|
24
|
-
onClick: i,
|
|
9
|
+
function u({ subtype: e }) {
|
|
10
|
+
let t = {
|
|
11
|
+
width: 14,
|
|
12
|
+
height: 14,
|
|
13
|
+
fill: "none",
|
|
14
|
+
"aria-hidden": !0
|
|
15
|
+
};
|
|
16
|
+
return e === "Text" ? /* @__PURE__ */ l("svg", {
|
|
17
|
+
...t,
|
|
18
|
+
viewBox: "0 0 12 12",
|
|
25
19
|
children: [
|
|
26
|
-
/* @__PURE__ */ c("
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
/* @__PURE__ */ c("rect", {
|
|
21
|
+
x: "0.5",
|
|
22
|
+
y: "0.5",
|
|
23
|
+
width: "9",
|
|
24
|
+
height: "8",
|
|
25
|
+
rx: "1",
|
|
26
|
+
fill: "rgba(255,210,0,0.9)",
|
|
27
|
+
stroke: "rgba(160,120,0,0.7)",
|
|
28
|
+
strokeWidth: "1"
|
|
29
|
+
}),
|
|
30
|
+
/* @__PURE__ */ c("path", {
|
|
31
|
+
d: "M9.5 5.5v3l2.5-3z",
|
|
32
|
+
fill: "rgba(255,210,0,0.9)",
|
|
33
|
+
stroke: "rgba(160,120,0,0.7)",
|
|
34
|
+
strokeWidth: "1"
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ c("line", {
|
|
37
|
+
x1: "2",
|
|
38
|
+
y1: "3",
|
|
39
|
+
x2: "8",
|
|
40
|
+
y2: "3",
|
|
41
|
+
stroke: "rgba(90,60,0,0.8)",
|
|
42
|
+
strokeWidth: "1",
|
|
43
|
+
strokeLinecap: "round"
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ c("line", {
|
|
46
|
+
x1: "2",
|
|
47
|
+
y1: "5.5",
|
|
48
|
+
x2: "7",
|
|
49
|
+
y2: "5.5",
|
|
50
|
+
stroke: "rgba(90,60,0,0.8)",
|
|
51
|
+
strokeWidth: "1",
|
|
52
|
+
strokeLinecap: "round"
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}) : /* @__PURE__ */ l("svg", {
|
|
56
|
+
...t,
|
|
57
|
+
viewBox: "0 0 16 16",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ c("circle", {
|
|
60
|
+
cx: "8",
|
|
61
|
+
cy: "8",
|
|
62
|
+
r: "5.5",
|
|
63
|
+
stroke: "currentColor",
|
|
64
|
+
strokeWidth: "1.5"
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ c("line", {
|
|
67
|
+
x1: "8",
|
|
68
|
+
y1: "6",
|
|
69
|
+
x2: "8",
|
|
70
|
+
y2: "10",
|
|
71
|
+
stroke: "currentColor",
|
|
72
|
+
strokeWidth: "1.5",
|
|
73
|
+
strokeLinecap: "round"
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ c("circle", {
|
|
76
|
+
cx: "8",
|
|
77
|
+
cy: "4.5",
|
|
78
|
+
r: "0.75",
|
|
79
|
+
fill: "currentColor"
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
var d = a(function({ ann: e, annotationTypes: t, onNavigate: n }) {
|
|
85
|
+
let r = t[e.subtype] ?? e.subtype, a = o(() => n(e), [n, e]);
|
|
86
|
+
return /* @__PURE__ */ l("div", {
|
|
87
|
+
className: `${i.card} ${e.rect ? i.cardClickable : ""}`,
|
|
88
|
+
onClick: a,
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ l("div", {
|
|
91
|
+
className: i.cardHeader,
|
|
92
|
+
children: [/* @__PURE__ */ l("span", {
|
|
93
|
+
className: i.cardLabel,
|
|
94
|
+
children: [/* @__PURE__ */ c(u, { subtype: e.subtype }), r]
|
|
95
|
+
}), /* @__PURE__ */ l("span", {
|
|
96
|
+
className: i.cardPage,
|
|
33
97
|
children: ["p.", e.page]
|
|
34
98
|
})]
|
|
35
99
|
}),
|
|
36
|
-
e.title && /* @__PURE__ */
|
|
37
|
-
className:
|
|
100
|
+
e.title && /* @__PURE__ */ c("div", {
|
|
101
|
+
className: i.cardAuthor,
|
|
38
102
|
children: e.title
|
|
39
103
|
}),
|
|
40
|
-
e.contents && /* @__PURE__ */
|
|
41
|
-
className:
|
|
104
|
+
e.contents && /* @__PURE__ */ c("div", {
|
|
105
|
+
className: i.cardContent,
|
|
42
106
|
children: e.contents
|
|
43
107
|
})
|
|
44
108
|
]
|
|
45
109
|
});
|
|
46
110
|
});
|
|
47
|
-
function
|
|
48
|
-
let { pdf:
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
className:
|
|
51
|
-
children: [t, !o &&
|
|
52
|
-
className:
|
|
53
|
-
children:
|
|
111
|
+
function f({ icon: t }) {
|
|
112
|
+
let { pdf: n } = e(), { annotations: a, loading: o } = r({ pdf: n }), s = a.length;
|
|
113
|
+
return /* @__PURE__ */ l("span", {
|
|
114
|
+
className: i.iconWrapper,
|
|
115
|
+
children: [t, !o && s > 0 && /* @__PURE__ */ c("span", {
|
|
116
|
+
className: i.badge,
|
|
117
|
+
children: s > 99 ? "99+" : s
|
|
54
118
|
})]
|
|
55
119
|
});
|
|
56
120
|
}
|
|
57
|
-
function
|
|
58
|
-
let { pdf:
|
|
59
|
-
|
|
121
|
+
function p() {
|
|
122
|
+
let { pdf: a, goToPage: u, setHighlight: f, setZoom: p, setFitMode: m, rotation: h, containerRef: g } = e(), _ = n(), { annotations: v, loading: y } = r({ pdf: a }), b = o(async (e) => {
|
|
123
|
+
m("page"), a && g.current && p(await t("page", a, g.current, h)), u(e.page), e.rect && f({
|
|
60
124
|
page: e.page,
|
|
61
125
|
pdfRect: e.rect
|
|
62
126
|
});
|
|
63
127
|
}, [
|
|
64
|
-
|
|
65
|
-
|
|
128
|
+
a,
|
|
129
|
+
g,
|
|
130
|
+
h,
|
|
131
|
+
u,
|
|
66
132
|
p,
|
|
67
|
-
|
|
68
|
-
f
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
className: r.list,
|
|
133
|
+
m,
|
|
134
|
+
f
|
|
135
|
+
]), x = s(() => v.reduce((e, t) => ((e[t.page] ??= []).push(t), e), {}), [v]);
|
|
136
|
+
return /* @__PURE__ */ l("div", {
|
|
137
|
+
className: i.list,
|
|
73
138
|
children: [
|
|
74
|
-
|
|
75
|
-
className:
|
|
76
|
-
children:
|
|
139
|
+
y && /* @__PURE__ */ c("div", {
|
|
140
|
+
className: i.emptyState,
|
|
141
|
+
children: _.annotationsLoading
|
|
77
142
|
}),
|
|
78
|
-
!
|
|
79
|
-
className:
|
|
80
|
-
children:
|
|
143
|
+
!y && v.length === 0 && /* @__PURE__ */ c("div", {
|
|
144
|
+
className: i.emptyState,
|
|
145
|
+
children: _.annotationsEmpty
|
|
81
146
|
}),
|
|
82
|
-
!
|
|
83
|
-
className:
|
|
84
|
-
children: [
|
|
85
|
-
|
|
147
|
+
!y && Object.entries(x).map(([e, t]) => /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ l("div", {
|
|
148
|
+
className: i.pageHeader,
|
|
149
|
+
children: [
|
|
150
|
+
_.annotationsPageHeader,
|
|
151
|
+
" ",
|
|
152
|
+
e
|
|
153
|
+
]
|
|
154
|
+
}), t.map((e) => /* @__PURE__ */ c(d, {
|
|
86
155
|
ann: e,
|
|
87
|
-
|
|
156
|
+
annotationTypes: _.annotationTypes,
|
|
157
|
+
onNavigate: b
|
|
88
158
|
}, e.id))] }, e))
|
|
89
159
|
]
|
|
90
160
|
});
|
|
91
161
|
}
|
|
92
162
|
//#endregion
|
|
93
|
-
export {
|
|
163
|
+
export { p as PDFAnnotations, f as PDFAnnotationsIcon };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
list: "
|
|
3
|
-
emptyState: "
|
|
4
|
-
pageHeader: "
|
|
5
|
-
card: "
|
|
6
|
-
cardClickable: "
|
|
7
|
-
cardHeader: "
|
|
8
|
-
cardLabel: "
|
|
9
|
-
cardPage: "
|
|
10
|
-
cardAuthor: "
|
|
11
|
-
cardContent: "
|
|
12
|
-
iconWrapper: "
|
|
13
|
-
badge: "
|
|
2
|
+
list: "_list_gygvf_1",
|
|
3
|
+
emptyState: "_emptyState_gygvf_6",
|
|
4
|
+
pageHeader: "_pageHeader_gygvf_12",
|
|
5
|
+
card: "_card_gygvf_23",
|
|
6
|
+
cardClickable: "_cardClickable_gygvf_33",
|
|
7
|
+
cardHeader: "_cardHeader_gygvf_41",
|
|
8
|
+
cardLabel: "_cardLabel_gygvf_48",
|
|
9
|
+
cardPage: "_cardPage_gygvf_57",
|
|
10
|
+
cardAuthor: "_cardAuthor_gygvf_62",
|
|
11
|
+
cardContent: "_cardContent_gygvf_68",
|
|
12
|
+
iconWrapper: "_iconWrapper_gygvf_74",
|
|
13
|
+
badge: "_badge_gygvf_81"
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
16
16
|
export { e as default };
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
2
|
+
import { useLabels as t } from "../../hooks/useLabels.js";
|
|
3
|
+
import { useAttachments as n } from "../../hooks/useAttachments.js";
|
|
4
|
+
import r from "./PDFAttachments.module.js";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/features/PDFAttachments.tsx
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */
|
|
7
|
+
function o() {
|
|
8
|
+
return /* @__PURE__ */ a("svg", {
|
|
8
9
|
width: "13",
|
|
9
10
|
height: "13",
|
|
10
11
|
viewBox: "0 0 13 13",
|
|
11
12
|
fill: "none",
|
|
12
13
|
"aria-hidden": !0,
|
|
13
|
-
children: [/* @__PURE__ */
|
|
14
|
+
children: [/* @__PURE__ */ i("path", {
|
|
14
15
|
d: "M6.5 1.5v7M3.5 6l3 3 3-3",
|
|
15
16
|
stroke: "currentColor",
|
|
16
17
|
strokeWidth: "1.5",
|
|
17
18
|
strokeLinecap: "round",
|
|
18
19
|
strokeLinejoin: "round"
|
|
19
|
-
}), /* @__PURE__ */
|
|
20
|
+
}), /* @__PURE__ */ i("path", {
|
|
20
21
|
d: "M1.5 10.5h10",
|
|
21
22
|
stroke: "currentColor",
|
|
22
23
|
strokeWidth: "1.5",
|
|
@@ -24,19 +25,19 @@ function a() {
|
|
|
24
25
|
})]
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
function s() {
|
|
29
|
+
return /* @__PURE__ */ a("svg", {
|
|
29
30
|
width: "14",
|
|
30
31
|
height: "14",
|
|
31
32
|
viewBox: "0 0 14 14",
|
|
32
33
|
fill: "none",
|
|
33
34
|
"aria-hidden": !0,
|
|
34
|
-
children: [/* @__PURE__ */
|
|
35
|
+
children: [/* @__PURE__ */ i("path", {
|
|
35
36
|
d: "M3 1.5h5.5L11 4v8.5H3V1.5z",
|
|
36
37
|
stroke: "currentColor",
|
|
37
38
|
strokeWidth: "1.2",
|
|
38
39
|
strokeLinejoin: "round"
|
|
39
|
-
}), /* @__PURE__ */
|
|
40
|
+
}), /* @__PURE__ */ i("path", {
|
|
40
41
|
d: "M8.5 1.5V4H11",
|
|
41
42
|
stroke: "currentColor",
|
|
42
43
|
strokeWidth: "1.2",
|
|
@@ -44,51 +45,51 @@ function o() {
|
|
|
44
45
|
})]
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function c(e) {
|
|
48
49
|
let t = new Blob([new Uint8Array(e.content)]), n = URL.createObjectURL(t), r = document.createElement("a");
|
|
49
50
|
r.href = n, r.download = e.filename, r.click(), URL.revokeObjectURL(n);
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
let { pdf: o } = e(), { attachments: s, loading: c } =
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
className:
|
|
55
|
-
children: [
|
|
56
|
-
className:
|
|
52
|
+
function l({ icon: t }) {
|
|
53
|
+
let { pdf: o } = e(), { attachments: s, loading: c } = n({ pdf: o }), l = s.length;
|
|
54
|
+
return /* @__PURE__ */ a("span", {
|
|
55
|
+
className: r.iconWrapper,
|
|
56
|
+
children: [t, !c && l > 0 && /* @__PURE__ */ i("span", {
|
|
57
|
+
className: r.badge,
|
|
57
58
|
children: l > 99 ? "99+" : l
|
|
58
59
|
})]
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
let { pdf:
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
className:
|
|
62
|
+
function u() {
|
|
63
|
+
let { pdf: l } = e(), u = t(), { attachments: d, loading: f } = n({ pdf: l });
|
|
64
|
+
return /* @__PURE__ */ a("div", {
|
|
65
|
+
className: r.list,
|
|
65
66
|
children: [
|
|
66
|
-
|
|
67
|
-
className:
|
|
68
|
-
children:
|
|
67
|
+
f && /* @__PURE__ */ i("div", {
|
|
68
|
+
className: r.emptyState,
|
|
69
|
+
children: u.attachmentsLoading
|
|
69
70
|
}),
|
|
70
|
-
!
|
|
71
|
-
className:
|
|
72
|
-
children:
|
|
71
|
+
!f && d.length === 0 && /* @__PURE__ */ i("div", {
|
|
72
|
+
className: r.emptyState,
|
|
73
|
+
children: u.attachmentsEmpty
|
|
73
74
|
}),
|
|
74
|
-
!
|
|
75
|
-
className:
|
|
75
|
+
!f && d.map((e, t) => /* @__PURE__ */ a("div", {
|
|
76
|
+
className: r.card,
|
|
76
77
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
className:
|
|
79
|
-
children: /* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ i("span", {
|
|
79
|
+
className: r.fileIcon,
|
|
80
|
+
children: /* @__PURE__ */ i(s, {})
|
|
80
81
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
className:
|
|
82
|
+
/* @__PURE__ */ i("span", {
|
|
83
|
+
className: r.filename,
|
|
83
84
|
title: e.filename,
|
|
84
85
|
children: e.filename
|
|
85
86
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ i("button", {
|
|
87
88
|
type: "button",
|
|
88
|
-
className:
|
|
89
|
-
title:
|
|
90
|
-
onClick: () =>
|
|
91
|
-
children: /* @__PURE__ */
|
|
89
|
+
className: r.downloadBtn,
|
|
90
|
+
title: `${u.downloadAttachmentTitle} ${e.filename}`,
|
|
91
|
+
onClick: () => c(e),
|
|
92
|
+
children: /* @__PURE__ */ i(o, {})
|
|
92
93
|
})
|
|
93
94
|
]
|
|
94
95
|
}, t))
|
|
@@ -96,4 +97,4 @@ function l() {
|
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
//#endregion
|
|
99
|
-
export {
|
|
100
|
+
export { u as PDFAttachments, l as PDFAttachmentsIcon };
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useLabels as t } from "../../hooks/useLabels.js";
|
|
3
|
+
import { ToolbarButton as n } from "../ui/ToolbarButton.js";
|
|
4
|
+
import { useCallback as r, useRef as i } from "react";
|
|
5
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/features/PDFChangeFile.tsx
|
|
6
|
-
function
|
|
7
|
-
let { onChangeFile:
|
|
7
|
+
function c({ icon: c }) {
|
|
8
|
+
let { onChangeFile: l } = e(), u = t(), d = i(null), f = r((e) => {
|
|
8
9
|
let t = e.target.files?.[0];
|
|
9
|
-
t &&
|
|
10
|
-
}, [
|
|
11
|
-
return /* @__PURE__ */
|
|
12
|
-
ref:
|
|
10
|
+
t && l?.(t), e.target.value = "";
|
|
11
|
+
}, [l]), p = r(() => d.current?.click(), []);
|
|
12
|
+
return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("input", {
|
|
13
|
+
ref: d,
|
|
13
14
|
type: "file",
|
|
14
15
|
accept: ".pdf",
|
|
15
16
|
style: { display: "none" },
|
|
16
|
-
onChange:
|
|
17
|
-
}), /* @__PURE__ */
|
|
18
|
-
onClick:
|
|
19
|
-
title:
|
|
20
|
-
children:
|
|
17
|
+
onChange: f
|
|
18
|
+
}), /* @__PURE__ */ o(n, {
|
|
19
|
+
onClick: p,
|
|
20
|
+
title: u.changeFileTitle,
|
|
21
|
+
children: c
|
|
21
22
|
})] });
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
c.toolbarLabelKey = "changeFileToolbarLabel";
|
|
24
25
|
//#endregion
|
|
25
|
-
export {
|
|
26
|
+
export { c as PDFChangeFile };
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useLabels as t } from "../../hooks/useLabels.js";
|
|
3
|
+
import { ToolbarButton as n } from "../ui/ToolbarButton.js";
|
|
4
|
+
import { useCallback as r } from "react";
|
|
5
|
+
import { jsxs as i } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/features/PDFDownloadButton.tsx
|
|
6
|
-
function
|
|
7
|
-
let { file:
|
|
8
|
-
return /* @__PURE__ */
|
|
7
|
+
function a({ icon: a }) {
|
|
8
|
+
let { file: o } = e(), s = t();
|
|
9
|
+
return /* @__PURE__ */ i(n, {
|
|
9
10
|
$primary: !0,
|
|
10
|
-
onClick:
|
|
11
|
-
let e = URL.createObjectURL(
|
|
12
|
-
t.href = e, t.download =
|
|
13
|
-
}, [
|
|
14
|
-
title:
|
|
15
|
-
children: [
|
|
11
|
+
onClick: r(() => {
|
|
12
|
+
let e = URL.createObjectURL(o), t = document.createElement("a");
|
|
13
|
+
t.href = e, t.download = o.name || s.downloadFallbackFilename, t.click(), setTimeout(() => URL.revokeObjectURL(e), 0);
|
|
14
|
+
}, [o, s.downloadFallbackFilename]),
|
|
15
|
+
title: s.downloadTitle,
|
|
16
|
+
children: [a, s.downloadText]
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
a.toolbarLabelKey = "downloadToolbarLabel";
|
|
19
20
|
//#endregion
|
|
20
|
-
export {
|
|
21
|
+
export { a as PDFDownloadButton };
|
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
import { usePDFViewer as e } from "../../context/PDFViewerContext.js";
|
|
2
|
-
import {
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import { useLabels as t } from "../../hooks/useLabels.js";
|
|
3
|
+
import { ToolbarButton as n } from "../ui/ToolbarButton.js";
|
|
4
|
+
import r from "./PDFNavigation.module.js";
|
|
5
|
+
import { useCallback as i, useState as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/features/PDFNavigation.tsx
|
|
7
|
-
function
|
|
8
|
-
let { currentPage:
|
|
9
|
-
let e = parseInt(
|
|
10
|
-
isNaN(e) ||
|
|
11
|
-
}, [
|
|
12
|
-
|
|
13
|
-
}, [
|
|
14
|
-
e.key === "Enter" &&
|
|
15
|
-
}, [
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
className:
|
|
8
|
+
function c({ prevIcon: c, nextIcon: l }) {
|
|
9
|
+
let { currentPage: u, numPages: d, goToPage: f } = e(), p = t(), [m, h] = a(!1), [g, _] = a(""), v = i(() => {
|
|
10
|
+
let e = parseInt(g, 10);
|
|
11
|
+
isNaN(e) || f(e), h(!1);
|
|
12
|
+
}, [g, f]), y = i(() => {
|
|
13
|
+
h(!0), _(String(u));
|
|
14
|
+
}, [u]), b = i((e) => _(e.target.value), []), x = i((e) => {
|
|
15
|
+
e.key === "Enter" && v(), e.key === "Escape" && h(!1);
|
|
16
|
+
}, [v]), S = i(() => f(u - 1), [f, u]), C = i(() => f(u + 1), [f, u]);
|
|
17
|
+
return /* @__PURE__ */ s("div", {
|
|
18
|
+
className: r.navWrapper,
|
|
18
19
|
children: [
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
onClick:
|
|
21
|
-
disabled:
|
|
22
|
-
title:
|
|
23
|
-
children:
|
|
20
|
+
/* @__PURE__ */ o(n, {
|
|
21
|
+
onClick: S,
|
|
22
|
+
disabled: u === 1,
|
|
23
|
+
title: p.prevPageTitle,
|
|
24
|
+
children: c
|
|
24
25
|
}),
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
className:
|
|
26
|
+
/* @__PURE__ */ o("input", {
|
|
27
|
+
className: r.pageInput,
|
|
27
28
|
type: "number",
|
|
28
|
-
value:
|
|
29
|
-
onFocus:
|
|
30
|
-
onBlur:
|
|
31
|
-
onChange:
|
|
32
|
-
onKeyDown:
|
|
33
|
-
title:
|
|
29
|
+
value: m ? g : u,
|
|
30
|
+
onFocus: y,
|
|
31
|
+
onBlur: v,
|
|
32
|
+
onChange: b,
|
|
33
|
+
onKeyDown: x,
|
|
34
|
+
title: p.pageInputTitle
|
|
34
35
|
}),
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
className:
|
|
37
|
-
children: ["/ ",
|
|
36
|
+
/* @__PURE__ */ s("span", {
|
|
37
|
+
className: r.pageTotal,
|
|
38
|
+
children: ["/ ", d]
|
|
38
39
|
}),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
onClick:
|
|
41
|
-
disabled:
|
|
42
|
-
title:
|
|
43
|
-
children:
|
|
40
|
+
/* @__PURE__ */ o(n, {
|
|
41
|
+
onClick: C,
|
|
42
|
+
disabled: u === d,
|
|
43
|
+
title: p.nextPageTitle,
|
|
44
|
+
children: l
|
|
44
45
|
})
|
|
45
46
|
]
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
c.toolbarLabelKey = "navigationToolbarLabel";
|
|
49
50
|
//#endregion
|
|
50
|
-
export {
|
|
51
|
+
export { c as PDFNavigation };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var e = {
|
|
2
|
-
navWrapper: "
|
|
3
|
-
pageInput: "
|
|
4
|
-
pageTotal: "
|
|
2
|
+
navWrapper: "_navWrapper_14eo9_1",
|
|
3
|
+
pageInput: "_pageInput_14eo9_7",
|
|
4
|
+
pageTotal: "_pageTotal_14eo9_34"
|
|
5
5
|
};
|
|
6
6
|
//#endregion
|
|
7
7
|
export { e as default };
|