@turinhub/atomix-common-ui 0.1.1 → 0.2.0

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,686 +1,12 @@
1
- import { clsx as ae } from "clsx";
2
- import { twMerge as oe } from "tailwind-merge";
3
- import ce, { useState as ie, useEffect as ue } from "react";
4
- import { MoreVertical as de, Plus as fe, Search as me, ChevronLeft as xe, ChevronRight as he } from "lucide-react";
5
- function _e(...a) {
6
- return oe(ae(a));
7
- }
8
- var Z = { exports: {} }, B = {};
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 B;
21
- re = 1;
22
- var a = Symbol.for("react.transitional.element"), h = Symbol.for("react.fragment");
23
- function d(p, c, f) {
24
- var x = null;
25
- if (f !== void 0 && (x = "" + f), c.key !== void 0 && (x = "" + c.key), "key" in c) {
26
- f = {};
27
- for (var o in c)
28
- o !== "key" && (f[o] = c[o]);
29
- } else f = c;
30
- return c = f.ref, {
31
- $$typeof: a,
32
- type: p,
33
- key: x,
34
- ref: c !== void 0 ? c : null,
35
- props: f
36
- };
37
- }
38
- return B.Fragment = h, B.jsx = d, B.jsxs = d, B;
39
- }
40
- var L = {};
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 a(e) {
54
- if (e == null) return null;
55
- if (typeof e == "function")
56
- return e.$$typeof === K ? null : e.displayName || e.name || null;
57
- if (typeof e == "string") return e;
58
- switch (e) {
59
- case y:
60
- return "Fragment";
61
- case D:
62
- return "Profiler";
63
- case w:
64
- return "StrictMode";
65
- case _:
66
- return "Suspense";
67
- case g:
68
- return "SuspenseList";
69
- case Q:
70
- return "Activity";
71
- }
72
- if (typeof e == "object")
73
- switch (typeof e.tag == "number" && console.error(
74
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
75
- ), e.$$typeof) {
76
- case O:
77
- return "Portal";
78
- case R:
79
- return e.displayName || "Context";
80
- case S:
81
- return (e._context.displayName || "Context") + ".Consumer";
82
- case P:
83
- var t = e.render;
84
- return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
85
- case V:
86
- return t = e.displayName || null, t !== null ? t : a(e.type) || "Memo";
87
- case I:
88
- t = e._payload, e = e._init;
89
- try {
90
- return a(e(t));
91
- } catch {
92
- }
93
- }
94
- return null;
95
- }
96
- function h(e) {
97
- return "" + e;
98
- }
99
- function d(e) {
100
- try {
101
- h(e);
102
- var t = !1;
103
- } catch {
104
- t = !0;
105
- }
106
- if (t) {
107
- t = console;
108
- var n = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
109
- return n.call(
110
- t,
111
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
112
- i
113
- ), h(e);
114
- }
115
- }
116
- function p(e) {
117
- if (e === y) return "<>";
118
- if (typeof e == "object" && e !== null && e.$$typeof === I)
119
- return "<...>";
120
- try {
121
- var t = a(e);
122
- return t ? "<" + t + ">" : "<...>";
123
- } catch {
124
- return "<...>";
125
- }
126
- }
127
- function c() {
128
- var e = z.A;
129
- return e === null ? null : e.getOwner();
130
- }
131
- function f() {
132
- return Error("react-stack-top-frame");
133
- }
134
- function x(e) {
135
- if (W.call(e, "key")) {
136
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
137
- if (t && t.isReactWarning) return !1;
138
- }
139
- return e.key !== void 0;
140
- }
141
- function o(e, t) {
142
- function n() {
143
- q || (q = !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
- t
146
- ));
147
- }
148
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
149
- get: n,
150
- configurable: !0
151
- });
152
- }
153
- function T() {
154
- var e = a(this.type);
155
- return J[e] || (J[e] = !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
- )), e = this.props.ref, e !== void 0 ? e : null;
158
- }
159
- function m(e, t, n, i, $, M) {
160
- var u = n.ref;
161
- return e = {
162
- $$typeof: E,
163
- type: e,
164
- key: t,
165
- props: n,
166
- _owner: i
167
- }, (u !== void 0 ? u : null) !== null ? Object.defineProperty(e, "ref", {
168
- enumerable: !1,
169
- get: T
170
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
171
- configurable: !1,
172
- enumerable: !1,
173
- writable: !0,
174
- value: 0
175
- }), Object.defineProperty(e, "_debugInfo", {
176
- configurable: !1,
177
- enumerable: !1,
178
- writable: !0,
179
- value: null
180
- }), Object.defineProperty(e, "_debugStack", {
181
- configurable: !1,
182
- enumerable: !1,
183
- writable: !0,
184
- value: $
185
- }), Object.defineProperty(e, "_debugTask", {
186
- configurable: !1,
187
- enumerable: !1,
188
- writable: !0,
189
- value: M
190
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
191
- }
192
- function s(e, t, n, i, $, M) {
193
- var u = t.children;
194
- if (u !== void 0)
195
- if (i)
196
- if (H(u)) {
197
- for (i = 0; i < u.length; i++)
198
- k(u[i]);
199
- Object.freeze && Object.freeze(u);
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 k(u);
205
- if (W.call(t, "key")) {
206
- u = a(e);
207
- var C = Object.keys(t).filter(function(j) {
208
- return j !== "key";
209
- });
210
- i = 0 < C.length ? "{key: someKey, " + C.join(": ..., ") + ": ...}" : "{key: someKey}", G[u + i] || (C = 0 < C.length ? "{" + C.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
- i,
218
- u,
219
- C,
220
- u
221
- ), G[u + i] = !0);
222
- }
223
- if (u = null, n !== void 0 && (d(n), u = "" + n), x(t) && (d(t.key), u = "" + t.key), "key" in t) {
224
- n = {};
225
- for (var l in t)
226
- l !== "key" && (n[l] = t[l]);
227
- } else n = t;
228
- return u && o(
229
- n,
230
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
231
- ), m(
232
- e,
233
- u,
234
- n,
235
- c(),
236
- $,
237
- M
238
- );
239
- }
240
- function k(e) {
241
- N(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === I && (e._payload.status === "fulfilled" ? N(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
242
- }
243
- function N(e) {
244
- return typeof e == "object" && e !== null && e.$$typeof === E;
245
- }
246
- var b = ce, E = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), w = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), S = Symbol.for("react.consumer"), R = Symbol.for("react.context"), P = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), V = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), Q = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), z = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, W = Object.prototype.hasOwnProperty, H = Array.isArray, F = console.createTask ? console.createTask : function() {
247
- return null;
248
- };
249
- b = {
250
- react_stack_bottom_frame: function(e) {
251
- return e();
252
- }
253
- };
254
- var q, J = {}, U = b.react_stack_bottom_frame.bind(
255
- b,
256
- f
257
- )(), A = F(p(f)), G = {};
258
- L.Fragment = y, L.jsx = function(e, t, n) {
259
- var i = 1e4 > z.recentlyCreatedOwnerStacks++;
260
- return s(
261
- e,
262
- t,
263
- n,
264
- !1,
265
- i ? Error("react-stack-top-frame") : U,
266
- i ? F(p(e)) : A
267
- );
268
- }, L.jsxs = function(e, t, n) {
269
- var i = 1e4 > z.recentlyCreatedOwnerStacks++;
270
- return s(
271
- e,
272
- t,
273
- n,
274
- !0,
275
- i ? Error("react-stack-top-frame") : U,
276
- i ? F(p(e)) : A
277
- );
278
- };
279
- })()), L;
280
- }
281
- var se;
282
- function ve() {
283
- return se || (se = 1, process.env.NODE_ENV === "production" ? Z.exports = pe() : Z.exports = je()), Z.exports;
284
- }
285
- var r = ve();
286
- function Te({
287
- data: a,
288
- loading: h = !1,
289
- columns: d,
290
- rowKey: p,
291
- emptyText: c = "暂无数据",
292
- searchActiveEmptyText: f = "未找到匹配的记录",
293
- header: x,
294
- pagination: o,
295
- rowClassName: T,
296
- onRow: m,
297
- actions: s,
298
- components: k,
299
- renderCard: N,
300
- renderTable: b,
301
- renderActions: E
302
- }) {
303
- var u, C;
304
- if (!k)
305
- return /* @__PURE__ */ r.jsxs("div", { className: "p-4 text-center text-destructive", children: [
306
- "错误:请通过 components prop 注入 UI 组件",
307
- /* @__PURE__ */ r.jsx("br", {}),
308
- /* @__PURE__ */ r.jsx("code", { className: "text-sm", children: 'import { Card, Table, Button, ... } from "@/components/ui"' })
309
- ] });
310
- const {
311
- Card: O,
312
- CardContent: y,
313
- CardFooter: w,
314
- Table: D,
315
- TableBody: S,
316
- TableCell: R,
317
- TableHead: P,
318
- TableHeader: _,
319
- TableRow: g,
320
- Button: V,
321
- DropdownMenu: I,
322
- DropdownMenuTrigger: Q,
323
- DropdownMenuContent: K,
324
- DropdownMenuItem: z,
325
- DropdownMenuSeparator: W,
326
- Skeleton: H,
327
- TableHeaderComponent: F,
328
- TablePaginationComponent: q
329
- } = k, J = (l, j) => {
330
- if (typeof p == "function")
331
- return p(l);
332
- const v = l[p];
333
- return v != null ? String(v) : `row-${j}`;
334
- }, U = !!(x != null && x.searchValue && x.searchValue.trim().length > 0), A = !!(s != null && s.render || (u = s == null ? void 0 : s.items) != null && u.length), G = (s == null ? void 0 : s.mode) ?? ((C = s == null ? void 0 : s.items) != null && C.length ? "collapsed" : "expanded"), e = (l) => l.separator === !0, t = (l, j) => !s || !A ? null : G === "collapsed" && s.items && s.items.length > 0 ? /* @__PURE__ */ r.jsxs(I, { children: [
335
- /* @__PURE__ */ r.jsx(Q, { asChild: !0, children: /* @__PURE__ */ r.jsx(
336
- V,
337
- {
338
- variant: "ghost",
339
- className: "h-8 w-8 p-0",
340
- "aria-label": "打开行操作菜单",
341
- children: /* @__PURE__ */ r.jsx(de, { className: "h-4 w-4" })
342
- }
343
- ) }),
344
- /* @__PURE__ */ r.jsx(K, { align: "end", children: s.items.map(
345
- (v, X) => e(v) ? /* @__PURE__ */ r.jsx(W, {}, `separator-${X}`) : /* @__PURE__ */ r.jsxs(
346
- z,
347
- {
348
- onClick: () => v.onClick(l, j),
349
- className: v.className,
350
- children: [
351
- v.icon && /* @__PURE__ */ r.jsx("span", { className: "mr-2 h-4 w-4", children: v.icon }),
352
- v.label
353
- ]
354
- },
355
- `action-${X}`
356
- )
357
- ) })
358
- ] }) : s.render ? s.render(l, j) : null, n = () => /* @__PURE__ */ r.jsx(_, { children: /* @__PURE__ */ r.jsxs(g, { className: "bg-muted/50 hover:bg-muted/50", children: [
359
- d.map((l) => /* @__PURE__ */ r.jsx(
360
- P,
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
- A && /* @__PURE__ */ r.jsx(P, { className: "text-right font-semibold text-foreground", children: (s == null ? void 0 : s.title) || "操作" })
369
- ] }) }), i = () => h ? /* @__PURE__ */ r.jsx(S, { children: Array.from({ length: 5 }).map((l, j) => /* @__PURE__ */ r.jsxs(g, { children: [
370
- d.map((v) => /* @__PURE__ */ r.jsx(
371
- R,
372
- {
373
- style: { width: v.width },
374
- className: v.align === "center" ? "text-center" : v.align === "right" ? "text-right" : "",
375
- children: /* @__PURE__ */ r.jsx(H, { className: "h-4 w-full" })
376
- },
377
- String(v.key)
378
- )),
379
- A && /* @__PURE__ */ r.jsx(R, { children: /* @__PURE__ */ r.jsx(H, { className: "ml-auto h-4 w-8" }) })
380
- ] }, j)) }) : a.length === 0 ? /* @__PURE__ */ r.jsx(S, { children: /* @__PURE__ */ r.jsx(g, { children: /* @__PURE__ */ r.jsx(
381
- R,
382
- {
383
- colSpan: d.length + (A ? 1 : 0),
384
- className: "py-8 text-center text-muted-foreground",
385
- children: U ? f : c
386
- }
387
- ) }) }) : /* @__PURE__ */ r.jsx(S, { children: a.map((l, j) => {
388
- const v = J(l, j), X = m == null ? void 0 : m(l, j), le = T == null ? void 0 : T(l, j);
389
- return /* @__PURE__ */ r.jsxs(
390
- g,
391
- {
392
- className: `${le || ""} hover:bg-muted/50`,
393
- ...X,
394
- children: [
395
- d.map((Y) => {
396
- const ee = l[Y.key], ne = Y.render ? Y.render(ee, l, j) : ee;
397
- return /* @__PURE__ */ r.jsx(
398
- R,
399
- {
400
- className: Y.align === "center" ? "text-center" : Y.align === "right" ? "text-right" : "",
401
- children: ne
402
- },
403
- String(Y.key)
404
- );
405
- }),
406
- A && /* @__PURE__ */ r.jsx(R, { className: "text-right", children: E ? E(l, j) : t(l, j) })
407
- ]
408
- },
409
- v
410
- );
411
- }) }), $ = (l) => /* @__PURE__ */ r.jsxs(O, { children: [
412
- x && /* @__PURE__ */ r.jsx("div", { className: "p-6 pb-0", children: /* @__PURE__ */ r.jsx(F, { ...x }) }),
413
- /* @__PURE__ */ r.jsx(y, { className: "p-0", children: l }),
414
- (o == null ? void 0 : o.show) !== !1 && o && /* @__PURE__ */ r.jsx(w, { className: "border-t py-4", children: /* @__PURE__ */ r.jsx(
415
- q,
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: U
426
- }
427
- ) })
428
- ] }), M = (l, j) => /* @__PURE__ */ r.jsxs(D, { children: [
429
- l,
430
- j
431
- ] });
432
- return N ? N(
433
- b ? b(n(), i()) : M(n(), i())
434
- ) : $(
435
- b ? b(n(), i()) : M(n(), i())
436
- );
437
- }
438
- function Re({
439
- open: a,
440
- onOpenChange: h,
441
- title: d,
442
- description: p,
443
- onConfirm: c,
444
- loading: f = !1,
445
- confirmText: x = "确认删除",
446
- cancelText: o = "取消",
447
- confirmButtonVariant: T = "destructive",
448
- verification: m,
449
- components: s,
450
- loadingIcon: k
451
- }) {
452
- const [N, b] = ie("");
453
- if (ue(() => {
454
- a && b("");
455
- }, [a, m == null ? void 0 : m.targetValue]), !s)
456
- return /* @__PURE__ */ r.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
457
- const {
458
- Dialog: E,
459
- DialogContent: O,
460
- DialogHeader: y,
461
- DialogFooter: w,
462
- DialogTitle: D,
463
- DialogDescription: S,
464
- Button: R,
465
- Input: P,
466
- Label: _
467
- } = s, g = m ? N !== m.targetValue : !1, V = () => {
468
- g || c();
469
- };
470
- return /* @__PURE__ */ r.jsx(E, { open: a, onOpenChange: h, children: /* @__PURE__ */ r.jsxs(O, { children: [
471
- /* @__PURE__ */ r.jsxs(y, { children: [
472
- /* @__PURE__ */ r.jsx(D, { asChild: !0, children: /* @__PURE__ */ r.jsx("div", { className: "flex items-center gap-2", children: d }) }),
473
- /* @__PURE__ */ r.jsx(S, { asChild: !0, children: /* @__PURE__ */ r.jsx("div", { children: p }) })
474
- ] }),
475
- m && /* @__PURE__ */ r.jsx("div", { className: "space-y-4 py-2", children: /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
476
- /* @__PURE__ */ r.jsx(_, { htmlFor: "confirm-input", children: m.label || "请输入以确认" }),
477
- /* @__PURE__ */ r.jsx(
478
- P,
479
- {
480
- id: "confirm-input",
481
- value: N,
482
- onChange: (I) => b(I.target.value),
483
- placeholder: m.placeholder,
484
- disabled: f
485
- }
486
- )
487
- ] }) }),
488
- /* @__PURE__ */ r.jsxs(w, { children: [
489
- /* @__PURE__ */ r.jsx(
490
- R,
491
- {
492
- variant: "outline",
493
- onClick: () => h(!1),
494
- disabled: f,
495
- children: o
496
- }
497
- ),
498
- /* @__PURE__ */ r.jsxs(
499
- R,
500
- {
501
- variant: T,
502
- onClick: V,
503
- disabled: g || f,
504
- children: [
505
- f && /* @__PURE__ */ r.jsx("span", { className: "mr-2", children: k || /* @__PURE__ */ r.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__ */ r.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__ */ r.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
- x
535
- ]
536
- }
537
- )
538
- ] })
539
- ] }) });
540
- }
541
- function ke({
542
- title: a,
543
- searchPlaceholder: h = "搜索...",
544
- searchValue: d = "",
545
- onSearchChange: p,
546
- onSearch: c,
547
- showSearch: f = !0,
548
- action: x,
549
- actionLabel: o,
550
- onActionClick: T,
551
- loading: m = !1,
552
- components: s
553
- }) {
554
- if (!s)
555
- return /* @__PURE__ */ r.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
556
- const { Input: k, Button: N } = s, b = (E) => {
557
- E.key === "Enter" && c && c();
558
- };
559
- return /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-4 p-1", children: [
560
- /* @__PURE__ */ r.jsxs("div", { className: "flex items-center justify-between", children: [
561
- /* @__PURE__ */ r.jsx("div", { className: "text-lg font-semibold leading-none tracking-tight", children: a }),
562
- /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
563
- x && /* @__PURE__ */ r.jsx("div", { className: "flex items-center gap-2", children: x }),
564
- !x && o && T && /* @__PURE__ */ r.jsxs(N, { onClick: T, disabled: m, size: "sm", children: [
565
- /* @__PURE__ */ r.jsx(fe, { className: "mr-2 h-4 w-4" }),
566
- o
567
- ] })
568
- ] })
569
- ] }),
570
- f && /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
571
- /* @__PURE__ */ r.jsxs("div", { className: "relative max-w-sm flex-1", children: [
572
- /* @__PURE__ */ r.jsx(me, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
573
- /* @__PURE__ */ r.jsx(
574
- k,
575
- {
576
- placeholder: h,
577
- value: d,
578
- onChange: (E) => p == null ? void 0 : p(E.target.value),
579
- onKeyPress: b,
580
- className: "h-9 pl-8",
581
- disabled: m
582
- }
583
- )
584
- ] }),
585
- c && /* @__PURE__ */ r.jsx(
586
- N,
587
- {
588
- onClick: c,
589
- disabled: m,
590
- variant: "secondary",
591
- size: "sm",
592
- children: "搜索"
593
- }
594
- )
595
- ] })
596
- ] });
597
- }
598
- function we({
599
- currentPage: a,
600
- pageSize: h,
601
- total: d,
602
- onPageChange: p,
603
- onPageSizeChange: c,
604
- pageSizeOptions: f = [10, 20, 50],
605
- showPageSizeSelector: x = !0,
606
- showTotal: o = !0,
607
- searchActive: T = !1,
608
- components: m
609
- }) {
610
- if (!m)
611
- return /* @__PURE__ */ r.jsx("div", { className: "p-4 text-center text-destructive", children: "错误:请通过 components prop 注入 UI 组件" });
612
- const {
613
- Button: s,
614
- Select: k,
615
- SelectTrigger: N,
616
- SelectContent: b,
617
- SelectItem: E,
618
- SelectValue: O
619
- } = m, y = Math.ceil(d / h), w = Math.max(y, 1), D = a * h + 1, S = Math.min((a + 1) * h, d), R = Array.from(
620
- /* @__PURE__ */ new Set([...f, h])
621
- ).sort((_, g) => _ - g), P = x && !!c;
622
- return d === 0 ? null : /* @__PURE__ */ r.jsxs("div", { className: "flex w-full items-center justify-between", children: [
623
- o && /* @__PURE__ */ r.jsx("div", { className: "text-sm text-muted-foreground", children: T ? `找到 ${d} 条匹配记录` : d > 0 ? `显示 ${D} - ${S} 条,共 ${d} 条记录` : "暂无数据" }),
624
- /* @__PURE__ */ r.jsxs("div", { className: "flex items-center space-x-2", children: [
625
- P && /* @__PURE__ */ r.jsxs("div", { className: "mr-2 flex items-center gap-2", children: [
626
- /* @__PURE__ */ r.jsx("span", { className: "text-sm text-muted-foreground", children: "每页" }),
627
- /* @__PURE__ */ r.jsxs(
628
- k,
629
- {
630
- value: String(h),
631
- onValueChange: (_) => {
632
- const g = Number(_);
633
- Number.isNaN(g) || g === h || !c || c(g);
634
- },
635
- children: [
636
- /* @__PURE__ */ r.jsx(N, { className: "h-8 w-[90px]", children: /* @__PURE__ */ r.jsx(O, {}) }),
637
- /* @__PURE__ */ r.jsx(b, { children: R.map((_) => /* @__PURE__ */ r.jsx(E, { value: String(_), children: _ }, _)) })
638
- ]
639
- }
640
- ),
641
- /* @__PURE__ */ r.jsx("span", { className: "text-sm text-muted-foreground", children: "条" })
642
- ] }),
643
- /* @__PURE__ */ r.jsxs("div", { className: "mr-4 text-sm text-muted-foreground", children: [
644
- "第 ",
645
- a + 1,
646
- " 页,共 ",
647
- w,
648
- " 页"
649
- ] }),
650
- /* @__PURE__ */ r.jsxs(
651
- s,
652
- {
653
- variant: "outline",
654
- size: "sm",
655
- onClick: () => p(a - 1),
656
- disabled: a === 0 || w <= 1,
657
- children: [
658
- /* @__PURE__ */ r.jsx(xe, { className: "h-4 w-4" }),
659
- "上一页"
660
- ]
661
- }
662
- ),
663
- /* @__PURE__ */ r.jsxs(
664
- s,
665
- {
666
- variant: "outline",
667
- size: "sm",
668
- onClick: () => p(a + 1),
669
- disabled: a >= w - 1 || w <= 1,
670
- children: [
671
- "下一页",
672
- /* @__PURE__ */ r.jsx(he, { className: "h-4 w-4" })
673
- ]
674
- }
675
- )
676
- ] })
677
- ] });
678
- }
1
+ import { D as s, a as t, S as i, T as r, b as l, c as n, d as o, e as T } from "./index-DruzjpTS.js";
679
2
  export {
680
- Te as DataTable,
681
- Re as DeleteConfirmDialog,
682
- ke as TableHeader,
683
- we as TablePagination,
684
- _e as cn
3
+ s as DataTable,
4
+ t as DeleteConfirmDialog,
5
+ i as SimplePDFReader,
6
+ r as TableHeader,
7
+ l as TablePagination,
8
+ n as ThemeSwitcher,
9
+ o as ThemeSwitcherContent,
10
+ T as cn
685
11
  };
686
12
  //# sourceMappingURL=index.js.map