@turinhub/atomix-common-ui 0.2.1 → 0.2.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/dist/components/PDFReader.d.ts.map +1 -1
- package/dist/{index-DaMRZoHB.js → index-6lJCWESg.js} +596 -613
- package/dist/index-6lJCWESg.js.map +1 -0
- package/dist/{index-0y7GsdPm.js → index-Ba1twkJn.js} +2 -2
- package/dist/{index-0y7GsdPm.js.map → index-Ba1twkJn.js.map} +1 -1
- package/dist/index-C94iJmKE.cjs +23 -0
- package/dist/index-C94iJmKE.cjs.map +1 -0
- package/dist/{index-Ct6imo1i.cjs → index-CN76z2bu.cjs} +3 -3
- package/dist/{index-Ct6imo1i.cjs.map → index-CN76z2bu.cjs.map} +1 -1
- package/dist/index.c.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -2
- package/dist/index-BTZUO0o2.cjs +0 -23
- package/dist/index-BTZUO0o2.cjs.map +0 -1
- package/dist/index-DaMRZoHB.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { clsx as Qe } from "clsx";
|
|
2
2
|
import { twMerge as et } from "tailwind-merge";
|
|
3
|
-
import tt, { useState as M, useEffect as
|
|
4
|
-
import { MoreVertical as
|
|
5
|
-
function yt(...
|
|
6
|
-
return et(Qe(
|
|
3
|
+
import tt, { useState as M, useEffect as te, useRef as je, useMemo as Oe, useCallback as ne, memo as rt } from "react";
|
|
4
|
+
import { MoreVertical as st, Plus as nt, Search as lt, ChevronLeft as we, ChevronRight as ke, ZoomOut as Ie, ZoomIn as Fe, Minimize2 as Se, Maximize2 as $e, PanelLeft as at, RotateCw as it, ScrollText as ct, FileText as ot } from "lucide-react";
|
|
5
|
+
function yt(...r) {
|
|
6
|
+
return et(Qe(r));
|
|
7
7
|
}
|
|
8
|
-
var Ne = { exports: {} },
|
|
8
|
+
var Ne = { exports: {} }, he = {};
|
|
9
9
|
/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.js
|
|
@@ -15,29 +15,29 @@ var Ne = { exports: {} }, je = {};
|
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*/
|
|
18
|
-
var
|
|
18
|
+
var De;
|
|
19
19
|
function ut() {
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
function c(u, a,
|
|
24
|
-
var
|
|
25
|
-
if (
|
|
26
|
-
|
|
20
|
+
if (De) return he;
|
|
21
|
+
De = 1;
|
|
22
|
+
var r = Symbol.for("react.transitional.element"), j = Symbol.for("react.fragment");
|
|
23
|
+
function c(u, a, f) {
|
|
24
|
+
var h = null;
|
|
25
|
+
if (f !== void 0 && (h = "" + f), a.key !== void 0 && (h = "" + a.key), "key" in a) {
|
|
26
|
+
f = {};
|
|
27
27
|
for (var o in a)
|
|
28
|
-
o !== "key" && (
|
|
29
|
-
} else
|
|
30
|
-
return a =
|
|
31
|
-
$$typeof:
|
|
28
|
+
o !== "key" && (f[o] = a[o]);
|
|
29
|
+
} else f = a;
|
|
30
|
+
return a = f.ref, {
|
|
31
|
+
$$typeof: r,
|
|
32
32
|
type: u,
|
|
33
|
-
key:
|
|
33
|
+
key: h,
|
|
34
34
|
ref: a !== void 0 ? a : null,
|
|
35
|
-
props:
|
|
35
|
+
props: f
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return he.Fragment = j, he.jsx = c, he.jsxs = c, he;
|
|
39
39
|
}
|
|
40
|
-
var
|
|
40
|
+
var pe = {};
|
|
41
41
|
/**
|
|
42
42
|
* @license React
|
|
43
43
|
* react-jsx-runtime.development.js
|
|
@@ -50,17 +50,17 @@ var ve = {};
|
|
|
50
50
|
var Me;
|
|
51
51
|
function dt() {
|
|
52
52
|
return Me || (Me = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
53
|
-
function
|
|
53
|
+
function r(t) {
|
|
54
54
|
if (t == null) return null;
|
|
55
55
|
if (typeof t == "function")
|
|
56
56
|
return t.$$typeof === K ? null : t.displayName || t.name || null;
|
|
57
57
|
if (typeof t == "string") return t;
|
|
58
58
|
switch (t) {
|
|
59
|
-
case
|
|
59
|
+
case L:
|
|
60
60
|
return "Fragment";
|
|
61
|
-
case
|
|
61
|
+
case N:
|
|
62
62
|
return "Profiler";
|
|
63
|
-
case
|
|
63
|
+
case W:
|
|
64
64
|
return "StrictMode";
|
|
65
65
|
case q:
|
|
66
66
|
return "Suspense";
|
|
@@ -77,17 +77,17 @@ function dt() {
|
|
|
77
77
|
return "Portal";
|
|
78
78
|
case d:
|
|
79
79
|
return t.displayName || "Context";
|
|
80
|
-
case
|
|
80
|
+
case g:
|
|
81
81
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
82
|
-
case
|
|
83
|
-
var
|
|
84
|
-
return t = t.displayName, t || (t =
|
|
82
|
+
case Y:
|
|
83
|
+
var s = t.render;
|
|
84
|
+
return t = t.displayName, t || (t = s.displayName || s.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
85
85
|
case I:
|
|
86
|
-
return
|
|
86
|
+
return s = t.displayName || null, s !== null ? s : r(t.type) || "Memo";
|
|
87
87
|
case S:
|
|
88
|
-
|
|
88
|
+
s = t._payload, t = t._init;
|
|
89
89
|
try {
|
|
90
|
-
return
|
|
90
|
+
return r(t(s));
|
|
91
91
|
} catch {
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -99,27 +99,27 @@ function dt() {
|
|
|
99
99
|
function c(t) {
|
|
100
100
|
try {
|
|
101
101
|
j(t);
|
|
102
|
-
var
|
|
102
|
+
var s = !1;
|
|
103
103
|
} catch {
|
|
104
|
-
|
|
104
|
+
s = !0;
|
|
105
105
|
}
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
var
|
|
109
|
-
return
|
|
110
|
-
|
|
106
|
+
if (s) {
|
|
107
|
+
s = console;
|
|
108
|
+
var x = s.error, D = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
109
|
+
return x.call(
|
|
110
|
+
s,
|
|
111
111
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
112
|
-
|
|
112
|
+
D
|
|
113
113
|
), j(t);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
function u(t) {
|
|
117
|
-
if (t ===
|
|
117
|
+
if (t === L) return "<>";
|
|
118
118
|
if (typeof t == "object" && t !== null && t.$$typeof === S)
|
|
119
119
|
return "<...>";
|
|
120
120
|
try {
|
|
121
|
-
var
|
|
122
|
-
return
|
|
121
|
+
var s = r(t);
|
|
122
|
+
return s ? "<" + s + ">" : "<...>";
|
|
123
123
|
} catch {
|
|
124
124
|
return "<...>";
|
|
125
125
|
}
|
|
@@ -128,45 +128,45 @@ function dt() {
|
|
|
128
128
|
var t = i.A;
|
|
129
129
|
return t === null ? null : t.getOwner();
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function f() {
|
|
132
132
|
return Error("react-stack-top-frame");
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
if (
|
|
136
|
-
var
|
|
137
|
-
if (
|
|
134
|
+
function h(t) {
|
|
135
|
+
if (C.call(t, "key")) {
|
|
136
|
+
var s = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
137
|
+
if (s && s.isReactWarning) return !1;
|
|
138
138
|
}
|
|
139
139
|
return t.key !== void 0;
|
|
140
140
|
}
|
|
141
|
-
function o(t,
|
|
142
|
-
function
|
|
141
|
+
function o(t, s) {
|
|
142
|
+
function x() {
|
|
143
143
|
H || (H = !0, console.error(
|
|
144
144
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
145
|
-
|
|
145
|
+
s
|
|
146
146
|
));
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
get:
|
|
148
|
+
x.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
149
|
+
get: x,
|
|
150
150
|
configurable: !0
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
var t =
|
|
153
|
+
function _() {
|
|
154
|
+
var t = r(this.type);
|
|
155
155
|
return ue[t] || (ue[t] = !0, console.error(
|
|
156
156
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
157
157
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
var
|
|
159
|
+
function b(t, s, x, D, X, le) {
|
|
160
|
+
var R = x.ref;
|
|
161
161
|
return t = {
|
|
162
|
-
$$typeof:
|
|
162
|
+
$$typeof: z,
|
|
163
163
|
type: t,
|
|
164
|
-
key:
|
|
165
|
-
props:
|
|
166
|
-
_owner:
|
|
167
|
-
}, (
|
|
164
|
+
key: s,
|
|
165
|
+
props: x,
|
|
166
|
+
_owner: D
|
|
167
|
+
}, (R !== void 0 ? R : null) !== null ? Object.defineProperty(t, "ref", {
|
|
168
168
|
enumerable: !1,
|
|
169
|
-
get:
|
|
169
|
+
get: _
|
|
170
170
|
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
171
171
|
configurable: !1,
|
|
172
172
|
enumerable: !1,
|
|
@@ -181,7 +181,7 @@ function dt() {
|
|
|
181
181
|
configurable: !1,
|
|
182
182
|
enumerable: !1,
|
|
183
183
|
writable: !0,
|
|
184
|
-
value:
|
|
184
|
+
value: X
|
|
185
185
|
}), Object.defineProperty(t, "_debugTask", {
|
|
186
186
|
configurable: !1,
|
|
187
187
|
enumerable: !1,
|
|
@@ -189,94 +189,94 @@ function dt() {
|
|
|
189
189
|
value: le
|
|
190
190
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
191
191
|
}
|
|
192
|
-
function l(t,
|
|
193
|
-
var
|
|
194
|
-
if (
|
|
195
|
-
if (
|
|
196
|
-
if (
|
|
197
|
-
for (
|
|
198
|
-
|
|
199
|
-
Object.freeze && Object.freeze(
|
|
192
|
+
function l(t, s, x, D, X, le) {
|
|
193
|
+
var R = s.children;
|
|
194
|
+
if (R !== void 0)
|
|
195
|
+
if (D)
|
|
196
|
+
if (E(R)) {
|
|
197
|
+
for (D = 0; D < R.length; D++)
|
|
198
|
+
P(R[D]);
|
|
199
|
+
Object.freeze && Object.freeze(R);
|
|
200
200
|
} else
|
|
201
201
|
console.error(
|
|
202
202
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
203
203
|
);
|
|
204
|
-
else
|
|
205
|
-
if (
|
|
206
|
-
|
|
207
|
-
var
|
|
208
|
-
return
|
|
204
|
+
else P(R);
|
|
205
|
+
if (C.call(s, "key")) {
|
|
206
|
+
R = r(t);
|
|
207
|
+
var V = Object.keys(s).filter(function(w) {
|
|
208
|
+
return w !== "key";
|
|
209
209
|
});
|
|
210
|
-
|
|
210
|
+
D = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", se[R + D] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
211
211
|
`A props object containing a "key" prop is being spread into JSX:
|
|
212
212
|
let props = %s;
|
|
213
213
|
<%s {...props} />
|
|
214
214
|
React keys must be passed directly to JSX without using spread:
|
|
215
215
|
let props = %s;
|
|
216
216
|
<%s key={someKey} {...props} />`,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
),
|
|
217
|
+
D,
|
|
218
|
+
R,
|
|
219
|
+
V,
|
|
220
|
+
R
|
|
221
|
+
), se[R + D] = !0);
|
|
222
222
|
}
|
|
223
|
-
if (
|
|
224
|
-
|
|
225
|
-
for (var
|
|
226
|
-
|
|
227
|
-
} else
|
|
228
|
-
return
|
|
229
|
-
|
|
223
|
+
if (R = null, x !== void 0 && (c(x), R = "" + x), h(s) && (c(s.key), R = "" + s.key), "key" in s) {
|
|
224
|
+
x = {};
|
|
225
|
+
for (var p in s)
|
|
226
|
+
p !== "key" && (x[p] = s[p]);
|
|
227
|
+
} else x = s;
|
|
228
|
+
return R && o(
|
|
229
|
+
x,
|
|
230
230
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
231
|
-
),
|
|
231
|
+
), b(
|
|
232
232
|
t,
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
R,
|
|
234
|
+
x,
|
|
235
235
|
a(),
|
|
236
|
-
|
|
236
|
+
X,
|
|
237
237
|
le
|
|
238
238
|
);
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function P(t) {
|
|
241
241
|
A(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === S && (t._payload.status === "fulfilled" ? A(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
242
242
|
}
|
|
243
243
|
function A(t) {
|
|
244
|
-
return typeof t == "object" && t !== null && t.$$typeof ===
|
|
244
|
+
return typeof t == "object" && t !== null && t.$$typeof === z;
|
|
245
245
|
}
|
|
246
|
-
var
|
|
246
|
+
var y = tt, z = Symbol.for("react.transitional.element"), J = Symbol.for("react.portal"), L = Symbol.for("react.fragment"), W = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), g = Symbol.for("react.consumer"), d = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), q = Symbol.for("react.suspense"), O = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), U = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), i = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, C = Object.prototype.hasOwnProperty, E = Array.isArray, $ = console.createTask ? console.createTask : function() {
|
|
247
247
|
return null;
|
|
248
248
|
};
|
|
249
|
-
|
|
249
|
+
y = {
|
|
250
250
|
react_stack_bottom_frame: function(t) {
|
|
251
251
|
return t();
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
|
-
var H, ue = {},
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
)(), Z = $(u(
|
|
258
|
-
|
|
259
|
-
var
|
|
254
|
+
var H, ue = {}, re = y.react_stack_bottom_frame.bind(
|
|
255
|
+
y,
|
|
256
|
+
f
|
|
257
|
+
)(), Z = $(u(f)), se = {};
|
|
258
|
+
pe.Fragment = L, pe.jsx = function(t, s, x) {
|
|
259
|
+
var D = 1e4 > i.recentlyCreatedOwnerStacks++;
|
|
260
260
|
return l(
|
|
261
261
|
t,
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
s,
|
|
263
|
+
x,
|
|
264
264
|
!1,
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
D ? Error("react-stack-top-frame") : re,
|
|
266
|
+
D ? $(u(t)) : Z
|
|
267
267
|
);
|
|
268
|
-
},
|
|
269
|
-
var
|
|
268
|
+
}, pe.jsxs = function(t, s, x) {
|
|
269
|
+
var D = 1e4 > i.recentlyCreatedOwnerStacks++;
|
|
270
270
|
return l(
|
|
271
271
|
t,
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
s,
|
|
273
|
+
x,
|
|
274
274
|
!0,
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
D ? Error("react-stack-top-frame") : re,
|
|
276
|
+
D ? $(u(t)) : Z
|
|
277
277
|
);
|
|
278
278
|
};
|
|
279
|
-
})()),
|
|
279
|
+
})()), pe;
|
|
280
280
|
}
|
|
281
281
|
var Ae;
|
|
282
282
|
function mt() {
|
|
@@ -284,24 +284,24 @@ function mt() {
|
|
|
284
284
|
}
|
|
285
285
|
var e = mt();
|
|
286
286
|
function Nt({
|
|
287
|
-
data:
|
|
287
|
+
data: r,
|
|
288
288
|
loading: j = !1,
|
|
289
289
|
columns: c,
|
|
290
290
|
rowKey: u,
|
|
291
291
|
emptyText: a = "暂无数据",
|
|
292
|
-
searchActiveEmptyText:
|
|
293
|
-
header:
|
|
292
|
+
searchActiveEmptyText: f = "未找到匹配的记录",
|
|
293
|
+
header: h,
|
|
294
294
|
pagination: o,
|
|
295
|
-
rowClassName:
|
|
296
|
-
onRow:
|
|
295
|
+
rowClassName: _,
|
|
296
|
+
onRow: b,
|
|
297
297
|
actions: l,
|
|
298
|
-
components:
|
|
298
|
+
components: P,
|
|
299
299
|
renderCard: A,
|
|
300
|
-
renderTable:
|
|
301
|
-
renderActions:
|
|
300
|
+
renderTable: y,
|
|
301
|
+
renderActions: z
|
|
302
302
|
}) {
|
|
303
|
-
var
|
|
304
|
-
if (!
|
|
303
|
+
var R, V;
|
|
304
|
+
if (!P)
|
|
305
305
|
return /* @__PURE__ */ e.jsxs("div", { className: "p-4 text-center text-destructive", children: [
|
|
306
306
|
"错误:请通过 components prop 注入 UI 组件",
|
|
307
307
|
/* @__PURE__ */ e.jsx("br", {}),
|
|
@@ -309,12 +309,12 @@ function Nt({
|
|
|
309
309
|
] });
|
|
310
310
|
const {
|
|
311
311
|
Card: J,
|
|
312
|
-
CardContent:
|
|
313
|
-
CardFooter:
|
|
314
|
-
Table:
|
|
315
|
-
TableBody:
|
|
312
|
+
CardContent: L,
|
|
313
|
+
CardFooter: W,
|
|
314
|
+
Table: N,
|
|
315
|
+
TableBody: g,
|
|
316
316
|
TableCell: d,
|
|
317
|
-
TableHead:
|
|
317
|
+
TableHead: Y,
|
|
318
318
|
TableHeader: q,
|
|
319
319
|
TableRow: O,
|
|
320
320
|
Button: I,
|
|
@@ -322,96 +322,96 @@ function Nt({
|
|
|
322
322
|
DropdownMenuTrigger: U,
|
|
323
323
|
DropdownMenuContent: K,
|
|
324
324
|
DropdownMenuItem: i,
|
|
325
|
-
DropdownMenuSeparator:
|
|
326
|
-
Skeleton:
|
|
325
|
+
DropdownMenuSeparator: C,
|
|
326
|
+
Skeleton: E,
|
|
327
327
|
TableHeaderComponent: $,
|
|
328
328
|
TablePaginationComponent: H
|
|
329
|
-
} =
|
|
329
|
+
} = P, ue = (p, w) => {
|
|
330
330
|
if (typeof u == "function")
|
|
331
|
-
return u(
|
|
332
|
-
const
|
|
333
|
-
return
|
|
334
|
-
},
|
|
331
|
+
return u(p);
|
|
332
|
+
const B = p[u];
|
|
333
|
+
return B != null ? String(B) : `row-${w}`;
|
|
334
|
+
}, re = !!(h != null && h.searchValue && h.searchValue.trim().length > 0), Z = !!(l != null && l.render || (R = l == null ? void 0 : l.items) != null && R.length), se = (l == null ? void 0 : l.mode) ?? ((V = l == null ? void 0 : l.items) != null && V.length ? "collapsed" : "expanded"), t = (p) => p.separator === !0, s = (p, w) => !l || !Z ? null : se === "collapsed" && l.items && l.items.length > 0 ? /* @__PURE__ */ e.jsxs(S, { children: [
|
|
335
335
|
/* @__PURE__ */ e.jsx(U, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
336
336
|
I,
|
|
337
337
|
{
|
|
338
338
|
variant: "ghost",
|
|
339
339
|
className: "h-8 w-8 p-0",
|
|
340
340
|
"aria-label": "打开行操作菜单",
|
|
341
|
-
children: /* @__PURE__ */ e.jsx(
|
|
341
|
+
children: /* @__PURE__ */ e.jsx(st, { className: "h-4 w-4" })
|
|
342
342
|
}
|
|
343
343
|
) }),
|
|
344
344
|
/* @__PURE__ */ e.jsx(K, { align: "end", children: l.items.map(
|
|
345
|
-
(
|
|
345
|
+
(B, de) => t(B) ? /* @__PURE__ */ e.jsx(C, {}, `separator-${de}`) : /* @__PURE__ */ e.jsxs(
|
|
346
346
|
i,
|
|
347
347
|
{
|
|
348
|
-
onClick: () =>
|
|
349
|
-
className:
|
|
348
|
+
onClick: () => B.onClick(p, w),
|
|
349
|
+
className: B.className,
|
|
350
350
|
children: [
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
B.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 h-4 w-4", children: B.icon }),
|
|
352
|
+
B.label
|
|
353
353
|
]
|
|
354
354
|
},
|
|
355
355
|
`action-${de}`
|
|
356
356
|
)
|
|
357
357
|
) })
|
|
358
|
-
] }) : l.render ? l.render(
|
|
359
|
-
c.map((
|
|
360
|
-
|
|
358
|
+
] }) : l.render ? l.render(p, w) : null, x = () => /* @__PURE__ */ e.jsx(q, { children: /* @__PURE__ */ e.jsxs(O, { className: "bg-muted/50 hover:bg-muted/50", children: [
|
|
359
|
+
c.map((p) => /* @__PURE__ */ e.jsx(
|
|
360
|
+
Y,
|
|
361
361
|
{
|
|
362
|
-
className: `font-semibold text-foreground ${
|
|
363
|
-
style: { width:
|
|
364
|
-
children:
|
|
362
|
+
className: `font-semibold text-foreground ${p.align === "center" ? "text-center" : p.align === "right" ? "text-right" : "text-left"}`,
|
|
363
|
+
style: { width: p.width },
|
|
364
|
+
children: p.title
|
|
365
365
|
},
|
|
366
|
-
String(
|
|
366
|
+
String(p.key)
|
|
367
367
|
)),
|
|
368
|
-
Z && /* @__PURE__ */ e.jsx(
|
|
369
|
-
] }) }),
|
|
370
|
-
c.map((
|
|
368
|
+
Z && /* @__PURE__ */ e.jsx(Y, { className: "text-right font-semibold text-foreground", children: (l == null ? void 0 : l.title) || "操作" })
|
|
369
|
+
] }) }), D = () => j ? /* @__PURE__ */ e.jsx(g, { children: Array.from({ length: 5 }).map((p, w) => /* @__PURE__ */ e.jsxs(O, { children: [
|
|
370
|
+
c.map((B) => /* @__PURE__ */ e.jsx(
|
|
371
371
|
d,
|
|
372
372
|
{
|
|
373
|
-
style: { width:
|
|
374
|
-
className:
|
|
375
|
-
children: /* @__PURE__ */ e.jsx(
|
|
373
|
+
style: { width: B.width },
|
|
374
|
+
className: B.align === "center" ? "text-center" : B.align === "right" ? "text-right" : "",
|
|
375
|
+
children: /* @__PURE__ */ e.jsx(E, { className: "h-4 w-full" })
|
|
376
376
|
},
|
|
377
|
-
String(
|
|
377
|
+
String(B.key)
|
|
378
378
|
)),
|
|
379
|
-
Z && /* @__PURE__ */ e.jsx(d, { children: /* @__PURE__ */ e.jsx(
|
|
380
|
-
] },
|
|
379
|
+
Z && /* @__PURE__ */ e.jsx(d, { children: /* @__PURE__ */ e.jsx(E, { className: "ml-auto h-4 w-8" }) })
|
|
380
|
+
] }, w)) }) : r.length === 0 ? /* @__PURE__ */ e.jsx(g, { children: /* @__PURE__ */ e.jsx(O, { children: /* @__PURE__ */ e.jsx(
|
|
381
381
|
d,
|
|
382
382
|
{
|
|
383
383
|
colSpan: c.length + (Z ? 1 : 0),
|
|
384
384
|
className: "py-8 text-center text-muted-foreground",
|
|
385
|
-
children:
|
|
385
|
+
children: re ? f : a
|
|
386
386
|
}
|
|
387
|
-
) }) }) : /* @__PURE__ */ e.jsx(
|
|
388
|
-
const
|
|
387
|
+
) }) }) : /* @__PURE__ */ e.jsx(g, { children: r.map((p, w) => {
|
|
388
|
+
const B = ue(p, w), de = b == null ? void 0 : b(p, w), ie = _ == null ? void 0 : _(p, w);
|
|
389
389
|
return /* @__PURE__ */ e.jsxs(
|
|
390
390
|
O,
|
|
391
391
|
{
|
|
392
392
|
className: `${ie || ""} hover:bg-muted/50`,
|
|
393
393
|
...de,
|
|
394
394
|
children: [
|
|
395
|
-
c.map((
|
|
396
|
-
const me =
|
|
395
|
+
c.map((ee) => {
|
|
396
|
+
const me = p[ee.key], fe = ee.render ? ee.render(me, p, w) : me;
|
|
397
397
|
return /* @__PURE__ */ e.jsx(
|
|
398
398
|
d,
|
|
399
399
|
{
|
|
400
|
-
className:
|
|
401
|
-
children:
|
|
400
|
+
className: ee.align === "center" ? "text-center" : ee.align === "right" ? "text-right" : "",
|
|
401
|
+
children: fe
|
|
402
402
|
},
|
|
403
|
-
String(
|
|
403
|
+
String(ee.key)
|
|
404
404
|
);
|
|
405
405
|
}),
|
|
406
|
-
Z && /* @__PURE__ */ e.jsx(d, { className: "text-right", children:
|
|
406
|
+
Z && /* @__PURE__ */ e.jsx(d, { className: "text-right", children: z ? z(p, w) : s(p, w) })
|
|
407
407
|
]
|
|
408
408
|
},
|
|
409
|
-
|
|
409
|
+
B
|
|
410
410
|
);
|
|
411
|
-
}) }),
|
|
412
|
-
|
|
413
|
-
/* @__PURE__ */ e.jsx(
|
|
414
|
-
(o == null ? void 0 : o.show) !== !1 && o && /* @__PURE__ */ e.jsx(
|
|
411
|
+
}) }), X = (p) => /* @__PURE__ */ e.jsxs(J, { children: [
|
|
412
|
+
h && /* @__PURE__ */ e.jsx("div", { className: "p-6 pb-0", children: /* @__PURE__ */ e.jsx($, { ...h }) }),
|
|
413
|
+
/* @__PURE__ */ e.jsx(L, { className: "p-0", children: p }),
|
|
414
|
+
(o == null ? void 0 : o.show) !== !1 && o && /* @__PURE__ */ e.jsx(W, { className: "border-t py-4", children: /* @__PURE__ */ e.jsx(
|
|
415
415
|
H,
|
|
416
416
|
{
|
|
417
417
|
currentPage: o.currentPage,
|
|
@@ -423,87 +423,87 @@ function Nt({
|
|
|
423
423
|
showPageSizeSelector: o.showPageSizeSelector,
|
|
424
424
|
showJumpToPage: o.showJumpToPage,
|
|
425
425
|
showTotal: o.showTotal,
|
|
426
|
-
searchActive:
|
|
426
|
+
searchActive: re
|
|
427
427
|
}
|
|
428
428
|
) })
|
|
429
|
-
] }), le = (
|
|
430
|
-
|
|
431
|
-
|
|
429
|
+
] }), le = (p, w) => /* @__PURE__ */ e.jsxs(N, { children: [
|
|
430
|
+
p,
|
|
431
|
+
w
|
|
432
432
|
] });
|
|
433
433
|
return A ? A(
|
|
434
|
-
|
|
435
|
-
) :
|
|
436
|
-
|
|
434
|
+
y ? y(x(), D()) : le(x(), D())
|
|
435
|
+
) : X(
|
|
436
|
+
y ? y(x(), D()) : le(x(), D())
|
|
437
437
|
);
|
|
438
438
|
}
|
|
439
439
|
function wt({
|
|
440
|
-
open:
|
|
440
|
+
open: r,
|
|
441
441
|
onOpenChange: j,
|
|
442
442
|
title: c,
|
|
443
443
|
description: u,
|
|
444
444
|
onConfirm: a,
|
|
445
|
-
loading:
|
|
446
|
-
confirmText:
|
|
445
|
+
loading: f = !1,
|
|
446
|
+
confirmText: h = "确认删除",
|
|
447
447
|
cancelText: o = "取消",
|
|
448
|
-
confirmButtonVariant:
|
|
449
|
-
verification:
|
|
448
|
+
confirmButtonVariant: _ = "destructive",
|
|
449
|
+
verification: b,
|
|
450
450
|
components: l,
|
|
451
|
-
loadingIcon:
|
|
451
|
+
loadingIcon: P
|
|
452
452
|
}) {
|
|
453
|
-
const [A,
|
|
454
|
-
if (
|
|
455
|
-
|
|
456
|
-
}, [
|
|
453
|
+
const [A, y] = M("");
|
|
454
|
+
if (te(() => {
|
|
455
|
+
r && y("");
|
|
456
|
+
}, [r, b == null ? void 0 : b.targetValue]), !l)
|
|
457
457
|
return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
|
|
458
458
|
const {
|
|
459
|
-
Dialog:
|
|
459
|
+
Dialog: z,
|
|
460
460
|
DialogContent: J,
|
|
461
|
-
DialogHeader:
|
|
462
|
-
DialogFooter:
|
|
463
|
-
DialogTitle:
|
|
464
|
-
DialogDescription:
|
|
461
|
+
DialogHeader: L,
|
|
462
|
+
DialogFooter: W,
|
|
463
|
+
DialogTitle: N,
|
|
464
|
+
DialogDescription: g,
|
|
465
465
|
Button: d,
|
|
466
|
-
Input:
|
|
466
|
+
Input: Y,
|
|
467
467
|
Label: q
|
|
468
|
-
} = l, O =
|
|
468
|
+
} = l, O = b ? A !== b.targetValue : !1, I = () => {
|
|
469
469
|
O || a();
|
|
470
470
|
};
|
|
471
|
-
return /* @__PURE__ */ e.jsx(
|
|
472
|
-
/* @__PURE__ */ e.jsxs(
|
|
473
|
-
/* @__PURE__ */ e.jsx(
|
|
474
|
-
/* @__PURE__ */ e.jsx(
|
|
471
|
+
return /* @__PURE__ */ e.jsx(z, { open: r, onOpenChange: j, children: /* @__PURE__ */ e.jsxs(J, { children: [
|
|
472
|
+
/* @__PURE__ */ e.jsxs(L, { children: [
|
|
473
|
+
/* @__PURE__ */ e.jsx(N, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: c }) }),
|
|
474
|
+
/* @__PURE__ */ e.jsx(g, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { children: u }) })
|
|
475
475
|
] }),
|
|
476
|
-
|
|
477
|
-
/* @__PURE__ */ e.jsx(q, { htmlFor: "confirm-input", children:
|
|
476
|
+
b && /* @__PURE__ */ e.jsx("div", { className: "space-y-4 py-2", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
|
|
477
|
+
/* @__PURE__ */ e.jsx(q, { htmlFor: "confirm-input", children: b.label || "请输入以确认" }),
|
|
478
478
|
/* @__PURE__ */ e.jsx(
|
|
479
|
-
|
|
479
|
+
Y,
|
|
480
480
|
{
|
|
481
481
|
id: "confirm-input",
|
|
482
482
|
value: A,
|
|
483
|
-
onChange: (S) =>
|
|
484
|
-
placeholder:
|
|
485
|
-
disabled:
|
|
483
|
+
onChange: (S) => y(S.target.value),
|
|
484
|
+
placeholder: b.placeholder,
|
|
485
|
+
disabled: f
|
|
486
486
|
}
|
|
487
487
|
)
|
|
488
488
|
] }) }),
|
|
489
|
-
/* @__PURE__ */ e.jsxs(
|
|
489
|
+
/* @__PURE__ */ e.jsxs(W, { children: [
|
|
490
490
|
/* @__PURE__ */ e.jsx(
|
|
491
491
|
d,
|
|
492
492
|
{
|
|
493
493
|
variant: "outline",
|
|
494
494
|
onClick: () => j(!1),
|
|
495
|
-
disabled:
|
|
495
|
+
disabled: f,
|
|
496
496
|
children: o
|
|
497
497
|
}
|
|
498
498
|
),
|
|
499
499
|
/* @__PURE__ */ e.jsxs(
|
|
500
500
|
d,
|
|
501
501
|
{
|
|
502
|
-
variant:
|
|
502
|
+
variant: _,
|
|
503
503
|
onClick: I,
|
|
504
|
-
disabled: O ||
|
|
504
|
+
disabled: O || f,
|
|
505
505
|
children: [
|
|
506
|
-
|
|
506
|
+
f && /* @__PURE__ */ e.jsx("span", { className: "mr-2", children: P || /* @__PURE__ */ e.jsxs(
|
|
507
507
|
"svg",
|
|
508
508
|
{
|
|
509
509
|
className: "h-4 w-4 animate-spin",
|
|
@@ -532,7 +532,7 @@ function wt({
|
|
|
532
532
|
]
|
|
533
533
|
}
|
|
534
534
|
) }),
|
|
535
|
-
|
|
535
|
+
h
|
|
536
536
|
]
|
|
537
537
|
}
|
|
538
538
|
)
|
|
@@ -540,46 +540,46 @@ function wt({
|
|
|
540
540
|
] }) });
|
|
541
541
|
}
|
|
542
542
|
function kt({
|
|
543
|
-
title:
|
|
543
|
+
title: r,
|
|
544
544
|
searchPlaceholder: j = "搜索...",
|
|
545
545
|
searchValue: c = "",
|
|
546
546
|
onSearchChange: u,
|
|
547
547
|
onSearch: a,
|
|
548
|
-
showSearch:
|
|
549
|
-
action:
|
|
548
|
+
showSearch: f = !0,
|
|
549
|
+
action: h,
|
|
550
550
|
actionLabel: o,
|
|
551
|
-
onActionClick:
|
|
552
|
-
loading:
|
|
551
|
+
onActionClick: _,
|
|
552
|
+
loading: b = !1,
|
|
553
553
|
components: l
|
|
554
554
|
}) {
|
|
555
555
|
if (!l)
|
|
556
556
|
return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
|
|
557
|
-
const { Input:
|
|
558
|
-
|
|
557
|
+
const { Input: P, Button: A } = l, y = (z) => {
|
|
558
|
+
z.key === "Enter" && a && a();
|
|
559
559
|
};
|
|
560
560
|
return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 p-1", children: [
|
|
561
561
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
562
|
-
/* @__PURE__ */ e.jsx("div", { className: "text-lg font-semibold leading-none tracking-tight", children:
|
|
562
|
+
/* @__PURE__ */ e.jsx("div", { className: "text-lg font-semibold leading-none tracking-tight", children: r }),
|
|
563
563
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
564
|
-
|
|
565
|
-
!
|
|
564
|
+
h && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: h }),
|
|
565
|
+
!h && o && _ && /* @__PURE__ */ e.jsxs(A, { onClick: _, disabled: b, size: "sm", children: [
|
|
566
566
|
/* @__PURE__ */ e.jsx(nt, { className: "mr-2 h-4 w-4" }),
|
|
567
567
|
o
|
|
568
568
|
] })
|
|
569
569
|
] })
|
|
570
570
|
] }),
|
|
571
|
-
|
|
571
|
+
f && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
572
572
|
/* @__PURE__ */ e.jsxs("div", { className: "relative max-w-sm flex-1", children: [
|
|
573
573
|
/* @__PURE__ */ e.jsx(lt, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
|
|
574
574
|
/* @__PURE__ */ e.jsx(
|
|
575
|
-
|
|
575
|
+
P,
|
|
576
576
|
{
|
|
577
577
|
placeholder: j,
|
|
578
578
|
value: c,
|
|
579
|
-
onChange: (
|
|
580
|
-
onKeyPress:
|
|
579
|
+
onChange: (z) => u == null ? void 0 : u(z.target.value),
|
|
580
|
+
onKeyPress: y,
|
|
581
581
|
className: "h-9 pl-8",
|
|
582
|
-
disabled:
|
|
582
|
+
disabled: b
|
|
583
583
|
}
|
|
584
584
|
)
|
|
585
585
|
] }),
|
|
@@ -587,7 +587,7 @@ function kt({
|
|
|
587
587
|
A,
|
|
588
588
|
{
|
|
589
589
|
onClick: a,
|
|
590
|
-
disabled:
|
|
590
|
+
disabled: b,
|
|
591
591
|
variant: "secondary",
|
|
592
592
|
size: "sm",
|
|
593
593
|
children: "搜索"
|
|
@@ -597,35 +597,35 @@ function kt({
|
|
|
597
597
|
] });
|
|
598
598
|
}
|
|
599
599
|
function Tt({
|
|
600
|
-
currentPage:
|
|
600
|
+
currentPage: r,
|
|
601
601
|
pageSize: j,
|
|
602
602
|
total: c,
|
|
603
603
|
onPageChange: u,
|
|
604
604
|
onPageSizeChange: a,
|
|
605
|
-
pageSizeOptions:
|
|
606
|
-
showPageSizeSelector:
|
|
605
|
+
pageSizeOptions: f = [10, 20, 50],
|
|
606
|
+
showPageSizeSelector: h = !0,
|
|
607
607
|
showJumpToPage: o = !0,
|
|
608
|
-
showTotal:
|
|
609
|
-
searchActive:
|
|
608
|
+
showTotal: _ = !0,
|
|
609
|
+
searchActive: b = !1,
|
|
610
610
|
components: l
|
|
611
611
|
}) {
|
|
612
|
-
const [
|
|
613
|
-
if (
|
|
614
|
-
A(String(
|
|
615
|
-
}, [
|
|
612
|
+
const [P, A] = M(String(r + 1));
|
|
613
|
+
if (te(() => {
|
|
614
|
+
A(String(r + 1));
|
|
615
|
+
}, [r]), !l)
|
|
616
616
|
return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
|
|
617
617
|
const {
|
|
618
|
-
Button:
|
|
619
|
-
Select:
|
|
618
|
+
Button: y,
|
|
619
|
+
Select: z,
|
|
620
620
|
SelectTrigger: J,
|
|
621
|
-
SelectContent:
|
|
622
|
-
SelectItem:
|
|
623
|
-
SelectValue:
|
|
624
|
-
} = l,
|
|
625
|
-
/* @__PURE__ */ new Set([...
|
|
626
|
-
).sort((i,
|
|
627
|
-
const
|
|
628
|
-
|
|
621
|
+
SelectContent: L,
|
|
622
|
+
SelectItem: W,
|
|
623
|
+
SelectValue: N
|
|
624
|
+
} = l, g = Math.ceil(c / j), d = Math.max(g, 1), Y = r * j + 1, q = Math.min((r + 1) * j, c), O = Array.from(
|
|
625
|
+
/* @__PURE__ */ new Set([...f, j])
|
|
626
|
+
).sort((i, C) => i - C), I = h && !!a, S = d > 1, U = (i) => {
|
|
627
|
+
const C = Math.max(0, Math.min(i, d - 1));
|
|
628
|
+
C !== r && u(C);
|
|
629
629
|
}, K = (() => {
|
|
630
630
|
if (d <= 7)
|
|
631
631
|
return Array.from({ length: d }, ($, H) => H);
|
|
@@ -634,36 +634,36 @@ function Tt({
|
|
|
634
634
|
1,
|
|
635
635
|
d - 2,
|
|
636
636
|
d - 1,
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
]),
|
|
641
|
-
for (const $ of
|
|
642
|
-
const H =
|
|
643
|
-
typeof H == "number" && $ - H > 1 &&
|
|
637
|
+
r - 1,
|
|
638
|
+
r,
|
|
639
|
+
r + 1
|
|
640
|
+
]), C = Array.from(i).filter(($) => $ >= 0 && $ < d).sort(($, H) => $ - H), E = [];
|
|
641
|
+
for (const $ of C) {
|
|
642
|
+
const H = E[E.length - 1];
|
|
643
|
+
typeof H == "number" && $ - H > 1 && E.push("ellipsis"), E.push($);
|
|
644
644
|
}
|
|
645
|
-
return
|
|
645
|
+
return E;
|
|
646
646
|
})();
|
|
647
647
|
return c === 0 ? null : /* @__PURE__ */ e.jsxs(
|
|
648
648
|
"div",
|
|
649
649
|
{
|
|
650
|
-
className: `flex w-full items-center gap-3 ${
|
|
650
|
+
className: `flex w-full items-center gap-3 ${_ ? "justify-between" : "justify-end"}`,
|
|
651
651
|
children: [
|
|
652
|
-
|
|
652
|
+
_ && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: b ? `找到 ${c} 条匹配记录` : c > 0 ? `显示 ${Y} - ${q} 条,共 ${c} 条记录` : "暂无数据" }),
|
|
653
653
|
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2", children: [
|
|
654
654
|
I && /* @__PURE__ */ e.jsxs("div", { className: "mr-2 flex items-center gap-2", children: [
|
|
655
655
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "每页" }),
|
|
656
656
|
/* @__PURE__ */ e.jsxs(
|
|
657
|
-
|
|
657
|
+
z,
|
|
658
658
|
{
|
|
659
659
|
value: String(j),
|
|
660
660
|
onValueChange: (i) => {
|
|
661
|
-
const
|
|
662
|
-
Number.isNaN(
|
|
661
|
+
const C = Number(i);
|
|
662
|
+
Number.isNaN(C) || C === j || !a || a(C);
|
|
663
663
|
},
|
|
664
664
|
children: [
|
|
665
|
-
/* @__PURE__ */ e.jsx(J, { className: "h-8 w-[90px]", children: /* @__PURE__ */ e.jsx(
|
|
666
|
-
/* @__PURE__ */ e.jsx(
|
|
665
|
+
/* @__PURE__ */ e.jsx(J, { className: "h-8 w-[90px]", children: /* @__PURE__ */ e.jsx(N, {}) }),
|
|
666
|
+
/* @__PURE__ */ e.jsx(L, { children: O.map((i) => /* @__PURE__ */ e.jsx(W, { value: String(i), children: i }, i)) })
|
|
667
667
|
]
|
|
668
668
|
}
|
|
669
669
|
),
|
|
@@ -671,50 +671,50 @@ function Tt({
|
|
|
671
671
|
] }),
|
|
672
672
|
/* @__PURE__ */ e.jsxs("div", { className: "mr-4 text-sm text-muted-foreground", children: [
|
|
673
673
|
"第 ",
|
|
674
|
-
|
|
674
|
+
r + 1,
|
|
675
675
|
" 页,共 ",
|
|
676
676
|
d,
|
|
677
677
|
" 页"
|
|
678
678
|
] }),
|
|
679
679
|
/* @__PURE__ */ e.jsx(
|
|
680
|
-
|
|
680
|
+
y,
|
|
681
681
|
{
|
|
682
682
|
variant: "outline",
|
|
683
683
|
size: "icon",
|
|
684
|
-
onClick: () => U(
|
|
685
|
-
disabled:
|
|
684
|
+
onClick: () => U(r - 1),
|
|
685
|
+
disabled: r === 0 || !S,
|
|
686
686
|
"aria-label": "上一页",
|
|
687
687
|
children: /* @__PURE__ */ e.jsx(we, { className: "h-4 w-4" })
|
|
688
688
|
}
|
|
689
689
|
),
|
|
690
690
|
/* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1", children: K.map(
|
|
691
|
-
(i,
|
|
691
|
+
(i, C) => i === "ellipsis" ? /* @__PURE__ */ e.jsx(
|
|
692
692
|
"span",
|
|
693
693
|
{
|
|
694
694
|
className: "inline-flex h-8 w-8 items-center justify-center text-sm text-muted-foreground",
|
|
695
695
|
children: "..."
|
|
696
696
|
},
|
|
697
|
-
`ellipsis-${
|
|
697
|
+
`ellipsis-${C}`
|
|
698
698
|
) : /* @__PURE__ */ e.jsx(
|
|
699
|
-
|
|
699
|
+
y,
|
|
700
700
|
{
|
|
701
|
-
variant: i ===
|
|
701
|
+
variant: i === r ? "default" : "outline",
|
|
702
702
|
size: "sm",
|
|
703
703
|
onClick: () => U(i),
|
|
704
|
-
disabled: i ===
|
|
705
|
-
"aria-current": i ===
|
|
704
|
+
disabled: i === r,
|
|
705
|
+
"aria-current": i === r ? "page" : void 0,
|
|
706
706
|
children: i + 1
|
|
707
707
|
},
|
|
708
708
|
i
|
|
709
709
|
)
|
|
710
710
|
) }),
|
|
711
711
|
/* @__PURE__ */ e.jsx(
|
|
712
|
-
|
|
712
|
+
y,
|
|
713
713
|
{
|
|
714
714
|
variant: "outline",
|
|
715
715
|
size: "icon",
|
|
716
|
-
onClick: () => U(
|
|
717
|
-
disabled:
|
|
716
|
+
onClick: () => U(r + 1),
|
|
717
|
+
disabled: r >= d - 1 || !S,
|
|
718
718
|
"aria-label": "下一页",
|
|
719
719
|
children: /* @__PURE__ */ e.jsx(ke, { className: "h-4 w-4" })
|
|
720
720
|
}
|
|
@@ -725,8 +725,8 @@ function Tt({
|
|
|
725
725
|
className: "ml-1 flex items-center gap-2",
|
|
726
726
|
onSubmit: (i) => {
|
|
727
727
|
i.preventDefault();
|
|
728
|
-
const
|
|
729
|
-
Number.isNaN(
|
|
728
|
+
const C = Number.parseInt(P, 10);
|
|
729
|
+
Number.isNaN(C) || U(C - 1);
|
|
730
730
|
},
|
|
731
731
|
children: [
|
|
732
732
|
/* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "跳至" }),
|
|
@@ -736,7 +736,7 @@ function Tt({
|
|
|
736
736
|
type: "number",
|
|
737
737
|
min: 1,
|
|
738
738
|
max: d,
|
|
739
|
-
value:
|
|
739
|
+
value: P,
|
|
740
740
|
disabled: !S,
|
|
741
741
|
onChange: (i) => A(i.target.value),
|
|
742
742
|
className: "h-8 w-16 rounded-md border border-input bg-background px-2 text-sm",
|
|
@@ -744,7 +744,7 @@ function Tt({
|
|
|
744
744
|
}
|
|
745
745
|
),
|
|
746
746
|
/* @__PURE__ */ e.jsx(
|
|
747
|
-
|
|
747
|
+
y,
|
|
748
748
|
{
|
|
749
749
|
type: "submit",
|
|
750
750
|
variant: "outline",
|
|
@@ -838,48 +838,48 @@ const ft = [
|
|
|
838
838
|
)
|
|
839
839
|
}
|
|
840
840
|
];
|
|
841
|
-
function
|
|
842
|
-
value:
|
|
841
|
+
function Et({
|
|
842
|
+
value: r,
|
|
843
843
|
onValueChange: j,
|
|
844
844
|
themes: c = ft,
|
|
845
845
|
triggerVariant: u = "ghost",
|
|
846
846
|
triggerSize: a = "icon",
|
|
847
|
-
triggerClassName:
|
|
848
|
-
iconSize:
|
|
847
|
+
triggerClassName: f,
|
|
848
|
+
iconSize: h = 16,
|
|
849
849
|
showCurrentIcon: o = !0,
|
|
850
|
-
enableSSRHandling:
|
|
851
|
-
triggerContent:
|
|
850
|
+
enableSSRHandling: _ = !0,
|
|
851
|
+
triggerContent: b,
|
|
852
852
|
components: l,
|
|
853
|
-
themeIcons:
|
|
853
|
+
themeIcons: P
|
|
854
854
|
}) {
|
|
855
|
-
const [A,
|
|
856
|
-
if (
|
|
857
|
-
|
|
858
|
-
}, []),
|
|
855
|
+
const [A, y] = M(!1);
|
|
856
|
+
if (te(() => {
|
|
857
|
+
y(!0);
|
|
858
|
+
}, []), _ && !A)
|
|
859
859
|
return null;
|
|
860
860
|
if (!l)
|
|
861
861
|
return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
|
|
862
862
|
const {
|
|
863
|
-
DropdownMenu:
|
|
863
|
+
DropdownMenu: z,
|
|
864
864
|
DropdownMenuTrigger: J,
|
|
865
|
-
DropdownMenuContent:
|
|
866
|
-
DropdownMenuRadioGroup:
|
|
867
|
-
DropdownMenuRadioItem:
|
|
868
|
-
Button:
|
|
865
|
+
DropdownMenuContent: L,
|
|
866
|
+
DropdownMenuRadioGroup: W,
|
|
867
|
+
DropdownMenuRadioItem: N,
|
|
868
|
+
Button: g
|
|
869
869
|
} = l, d = (I) => {
|
|
870
|
-
if (
|
|
871
|
-
return
|
|
870
|
+
if (P && P[I])
|
|
871
|
+
return P[I];
|
|
872
872
|
const S = c.find((U) => U.value === I);
|
|
873
873
|
return S == null ? void 0 : S.icon;
|
|
874
|
-
},
|
|
875
|
-
return /* @__PURE__ */ e.jsxs(
|
|
874
|
+
}, Y = d(r), q = o ? Y : null, O = h ? { width: h, height: h } : {};
|
|
875
|
+
return /* @__PURE__ */ e.jsxs(z, { children: [
|
|
876
876
|
/* @__PURE__ */ e.jsx(J, { asChild: !0, children: /* @__PURE__ */ e.jsx(
|
|
877
|
-
|
|
877
|
+
g,
|
|
878
878
|
{
|
|
879
879
|
variant: u,
|
|
880
880
|
size: a,
|
|
881
|
-
className:
|
|
882
|
-
children:
|
|
881
|
+
className: f,
|
|
882
|
+
children: b || /* @__PURE__ */ e.jsx(
|
|
883
883
|
"span",
|
|
884
884
|
{
|
|
885
885
|
style: O,
|
|
@@ -889,7 +889,7 @@ function Pt({
|
|
|
889
889
|
)
|
|
890
890
|
}
|
|
891
891
|
) }),
|
|
892
|
-
/* @__PURE__ */ e.jsx(
|
|
892
|
+
/* @__PURE__ */ e.jsx(L, { children: /* @__PURE__ */ e.jsx(W, { value: r, onValueChange: j, children: c.map((I) => /* @__PURE__ */ e.jsxs(N, { value: I.value, children: [
|
|
893
893
|
/* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", children: d(I.value) }),
|
|
894
894
|
/* @__PURE__ */ e.jsx("span", { children: I.label })
|
|
895
895
|
] }, I.value)) }) })
|
|
@@ -972,166 +972,166 @@ const xt = [
|
|
|
972
972
|
)
|
|
973
973
|
}
|
|
974
974
|
];
|
|
975
|
-
function
|
|
976
|
-
value:
|
|
975
|
+
function Pt({
|
|
976
|
+
value: r,
|
|
977
977
|
onValueChange: j,
|
|
978
978
|
themes: c = xt,
|
|
979
979
|
iconSize: u = 16,
|
|
980
980
|
components: a,
|
|
981
|
-
themeIcons:
|
|
981
|
+
themeIcons: f
|
|
982
982
|
}) {
|
|
983
983
|
if (!a)
|
|
984
984
|
return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
|
|
985
|
-
const { DropdownMenuRadioGroup:
|
|
986
|
-
if (
|
|
987
|
-
return
|
|
988
|
-
const
|
|
989
|
-
return
|
|
990
|
-
},
|
|
991
|
-
return /* @__PURE__ */ e.jsx(
|
|
992
|
-
/* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", style:
|
|
985
|
+
const { DropdownMenuRadioGroup: h, DropdownMenuRadioItem: o } = a, _ = (l) => {
|
|
986
|
+
if (f && f[l])
|
|
987
|
+
return f[l];
|
|
988
|
+
const P = c.find((A) => A.value === l);
|
|
989
|
+
return P == null ? void 0 : P.icon;
|
|
990
|
+
}, b = u ? { width: u, height: u } : {};
|
|
991
|
+
return /* @__PURE__ */ e.jsx(h, { value: r, onValueChange: j, children: c.map((l) => /* @__PURE__ */ e.jsxs(o, { value: l.value, children: [
|
|
992
|
+
/* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", style: b, children: _(l.value) }),
|
|
993
993
|
/* @__PURE__ */ e.jsx("span", { children: l.label })
|
|
994
994
|
] }, l.value)) });
|
|
995
995
|
}
|
|
996
996
|
function Rt({
|
|
997
|
-
url:
|
|
997
|
+
url: r,
|
|
998
998
|
initialPage: j = 1,
|
|
999
999
|
initialScale: c = 1,
|
|
1000
1000
|
scale: u,
|
|
1001
1001
|
onScaleChange: a,
|
|
1002
|
-
minScale:
|
|
1003
|
-
maxScale:
|
|
1002
|
+
minScale: f = 0.5,
|
|
1003
|
+
maxScale: h = 3,
|
|
1004
1004
|
currentPage: o,
|
|
1005
|
-
onPageChange:
|
|
1006
|
-
showToolbar:
|
|
1005
|
+
onPageChange: _,
|
|
1006
|
+
showToolbar: b = !0,
|
|
1007
1007
|
showPagination: l = !0,
|
|
1008
|
-
enableHotkeys:
|
|
1008
|
+
enableHotkeys: P = !0,
|
|
1009
1009
|
className: A,
|
|
1010
|
-
containerClassName:
|
|
1011
|
-
pageClassName:
|
|
1010
|
+
containerClassName: y,
|
|
1011
|
+
pageClassName: z,
|
|
1012
1012
|
components: J,
|
|
1013
|
-
onLoadSuccess:
|
|
1014
|
-
onLoadError:
|
|
1015
|
-
loadingText:
|
|
1016
|
-
errorText:
|
|
1013
|
+
onLoadSuccess: L,
|
|
1014
|
+
onLoadError: W,
|
|
1015
|
+
loadingText: N = "加载中...",
|
|
1016
|
+
errorText: g = "加载失败"
|
|
1017
1017
|
}) {
|
|
1018
|
-
const [d,
|
|
1019
|
-
const
|
|
1020
|
-
return
|
|
1021
|
-
}, [
|
|
1022
|
-
(
|
|
1023
|
-
const
|
|
1024
|
-
o === void 0 && O(v),
|
|
1018
|
+
const [d, Y] = M(null), [q, O] = M(j), [I, S] = M(c), [U, K] = M(!0), [i, C] = M(null), [E, $] = M(0), [H, ue] = M(!1), re = je(null), Z = je(null), [se, t] = M(null), s = o ?? q, x = u ?? I, D = Oe(() => {
|
|
1019
|
+
const m = [s];
|
|
1020
|
+
return s > 1 && m.push(s - 1), s < E && m.push(s + 1), m;
|
|
1021
|
+
}, [s, E]), X = ne(
|
|
1022
|
+
(m) => {
|
|
1023
|
+
const k = Math.max(E, 1), v = Math.min(Math.max(m, 1), k);
|
|
1024
|
+
o === void 0 && O(v), _ == null || _(v);
|
|
1025
1025
|
},
|
|
1026
|
-
[
|
|
1026
|
+
[E, o, _]
|
|
1027
1027
|
), le = ne(() => {
|
|
1028
|
-
|
|
1029
|
-
}, [
|
|
1030
|
-
|
|
1031
|
-
}, [
|
|
1032
|
-
const
|
|
1033
|
-
u === void 0 && S(
|
|
1034
|
-
}, [
|
|
1035
|
-
const
|
|
1036
|
-
u === void 0 && S(
|
|
1037
|
-
}, [
|
|
1038
|
-
var
|
|
1028
|
+
s > 1 && X(s - 1);
|
|
1029
|
+
}, [s, X]), R = ne(() => {
|
|
1030
|
+
s < E && X(s + 1);
|
|
1031
|
+
}, [s, E, X]), V = ne(() => {
|
|
1032
|
+
const m = Math.min(x + 0.25, h);
|
|
1033
|
+
u === void 0 && S(m), a == null || a(m);
|
|
1034
|
+
}, [x, h, u, a]), p = ne(() => {
|
|
1035
|
+
const m = Math.max(x - 0.25, f);
|
|
1036
|
+
u === void 0 && S(m), a == null || a(m);
|
|
1037
|
+
}, [x, f, u, a]), w = ne(async () => {
|
|
1038
|
+
var m, k, v;
|
|
1039
1039
|
if (!(typeof document > "u")) {
|
|
1040
1040
|
if (!document.fullscreenElement) {
|
|
1041
|
-
await ((
|
|
1041
|
+
await ((k = (m = re.current) == null ? void 0 : m.requestFullscreen) == null ? void 0 : k.call(m));
|
|
1042
1042
|
return;
|
|
1043
1043
|
}
|
|
1044
1044
|
await ((v = document.exitFullscreen) == null ? void 0 : v.call(document));
|
|
1045
1045
|
}
|
|
1046
1046
|
}, []);
|
|
1047
|
-
if (
|
|
1048
|
-
let
|
|
1047
|
+
if (te(() => {
|
|
1048
|
+
let m = !0;
|
|
1049
1049
|
return (async () => {
|
|
1050
1050
|
try {
|
|
1051
|
-
const v = await import("./index-
|
|
1051
|
+
const v = await import("./index-Ba1twkJn.js");
|
|
1052
1052
|
if (typeof window < "u") {
|
|
1053
1053
|
const F = v.pdfjs, ae = F == null ? void 0 : F.version;
|
|
1054
1054
|
F != null && F.GlobalWorkerOptions && ae && (F.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${ae}/build/pdf.worker.min.mjs`);
|
|
1055
1055
|
}
|
|
1056
|
-
|
|
1056
|
+
m && t(v);
|
|
1057
1057
|
} catch (v) {
|
|
1058
|
-
if (
|
|
1058
|
+
if (m) {
|
|
1059
1059
|
const F = v instanceof Error ? v : new Error("无法加载 react-pdf 库");
|
|
1060
|
-
|
|
1060
|
+
C(F), K(!1), W == null || W(F);
|
|
1061
1061
|
}
|
|
1062
1062
|
}
|
|
1063
1063
|
})(), () => {
|
|
1064
|
-
|
|
1064
|
+
m = !1;
|
|
1065
1065
|
};
|
|
1066
|
-
}, []),
|
|
1067
|
-
if (!
|
|
1068
|
-
let
|
|
1066
|
+
}, []), te(() => {
|
|
1067
|
+
if (!se || !r) return;
|
|
1068
|
+
let m = !0;
|
|
1069
1069
|
return (async () => {
|
|
1070
|
-
K(!0),
|
|
1070
|
+
K(!0), C(null);
|
|
1071
1071
|
try {
|
|
1072
|
-
const { Document: v } =
|
|
1072
|
+
const { Document: v } = se;
|
|
1073
1073
|
if (!v)
|
|
1074
1074
|
throw new Error("react-pdf Document 组件不可用");
|
|
1075
|
-
const F =
|
|
1075
|
+
const F = se.pdfjs.getDocument(r);
|
|
1076
1076
|
Z.current = F;
|
|
1077
1077
|
const ae = await F.promise;
|
|
1078
|
-
|
|
1079
|
-
(
|
|
1080
|
-
), K(!1),
|
|
1078
|
+
m && (Y(ae), $(ae.numPages), o === void 0 && O(
|
|
1079
|
+
(Pe) => Math.max(1, Math.min(Pe, ae.numPages))
|
|
1080
|
+
), K(!1), L == null || L(ae));
|
|
1081
1081
|
} catch (v) {
|
|
1082
|
-
if (
|
|
1082
|
+
if (m) {
|
|
1083
1083
|
const F = v instanceof Error ? v : new Error("PDF 加载失败");
|
|
1084
|
-
|
|
1084
|
+
C(F), K(!1), W == null || W(F);
|
|
1085
1085
|
}
|
|
1086
1086
|
}
|
|
1087
1087
|
})(), () => {
|
|
1088
|
-
|
|
1088
|
+
m = !1, Z.current && typeof Z.current.destroy == "function" && (Z.current.destroy(), Z.current = null);
|
|
1089
1089
|
};
|
|
1090
|
-
}, [
|
|
1090
|
+
}, [se, r, o, L, W]), te(() => {
|
|
1091
1091
|
if (typeof document > "u") return;
|
|
1092
|
-
const
|
|
1093
|
-
ue(document.fullscreenElement ===
|
|
1092
|
+
const m = () => {
|
|
1093
|
+
ue(document.fullscreenElement === re.current);
|
|
1094
1094
|
};
|
|
1095
|
-
return document.addEventListener("fullscreenchange",
|
|
1096
|
-
document.removeEventListener("fullscreenchange",
|
|
1095
|
+
return document.addEventListener("fullscreenchange", m), () => {
|
|
1096
|
+
document.removeEventListener("fullscreenchange", m);
|
|
1097
1097
|
};
|
|
1098
|
-
}, []),
|
|
1099
|
-
if (!
|
|
1100
|
-
const
|
|
1098
|
+
}, []), te(() => {
|
|
1099
|
+
if (!P) return;
|
|
1100
|
+
const m = (k) => {
|
|
1101
1101
|
const v = document.activeElement;
|
|
1102
|
-
v && (v.tagName === "INPUT" || v.getAttribute("role") === "input") || ((
|
|
1102
|
+
v && (v.tagName === "INPUT" || v.getAttribute("role") === "input") || ((k.ctrlKey || k.metaKey) && (k.key === "=" || k.key === "+") ? (k.preventDefault(), V()) : (k.ctrlKey || k.metaKey) && k.key === "-" ? (k.preventDefault(), p()) : k.key === "ArrowLeft" ? (k.preventDefault(), le()) : k.key === "ArrowRight" ? (k.preventDefault(), R()) : (k.key === "f" || k.key === "F") && (k.preventDefault(), w()));
|
|
1103
1103
|
};
|
|
1104
|
-
return document.addEventListener("keydown",
|
|
1105
|
-
document.removeEventListener("keydown",
|
|
1104
|
+
return document.addEventListener("keydown", m), () => {
|
|
1105
|
+
document.removeEventListener("keydown", m);
|
|
1106
1106
|
};
|
|
1107
1107
|
}, [
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1108
|
+
P,
|
|
1109
|
+
V,
|
|
1110
|
+
p,
|
|
1111
1111
|
le,
|
|
1112
|
-
|
|
1113
|
-
|
|
1112
|
+
R,
|
|
1113
|
+
w
|
|
1114
1114
|
]), !J)
|
|
1115
1115
|
return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
|
|
1116
1116
|
const {
|
|
1117
|
-
Card:
|
|
1117
|
+
Card: B,
|
|
1118
1118
|
CardContent: de,
|
|
1119
1119
|
Button: ie,
|
|
1120
|
-
Input:
|
|
1120
|
+
Input: ee,
|
|
1121
1121
|
Skeleton: me
|
|
1122
|
-
} = J,
|
|
1122
|
+
} = J, fe = () => b ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1123
1123
|
/* @__PURE__ */ e.jsx(
|
|
1124
1124
|
ie,
|
|
1125
1125
|
{
|
|
1126
1126
|
variant: "outline",
|
|
1127
1127
|
size: "sm",
|
|
1128
|
-
onClick:
|
|
1129
|
-
disabled:
|
|
1128
|
+
onClick: p,
|
|
1129
|
+
disabled: x <= f,
|
|
1130
1130
|
children: /* @__PURE__ */ e.jsx(Ie, {})
|
|
1131
1131
|
}
|
|
1132
1132
|
),
|
|
1133
1133
|
/* @__PURE__ */ e.jsxs("span", { className: "text-sm", children: [
|
|
1134
|
-
Math.round(
|
|
1134
|
+
Math.round(x * 100),
|
|
1135
1135
|
"%"
|
|
1136
1136
|
] }),
|
|
1137
1137
|
/* @__PURE__ */ e.jsx(
|
|
@@ -1139,8 +1139,8 @@ function Rt({
|
|
|
1139
1139
|
{
|
|
1140
1140
|
variant: "outline",
|
|
1141
1141
|
size: "sm",
|
|
1142
|
-
onClick:
|
|
1143
|
-
disabled:
|
|
1142
|
+
onClick: V,
|
|
1143
|
+
disabled: x >= h,
|
|
1144
1144
|
children: /* @__PURE__ */ e.jsx(Fe, {})
|
|
1145
1145
|
}
|
|
1146
1146
|
),
|
|
@@ -1150,30 +1150,30 @@ function Rt({
|
|
|
1150
1150
|
variant: "outline",
|
|
1151
1151
|
size: "icon",
|
|
1152
1152
|
onClick: () => {
|
|
1153
|
-
|
|
1153
|
+
w();
|
|
1154
1154
|
},
|
|
1155
1155
|
children: H ? /* @__PURE__ */ e.jsx(Se, {}) : /* @__PURE__ */ e.jsx($e, {})
|
|
1156
1156
|
}
|
|
1157
1157
|
)
|
|
1158
|
-
] }) : null,
|
|
1158
|
+
] }) : null, ve = () => l ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1159
1159
|
/* @__PURE__ */ e.jsx(
|
|
1160
1160
|
ie,
|
|
1161
1161
|
{
|
|
1162
1162
|
variant: "outline",
|
|
1163
1163
|
size: "icon",
|
|
1164
1164
|
onClick: le,
|
|
1165
|
-
disabled:
|
|
1165
|
+
disabled: s <= 1,
|
|
1166
1166
|
children: /* @__PURE__ */ e.jsx(we, {})
|
|
1167
1167
|
}
|
|
1168
1168
|
),
|
|
1169
|
-
|
|
1170
|
-
|
|
1169
|
+
ee ? /* @__PURE__ */ e.jsx(
|
|
1170
|
+
ee,
|
|
1171
1171
|
{
|
|
1172
1172
|
type: "number",
|
|
1173
1173
|
min: 1,
|
|
1174
|
-
max: Math.max(
|
|
1175
|
-
value:
|
|
1176
|
-
onChange: (
|
|
1174
|
+
max: Math.max(E, 1),
|
|
1175
|
+
value: s,
|
|
1176
|
+
onChange: (m) => X(parseInt(m.target.value, 10) || 1),
|
|
1177
1177
|
className: "w-16 text-center"
|
|
1178
1178
|
}
|
|
1179
1179
|
) : /* @__PURE__ */ e.jsx(
|
|
@@ -1181,82 +1181,82 @@ function Rt({
|
|
|
1181
1181
|
{
|
|
1182
1182
|
type: "number",
|
|
1183
1183
|
min: 1,
|
|
1184
|
-
max: Math.max(
|
|
1185
|
-
value:
|
|
1186
|
-
onChange: (
|
|
1184
|
+
max: Math.max(E, 1),
|
|
1185
|
+
value: s,
|
|
1186
|
+
onChange: (m) => X(parseInt(m.target.value, 10) || 1),
|
|
1187
1187
|
className: "w-16 rounded-md border border-input bg-background px-2 text-center text-sm"
|
|
1188
1188
|
}
|
|
1189
1189
|
),
|
|
1190
1190
|
/* @__PURE__ */ e.jsxs("span", { className: "text-sm text-muted-foreground", children: [
|
|
1191
1191
|
"/ ",
|
|
1192
|
-
|
|
1192
|
+
E
|
|
1193
1193
|
] }),
|
|
1194
1194
|
/* @__PURE__ */ e.jsx(
|
|
1195
1195
|
ie,
|
|
1196
1196
|
{
|
|
1197
1197
|
variant: "outline",
|
|
1198
1198
|
size: "icon",
|
|
1199
|
-
onClick:
|
|
1200
|
-
disabled:
|
|
1199
|
+
onClick: R,
|
|
1200
|
+
disabled: s >= E,
|
|
1201
1201
|
children: /* @__PURE__ */ e.jsx(ke, {})
|
|
1202
1202
|
}
|
|
1203
1203
|
)
|
|
1204
|
-
] }) : null,
|
|
1204
|
+
] }) : null, be = () => !b && !l ? null : /* @__PURE__ */ e.jsxs(
|
|
1205
1205
|
"div",
|
|
1206
1206
|
{
|
|
1207
1207
|
"data-testid": "pdf-operations-bar",
|
|
1208
1208
|
className: "flex items-center justify-between gap-4 border-b px-4 py-2",
|
|
1209
1209
|
children: [
|
|
1210
|
-
|
|
1211
|
-
|
|
1210
|
+
fe(),
|
|
1211
|
+
ve()
|
|
1212
1212
|
]
|
|
1213
1213
|
}
|
|
1214
1214
|
), Te = () => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center justify-center space-y-4 p-8", children: [
|
|
1215
1215
|
/* @__PURE__ */ e.jsx(me, { className: "h-8 w-32" }),
|
|
1216
1216
|
/* @__PURE__ */ e.jsx(me, { className: "h-64 w-full max-w-2xl" }),
|
|
1217
|
-
/* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children:
|
|
1218
|
-
] }),
|
|
1219
|
-
/* @__PURE__ */ e.jsx("p", { className: "font-medium", children:
|
|
1217
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: N })
|
|
1218
|
+
] }), ge = () => /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center justify-center space-y-4 p-8", children: /* @__PURE__ */ e.jsxs("div", { className: "text-center text-destructive", children: [
|
|
1219
|
+
/* @__PURE__ */ e.jsx("p", { className: "font-medium", children: g }),
|
|
1220
1220
|
i && /* @__PURE__ */ e.jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: i.message })
|
|
1221
|
-
] }) }),
|
|
1222
|
-
if (!
|
|
1223
|
-
const { Page:
|
|
1221
|
+
] }) }), Ee = () => {
|
|
1222
|
+
if (!se || !d) return null;
|
|
1223
|
+
const { Page: m } = se;
|
|
1224
1224
|
return /* @__PURE__ */ e.jsx(
|
|
1225
1225
|
"div",
|
|
1226
1226
|
{
|
|
1227
1227
|
className: `flex flex-col items-center justify-center ${H ? "h-[calc(100vh-56px)] overflow-auto" : "overflow-visible"}`,
|
|
1228
|
-
children:
|
|
1228
|
+
children: D.map((k) => /* @__PURE__ */ e.jsx(
|
|
1229
1229
|
"div",
|
|
1230
1230
|
{
|
|
1231
|
-
className:
|
|
1231
|
+
className: z,
|
|
1232
1232
|
style: {
|
|
1233
|
-
display:
|
|
1233
|
+
display: k === s ? "block" : "none"
|
|
1234
1234
|
},
|
|
1235
1235
|
children: /* @__PURE__ */ e.jsx(
|
|
1236
|
-
|
|
1236
|
+
m,
|
|
1237
1237
|
{
|
|
1238
1238
|
pdf: d,
|
|
1239
|
-
pageNumber:
|
|
1240
|
-
scale:
|
|
1239
|
+
pageNumber: k,
|
|
1240
|
+
scale: x,
|
|
1241
1241
|
renderTextLayer: !1,
|
|
1242
1242
|
renderAnnotationLayer: !1,
|
|
1243
1243
|
className: "shadow-md"
|
|
1244
1244
|
}
|
|
1245
1245
|
)
|
|
1246
1246
|
},
|
|
1247
|
-
|
|
1247
|
+
k
|
|
1248
1248
|
))
|
|
1249
1249
|
}
|
|
1250
1250
|
);
|
|
1251
1251
|
};
|
|
1252
|
-
return /* @__PURE__ */ e.jsx("div", { ref:
|
|
1253
|
-
|
|
1254
|
-
/* @__PURE__ */ e.jsx(de, { className:
|
|
1252
|
+
return /* @__PURE__ */ e.jsx("div", { ref: re, children: /* @__PURE__ */ e.jsxs(B, { className: A, children: [
|
|
1253
|
+
be(),
|
|
1254
|
+
/* @__PURE__ */ e.jsx(de, { className: y, children: U ? Te() : i ? ge() : Ee() })
|
|
1255
1255
|
] }) });
|
|
1256
1256
|
}
|
|
1257
|
-
const ze =
|
|
1257
|
+
const ze = rt(
|
|
1258
1258
|
({
|
|
1259
|
-
thumbnail:
|
|
1259
|
+
thumbnail: r,
|
|
1260
1260
|
isCurrentPage: j,
|
|
1261
1261
|
onClick: c
|
|
1262
1262
|
}) => /* @__PURE__ */ e.jsxs(
|
|
@@ -1267,8 +1267,8 @@ const ze = st(
|
|
|
1267
1267
|
/* @__PURE__ */ e.jsx(
|
|
1268
1268
|
"img",
|
|
1269
1269
|
{
|
|
1270
|
-
src:
|
|
1271
|
-
alt: `Page ${
|
|
1270
|
+
src: r.url,
|
|
1271
|
+
alt: `Page ${r.pageNumber}`,
|
|
1272
1272
|
className: "w-48 cursor-pointer border transition-opacity hover:opacity-80",
|
|
1273
1273
|
onClick: c,
|
|
1274
1274
|
onKeyDown: (u) => {
|
|
@@ -1280,7 +1280,7 @@ const ze = st(
|
|
|
1280
1280
|
),
|
|
1281
1281
|
/* @__PURE__ */ e.jsxs("span", { className: "mt-1 text-sm", children: [
|
|
1282
1282
|
"第 ",
|
|
1283
|
-
|
|
1283
|
+
r.pageNumber,
|
|
1284
1284
|
" 页"
|
|
1285
1285
|
] })
|
|
1286
1286
|
]
|
|
@@ -1289,145 +1289,145 @@ const ze = st(
|
|
|
1289
1289
|
);
|
|
1290
1290
|
ze.displayName = "PDFThumbnail";
|
|
1291
1291
|
const We = ({
|
|
1292
|
-
bookmark:
|
|
1292
|
+
bookmark: r,
|
|
1293
1293
|
depth: j,
|
|
1294
1294
|
onClick: c
|
|
1295
1295
|
}) => /* @__PURE__ */ e.jsxs("div", { style: { paddingLeft: `${j * 16}px` }, children: [
|
|
1296
1296
|
/* @__PURE__ */ e.jsx(
|
|
1297
1297
|
"button",
|
|
1298
1298
|
{
|
|
1299
|
-
onClick: () => c(
|
|
1299
|
+
onClick: () => c(r),
|
|
1300
1300
|
className: "w-full rounded px-2 py-1 text-left text-sm hover:bg-primary/10 hover:text-primary",
|
|
1301
|
-
children:
|
|
1301
|
+
children: r.title
|
|
1302
1302
|
}
|
|
1303
1303
|
),
|
|
1304
|
-
|
|
1304
|
+
r.items && r.items.map((u, a) => /* @__PURE__ */ e.jsx(
|
|
1305
1305
|
We,
|
|
1306
1306
|
{
|
|
1307
1307
|
bookmark: u,
|
|
1308
1308
|
depth: j + 1,
|
|
1309
1309
|
onClick: c
|
|
1310
1310
|
},
|
|
1311
|
-
`${
|
|
1311
|
+
`${r.title}-${a}`
|
|
1312
1312
|
))
|
|
1313
1313
|
] });
|
|
1314
1314
|
function ht({
|
|
1315
|
-
pdfDocument:
|
|
1315
|
+
pdfDocument: r,
|
|
1316
1316
|
currentPage: j,
|
|
1317
1317
|
onPageClick: c,
|
|
1318
1318
|
components: u
|
|
1319
1319
|
}) {
|
|
1320
|
-
const [a,
|
|
1321
|
-
|
|
1320
|
+
const [a, f] = M([]), [h, o] = M([]), [_, b] = M(!0), { Tabs: l, TabsList: P, TabsTrigger: A, TabsContent: y, ScrollArea: z, Skeleton: J } = u;
|
|
1321
|
+
te(() => {
|
|
1322
1322
|
(async () => {
|
|
1323
|
-
if (!
|
|
1324
|
-
|
|
1325
|
-
const
|
|
1326
|
-
for (let d = 1; d <=
|
|
1323
|
+
if (!r) return;
|
|
1324
|
+
b(!0);
|
|
1325
|
+
const g = [];
|
|
1326
|
+
for (let d = 1; d <= r.numPages; d++)
|
|
1327
1327
|
try {
|
|
1328
|
-
const
|
|
1328
|
+
const Y = await r.getPage(d), q = Y.getViewport({ scale: 0.2 }), O = document.createElement("canvas"), I = O.getContext("2d");
|
|
1329
1329
|
if (!I) continue;
|
|
1330
|
-
O.width = q.width, O.height = q.height, await
|
|
1330
|
+
O.width = q.width, O.height = q.height, await Y.render({
|
|
1331
1331
|
canvasContext: I,
|
|
1332
1332
|
viewport: q,
|
|
1333
1333
|
canvas: O
|
|
1334
|
-
}).promise,
|
|
1334
|
+
}).promise, g.push({
|
|
1335
1335
|
pageNumber: d,
|
|
1336
1336
|
url: O.toDataURL()
|
|
1337
1337
|
});
|
|
1338
|
-
} catch (
|
|
1339
|
-
console.error(`Error loading thumbnail for page ${d}:`,
|
|
1338
|
+
} catch (Y) {
|
|
1339
|
+
console.error(`Error loading thumbnail for page ${d}:`, Y);
|
|
1340
1340
|
}
|
|
1341
|
-
|
|
1341
|
+
f(g), b(!1);
|
|
1342
1342
|
})();
|
|
1343
|
-
}, [
|
|
1343
|
+
}, [r]), te(() => {
|
|
1344
1344
|
(async () => {
|
|
1345
|
-
if (
|
|
1345
|
+
if (r)
|
|
1346
1346
|
try {
|
|
1347
|
-
const
|
|
1348
|
-
o(
|
|
1349
|
-
} catch (
|
|
1350
|
-
console.error("Error loading bookmarks:",
|
|
1347
|
+
const g = await r.getOutline();
|
|
1348
|
+
o(g || []);
|
|
1349
|
+
} catch (g) {
|
|
1350
|
+
console.error("Error loading bookmarks:", g), o([]);
|
|
1351
1351
|
}
|
|
1352
1352
|
})();
|
|
1353
|
-
}, [
|
|
1354
|
-
const
|
|
1355
|
-
if (
|
|
1353
|
+
}, [r]);
|
|
1354
|
+
const L = async (N) => {
|
|
1355
|
+
if (r)
|
|
1356
1356
|
try {
|
|
1357
|
-
let
|
|
1358
|
-
if (
|
|
1359
|
-
if (typeof
|
|
1360
|
-
const d = await
|
|
1361
|
-
d && d[0] && (
|
|
1362
|
-
} else Array.isArray(
|
|
1363
|
-
else
|
|
1364
|
-
typeof
|
|
1365
|
-
} catch (
|
|
1366
|
-
console.error("Error navigating to bookmark:",
|
|
1357
|
+
let g;
|
|
1358
|
+
if (N.dest)
|
|
1359
|
+
if (typeof N.dest == "string") {
|
|
1360
|
+
const d = await r.getDestination(N.dest);
|
|
1361
|
+
d && d[0] && (g = await r.getPageIndex(d[0]));
|
|
1362
|
+
} else Array.isArray(N.dest) && N.dest[0] && (g = await r.getPageIndex(N.dest[0]));
|
|
1363
|
+
else N.pageNumber && (g = N.pageNumber - 1);
|
|
1364
|
+
typeof g == "number" && c(g + 1);
|
|
1365
|
+
} catch (g) {
|
|
1366
|
+
console.error("Error navigating to bookmark:", g);
|
|
1367
1367
|
}
|
|
1368
|
-
},
|
|
1368
|
+
}, W = () => /* @__PURE__ */ e.jsx("div", { className: "space-y-2 p-4", children: Array.from({ length: (r == null ? void 0 : r.numPages) || 5 }, (N, g) => /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center p-1", children: [
|
|
1369
1369
|
/* @__PURE__ */ e.jsx(J, { className: "h-32 w-48" }),
|
|
1370
1370
|
/* @__PURE__ */ e.jsx(J, { className: "mt-1 h-4 w-16" })
|
|
1371
|
-
] },
|
|
1371
|
+
] }, g)) });
|
|
1372
1372
|
return /* @__PURE__ */ e.jsx("div", { className: "w-64 border-r bg-muted", children: /* @__PURE__ */ e.jsxs(l, { defaultValue: "thumbnails", children: [
|
|
1373
|
-
/* @__PURE__ */ e.jsxs(
|
|
1373
|
+
/* @__PURE__ */ e.jsxs(P, { className: "w-full p-2", children: [
|
|
1374
1374
|
/* @__PURE__ */ e.jsx(A, { value: "thumbnails", className: "flex-1 bg-transparent", children: "缩略图" }),
|
|
1375
1375
|
/* @__PURE__ */ e.jsx(A, { value: "bookmarks", className: "flex-1 bg-transparent", children: "书签" })
|
|
1376
1376
|
] }),
|
|
1377
|
-
/* @__PURE__ */ e.jsx(
|
|
1377
|
+
/* @__PURE__ */ e.jsx(y, { value: "thumbnails", children: /* @__PURE__ */ e.jsx(z, { className: "h-[calc(100vh-8rem)]", children: _ ? W() : /* @__PURE__ */ e.jsx("div", { className: "space-y-2 p-4", children: a.map((N) => /* @__PURE__ */ e.jsx(
|
|
1378
1378
|
ze,
|
|
1379
1379
|
{
|
|
1380
|
-
thumbnail:
|
|
1381
|
-
isCurrentPage: j ===
|
|
1382
|
-
onClick: () => c(
|
|
1380
|
+
thumbnail: N,
|
|
1381
|
+
isCurrentPage: j === N.pageNumber,
|
|
1382
|
+
onClick: () => c(N.pageNumber)
|
|
1383
1383
|
},
|
|
1384
|
-
|
|
1384
|
+
N.pageNumber
|
|
1385
1385
|
)) }) }) }),
|
|
1386
|
-
/* @__PURE__ */ e.jsx(
|
|
1386
|
+
/* @__PURE__ */ e.jsx(y, { value: "bookmarks", children: /* @__PURE__ */ e.jsx(z, { className: "h-[calc(100vh-8rem)]", children: /* @__PURE__ */ e.jsx("div", { className: "p-4", children: h.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "py-4 text-center text-sm text-muted-foreground", children: "没有可用的书签" }) : /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: h.map((N, g) => /* @__PURE__ */ e.jsx(
|
|
1387
1387
|
We,
|
|
1388
1388
|
{
|
|
1389
|
-
bookmark:
|
|
1389
|
+
bookmark: N,
|
|
1390
1390
|
depth: 0,
|
|
1391
|
-
onClick:
|
|
1391
|
+
onClick: L
|
|
1392
1392
|
},
|
|
1393
|
-
`${
|
|
1393
|
+
`${N.title}-${g}`
|
|
1394
1394
|
)) }) }) }) })
|
|
1395
1395
|
] }) });
|
|
1396
1396
|
}
|
|
1397
|
-
function pt(
|
|
1398
|
-
const c =
|
|
1397
|
+
function pt(r, j) {
|
|
1398
|
+
const c = je(
|
|
1399
1399
|
void 0
|
|
1400
1400
|
);
|
|
1401
1401
|
return ne(
|
|
1402
1402
|
(...u) => {
|
|
1403
|
-
c.current && clearTimeout(c.current), c.current = setTimeout(() =>
|
|
1403
|
+
c.current && clearTimeout(c.current), c.current = setTimeout(() => r(...u), j);
|
|
1404
1404
|
},
|
|
1405
|
-
[
|
|
1405
|
+
[r, j]
|
|
1406
1406
|
);
|
|
1407
1407
|
}
|
|
1408
1408
|
function _t({
|
|
1409
|
-
url:
|
|
1409
|
+
url: r,
|
|
1410
1410
|
initialPage: j = 1,
|
|
1411
1411
|
initialScale: c = 1,
|
|
1412
1412
|
initialRotation: u = 0,
|
|
1413
1413
|
currentPage: a,
|
|
1414
|
-
onPageChange:
|
|
1415
|
-
scale:
|
|
1414
|
+
onPageChange: f,
|
|
1415
|
+
scale: h,
|
|
1416
1416
|
onScaleChange: o,
|
|
1417
|
-
rotation:
|
|
1418
|
-
onRotationChange:
|
|
1417
|
+
rotation: _,
|
|
1418
|
+
onRotationChange: b,
|
|
1419
1419
|
minScale: l = 0.5,
|
|
1420
|
-
maxScale:
|
|
1420
|
+
maxScale: P = 2.5,
|
|
1421
1421
|
showToolbar: A = !0,
|
|
1422
|
-
showSidebar:
|
|
1423
|
-
showRotation:
|
|
1422
|
+
showSidebar: y = !0,
|
|
1423
|
+
showRotation: z = !0,
|
|
1424
1424
|
showModeToggle: J = !0,
|
|
1425
|
-
showFullscreen:
|
|
1426
|
-
enableHotkeys:
|
|
1427
|
-
enableMobileNav:
|
|
1428
|
-
displayMode:
|
|
1425
|
+
showFullscreen: L = !0,
|
|
1426
|
+
enableHotkeys: W = !0,
|
|
1427
|
+
enableMobileNav: N = !0,
|
|
1428
|
+
displayMode: g = "scroll",
|
|
1429
1429
|
className: d,
|
|
1430
|
-
toolbarClassName:
|
|
1430
|
+
toolbarClassName: Y,
|
|
1431
1431
|
contentClassName: q,
|
|
1432
1432
|
contentHeight: O = "80vh",
|
|
1433
1433
|
pageClassName: I,
|
|
@@ -1435,123 +1435,103 @@ function _t({
|
|
|
1435
1435
|
cMapUrl: U,
|
|
1436
1436
|
standardFontDataUrl: K,
|
|
1437
1437
|
components: i,
|
|
1438
|
-
onLoadSuccess:
|
|
1439
|
-
onLoadError:
|
|
1438
|
+
onLoadSuccess: C,
|
|
1439
|
+
onLoadError: E,
|
|
1440
1440
|
onPageRender: $,
|
|
1441
1441
|
loadingText: H = "正在加载PDF文档...",
|
|
1442
1442
|
errorText: ue = "PDF加载失败"
|
|
1443
1443
|
}) {
|
|
1444
|
-
const [
|
|
1445
|
-
|
|
1446
|
-
), [
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
}, [
|
|
1450
|
-
const [
|
|
1444
|
+
const [re, Z] = M(null), [se, t] = M(j), [s, x] = M(c), [D, X] = M(u), [le, R] = M(!1), [V, p] = M(null), [w, B] = M(0), [de, ie] = M(!1), [ee, me] = M(
|
|
1445
|
+
g === "scroll"
|
|
1446
|
+
), [fe, ve] = M(y);
|
|
1447
|
+
te(() => {
|
|
1448
|
+
ve(y);
|
|
1449
|
+
}, [y]);
|
|
1450
|
+
const [be, Te] = M(void 0), [ge, Ee] = M(null), m = je(null), k = je(null), v = a ?? se, F = h ?? s, ae = _ ?? D, { Card: Pe, CardContent: Be, Button: ce, Input: Le, Skeleton: Ye } = i || {}, Ve = Oe(() => {
|
|
1451
1451
|
const n = {
|
|
1452
1452
|
withCredentials: !1
|
|
1453
1453
|
};
|
|
1454
1454
|
return U && (n.cMapUrl = U, n.cMapPacked = !0), K && (n.standardFontDataUrl = K), n;
|
|
1455
1455
|
}, [U, K]);
|
|
1456
|
-
|
|
1456
|
+
te(() => {
|
|
1457
1457
|
let n = !0;
|
|
1458
1458
|
return (async () => {
|
|
1459
1459
|
try {
|
|
1460
|
-
const
|
|
1460
|
+
const Q = await import("./index-Ba1twkJn.js");
|
|
1461
1461
|
if (typeof window < "u") {
|
|
1462
|
-
const
|
|
1463
|
-
|
|
1462
|
+
const G = Q.pdfjs, ye = G == null ? void 0 : G.version;
|
|
1463
|
+
G != null && G.GlobalWorkerOptions && ye && (S ? G.GlobalWorkerOptions.workerSrc = S : G.GlobalWorkerOptions.workerSrc = `https://cdn.jsdelivr.net/npm/pdfjs-dist@${ye}/build/pdf.worker.min.mjs`, !U && G.GlobalWorkerOptions && (G.GlobalWorkerOptions.cMapUrl = `https://unpkg.com/pdfjs-dist@${ye}/cmaps/`), !K && G.GlobalWorkerOptions && (G.GlobalWorkerOptions.standardFontDataUrl = `https://unpkg.com/pdfjs-dist@${ye}/standard_fonts/`));
|
|
1464
1464
|
}
|
|
1465
|
-
n &&
|
|
1466
|
-
} catch (
|
|
1465
|
+
n && Ee(Q);
|
|
1466
|
+
} catch (Q) {
|
|
1467
1467
|
if (n) {
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1468
|
+
const G = Q instanceof Error ? Q : new Error("无法加载 react-pdf 库");
|
|
1469
|
+
p(G), R(!1), E == null || E(G);
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
1472
|
})(), () => {
|
|
1473
1473
|
n = !1;
|
|
1474
1474
|
};
|
|
1475
|
-
}, [S, U, K,
|
|
1476
|
-
|
|
1477
|
-
let n = !0;
|
|
1478
|
-
return (async () => {
|
|
1479
|
-
T(!0), m(null);
|
|
1480
|
-
try {
|
|
1481
|
-
const { Document: X } = fe;
|
|
1482
|
-
if (!X)
|
|
1483
|
-
throw new Error("react-pdf Document 组件不可用");
|
|
1484
|
-
const xe = await fe.pdfjs.getDocument(s).promise;
|
|
1485
|
-
n && (Z(xe), Y(xe.numPages), T(!1), R == null || R(xe));
|
|
1486
|
-
} catch (X) {
|
|
1487
|
-
if (n) {
|
|
1488
|
-
const z = X instanceof Error ? X : new Error("PDF 加载失败");
|
|
1489
|
-
m(z), T(!1), y == null || y(z);
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
})(), () => {
|
|
1493
|
-
n = !1;
|
|
1494
|
-
};
|
|
1495
|
-
}, [fe, s, R, y]);
|
|
1496
|
-
const Le = ne(
|
|
1475
|
+
}, [S, U, K, E]);
|
|
1476
|
+
const Ge = ne(
|
|
1497
1477
|
(n) => {
|
|
1498
|
-
console.error("PDF加载失败:", n), console.error("PDF URL:",
|
|
1478
|
+
console.error("PDF加载失败:", n), console.error("PDF URL:", r), p(
|
|
1499
1479
|
new Error(`${ue}: ${n.message || "请检查文件路径或网络连接"}`)
|
|
1500
|
-
),
|
|
1480
|
+
), E == null || E(n);
|
|
1501
1481
|
},
|
|
1502
|
-
[
|
|
1482
|
+
[r, ue, E]
|
|
1503
1483
|
), oe = ne(
|
|
1504
1484
|
(n) => {
|
|
1505
|
-
const
|
|
1506
|
-
a === void 0 && t(
|
|
1485
|
+
const T = w > 0 ? Math.max(1, Math.min(n, w)) : n;
|
|
1486
|
+
a === void 0 && t(T), f == null || f(T);
|
|
1507
1487
|
},
|
|
1508
|
-
[
|
|
1509
|
-
),
|
|
1488
|
+
[w, a, f]
|
|
1489
|
+
), xe = ne(
|
|
1510
1490
|
(n) => {
|
|
1511
|
-
const
|
|
1512
|
-
|
|
1491
|
+
const T = Math.max(l, Math.min(P, F + n));
|
|
1492
|
+
h === void 0 && x(T), o == null || o(T);
|
|
1513
1493
|
},
|
|
1514
|
-
[F, l,
|
|
1494
|
+
[F, l, P, h, o]
|
|
1515
1495
|
), Ue = ne(() => {
|
|
1516
1496
|
const n = (ae + 90) % 360;
|
|
1517
|
-
|
|
1518
|
-
}, [ae,
|
|
1497
|
+
_ === void 0 && X(n), b == null || b(n);
|
|
1498
|
+
}, [ae, _, b]), Ce = pt((n) => {
|
|
1519
1499
|
Te(n);
|
|
1520
1500
|
}, 100);
|
|
1521
|
-
|
|
1522
|
-
if (!
|
|
1523
|
-
const n =
|
|
1524
|
-
|
|
1501
|
+
te(() => {
|
|
1502
|
+
if (!k.current) return;
|
|
1503
|
+
const n = k.current, T = () => {
|
|
1504
|
+
Ce(n.clientWidth);
|
|
1525
1505
|
};
|
|
1526
|
-
|
|
1527
|
-
const
|
|
1528
|
-
|
|
1506
|
+
T();
|
|
1507
|
+
const Q = new ResizeObserver(() => {
|
|
1508
|
+
T();
|
|
1529
1509
|
});
|
|
1530
|
-
return
|
|
1531
|
-
|
|
1510
|
+
return Q.observe(n), () => {
|
|
1511
|
+
Q.disconnect();
|
|
1532
1512
|
};
|
|
1533
|
-
}, [
|
|
1534
|
-
if (!
|
|
1535
|
-
const n = (
|
|
1536
|
-
(
|
|
1513
|
+
}, [Ce]), te(() => {
|
|
1514
|
+
if (!W) return;
|
|
1515
|
+
const n = (T) => {
|
|
1516
|
+
(T.ctrlKey || T.metaKey) && (T.key === "=" || T.key === "+") ? (T.preventDefault(), xe(0.1)) : (T.ctrlKey || T.metaKey) && T.key === "-" ? (T.preventDefault(), xe(-0.1)) : T.key === "ArrowLeft" ? (T.preventDefault(), oe(v - 1)) : T.key === "ArrowRight" && (T.preventDefault(), oe(v + 1));
|
|
1537
1517
|
};
|
|
1538
1518
|
return document.addEventListener("keydown", n), () => {
|
|
1539
1519
|
document.removeEventListener("keydown", n);
|
|
1540
1520
|
};
|
|
1541
|
-
}, [
|
|
1521
|
+
}, [W, v, oe, xe]);
|
|
1542
1522
|
const Je = ne(async () => {
|
|
1543
|
-
var n,
|
|
1523
|
+
var n, T;
|
|
1544
1524
|
if (!(typeof document > "u"))
|
|
1545
1525
|
if (document.fullscreenElement)
|
|
1546
1526
|
document.exitFullscreen && (await document.exitFullscreen(), ie(!1));
|
|
1547
1527
|
else
|
|
1548
1528
|
try {
|
|
1549
|
-
await ((
|
|
1550
|
-
} catch (
|
|
1551
|
-
console.error("Error attempting to enable fullscreen:",
|
|
1529
|
+
await ((T = (n = m.current) == null ? void 0 : n.requestFullscreen) == null ? void 0 : T.call(n)), ie(!0);
|
|
1530
|
+
} catch (Q) {
|
|
1531
|
+
console.error("Error attempting to enable fullscreen:", Q);
|
|
1552
1532
|
}
|
|
1553
1533
|
}, []);
|
|
1554
|
-
|
|
1534
|
+
te(() => {
|
|
1555
1535
|
if (typeof document > "u") return;
|
|
1556
1536
|
const n = () => {
|
|
1557
1537
|
ie(!!document.fullscreenElement);
|
|
@@ -1568,16 +1548,16 @@ function _t({
|
|
|
1568
1548
|
), Ke = () => A ? /* @__PURE__ */ e.jsxs(
|
|
1569
1549
|
"div",
|
|
1570
1550
|
{
|
|
1571
|
-
className: `flex items-center justify-between gap-4 border-b px-4 py-2 ${
|
|
1551
|
+
className: `flex items-center justify-between gap-4 border-b px-4 py-2 ${Y || ""}`,
|
|
1572
1552
|
children: [
|
|
1573
1553
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1574
|
-
|
|
1554
|
+
y && /* @__PURE__ */ e.jsx(
|
|
1575
1555
|
ce,
|
|
1576
1556
|
{
|
|
1577
1557
|
variant: "outline",
|
|
1578
1558
|
size: "icon",
|
|
1579
|
-
onClick: () =>
|
|
1580
|
-
title:
|
|
1559
|
+
onClick: () => ve(!fe),
|
|
1560
|
+
title: fe ? "隐藏侧边栏" : "显示侧边栏",
|
|
1581
1561
|
children: /* @__PURE__ */ e.jsx(at, {})
|
|
1582
1562
|
}
|
|
1583
1563
|
),
|
|
@@ -1586,7 +1566,7 @@ function _t({
|
|
|
1586
1566
|
{
|
|
1587
1567
|
variant: "outline",
|
|
1588
1568
|
size: "icon",
|
|
1589
|
-
onClick: () =>
|
|
1569
|
+
onClick: () => xe(-0.1),
|
|
1590
1570
|
disabled: F <= l,
|
|
1591
1571
|
children: /* @__PURE__ */ e.jsx(Ie, {})
|
|
1592
1572
|
}
|
|
@@ -1600,23 +1580,23 @@ function _t({
|
|
|
1600
1580
|
{
|
|
1601
1581
|
variant: "outline",
|
|
1602
1582
|
size: "icon",
|
|
1603
|
-
onClick: () =>
|
|
1604
|
-
disabled: F >=
|
|
1583
|
+
onClick: () => xe(0.1),
|
|
1584
|
+
disabled: F >= P,
|
|
1605
1585
|
children: /* @__PURE__ */ e.jsx(Fe, {})
|
|
1606
1586
|
}
|
|
1607
1587
|
),
|
|
1608
|
-
|
|
1588
|
+
z && /* @__PURE__ */ e.jsx(ce, { variant: "outline", size: "icon", onClick: Ue, children: /* @__PURE__ */ e.jsx(it, {}) }),
|
|
1609
1589
|
J && /* @__PURE__ */ e.jsx(
|
|
1610
1590
|
ce,
|
|
1611
1591
|
{
|
|
1612
1592
|
variant: "outline",
|
|
1613
1593
|
size: "icon",
|
|
1614
|
-
onClick: () => me(!
|
|
1615
|
-
title:
|
|
1616
|
-
children:
|
|
1594
|
+
onClick: () => me(!ee),
|
|
1595
|
+
title: ee ? "单页模式" : "滚动模式",
|
|
1596
|
+
children: ee ? /* @__PURE__ */ e.jsx(ct, {}) : /* @__PURE__ */ e.jsx(ot, {})
|
|
1617
1597
|
}
|
|
1618
1598
|
),
|
|
1619
|
-
|
|
1599
|
+
L && /* @__PURE__ */ e.jsx(ce, { variant: "outline", size: "icon", onClick: Je, children: de ? /* @__PURE__ */ e.jsx(Se, {}) : /* @__PURE__ */ e.jsx($e, {}) })
|
|
1620
1600
|
] }),
|
|
1621
1601
|
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1622
1602
|
/* @__PURE__ */ e.jsx(
|
|
@@ -1630,11 +1610,11 @@ function _t({
|
|
|
1630
1610
|
}
|
|
1631
1611
|
),
|
|
1632
1612
|
/* @__PURE__ */ e.jsx(
|
|
1633
|
-
|
|
1613
|
+
Le,
|
|
1634
1614
|
{
|
|
1635
1615
|
type: "number",
|
|
1636
1616
|
min: 1,
|
|
1637
|
-
max:
|
|
1617
|
+
max: w,
|
|
1638
1618
|
value: v,
|
|
1639
1619
|
onChange: (n) => oe(parseInt(n.target.value) || 1),
|
|
1640
1620
|
className: "w-16 text-center"
|
|
@@ -1642,7 +1622,7 @@ function _t({
|
|
|
1642
1622
|
),
|
|
1643
1623
|
/* @__PURE__ */ e.jsxs("span", { className: "text-sm text-muted-foreground", children: [
|
|
1644
1624
|
"/ ",
|
|
1645
|
-
|
|
1625
|
+
w
|
|
1646
1626
|
] }),
|
|
1647
1627
|
/* @__PURE__ */ e.jsx(
|
|
1648
1628
|
ce,
|
|
@@ -1650,62 +1630,65 @@ function _t({
|
|
|
1650
1630
|
variant: "outline",
|
|
1651
1631
|
size: "icon",
|
|
1652
1632
|
onClick: () => oe(v + 1),
|
|
1653
|
-
disabled: v >=
|
|
1633
|
+
disabled: w > 0 && v >= w,
|
|
1654
1634
|
children: /* @__PURE__ */ e.jsx(ke, {})
|
|
1655
1635
|
}
|
|
1656
1636
|
)
|
|
1657
1637
|
] })
|
|
1658
1638
|
]
|
|
1659
1639
|
}
|
|
1660
|
-
) : null,
|
|
1640
|
+
) : null, Re = () => /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("p", { className: "text-muted-foreground", children: H }) }), _e = () => /* @__PURE__ */ e.jsx("div", { className: "flex h-full min-h-[400px] items-center justify-center px-4 text-center text-destructive", children: /* @__PURE__ */ e.jsxs("div", { className: "max-w-md", children: [
|
|
1661
1641
|
/* @__PURE__ */ e.jsx("p", { className: "mb-2 text-lg font-medium", children: "文件加载失败" }),
|
|
1662
|
-
/* @__PURE__ */ e.jsx("p", { className: "text-sm opacity-80", children:
|
|
1642
|
+
/* @__PURE__ */ e.jsx("p", { className: "text-sm opacity-80", children: V == null ? void 0 : V.message })
|
|
1663
1643
|
] }) }), He = () => {
|
|
1664
|
-
if (!
|
|
1665
|
-
const { Document: n, Page:
|
|
1644
|
+
if (!ge) return Re();
|
|
1645
|
+
const { Document: n, Page: T } = ge;
|
|
1666
1646
|
return /* @__PURE__ */ e.jsx(
|
|
1667
1647
|
"div",
|
|
1668
1648
|
{
|
|
1669
|
-
ref:
|
|
1649
|
+
ref: k,
|
|
1670
1650
|
className: `pdf-container flex-1 overflow-y-auto ${q || ""}`,
|
|
1671
1651
|
children: /* @__PURE__ */ e.jsx("div", { className: "flex min-h-full justify-center px-4", children: /* @__PURE__ */ e.jsx(
|
|
1672
1652
|
n,
|
|
1673
1653
|
{
|
|
1674
|
-
|
|
1675
|
-
onLoadError:
|
|
1676
|
-
options:
|
|
1677
|
-
loading:
|
|
1678
|
-
error:
|
|
1679
|
-
|
|
1654
|
+
file: r,
|
|
1655
|
+
onLoadError: Ge,
|
|
1656
|
+
options: Ve,
|
|
1657
|
+
loading: Re(),
|
|
1658
|
+
error: _e(),
|
|
1659
|
+
onLoadSuccess: (Q) => {
|
|
1660
|
+
re || (Z(Q), B(Q.numPages), R(!1), C == null || C(Q));
|
|
1661
|
+
},
|
|
1662
|
+
children: V ? _e() : ee ? (
|
|
1680
1663
|
// 显示所有页面模式
|
|
1681
|
-
Array.from(new Array(
|
|
1664
|
+
Array.from(new Array(w), (Q, G) => /* @__PURE__ */ e.jsx(
|
|
1682
1665
|
"div",
|
|
1683
1666
|
{
|
|
1684
1667
|
className: `mb-4 ${I || ""}`,
|
|
1685
1668
|
children: /* @__PURE__ */ e.jsx(
|
|
1686
|
-
|
|
1669
|
+
T,
|
|
1687
1670
|
{
|
|
1688
|
-
pageNumber:
|
|
1671
|
+
pageNumber: G + 1,
|
|
1689
1672
|
renderTextLayer: !1,
|
|
1690
1673
|
renderAnnotationLayer: !1,
|
|
1691
|
-
width:
|
|
1674
|
+
width: be,
|
|
1692
1675
|
scale: F,
|
|
1693
1676
|
rotate: ae,
|
|
1694
|
-
onRenderSuccess: () => $ == null ? void 0 : $(
|
|
1677
|
+
onRenderSuccess: () => $ == null ? void 0 : $(G + 1)
|
|
1695
1678
|
}
|
|
1696
1679
|
)
|
|
1697
1680
|
},
|
|
1698
|
-
`page_${
|
|
1681
|
+
`page_${G + 1}`
|
|
1699
1682
|
))
|
|
1700
1683
|
) : (
|
|
1701
1684
|
// 单页模式
|
|
1702
1685
|
/* @__PURE__ */ e.jsx("div", { className: I || "", children: /* @__PURE__ */ e.jsx(
|
|
1703
|
-
|
|
1686
|
+
T,
|
|
1704
1687
|
{
|
|
1705
1688
|
pageNumber: v,
|
|
1706
1689
|
renderTextLayer: !1,
|
|
1707
1690
|
renderAnnotationLayer: !1,
|
|
1708
|
-
width:
|
|
1691
|
+
width: be,
|
|
1709
1692
|
scale: F,
|
|
1710
1693
|
rotate: ae,
|
|
1711
1694
|
onRenderSuccess: () => $ == null ? void 0 : $(v)
|
|
@@ -1717,12 +1700,12 @@ function _t({
|
|
|
1717
1700
|
}
|
|
1718
1701
|
);
|
|
1719
1702
|
}, Ze = () => {
|
|
1720
|
-
if (!
|
|
1703
|
+
if (!y || !fe || !re) return null;
|
|
1721
1704
|
const n = ht;
|
|
1722
1705
|
return /* @__PURE__ */ e.jsx(
|
|
1723
1706
|
n,
|
|
1724
1707
|
{
|
|
1725
|
-
pdfDocument:
|
|
1708
|
+
pdfDocument: re,
|
|
1726
1709
|
currentPage: v,
|
|
1727
1710
|
onPageClick: qe,
|
|
1728
1711
|
components: {
|
|
@@ -1731,11 +1714,11 @@ function _t({
|
|
|
1731
1714
|
TabsTrigger: i.TabsTrigger,
|
|
1732
1715
|
TabsContent: i.TabsContent,
|
|
1733
1716
|
ScrollArea: i.ScrollArea,
|
|
1734
|
-
Skeleton:
|
|
1717
|
+
Skeleton: Ye
|
|
1735
1718
|
}
|
|
1736
1719
|
}
|
|
1737
1720
|
);
|
|
1738
|
-
}, Xe = () =>
|
|
1721
|
+
}, Xe = () => N ? /* @__PURE__ */ e.jsxs("div", { className: "fixed bottom-4 left-1/2 z-50 flex -translate-x-1/2 gap-2 md:hidden", children: [
|
|
1739
1722
|
/* @__PURE__ */ e.jsxs(
|
|
1740
1723
|
ce,
|
|
1741
1724
|
{
|
|
@@ -1755,7 +1738,7 @@ function _t({
|
|
|
1755
1738
|
variant: "secondary",
|
|
1756
1739
|
size: "sm",
|
|
1757
1740
|
onClick: () => oe(v + 1),
|
|
1758
|
-
disabled: v >=
|
|
1741
|
+
disabled: v >= w,
|
|
1759
1742
|
children: [
|
|
1760
1743
|
/* @__PURE__ */ e.jsx("span", { className: "mr-1", children: "下一页" }),
|
|
1761
1744
|
/* @__PURE__ */ e.jsx(ke, {})
|
|
@@ -1765,19 +1748,19 @@ function _t({
|
|
|
1765
1748
|
] }) : null;
|
|
1766
1749
|
if (!i)
|
|
1767
1750
|
return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
|
|
1768
|
-
if (
|
|
1751
|
+
if (y) {
|
|
1769
1752
|
const n = [];
|
|
1770
1753
|
if (i.Tabs || n.push("Tabs"), i.TabsList || n.push("TabsList"), i.TabsTrigger || n.push("TabsTrigger"), i.TabsContent || n.push("TabsContent"), i.ScrollArea || n.push("ScrollArea"), n.length > 0) {
|
|
1771
|
-
const
|
|
1754
|
+
const T = n.length === 1 ? n[0] : `${n.slice(0, -1).join("、")} 和 ${n[n.length - 1]}`;
|
|
1772
1755
|
return /* @__PURE__ */ e.jsxs("div", { className: "p-4 text-center text-destructive", children: [
|
|
1773
1756
|
"错误:侧边栏功能需要注入 ",
|
|
1774
|
-
|
|
1757
|
+
T,
|
|
1775
1758
|
" 组件"
|
|
1776
1759
|
] });
|
|
1777
1760
|
}
|
|
1778
1761
|
}
|
|
1779
|
-
return /* @__PURE__ */ e.jsxs("div", { ref:
|
|
1780
|
-
/* @__PURE__ */ e.jsxs(
|
|
1762
|
+
return /* @__PURE__ */ e.jsxs("div", { ref: m, children: [
|
|
1763
|
+
/* @__PURE__ */ e.jsxs(Pe, { className: d, children: [
|
|
1781
1764
|
Ke(),
|
|
1782
1765
|
/* @__PURE__ */ e.jsx(
|
|
1783
1766
|
Be,
|
|
@@ -1786,7 +1769,7 @@ function _t({
|
|
|
1786
1769
|
style: { height: de ? "100vh" : O },
|
|
1787
1770
|
children: /* @__PURE__ */ e.jsx("div", { className: "flex h-full flex-col", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
1788
1771
|
Ze(),
|
|
1789
|
-
le ?
|
|
1772
|
+
le ? Re() : V ? _e() : He()
|
|
1790
1773
|
] }) })
|
|
1791
1774
|
}
|
|
1792
1775
|
)
|
|
@@ -1802,9 +1785,9 @@ export {
|
|
|
1802
1785
|
wt as a,
|
|
1803
1786
|
ht as b,
|
|
1804
1787
|
Tt as c,
|
|
1805
|
-
|
|
1806
|
-
|
|
1788
|
+
Et as d,
|
|
1789
|
+
Pt as e,
|
|
1807
1790
|
yt as f,
|
|
1808
1791
|
e as j
|
|
1809
1792
|
};
|
|
1810
|
-
//# sourceMappingURL=index-
|
|
1793
|
+
//# sourceMappingURL=index-6lJCWESg.js.map
|