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