@turinhub/atomix-common-ui 0.1.2 → 0.2.1

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/index.js CHANGED
@@ -1,920 +1,14 @@
1
- import { clsx as ce } from "clsx";
2
- import { twMerge as ie } from "tailwind-merge";
3
- import ue, { useState as ne, useEffect as le } from "react";
4
- import { MoreVertical as de, Plus as fe, Search as xe, ChevronLeft as me, ChevronRight as he } from "lucide-react";
5
- function ye(...n) {
6
- return ie(ce(n));
7
- }
8
- var Q = { exports: {} }, U = {};
9
- /**
10
- * @license React
11
- * react-jsx-runtime.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */
18
- var re;
19
- function pe() {
20
- if (re) return U;
21
- re = 1;
22
- var n = Symbol.for("react.transitional.element"), h = Symbol.for("react.fragment");
23
- function c(x, a, i) {
24
- var d = null;
25
- if (i !== void 0 && (d = "" + i), a.key !== void 0 && (d = "" + a.key), "key" in a) {
26
- i = {};
27
- for (var o in a)
28
- o !== "key" && (i[o] = a[o]);
29
- } else i = a;
30
- return a = i.ref, {
31
- $$typeof: n,
32
- type: x,
33
- key: d,
34
- ref: a !== void 0 ? a : null,
35
- props: i
36
- };
37
- }
38
- return U.Fragment = h, U.jsx = c, U.jsxs = c, U;
39
- }
40
- var V = {};
41
- /**
42
- * @license React
43
- * react-jsx-runtime.development.js
44
- *
45
- * Copyright (c) Meta Platforms, Inc. and affiliates.
46
- *
47
- * This source code is licensed under the MIT license found in the
48
- * LICENSE file in the root directory of this source tree.
49
- */
50
- var te;
51
- function je() {
52
- return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
53
- function n(r) {
54
- if (r == null) return null;
55
- if (typeof r == "function")
56
- return r.$$typeof === K ? null : r.displayName || r.name || null;
57
- if (typeof r == "string") return r;
58
- switch (r) {
59
- case C:
60
- return "Fragment";
61
- case O:
62
- return "Profiler";
63
- case R:
64
- return "StrictMode";
65
- case E:
66
- return "Suspense";
67
- case g:
68
- return "SuspenseList";
69
- case L:
70
- return "Activity";
71
- }
72
- if (typeof r == "object")
73
- switch (typeof r.tag == "number" && console.error(
74
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
75
- ), r.$$typeof) {
76
- case M:
77
- return "Portal";
78
- case y:
79
- return r.displayName || "Context";
80
- case S:
81
- return (r._context.displayName || "Context") + ".Consumer";
82
- case A:
83
- var s = r.render;
84
- return r = r.displayName, r || (r = s.displayName || s.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
85
- case _:
86
- return s = r.displayName || null, s !== null ? s : n(r.type) || "Memo";
87
- case P:
88
- s = r._payload, r = r._init;
89
- try {
90
- return n(r(s));
91
- } catch {
92
- }
93
- }
94
- return null;
95
- }
96
- function h(r) {
97
- return "" + r;
98
- }
99
- function c(r) {
100
- try {
101
- h(r);
102
- var s = !1;
103
- } catch {
104
- s = !0;
105
- }
106
- if (s) {
107
- s = console;
108
- var u = s.error, m = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
109
- return u.call(
110
- s,
111
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
112
- m
113
- ), h(r);
114
- }
115
- }
116
- function x(r) {
117
- if (r === C) return "<>";
118
- if (typeof r == "object" && r !== null && r.$$typeof === P)
119
- return "<...>";
120
- try {
121
- var s = n(r);
122
- return s ? "<" + s + ">" : "<...>";
123
- } catch {
124
- return "<...>";
125
- }
126
- }
127
- function a() {
128
- var r = Y.A;
129
- return r === null ? null : r.getOwner();
130
- }
131
- function i() {
132
- return Error("react-stack-top-frame");
133
- }
134
- function d(r) {
135
- if (H.call(r, "key")) {
136
- var s = Object.getOwnPropertyDescriptor(r, "key").get;
137
- if (s && s.isReactWarning) return !1;
138
- }
139
- return r.key !== void 0;
140
- }
141
- function o(r, s) {
142
- function u() {
143
- G || (G = !0, console.error(
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
- s
146
- ));
147
- }
148
- u.isReactWarning = !0, Object.defineProperty(r, "key", {
149
- get: u,
150
- configurable: !0
151
- });
152
- }
153
- function w() {
154
- var r = n(this.type);
155
- return J[r] || (J[r] = !0, console.error(
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
- )), r = this.props.ref, r !== void 0 ? r : null;
158
- }
159
- function f(r, s, u, m, $, W) {
160
- var p = u.ref;
161
- return r = {
162
- $$typeof: T,
163
- type: r,
164
- key: s,
165
- props: u,
166
- _owner: m
167
- }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(r, "ref", {
168
- enumerable: !1,
169
- get: w
170
- }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
171
- configurable: !1,
172
- enumerable: !1,
173
- writable: !0,
174
- value: 0
175
- }), Object.defineProperty(r, "_debugInfo", {
176
- configurable: !1,
177
- enumerable: !1,
178
- writable: !0,
179
- value: null
180
- }), Object.defineProperty(r, "_debugStack", {
181
- configurable: !1,
182
- enumerable: !1,
183
- writable: !0,
184
- value: $
185
- }), Object.defineProperty(r, "_debugTask", {
186
- configurable: !1,
187
- enumerable: !1,
188
- writable: !0,
189
- value: W
190
- }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
191
- }
192
- function t(r, s, u, m, $, W) {
193
- var p = s.children;
194
- if (p !== void 0)
195
- if (m)
196
- if (q(p)) {
197
- for (m = 0; m < p.length; m++)
198
- j(p[m]);
199
- Object.freeze && Object.freeze(p);
200
- } else
201
- console.error(
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
- );
204
- else j(p);
205
- if (H.call(s, "key")) {
206
- p = n(r);
207
- var D = Object.keys(s).filter(function(N) {
208
- return N !== "key";
209
- });
210
- m = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", X[p + m] || (D = 0 < D.length ? "{" + D.join(": ..., ") + ": ...}" : "{}", console.error(
211
- `A props object containing a "key" prop is being spread into JSX:
212
- let props = %s;
213
- <%s {...props} />
214
- React keys must be passed directly to JSX without using spread:
215
- let props = %s;
216
- <%s key={someKey} {...props} />`,
217
- m,
218
- p,
219
- D,
220
- p
221
- ), X[p + m] = !0);
222
- }
223
- if (p = null, u !== void 0 && (c(u), p = "" + u), d(s) && (c(s.key), p = "" + s.key), "key" in s) {
224
- u = {};
225
- for (var l in s)
226
- l !== "key" && (u[l] = s[l]);
227
- } else u = s;
228
- return p && o(
229
- u,
230
- typeof r == "function" ? r.displayName || r.name || "Unknown" : r
231
- ), f(
232
- r,
233
- p,
234
- u,
235
- a(),
236
- $,
237
- W
238
- );
239
- }
240
- function j(r) {
241
- b(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === P && (r._payload.status === "fulfilled" ? b(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
242
- }
243
- function b(r) {
244
- return typeof r == "object" && r !== null && r.$$typeof === T;
245
- }
246
- var v = ue, T = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), C = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), O = Symbol.for("react.profiler"), S = Symbol.for("react.consumer"), y = Symbol.for("react.context"), A = Symbol.for("react.forward_ref"), E = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), L = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), Y = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, H = Object.prototype.hasOwnProperty, q = Array.isArray, F = console.createTask ? console.createTask : function() {
247
- return null;
248
- };
249
- v = {
250
- react_stack_bottom_frame: function(r) {
251
- return r();
252
- }
253
- };
254
- var G, J = {}, z = v.react_stack_bottom_frame.bind(
255
- v,
256
- i
257
- )(), I = F(x(i)), X = {};
258
- V.Fragment = C, V.jsx = function(r, s, u) {
259
- var m = 1e4 > Y.recentlyCreatedOwnerStacks++;
260
- return t(
261
- r,
262
- s,
263
- u,
264
- !1,
265
- m ? Error("react-stack-top-frame") : z,
266
- m ? F(x(r)) : I
267
- );
268
- }, V.jsxs = function(r, s, u) {
269
- var m = 1e4 > Y.recentlyCreatedOwnerStacks++;
270
- return t(
271
- r,
272
- s,
273
- u,
274
- !0,
275
- m ? Error("react-stack-top-frame") : z,
276
- m ? F(x(r)) : I
277
- );
278
- };
279
- })()), V;
280
- }
281
- var se;
282
- function ve() {
283
- return se || (se = 1, process.env.NODE_ENV === "production" ? Q.exports = pe() : Q.exports = je()), Q.exports;
284
- }
285
- var e = ve();
286
- function Ee({
287
- data: n,
288
- loading: h = !1,
289
- columns: c,
290
- rowKey: x,
291
- emptyText: a = "暂无数据",
292
- searchActiveEmptyText: i = "未找到匹配的记录",
293
- header: d,
294
- pagination: o,
295
- rowClassName: w,
296
- onRow: f,
297
- actions: t,
298
- components: j,
299
- renderCard: b,
300
- renderTable: v,
301
- renderActions: T
302
- }) {
303
- var p, D;
304
- if (!j)
305
- return /* @__PURE__ */ e.jsxs("div", { className: "p-4 text-center text-destructive", children: [
306
- "错误:请通过 components prop 注入 UI 组件",
307
- /* @__PURE__ */ e.jsx("br", {}),
308
- /* @__PURE__ */ e.jsx("code", { className: "text-sm", children: 'import { Card, Table, Button, ... } from "@/components/ui"' })
309
- ] });
310
- const {
311
- Card: M,
312
- CardContent: C,
313
- CardFooter: R,
314
- Table: O,
315
- TableBody: S,
316
- TableCell: y,
317
- TableHead: A,
318
- TableHeader: E,
319
- TableRow: g,
320
- Button: _,
321
- DropdownMenu: P,
322
- DropdownMenuTrigger: L,
323
- DropdownMenuContent: K,
324
- DropdownMenuItem: Y,
325
- DropdownMenuSeparator: H,
326
- Skeleton: q,
327
- TableHeaderComponent: F,
328
- TablePaginationComponent: G
329
- } = j, J = (l, N) => {
330
- if (typeof x == "function")
331
- return x(l);
332
- const k = l[x];
333
- return k != null ? String(k) : `row-${N}`;
334
- }, z = !!(d != null && d.searchValue && d.searchValue.trim().length > 0), I = !!(t != null && t.render || (p = t == null ? void 0 : t.items) != null && p.length), X = (t == null ? void 0 : t.mode) ?? ((D = t == null ? void 0 : t.items) != null && D.length ? "collapsed" : "expanded"), r = (l) => l.separator === !0, s = (l, N) => !t || !I ? null : X === "collapsed" && t.items && t.items.length > 0 ? /* @__PURE__ */ e.jsxs(P, { children: [
335
- /* @__PURE__ */ e.jsx(L, { asChild: !0, children: /* @__PURE__ */ e.jsx(
336
- _,
337
- {
338
- variant: "ghost",
339
- className: "h-8 w-8 p-0",
340
- "aria-label": "打开行操作菜单",
341
- children: /* @__PURE__ */ e.jsx(de, { className: "h-4 w-4" })
342
- }
343
- ) }),
344
- /* @__PURE__ */ e.jsx(K, { align: "end", children: t.items.map(
345
- (k, Z) => r(k) ? /* @__PURE__ */ e.jsx(H, {}, `separator-${Z}`) : /* @__PURE__ */ e.jsxs(
346
- Y,
347
- {
348
- onClick: () => k.onClick(l, N),
349
- className: k.className,
350
- children: [
351
- k.icon && /* @__PURE__ */ e.jsx("span", { className: "mr-2 h-4 w-4", children: k.icon }),
352
- k.label
353
- ]
354
- },
355
- `action-${Z}`
356
- )
357
- ) })
358
- ] }) : t.render ? t.render(l, N) : null, u = () => /* @__PURE__ */ e.jsx(E, { children: /* @__PURE__ */ e.jsxs(g, { className: "bg-muted/50 hover:bg-muted/50", children: [
359
- c.map((l) => /* @__PURE__ */ e.jsx(
360
- A,
361
- {
362
- className: `font-semibold text-foreground ${l.align === "center" ? "text-center" : l.align === "right" ? "text-right" : "text-left"}`,
363
- style: { width: l.width },
364
- children: l.title
365
- },
366
- String(l.key)
367
- )),
368
- I && /* @__PURE__ */ e.jsx(A, { className: "text-right font-semibold text-foreground", children: (t == null ? void 0 : t.title) || "操作" })
369
- ] }) }), m = () => h ? /* @__PURE__ */ e.jsx(S, { children: Array.from({ length: 5 }).map((l, N) => /* @__PURE__ */ e.jsxs(g, { children: [
370
- c.map((k) => /* @__PURE__ */ e.jsx(
371
- y,
372
- {
373
- style: { width: k.width },
374
- className: k.align === "center" ? "text-center" : k.align === "right" ? "text-right" : "",
375
- children: /* @__PURE__ */ e.jsx(q, { className: "h-4 w-full" })
376
- },
377
- String(k.key)
378
- )),
379
- I && /* @__PURE__ */ e.jsx(y, { children: /* @__PURE__ */ e.jsx(q, { className: "ml-auto h-4 w-8" }) })
380
- ] }, N)) }) : n.length === 0 ? /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsx(g, { children: /* @__PURE__ */ e.jsx(
381
- y,
382
- {
383
- colSpan: c.length + (I ? 1 : 0),
384
- className: "py-8 text-center text-muted-foreground",
385
- children: z ? i : a
386
- }
387
- ) }) }) : /* @__PURE__ */ e.jsx(S, { children: n.map((l, N) => {
388
- const k = J(l, N), Z = f == null ? void 0 : f(l, N), ae = w == null ? void 0 : w(l, N);
389
- return /* @__PURE__ */ e.jsxs(
390
- g,
391
- {
392
- className: `${ae || ""} hover:bg-muted/50`,
393
- ...Z,
394
- children: [
395
- c.map((B) => {
396
- const ee = l[B.key], oe = B.render ? B.render(ee, l, N) : ee;
397
- return /* @__PURE__ */ e.jsx(
398
- y,
399
- {
400
- className: B.align === "center" ? "text-center" : B.align === "right" ? "text-right" : "",
401
- children: oe
402
- },
403
- String(B.key)
404
- );
405
- }),
406
- I && /* @__PURE__ */ e.jsx(y, { className: "text-right", children: T ? T(l, N) : s(l, N) })
407
- ]
408
- },
409
- k
410
- );
411
- }) }), $ = (l) => /* @__PURE__ */ e.jsxs(M, { children: [
412
- d && /* @__PURE__ */ e.jsx("div", { className: "p-6 pb-0", children: /* @__PURE__ */ e.jsx(F, { ...d }) }),
413
- /* @__PURE__ */ e.jsx(C, { className: "p-0", children: l }),
414
- (o == null ? void 0 : o.show) !== !1 && o && /* @__PURE__ */ e.jsx(R, { className: "border-t py-4", children: /* @__PURE__ */ e.jsx(
415
- G,
416
- {
417
- currentPage: o.currentPage,
418
- pageSize: o.pageSize,
419
- total: o.total,
420
- onPageChange: o.onPageChange,
421
- onPageSizeChange: o.onPageSizeChange,
422
- pageSizeOptions: o.pageSizeOptions,
423
- showPageSizeSelector: o.showPageSizeSelector,
424
- showTotal: o.showTotal,
425
- searchActive: z
426
- }
427
- ) })
428
- ] }), W = (l, N) => /* @__PURE__ */ e.jsxs(O, { children: [
429
- l,
430
- N
431
- ] });
432
- return b ? b(
433
- v ? v(u(), m()) : W(u(), m())
434
- ) : $(
435
- v ? v(u(), m()) : W(u(), m())
436
- );
437
- }
438
- function _e({
439
- open: n,
440
- onOpenChange: h,
441
- title: c,
442
- description: x,
443
- onConfirm: a,
444
- loading: i = !1,
445
- confirmText: d = "确认删除",
446
- cancelText: o = "取消",
447
- confirmButtonVariant: w = "destructive",
448
- verification: f,
449
- components: t,
450
- loadingIcon: j
451
- }) {
452
- const [b, v] = ne("");
453
- if (le(() => {
454
- n && v("");
455
- }, [n, f == null ? void 0 : f.targetValue]), !t)
456
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
457
- const {
458
- Dialog: T,
459
- DialogContent: M,
460
- DialogHeader: C,
461
- DialogFooter: R,
462
- DialogTitle: O,
463
- DialogDescription: S,
464
- Button: y,
465
- Input: A,
466
- Label: E
467
- } = t, g = f ? b !== f.targetValue : !1, _ = () => {
468
- g || a();
469
- };
470
- return /* @__PURE__ */ e.jsx(T, { open: n, onOpenChange: h, children: /* @__PURE__ */ e.jsxs(M, { children: [
471
- /* @__PURE__ */ e.jsxs(C, { children: [
472
- /* @__PURE__ */ e.jsx(O, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: c }) }),
473
- /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { children: x }) })
474
- ] }),
475
- f && /* @__PURE__ */ e.jsx("div", { className: "space-y-4 py-2", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
476
- /* @__PURE__ */ e.jsx(E, { htmlFor: "confirm-input", children: f.label || "请输入以确认" }),
477
- /* @__PURE__ */ e.jsx(
478
- A,
479
- {
480
- id: "confirm-input",
481
- value: b,
482
- onChange: (P) => v(P.target.value),
483
- placeholder: f.placeholder,
484
- disabled: i
485
- }
486
- )
487
- ] }) }),
488
- /* @__PURE__ */ e.jsxs(R, { children: [
489
- /* @__PURE__ */ e.jsx(
490
- y,
491
- {
492
- variant: "outline",
493
- onClick: () => h(!1),
494
- disabled: i,
495
- children: o
496
- }
497
- ),
498
- /* @__PURE__ */ e.jsxs(
499
- y,
500
- {
501
- variant: w,
502
- onClick: _,
503
- disabled: g || i,
504
- children: [
505
- i && /* @__PURE__ */ e.jsx("span", { className: "mr-2", children: j || /* @__PURE__ */ e.jsxs(
506
- "svg",
507
- {
508
- className: "h-4 w-4 animate-spin",
509
- fill: "none",
510
- viewBox: "0 0 24 24",
511
- children: [
512
- /* @__PURE__ */ e.jsx(
513
- "circle",
514
- {
515
- className: "opacity-25",
516
- cx: "12",
517
- cy: "12",
518
- r: "10",
519
- stroke: "currentColor",
520
- strokeWidth: "4"
521
- }
522
- ),
523
- /* @__PURE__ */ e.jsx(
524
- "path",
525
- {
526
- className: "opacity-75",
527
- fill: "currentColor",
528
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
529
- }
530
- )
531
- ]
532
- }
533
- ) }),
534
- d
535
- ]
536
- }
537
- )
538
- ] })
539
- ] }) });
540
- }
541
- function Re({
542
- title: n,
543
- searchPlaceholder: h = "搜索...",
544
- searchValue: c = "",
545
- onSearchChange: x,
546
- onSearch: a,
547
- showSearch: i = !0,
548
- action: d,
549
- actionLabel: o,
550
- onActionClick: w,
551
- loading: f = !1,
552
- components: t
553
- }) {
554
- if (!t)
555
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
556
- const { Input: j, Button: b } = t, v = (T) => {
557
- T.key === "Enter" && a && a();
558
- };
559
- return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 p-1", children: [
560
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
561
- /* @__PURE__ */ e.jsx("div", { className: "text-lg font-semibold leading-none tracking-tight", children: n }),
562
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
563
- d && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: d }),
564
- !d && o && w && /* @__PURE__ */ e.jsxs(b, { onClick: w, disabled: f, size: "sm", children: [
565
- /* @__PURE__ */ e.jsx(fe, { className: "mr-2 h-4 w-4" }),
566
- o
567
- ] })
568
- ] })
569
- ] }),
570
- i && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
571
- /* @__PURE__ */ e.jsxs("div", { className: "relative max-w-sm flex-1", children: [
572
- /* @__PURE__ */ e.jsx(xe, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
573
- /* @__PURE__ */ e.jsx(
574
- j,
575
- {
576
- placeholder: h,
577
- value: c,
578
- onChange: (T) => x == null ? void 0 : x(T.target.value),
579
- onKeyPress: v,
580
- className: "h-9 pl-8",
581
- disabled: f
582
- }
583
- )
584
- ] }),
585
- a && /* @__PURE__ */ e.jsx(
586
- b,
587
- {
588
- onClick: a,
589
- disabled: f,
590
- variant: "secondary",
591
- size: "sm",
592
- children: "搜索"
593
- }
594
- )
595
- ] })
596
- ] });
597
- }
598
- function Ce({
599
- currentPage: n,
600
- pageSize: h,
601
- total: c,
602
- onPageChange: x,
603
- onPageSizeChange: a,
604
- pageSizeOptions: i = [10, 20, 50],
605
- showPageSizeSelector: d = !0,
606
- showTotal: o = !0,
607
- searchActive: w = !1,
608
- components: f
609
- }) {
610
- if (!f)
611
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
612
- const {
613
- Button: t,
614
- Select: j,
615
- SelectTrigger: b,
616
- SelectContent: v,
617
- SelectItem: T,
618
- SelectValue: M
619
- } = f, C = Math.ceil(c / h), R = Math.max(C, 1), O = n * h + 1, S = Math.min((n + 1) * h, c), y = Array.from(
620
- /* @__PURE__ */ new Set([...i, h])
621
- ).sort((E, g) => E - g), A = d && !!a;
622
- return c === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "flex w-full items-center justify-between", children: [
623
- o && /* @__PURE__ */ e.jsx("div", { className: "text-sm text-muted-foreground", children: w ? `找到 ${c} 条匹配记录` : c > 0 ? `显示 ${O} - ${S} 条,共 ${c} 条记录` : "暂无数据" }),
624
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
625
- A && /* @__PURE__ */ e.jsxs("div", { className: "mr-2 flex items-center gap-2", children: [
626
- /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "每页" }),
627
- /* @__PURE__ */ e.jsxs(
628
- j,
629
- {
630
- value: String(h),
631
- onValueChange: (E) => {
632
- const g = Number(E);
633
- Number.isNaN(g) || g === h || !a || a(g);
634
- },
635
- children: [
636
- /* @__PURE__ */ e.jsx(b, { className: "h-8 w-[90px]", children: /* @__PURE__ */ e.jsx(M, {}) }),
637
- /* @__PURE__ */ e.jsx(v, { children: y.map((E) => /* @__PURE__ */ e.jsx(T, { value: String(E), children: E }, E)) })
638
- ]
639
- }
640
- ),
641
- /* @__PURE__ */ e.jsx("span", { className: "text-sm text-muted-foreground", children: "条" })
642
- ] }),
643
- /* @__PURE__ */ e.jsxs("div", { className: "mr-4 text-sm text-muted-foreground", children: [
644
- "第 ",
645
- n + 1,
646
- " 页,共 ",
647
- R,
648
- " 页"
649
- ] }),
650
- /* @__PURE__ */ e.jsxs(
651
- t,
652
- {
653
- variant: "outline",
654
- size: "sm",
655
- onClick: () => x(n - 1),
656
- disabled: n === 0 || R <= 1,
657
- children: [
658
- /* @__PURE__ */ e.jsx(me, { className: "h-4 w-4" }),
659
- "上一页"
660
- ]
661
- }
662
- ),
663
- /* @__PURE__ */ e.jsxs(
664
- t,
665
- {
666
- variant: "outline",
667
- size: "sm",
668
- onClick: () => x(n + 1),
669
- disabled: n >= R - 1 || R <= 1,
670
- children: [
671
- "下一页",
672
- /* @__PURE__ */ e.jsx(he, { className: "h-4 w-4" })
673
- ]
674
- }
675
- )
676
- ] })
677
- ] });
678
- }
679
- const be = [
680
- {
681
- value: "light",
682
- label: "浅色",
683
- icon: /* @__PURE__ */ e.jsxs(
684
- "svg",
685
- {
686
- className: "h-4 w-4",
687
- fill: "none",
688
- viewBox: "0 0 24 24",
689
- stroke: "currentColor",
690
- children: [
691
- /* @__PURE__ */ e.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
692
- /* @__PURE__ */ e.jsx(
693
- "path",
694
- {
695
- className: "opacity-75",
696
- d: "M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41",
697
- strokeWidth: "2",
698
- strokeLinecap: "round"
699
- }
700
- )
701
- ]
702
- }
703
- )
704
- },
705
- {
706
- value: "dark",
707
- label: "深色",
708
- icon: /* @__PURE__ */ e.jsx(
709
- "svg",
710
- {
711
- className: "h-4 w-4",
712
- fill: "none",
713
- viewBox: "0 0 24 24",
714
- stroke: "currentColor",
715
- children: /* @__PURE__ */ e.jsx(
716
- "path",
717
- {
718
- d: "M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z",
719
- strokeWidth: "2",
720
- strokeLinecap: "round",
721
- strokeLinejoin: "round"
722
- }
723
- )
724
- }
725
- )
726
- },
727
- {
728
- value: "system",
729
- label: "跟随系统",
730
- icon: /* @__PURE__ */ e.jsxs(
731
- "svg",
732
- {
733
- className: "h-4 w-4",
734
- fill: "none",
735
- viewBox: "0 0 24 24",
736
- stroke: "currentColor",
737
- children: [
738
- /* @__PURE__ */ e.jsx(
739
- "rect",
740
- {
741
- x: "2",
742
- y: "3",
743
- width: "20",
744
- height: "14",
745
- rx: "2",
746
- ry: "2",
747
- strokeWidth: "2"
748
- }
749
- ),
750
- /* @__PURE__ */ e.jsx("path", { d: "M8 21h8m-4-4v4", strokeWidth: "2", strokeLinecap: "round" })
751
- ]
752
- }
753
- )
754
- }
755
- ];
756
- function Se({
757
- value: n,
758
- onValueChange: h,
759
- themes: c = be,
760
- triggerVariant: x = "ghost",
761
- triggerSize: a = "icon",
762
- triggerClassName: i,
763
- iconSize: d = 16,
764
- showCurrentIcon: o = !0,
765
- enableSSRHandling: w = !0,
766
- triggerContent: f,
767
- components: t,
768
- themeIcons: j
769
- }) {
770
- const [b, v] = ne(!1);
771
- if (le(() => {
772
- v(!0);
773
- }, []), w && !b)
774
- return null;
775
- if (!t)
776
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
777
- const {
778
- DropdownMenu: T,
779
- DropdownMenuTrigger: M,
780
- DropdownMenuContent: C,
781
- DropdownMenuRadioGroup: R,
782
- DropdownMenuRadioItem: O,
783
- Button: S
784
- } = t, y = (_) => {
785
- if (j && j[_])
786
- return j[_];
787
- const P = c.find((L) => L.value === _);
788
- return P == null ? void 0 : P.icon;
789
- }, A = y(n), E = o ? A : null, g = d ? { width: d, height: d } : {};
790
- return /* @__PURE__ */ e.jsxs(T, { children: [
791
- /* @__PURE__ */ e.jsx(M, { asChild: !0, children: /* @__PURE__ */ e.jsx(
792
- S,
793
- {
794
- variant: x,
795
- size: a,
796
- className: i,
797
- children: f || /* @__PURE__ */ e.jsx(
798
- "span",
799
- {
800
- style: g,
801
- className: "inline-flex items-center justify-center",
802
- children: E
803
- }
804
- )
805
- }
806
- ) }),
807
- /* @__PURE__ */ e.jsx(C, { children: /* @__PURE__ */ e.jsx(R, { value: n, onValueChange: h, children: c.map((_) => /* @__PURE__ */ e.jsxs(O, { value: _.value, children: [
808
- /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", children: y(_.value) }),
809
- /* @__PURE__ */ e.jsx("span", { children: _.label })
810
- ] }, _.value)) }) })
811
- ] });
812
- }
813
- const ge = [
814
- {
815
- value: "light",
816
- label: "浅色",
817
- icon: /* @__PURE__ */ e.jsxs(
818
- "svg",
819
- {
820
- className: "h-4 w-4",
821
- fill: "none",
822
- viewBox: "0 0 24 24",
823
- stroke: "currentColor",
824
- children: [
825
- /* @__PURE__ */ e.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "2" }),
826
- /* @__PURE__ */ e.jsx(
827
- "path",
828
- {
829
- className: "opacity-75",
830
- d: "M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41",
831
- strokeWidth: "2",
832
- strokeLinecap: "round"
833
- }
834
- )
835
- ]
836
- }
837
- )
838
- },
839
- {
840
- value: "dark",
841
- label: "深色",
842
- icon: /* @__PURE__ */ e.jsx(
843
- "svg",
844
- {
845
- className: "h-4 w-4",
846
- fill: "none",
847
- viewBox: "0 0 24 24",
848
- stroke: "currentColor",
849
- children: /* @__PURE__ */ e.jsx(
850
- "path",
851
- {
852
- d: "M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z",
853
- strokeWidth: "2",
854
- strokeLinecap: "round",
855
- strokeLinejoin: "round"
856
- }
857
- )
858
- }
859
- )
860
- },
861
- {
862
- value: "system",
863
- label: "跟随系统",
864
- icon: /* @__PURE__ */ e.jsxs(
865
- "svg",
866
- {
867
- className: "h-4 w-4",
868
- fill: "none",
869
- viewBox: "0 0 24 24",
870
- stroke: "currentColor",
871
- children: [
872
- /* @__PURE__ */ e.jsx(
873
- "rect",
874
- {
875
- x: "2",
876
- y: "3",
877
- width: "20",
878
- height: "14",
879
- rx: "2",
880
- ry: "2",
881
- strokeWidth: "2"
882
- }
883
- ),
884
- /* @__PURE__ */ e.jsx("path", { d: "M8 21h8m-4-4v4", strokeWidth: "2", strokeLinecap: "round" })
885
- ]
886
- }
887
- )
888
- }
889
- ];
890
- function Pe({
891
- value: n,
892
- onValueChange: h,
893
- themes: c = ge,
894
- iconSize: x = 16,
895
- components: a,
896
- themeIcons: i
897
- }) {
898
- if (!a)
899
- return /* @__PURE__ */ e.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
900
- const { DropdownMenuRadioGroup: d, DropdownMenuRadioItem: o } = a, w = (t) => {
901
- if (i && i[t])
902
- return i[t];
903
- const j = c.find((b) => b.value === t);
904
- return j == null ? void 0 : j.icon;
905
- }, f = x ? { width: x, height: x } : {};
906
- return /* @__PURE__ */ e.jsx(d, { value: n, onValueChange: h, children: c.map((t) => /* @__PURE__ */ e.jsxs(o, { value: t.value, children: [
907
- /* @__PURE__ */ e.jsx("span", { className: "mr-2 inline-flex items-center", style: f, children: w(t.value) }),
908
- /* @__PURE__ */ e.jsx("span", { children: t.label })
909
- ] }, t.value)) });
910
- }
1
+ import { D as s, a as r, P as i, b as t, S as D, T as l, c as n, d as o, e as T, f as b } from "./index-DaMRZoHB.js";
911
2
  export {
912
- Ee as DataTable,
913
- _e as DeleteConfirmDialog,
914
- Re as TableHeader,
915
- Ce as TablePagination,
916
- Se as ThemeSwitcher,
917
- Pe as ThemeSwitcherContent,
918
- ye as cn
3
+ s as DataTable,
4
+ r as DeleteConfirmDialog,
5
+ i as PDFReader,
6
+ t as PDFSidebar,
7
+ D as SimplePDFReader,
8
+ l as TableHeader,
9
+ n as TablePagination,
10
+ o as ThemeSwitcher,
11
+ T as ThemeSwitcherContent,
12
+ b as cn
919
13
  };
920
14
  //# sourceMappingURL=index.js.map