@jc-times/business-ui 0.3.0 → 0.3.2
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/CHANGELOG.md +10 -0
- package/THIRD_PARTY_NOTICES.md +5 -0
- package/assets/pdf-fonts/NotoSans-Bold.ttf +0 -0
- package/assets/pdf-fonts/NotoSans-BoldItalic.ttf +0 -0
- package/assets/pdf-fonts/NotoSans-Italic.ttf +0 -0
- package/assets/pdf-fonts/NotoSans-Regular.ttf +0 -0
- package/assets/pdf-fonts/NotoSansHans-Regular.otf +0 -0
- package/assets/pdf-fonts/OFL-CJK.txt +92 -0
- package/assets/pdf-fonts/OFL-Latin.txt +94 -0
- package/assets/pdf-fonts/README.md +11 -0
- package/dist/Alert.js +5 -1
- package/dist/Button.js +1 -1
- package/dist/Cascader.js +19 -19
- package/dist/Combobox.js +38 -38
- package/dist/DataTableIcons.js +25 -25
- package/dist/DateInput.js +67 -67
- package/dist/DropdownMenu.js +35 -35
- package/dist/EmptyState.js +8 -8
- package/dist/ExplainableButton.js +11 -11
- package/dist/FloatingControls.js +31 -31
- package/dist/ModalShell.js +32 -32
- package/dist/MultiSelect.js +37 -37
- package/dist/Pagination.js +27 -27
- package/dist/RecoverableAsyncState.js +8 -8
- package/dist/Select.js +17 -17
- package/dist/SortableList.js +18 -18
- package/dist/Toast.js +30 -30
- package/dist/TreeSelect.js +107 -107
- package/dist/data-table.js +71 -71
- package/dist/document-viewer/PdfToolbar.js +12 -12
- package/dist/document-viewer/PdfWorkspace.js +15 -15
- package/dist/document-viewer-v2/DocumentViewerV2.js +49 -48
- package/dist/document-viewer-v2/HeadlessPdfViewer.js +128 -124
- package/dist/document-viewer-v2/pdf-font-fallback.js +35 -0
- package/dist/types/document-viewer-v2/pdf-font-fallback.d.ts +2 -0
- package/dist/vendor/embedpdf-zoom-react.js +3 -186
- package/dist/vendor/embedpdf-zoom-react10.js +6 -0
- package/dist/vendor/embedpdf-zoom-react11.js +30 -0
- package/dist/vendor/embedpdf-zoom-react12.js +16 -0
- package/dist/vendor/embedpdf-zoom-react13.js +15 -0
- package/dist/vendor/embedpdf-zoom-react14.js +33 -0
- package/dist/vendor/embedpdf-zoom-react15.js +20 -0
- package/dist/vendor/embedpdf-zoom-react16.js +26 -0
- package/dist/vendor/embedpdf-zoom-react17.js +25 -0
- package/dist/vendor/embedpdf-zoom-react18.js +17 -0
- package/dist/vendor/embedpdf-zoom-react19.js +187 -0
- package/dist/vendor/embedpdf-zoom-react2.js +13 -0
- package/dist/vendor/embedpdf-zoom-react3.js +14 -0
- package/dist/vendor/embedpdf-zoom-react4.js +8 -0
- package/dist/vendor/embedpdf-zoom-react5.js +4 -0
- package/dist/vendor/embedpdf-zoom-react6.js +14 -0
- package/dist/vendor/embedpdf-zoom-react7.js +40 -0
- package/dist/vendor/embedpdf-zoom-react8.js +17 -0
- package/dist/vendor/embedpdf-zoom-react9.js +7 -0
- package/docs/agent-guide.md +2 -0
- package/docs/document-viewer-v2.md +2 -2
- package/package.json +7 -3
|
@@ -2,42 +2,43 @@ import { Button as e } from "../Button.js";
|
|
|
2
2
|
import { PdfWorkspace as t } from "../document-viewer/PdfWorkspace.js";
|
|
3
3
|
import { PdfToolbar as n } from "../document-viewer/PdfToolbar.js";
|
|
4
4
|
import { usePdfViewport as r } from "../document-viewer/usePdfViewport.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useEffect as c, useLayoutEffect as
|
|
5
|
+
import { pdfFontFallback as i } from "./pdf-font-fallback.js";
|
|
6
|
+
import { ZoomGestureWrapper as a, react_exports as o, useZoom as s } from "../vendor/embedpdf-zoom-react19.js";
|
|
7
|
+
import { HeadlessSearch as ee } from "./HeadlessSearch.js";
|
|
8
|
+
import { useEffect as c, useLayoutEffect as te, useMemo as ne, useRef as l, useState as u } from "react";
|
|
9
9
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { Search as re, X as ie } from "lucide-react";
|
|
10
11
|
import { createPluginRegistration as p } from "@embedpdf/core";
|
|
11
|
-
import { EmbedPDF as m, useDocumentState as
|
|
12
|
+
import { EmbedPDF as m, useDocumentState as ae } from "@embedpdf/core/react";
|
|
12
13
|
import { usePdfiumEngine as h } from "@embedpdf/engines/react";
|
|
13
14
|
import { DocumentManagerPluginPackage as g } from "@embedpdf/plugin-document-manager/react";
|
|
14
|
-
import { Viewport as
|
|
15
|
-
import { ScrollPluginPackage as v, Scroller as
|
|
16
|
-
import { RenderLayer as
|
|
17
|
-
import { Rotate as
|
|
18
|
-
import { ThumbImg as
|
|
19
|
-
import { SearchLayer as
|
|
20
|
-
import { SelectionLayer as
|
|
21
|
-
import { InteractionManagerPluginPackage as
|
|
15
|
+
import { Viewport as oe, ViewportPluginPackage as _, useViewportCapability as se } from "@embedpdf/plugin-viewport/react";
|
|
16
|
+
import { ScrollPluginPackage as v, Scroller as ce, useScrollCapability as le } from "@embedpdf/plugin-scroll/react";
|
|
17
|
+
import { RenderLayer as ue, RenderPluginPackage as y } from "@embedpdf/plugin-render/react";
|
|
18
|
+
import { Rotate as de, RotatePluginPackage as b, useRotate as fe } from "@embedpdf/plugin-rotate/react";
|
|
19
|
+
import { ThumbImg as pe, ThumbnailPluginPackage as x, ThumbnailsPane as me } from "@embedpdf/plugin-thumbnail/react";
|
|
20
|
+
import { SearchLayer as he, SearchPluginPackage as S, useSearch as ge } from "@embedpdf/plugin-search/react";
|
|
21
|
+
import { SelectionLayer as _e, SelectionPluginPackage as C, useSelectionCapability as ve } from "@embedpdf/plugin-selection/react";
|
|
22
|
+
import { InteractionManagerPluginPackage as w, PagePointerProvider as ye } from "@embedpdf/plugin-interaction-manager/react";
|
|
22
23
|
//#region src/document-viewer-v2/HeadlessPdfViewer.tsx
|
|
23
|
-
var
|
|
24
|
+
var T = "(max-width: 900px), (hover: none) and (pointer: coarse)";
|
|
24
25
|
function be(e) {
|
|
25
|
-
let [t, n] = u(() => e && typeof window < "u" && window.matchMedia(
|
|
26
|
+
let [t, n] = u(() => e && typeof window < "u" && window.matchMedia(T).matches);
|
|
26
27
|
return c(() => {
|
|
27
28
|
if (!e) {
|
|
28
29
|
n(!1);
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
|
-
let t = window.matchMedia(
|
|
32
|
+
let t = window.matchMedia(T), r = () => n(t.matches);
|
|
32
33
|
return r(), t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
33
34
|
}, [e]), t;
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function E(e) {
|
|
36
37
|
let { engine: t, isLoading: n, error: r } = h({
|
|
37
38
|
worker: !0,
|
|
38
|
-
fontFallback:
|
|
39
|
+
fontFallback: i,
|
|
39
40
|
...e.engineOptions
|
|
40
|
-
}), [
|
|
41
|
+
}), [a] = u(() => {
|
|
41
42
|
let { id: t, kind: n, ...r } = e.source;
|
|
42
43
|
return [
|
|
43
44
|
p(g, { initialDocuments: [{
|
|
@@ -47,16 +48,19 @@ function T(e) {
|
|
|
47
48
|
}] }),
|
|
48
49
|
p(_),
|
|
49
50
|
p(v, { defaultPageGap: 20 }),
|
|
50
|
-
p(y, {
|
|
51
|
-
|
|
51
|
+
p(y, {
|
|
52
|
+
withAnnotations: !0,
|
|
53
|
+
withForms: !0
|
|
54
|
+
}),
|
|
55
|
+
p(o.ZoomPluginPackage, {
|
|
52
56
|
defaultZoomLevel: 1,
|
|
53
57
|
minZoom: e.initialZoom === "fit-width" ? .1 : .5,
|
|
54
58
|
maxZoom: 3
|
|
55
59
|
}),
|
|
56
60
|
p(b),
|
|
57
|
-
p(
|
|
61
|
+
p(w, { exclusionRules: { dataAttributes: ["data-pdf-business-control"] } }),
|
|
58
62
|
p(S),
|
|
59
|
-
p(
|
|
63
|
+
p(C, { marquee: { enabled: !1 } }),
|
|
60
64
|
p(x, { width: 100 })
|
|
61
65
|
];
|
|
62
66
|
});
|
|
@@ -68,44 +72,44 @@ function T(e) {
|
|
|
68
72
|
children: "正在加载 PDF 引擎…"
|
|
69
73
|
}) : /* @__PURE__ */ d(m, {
|
|
70
74
|
engine: t,
|
|
71
|
-
plugins:
|
|
75
|
+
plugins: a,
|
|
72
76
|
onInitialized: async (t) => {
|
|
73
77
|
e.onReady?.(t);
|
|
74
78
|
},
|
|
75
|
-
children: /* @__PURE__ */ d(
|
|
79
|
+
children: /* @__PURE__ */ d(D, { ...e })
|
|
76
80
|
});
|
|
77
81
|
}
|
|
78
|
-
function
|
|
79
|
-
let
|
|
80
|
-
z.current =
|
|
82
|
+
function D(i) {
|
|
83
|
+
let p = i.source.id, m = ae(p), h = m?.document, { provides: g } = le(), _ = ne(() => g?.forDocument(p), [g, p]), { provides: v, state: y } = s(p), { provides: b } = se(), { provides: x } = ve(), { provides: S } = ge(p), { provides: C, rotation: w } = fe(p), T = r(p), [E, D] = u(1), [O, k] = u(null), A = be(i.mobileMode === "continuous-reader"), j = i.searchMode === "collapsible", M = i.features?.search !== !1, [N, P] = u(!j), F = h?.pages.length ?? 0, I = Math.max(1, Math.min(F || 1, i.currentPage ?? E)), L = i.pageMode === "single" && !A, R = i.features?.textSelection !== !1 && !A, z = l(i);
|
|
84
|
+
z.current = i, c(() => {
|
|
81
85
|
P(!j), k(null);
|
|
82
|
-
}, [
|
|
83
|
-
let B =
|
|
84
|
-
|
|
86
|
+
}, [p, j]);
|
|
87
|
+
let B = m?.scale ?? 1, V = l(!1), H = l(i.currentPage ?? 1), U = l(!0), W = l(I), G = l(L), K = l(null);
|
|
88
|
+
te(() => {
|
|
85
89
|
(W.current !== I || G.current !== L) && ((G.current !== L || I !== K.current) && (H.current = I), G.current !== L && (U.current = !0), W.current = I, G.current = L, K.current = null);
|
|
86
90
|
}, [I, L]);
|
|
87
|
-
let q = l(
|
|
88
|
-
q.current =
|
|
89
|
-
if (!
|
|
91
|
+
let q = l(v);
|
|
92
|
+
q.current = v, c(() => {
|
|
93
|
+
if (!b || !F) return;
|
|
90
94
|
let e = () => {
|
|
91
|
-
let e =
|
|
92
|
-
!V.current && e.clientWidth && e.clientHeight && q.current && (V.current = !0, q.current.requestZoom(z.current.zoom ?? (z.current.initialZoom === "fit-width" ?
|
|
93
|
-
}, t =
|
|
94
|
-
t.documentId ===
|
|
95
|
+
let e = b.forDocument(p).getMetrics();
|
|
96
|
+
!V.current && e.clientWidth && e.clientHeight && q.current && (V.current = !0, q.current.requestZoom(z.current.zoom ?? (z.current.initialZoom === "fit-width" ? o.ZoomMode.FitWidth : z.current.initialZoom ?? 1)));
|
|
97
|
+
}, t = b.onViewportResize((t) => {
|
|
98
|
+
t.documentId === p && e();
|
|
95
99
|
});
|
|
96
100
|
return e(), t;
|
|
97
101
|
}, [
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
b,
|
|
103
|
+
p,
|
|
100
104
|
F
|
|
101
105
|
]), c(() => {
|
|
102
|
-
if (
|
|
106
|
+
if (_ && !L) return _.onPageChange((e) => {
|
|
103
107
|
V.current && !U.current && (z.current.currentPage === void 0 && D(e.pageNumber), e.pageNumber !== z.current.currentPage && (K.current = e.pageNumber, z.current.onCurrentPageChange?.(e.pageNumber)));
|
|
104
108
|
});
|
|
105
|
-
}, [
|
|
106
|
-
if (!
|
|
109
|
+
}, [_, L]), c(() => {
|
|
110
|
+
if (!_ || L || !F) return;
|
|
107
111
|
let e = () => {
|
|
108
|
-
H.current !== null && (U.current = !0,
|
|
112
|
+
H.current !== null && (U.current = !0, _.scrollToPage({
|
|
109
113
|
pageNumber: H.current,
|
|
110
114
|
behavior: "instant",
|
|
111
115
|
...O?.page === H.current ? {
|
|
@@ -114,19 +118,19 @@ function E(p) {
|
|
|
114
118
|
alignY: 40
|
|
115
119
|
} : {}
|
|
116
120
|
}));
|
|
117
|
-
}, t =
|
|
118
|
-
t.documentId ===
|
|
119
|
-
}), n =
|
|
120
|
-
t.documentId ===
|
|
121
|
+
}, t = g?.onLayoutReady((t) => {
|
|
122
|
+
t.documentId === p && e();
|
|
123
|
+
}), n = b?.onViewportResize((t) => {
|
|
124
|
+
t.documentId === p && e();
|
|
121
125
|
}), r = requestAnimationFrame(e);
|
|
122
126
|
return () => {
|
|
123
127
|
cancelAnimationFrame(r), t?.(), n?.();
|
|
124
128
|
};
|
|
125
129
|
}, [
|
|
126
|
-
v,
|
|
127
130
|
_,
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
g,
|
|
132
|
+
b,
|
|
133
|
+
p,
|
|
130
134
|
L,
|
|
131
135
|
F,
|
|
132
136
|
I,
|
|
@@ -134,9 +138,9 @@ function E(p) {
|
|
|
134
138
|
w,
|
|
135
139
|
O
|
|
136
140
|
]), c(() => {
|
|
137
|
-
if (!L || !O || !
|
|
138
|
-
let e = () => xe(T.containerRef.current, O,
|
|
139
|
-
t.documentId ===
|
|
141
|
+
if (!L || !O || !b) return;
|
|
142
|
+
let e = () => xe(T.containerRef.current, O, b.forDocument(p)), t = b.onViewportResize((t) => {
|
|
143
|
+
t.documentId === p && e();
|
|
140
144
|
}), n = requestAnimationFrame(e);
|
|
141
145
|
return () => {
|
|
142
146
|
cancelAnimationFrame(n), t();
|
|
@@ -144,23 +148,23 @@ function E(p) {
|
|
|
144
148
|
}, [
|
|
145
149
|
L,
|
|
146
150
|
O,
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
b,
|
|
152
|
+
p,
|
|
149
153
|
I,
|
|
150
154
|
B,
|
|
151
155
|
w
|
|
152
156
|
]);
|
|
153
|
-
let J = l(
|
|
157
|
+
let J = l(i.zoom ?? null), Y = l(i.rotation ?? null), X = l(B), Se = l(w);
|
|
154
158
|
c(() => {
|
|
155
|
-
|
|
159
|
+
i.zoom !== void 0 && v && F && Math.abs(i.zoom - B) > .001 && (J.current = i.zoom, v.requestZoom(i.zoom));
|
|
156
160
|
}, [
|
|
157
|
-
|
|
158
|
-
!!
|
|
161
|
+
i.zoom,
|
|
162
|
+
!!v,
|
|
159
163
|
F
|
|
160
164
|
]), c(() => {
|
|
161
|
-
|
|
165
|
+
i.rotation !== void 0 && C && F && i.rotation !== w * 90 && (Y.current = i.rotation, C.setRotation((i.rotation / 90 % 4 + 4) % 4));
|
|
162
166
|
}, [
|
|
163
|
-
|
|
167
|
+
i.rotation,
|
|
164
168
|
!!C,
|
|
165
169
|
F
|
|
166
170
|
]), c(() => {
|
|
@@ -176,8 +180,8 @@ function E(p) {
|
|
|
176
180
|
}
|
|
177
181
|
Se.current !== w && z.current.onRotationChange?.(w * 90), Se.current = w;
|
|
178
182
|
}, [w]), c(() => {
|
|
179
|
-
let e =
|
|
180
|
-
e && t &&
|
|
183
|
+
let e = i.focusTarget, t = e && h?.pages[e.page - 1];
|
|
184
|
+
e && t && _ && !L && (U.current = !0, _.scrollToPage({
|
|
181
185
|
pageNumber: e.page,
|
|
182
186
|
pageCoordinates: {
|
|
183
187
|
x: t.size.width / 2,
|
|
@@ -187,8 +191,8 @@ function E(p) {
|
|
|
187
191
|
behavior: "instant"
|
|
188
192
|
}));
|
|
189
193
|
}, [
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
i.focusTarget?.token,
|
|
195
|
+
_,
|
|
192
196
|
F,
|
|
193
197
|
L
|
|
194
198
|
]);
|
|
@@ -197,54 +201,54 @@ function E(p) {
|
|
|
197
201
|
}, Q = (e) => {
|
|
198
202
|
K.current = null;
|
|
199
203
|
let t = Math.max(1, Math.min(F, e));
|
|
200
|
-
|
|
204
|
+
i.currentPage === void 0 && D(t), i.onCurrentPageChange?.(t);
|
|
201
205
|
}, Ce = (e) => {
|
|
202
|
-
let t =
|
|
206
|
+
let t = h?.pages[e];
|
|
203
207
|
if (!t) return null;
|
|
204
|
-
let n = (t.rotation + w) % 4, { width: r, height:
|
|
205
|
-
documentId:
|
|
208
|
+
let n = (t.rotation + w) % 4, { width: r, height: a } = t.size, o = {
|
|
209
|
+
documentId: p,
|
|
206
210
|
page: e + 1,
|
|
207
211
|
pageIndex: e,
|
|
208
212
|
width: r,
|
|
209
|
-
height:
|
|
213
|
+
height: a,
|
|
210
214
|
zoom: B,
|
|
211
215
|
rotation: n * 90
|
|
212
|
-
},
|
|
216
|
+
}, s = n % 2 == 1;
|
|
213
217
|
return /* @__PURE__ */ d("div", {
|
|
214
218
|
className: "ui-v2-native-page",
|
|
215
219
|
"data-page": e + 1,
|
|
216
220
|
style: {
|
|
217
221
|
position: "relative",
|
|
218
|
-
width: (
|
|
219
|
-
height: (
|
|
222
|
+
width: (s ? a : r) * B,
|
|
223
|
+
height: (s ? r : a) * B
|
|
220
224
|
},
|
|
221
225
|
children: /* @__PURE__ */ d(ye, {
|
|
222
|
-
documentId:
|
|
226
|
+
documentId: p,
|
|
223
227
|
pageIndex: e,
|
|
224
228
|
rotation: n,
|
|
225
229
|
scale: B,
|
|
226
|
-
children: /* @__PURE__ */ f(
|
|
227
|
-
documentId:
|
|
230
|
+
children: /* @__PURE__ */ f(de, {
|
|
231
|
+
documentId: p,
|
|
228
232
|
pageIndex: e,
|
|
229
233
|
rotation: n,
|
|
230
234
|
style: {
|
|
231
235
|
width: r * B,
|
|
232
|
-
height:
|
|
236
|
+
height: a * B
|
|
233
237
|
},
|
|
234
238
|
children: [
|
|
235
|
-
|
|
239
|
+
i.renderPage ? i.renderPage({
|
|
236
240
|
page: e + 1,
|
|
237
241
|
zoom: B,
|
|
238
242
|
rotation: n * 90
|
|
239
|
-
}) : /* @__PURE__ */ d(
|
|
243
|
+
}) : /* @__PURE__ */ d(ue, {
|
|
240
244
|
draggable: !1,
|
|
241
|
-
documentId:
|
|
245
|
+
documentId: p,
|
|
242
246
|
pageIndex: e,
|
|
243
247
|
"aria-label": `第 ${e + 1} 页`
|
|
244
248
|
}),
|
|
245
|
-
M && N && /* @__PURE__ */ d(
|
|
249
|
+
M && N && /* @__PURE__ */ d(he, {
|
|
246
250
|
"data-ui-search-layer": !0,
|
|
247
|
-
documentId:
|
|
251
|
+
documentId: p,
|
|
248
252
|
pageIndex: e,
|
|
249
253
|
scale: B
|
|
250
254
|
}),
|
|
@@ -259,24 +263,24 @@ function E(p) {
|
|
|
259
263
|
pointerEvents: "none"
|
|
260
264
|
}
|
|
261
265
|
}),
|
|
262
|
-
R && /* @__PURE__ */ d(
|
|
263
|
-
documentId:
|
|
266
|
+
R && /* @__PURE__ */ d(_e, {
|
|
267
|
+
documentId: p,
|
|
264
268
|
pageIndex: e,
|
|
265
269
|
scale: B,
|
|
266
270
|
rotation: 0
|
|
267
271
|
}),
|
|
268
|
-
|
|
272
|
+
i.renderPageOverlay && /* @__PURE__ */ d("div", {
|
|
269
273
|
className: "ui-v2-page-overlay",
|
|
270
274
|
style: {
|
|
271
275
|
position: "absolute",
|
|
272
276
|
inset: 0,
|
|
273
277
|
width: r,
|
|
274
|
-
height:
|
|
278
|
+
height: a,
|
|
275
279
|
transform: `scale(${B})`,
|
|
276
280
|
transformOrigin: "0 0",
|
|
277
281
|
pointerEvents: "none"
|
|
278
282
|
},
|
|
279
|
-
children:
|
|
283
|
+
children: i.renderPageOverlay(o)
|
|
280
284
|
})
|
|
281
285
|
]
|
|
282
286
|
})
|
|
@@ -288,61 +292,61 @@ function E(p) {
|
|
|
288
292
|
"aria-expanded": N,
|
|
289
293
|
"aria-label": N ? "收起文档搜索" : "搜索文档",
|
|
290
294
|
onClick: () => {
|
|
291
|
-
N && (
|
|
295
|
+
N && (S?.stopSearch(), k(null)), P(!N);
|
|
292
296
|
},
|
|
293
|
-
children: [d(N ?
|
|
297
|
+
children: [d(N ? ie : re, { size: 15 }), /* @__PURE__ */ d("span", {
|
|
294
298
|
className: "ui-mobile-reader-search-label",
|
|
295
299
|
children: N ? "收起搜索" : "搜索文档"
|
|
296
300
|
})]
|
|
297
301
|
});
|
|
298
302
|
return /* @__PURE__ */ f("section", {
|
|
299
303
|
ref: T.containerRef,
|
|
300
|
-
style:
|
|
304
|
+
style: i.style,
|
|
301
305
|
onKeyDown: (e) => {
|
|
302
306
|
if (!R || !(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== "c" || e.target.closest("input, textarea, [contenteditable=\"true\"]")) return;
|
|
303
|
-
let t =
|
|
307
|
+
let t = x?.forDocument(p);
|
|
304
308
|
t?.getState().selection && (e.preventDefault(), t.copyToClipboard());
|
|
305
309
|
},
|
|
306
|
-
"aria-label":
|
|
310
|
+
"aria-label": i.ariaLabel ?? "PDF 文档查看器",
|
|
307
311
|
className: [
|
|
308
312
|
"ui-document-viewer",
|
|
309
313
|
"ui-document-viewer-v2-headless",
|
|
310
|
-
|
|
314
|
+
i.layoutMode === "fill" && "ui-viewer-fill",
|
|
311
315
|
A && "ui-mobile-continuous-reader",
|
|
312
316
|
T.fullscreen && "ui-viewer-fullscreen",
|
|
313
|
-
|
|
317
|
+
i.className
|
|
314
318
|
].filter(Boolean).join(" "),
|
|
315
319
|
children: [
|
|
316
|
-
|
|
320
|
+
i.showToolbar !== !1 && /* @__PURE__ */ f("div", {
|
|
317
321
|
className: "ui-viewer-toolbar",
|
|
318
322
|
children: [
|
|
319
|
-
|
|
323
|
+
i.title !== void 0 && /* @__PURE__ */ d("div", {
|
|
320
324
|
className: "ui-viewer-title",
|
|
321
|
-
children:
|
|
325
|
+
children: i.title
|
|
322
326
|
}),
|
|
323
|
-
|
|
327
|
+
i.toolbar,
|
|
324
328
|
$,
|
|
325
329
|
/* @__PURE__ */ d(n, {
|
|
326
|
-
zoom:
|
|
330
|
+
zoom: y.currentZoomLevel,
|
|
327
331
|
disabled: !F,
|
|
328
332
|
fullscreen: T.fullscreen,
|
|
329
333
|
canZoomIn: B < 3,
|
|
330
|
-
canZoomOut: B > (
|
|
331
|
-
onZoomIn: () =>
|
|
332
|
-
onZoomOut: () =>
|
|
334
|
+
canZoomOut: B > (i.initialZoom === "fit-width" ? .1 : .5),
|
|
335
|
+
onZoomIn: () => v?.zoomIn(),
|
|
336
|
+
onZoomOut: () => v?.zoomOut(),
|
|
333
337
|
onRotate: () => C?.rotateForward(),
|
|
334
338
|
onToggleFullscreen: T.toggleFullscreen
|
|
335
339
|
})
|
|
336
340
|
]
|
|
337
341
|
}),
|
|
338
|
-
|
|
342
|
+
i.showToolbar === !1 && $ && /* @__PURE__ */ d("div", {
|
|
339
343
|
className: "ui-v2-search-disclosure",
|
|
340
344
|
children: $
|
|
341
345
|
}),
|
|
342
|
-
M && N && /* @__PURE__ */ d(
|
|
346
|
+
M && N && /* @__PURE__ */ d(ee, {
|
|
343
347
|
onClear: () => k(null),
|
|
344
348
|
enabled: !!F,
|
|
345
|
-
documentId:
|
|
349
|
+
documentId: p,
|
|
346
350
|
onPageChange: (e, t) => {
|
|
347
351
|
H.current = e, k(t ? {
|
|
348
352
|
page: e,
|
|
@@ -350,13 +354,13 @@ function E(p) {
|
|
|
350
354
|
} : null), Q(e);
|
|
351
355
|
}
|
|
352
356
|
}),
|
|
353
|
-
|
|
357
|
+
m?.status === "error" ? /* @__PURE__ */ f("div", {
|
|
354
358
|
role: "alert",
|
|
355
|
-
children: ["PDF 加载失败:",
|
|
356
|
-
}) :
|
|
357
|
-
defaultRailCollapsed:
|
|
358
|
-
rail: /* @__PURE__ */ d(
|
|
359
|
-
documentId:
|
|
359
|
+
children: ["PDF 加载失败:", m.error]
|
|
360
|
+
}) : h ? /* @__PURE__ */ d(t, {
|
|
361
|
+
defaultRailCollapsed: i.defaultRailCollapsed,
|
|
362
|
+
rail: /* @__PURE__ */ d(me, {
|
|
363
|
+
documentId: p,
|
|
360
364
|
children: (t) => /* @__PURE__ */ f(e, {
|
|
361
365
|
variant: "ghost",
|
|
362
366
|
className: "ui-v2-thumbnail",
|
|
@@ -370,8 +374,8 @@ function E(p) {
|
|
|
370
374
|
height: t.wrapperHeight,
|
|
371
375
|
display: "grid"
|
|
372
376
|
},
|
|
373
|
-
children: [/* @__PURE__ */ d(
|
|
374
|
-
documentId:
|
|
377
|
+
children: [/* @__PURE__ */ d(pe, {
|
|
378
|
+
documentId: p,
|
|
375
379
|
meta: t,
|
|
376
380
|
className: "ui-v2-thumbnail-image",
|
|
377
381
|
style: {
|
|
@@ -381,8 +385,8 @@ function E(p) {
|
|
|
381
385
|
}), /* @__PURE__ */ d("span", { children: t.pageIndex + 1 })]
|
|
382
386
|
}, t.pageIndex)
|
|
383
387
|
}),
|
|
384
|
-
children: /* @__PURE__ */ d(
|
|
385
|
-
documentId:
|
|
388
|
+
children: /* @__PURE__ */ d(oe, {
|
|
389
|
+
documentId: p,
|
|
386
390
|
className: "ui-v2-native-viewport",
|
|
387
391
|
tabIndex: 0,
|
|
388
392
|
"aria-label": "PDF 页面滚动区域",
|
|
@@ -395,16 +399,16 @@ function E(p) {
|
|
|
395
399
|
onTouchMoveCapture: Z,
|
|
396
400
|
onPointerDownCapture: Z,
|
|
397
401
|
onKeyDownCapture: Z,
|
|
398
|
-
children: /* @__PURE__ */ d(
|
|
399
|
-
documentId:
|
|
400
|
-
enablePinch:
|
|
401
|
-
minZoom:
|
|
402
|
+
children: /* @__PURE__ */ d(a, {
|
|
403
|
+
documentId: p,
|
|
404
|
+
enablePinch: i.features?.pinchZoom !== !1,
|
|
405
|
+
minZoom: i.initialZoom === "fit-width" ? .1 : .5,
|
|
402
406
|
maxZoom: 3,
|
|
403
407
|
children: L ? /* @__PURE__ */ d("div", {
|
|
404
408
|
className: "ui-v2-native-single",
|
|
405
409
|
children: Ce(I - 1)
|
|
406
|
-
}) : /* @__PURE__ */ d(
|
|
407
|
-
documentId:
|
|
410
|
+
}) : /* @__PURE__ */ d(ce, {
|
|
411
|
+
documentId: p,
|
|
408
412
|
renderPage: ({ pageIndex: e }) => Ce(e)
|
|
409
413
|
})
|
|
410
414
|
})
|
|
@@ -438,7 +442,7 @@ function E(p) {
|
|
|
438
442
|
onClick: () => Q(I + 1),
|
|
439
443
|
children: "下一页"
|
|
440
444
|
}),
|
|
441
|
-
|
|
445
|
+
i.footer
|
|
442
446
|
]
|
|
443
447
|
})
|
|
444
448
|
]
|
|
@@ -456,4 +460,4 @@ function xe(e, t, n) {
|
|
|
456
460
|
});
|
|
457
461
|
}
|
|
458
462
|
//#endregion
|
|
459
|
-
export {
|
|
463
|
+
export { E as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import e from "@jc-times/business-ui/pdf-fonts/NotoSansHans-Regular.otf?url";
|
|
2
|
+
import t from "@jc-times/business-ui/pdf-fonts/NotoSans-Regular.ttf?url";
|
|
3
|
+
import n from "@jc-times/business-ui/pdf-fonts/NotoSans-Bold.ttf?url";
|
|
4
|
+
import r from "@jc-times/business-ui/pdf-fonts/NotoSans-Italic.ttf?url";
|
|
5
|
+
import i from "@jc-times/business-ui/pdf-fonts/NotoSans-BoldItalic.ttf?url";
|
|
6
|
+
//#region src/document-viewer-v2/pdf-font-fallback.ts
|
|
7
|
+
var a = (e) => typeof window > "u" ? e : new URL(e, window.location.href).href, o = {
|
|
8
|
+
fonts: {
|
|
9
|
+
0: [
|
|
10
|
+
{
|
|
11
|
+
url: a(t),
|
|
12
|
+
weight: 400
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
url: a(n),
|
|
16
|
+
weight: 700
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
url: a(r),
|
|
20
|
+
weight: 400,
|
|
21
|
+
italic: !0
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
url: a(i),
|
|
25
|
+
weight: 700,
|
|
26
|
+
italic: !0
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
1: a(e),
|
|
30
|
+
134: a(e)
|
|
31
|
+
},
|
|
32
|
+
defaultFont: a(e)
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { o as pdfFontFallback };
|