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