@rue-js/design 0.0.21

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.
@@ -0,0 +1,2046 @@
1
+ /**
2
+ * @rue-js/design v0.0.21
3
+ * (c) 2025-present Xiangmin Liu and Rue contributors
4
+ * @license MIT
5
+ **/
6
+ var RueRuntimeDOM = (function (exports, jsxRuntime, runtime, router) {
7
+ 'use strict';
8
+
9
+ const Alert = ({
10
+ variant,
11
+ outline,
12
+ dash,
13
+ soft,
14
+ direction,
15
+ className,
16
+ children
17
+ }) => {
18
+ let cls = "alert";
19
+ if (variant) cls += ` alert-${variant}`;
20
+ if (outline) cls += ` alert-outline`;
21
+ if (dash) cls += ` alert-dash`;
22
+ if (soft) cls += ` alert-soft`;
23
+ if (direction) cls += ` alert-${direction}`;
24
+ if (className) cls += ` ${className}`;
25
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "alert", className: cls, children });
26
+ };
27
+
28
+ const Accordion = ({
29
+ icon,
30
+ force,
31
+ use = "radio",
32
+ name,
33
+ open,
34
+ className,
35
+ children,
36
+ items
37
+ }) => {
38
+ if (items && items.length) {
39
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: items.map((it, i) => {
40
+ const iIcon = it.icon ?? icon;
41
+ const iForce = it.force ?? force;
42
+ const iUse = it.use ?? use;
43
+ let iCls = "collapse";
44
+ if (iIcon === "arrow") iCls += ` collapse-arrow`;
45
+ if (iIcon === "plus") iCls += ` collapse-plus`;
46
+ if (iForce === "open") iCls += ` collapse-open`;
47
+ if (iForce === "close") iCls += ` collapse-close`;
48
+ if (className) iCls += ` ${className}`;
49
+ if (it.className) iCls += ` ${it.className}`;
50
+ if (iUse === "details") {
51
+ return /* @__PURE__ */ jsxRuntime.jsxs("details", { className: iCls, name, open: it.open, children: [
52
+ /* @__PURE__ */ jsxRuntime.jsx(
53
+ "summary",
54
+ {
55
+ className: it.titleClassName ? `collapse-title ${it.titleClassName}` : "collapse-title",
56
+ children: it.title
57
+ }
58
+ ),
59
+ /* @__PURE__ */ jsxRuntime.jsx(
60
+ "div",
61
+ {
62
+ className: it.contentClassName ? `collapse-content ${it.contentClassName}` : "collapse-content",
63
+ children: it.content
64
+ }
65
+ )
66
+ ] }, i);
67
+ }
68
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: iCls, children: [
69
+ /* @__PURE__ */ jsxRuntime.jsx("input", { type: "radio", name, checked: it.open }),
70
+ /* @__PURE__ */ jsxRuntime.jsx(
71
+ "div",
72
+ {
73
+ className: it.titleClassName ? `collapse-title ${it.titleClassName}` : "collapse-title",
74
+ children: it.title
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsxRuntime.jsx(
78
+ "div",
79
+ {
80
+ className: it.contentClassName ? `collapse-content ${it.contentClassName}` : "collapse-content",
81
+ children: it.content
82
+ }
83
+ )
84
+ ] }, i);
85
+ }) });
86
+ }
87
+ let cls = "collapse";
88
+ if (icon === "arrow") cls += ` collapse-arrow`;
89
+ if (icon === "plus") cls += ` collapse-plus`;
90
+ if (force === "open") cls += ` collapse-open`;
91
+ if (force === "close") cls += ` collapse-close`;
92
+ if (className) cls += ` ${className}`;
93
+ if (use === "details") {
94
+ return /* @__PURE__ */ jsxRuntime.jsx("details", { className: cls, name, open, children });
95
+ }
96
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cls, children: [
97
+ /* @__PURE__ */ jsxRuntime.jsx("input", { type: "radio", name, checked: open }),
98
+ children
99
+ ] });
100
+ };
101
+ const Title$4 = ({ className, children, as = "div" }) => {
102
+ let cls = "collapse-title";
103
+ if (className) cls += ` ${className}`;
104
+ return as === "summary" ? /* @__PURE__ */ jsxRuntime.jsx("summary", { className: cls, children }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
105
+ };
106
+ const Content$1 = ({ className, children }) => {
107
+ let cls = "collapse-content";
108
+ if (className) cls += ` ${className}`;
109
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
110
+ };
111
+ const AccordionCompound = Object.assign(Accordion, {
112
+ Title: Title$4,
113
+ Content: Content$1
114
+ });
115
+
116
+ const Button = ({
117
+ variant,
118
+ size,
119
+ outline,
120
+ dash,
121
+ soft,
122
+ ghost,
123
+ link,
124
+ active,
125
+ block,
126
+ wide,
127
+ square,
128
+ circle,
129
+ disabled,
130
+ disabledClass,
131
+ loading,
132
+ type,
133
+ className,
134
+ onClick,
135
+ children
136
+ }) => {
137
+ let cls = "btn";
138
+ if (variant) cls += ` btn-${variant}`;
139
+ if (size) cls += ` btn-${size}`;
140
+ if (outline) cls += ` btn-outline`;
141
+ if (dash) cls += ` btn-dash`;
142
+ if (soft) cls += ` btn-soft`;
143
+ if (ghost) cls += ` btn-ghost`;
144
+ if (link) cls += ` btn-link`;
145
+ if (active) cls += ` btn-active`;
146
+ if (block) cls += ` btn-block`;
147
+ if (wide) cls += ` btn-wide`;
148
+ if (square) cls += ` btn-square`;
149
+ if (circle) cls += ` btn-circle`;
150
+ if (disabledClass) cls += ` btn-disabled`;
151
+ if (className) cls += ` ${className}`;
152
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { className: cls, disabled: disabled || loading, type, onClick, children });
153
+ };
154
+
155
+ const Card = ({ size, border, dash, side, imageFull, className, children }) => {
156
+ let cls = "card";
157
+ if (size) cls += ` card-${size}`;
158
+ if (border) cls += ` card-border`;
159
+ if (dash) cls += ` card-dash`;
160
+ if (side) cls += ` card-side`;
161
+ if (imageFull) cls += ` image-full`;
162
+ if (className) cls += ` ${className}`;
163
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
164
+ };
165
+ const Body$1 = ({ className, children }) => {
166
+ let cls = "card-body";
167
+ if (className) cls += ` ${className}`;
168
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
169
+ };
170
+ const Title$3 = ({ className, children }) => {
171
+ let cls = "card-title";
172
+ if (className) cls += ` ${className}`;
173
+ return /* @__PURE__ */ jsxRuntime.jsx("h2", { className: cls, children });
174
+ };
175
+ const Actions$1 = ({ className, children }) => {
176
+ let cls = "card-actions";
177
+ if (className) cls += ` ${className}`;
178
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
179
+ };
180
+ const Figure$1 = ({ className, children }) => {
181
+ let cls = "figure";
182
+ if (className) cls += ` ${className}`;
183
+ return /* @__PURE__ */ jsxRuntime.jsx("figure", { className: cls, children });
184
+ };
185
+ const CardCompound = Object.assign(Card, {
186
+ Body: Body$1,
187
+ Title: Title$3,
188
+ Actions: Actions$1,
189
+ Figure: Figure$1
190
+ });
191
+
192
+ const Avatar = ({ status, className, children }) => {
193
+ let cls = "avatar not-prose";
194
+ if (status) cls += ` avatar-${status}`;
195
+ if (className) cls += ` ${className}`;
196
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
197
+ };
198
+ const Group = ({ className, children, items }) => {
199
+ let cls = "avatar-group";
200
+ if (className) cls += ` ${className}`;
201
+ if (items && items.length) {
202
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children: items.map((m, i) => (
203
+ /* 逐项渲染子头像 */
204
+ /* @__PURE__ */ jsxRuntime.jsx(Avatar, { status: m.status, children: m.children }, i)
205
+ )) });
206
+ }
207
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
208
+ };
209
+ const AvatarCompound = Object.assign(Avatar, {
210
+ Group
211
+ });
212
+
213
+ const Divider = ({ variant, direction, placement, className, children }) => {
214
+ let cls = "divider";
215
+ if (direction) cls += ` divider-${direction}`;
216
+ if (variant) cls += ` divider-${variant}`;
217
+ if (placement) cls += ` divider-${placement}`;
218
+ if (className) cls += ` ${className}`;
219
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
220
+ };
221
+
222
+ const Footer$1 = ({ direction, center, className, children }) => {
223
+ let cls = "footer";
224
+ if (direction) cls += ` footer-${direction}`;
225
+ if (center) cls += ` footer-center`;
226
+ if (className) cls += ` ${className}`;
227
+ return /* @__PURE__ */ jsxRuntime.jsx("footer", { className: cls, children });
228
+ };
229
+
230
+ const Modal = ({ open, title, children, actions, className, onClose }) => {
231
+ if (!open) return null;
232
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "modal modal-open", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `modal-box ${className ?? ""}`, children: [
233
+ title ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-semibold mb-2", children: title }) : null,
234
+ children,
235
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "modal-action", children: [
236
+ actions,
237
+ onClose ? /* @__PURE__ */ jsxRuntime.jsx("button", { className: "btn", onClick: onClose, children: "\u5173\u95ED" }) : null
238
+ ] })
239
+ ] }) });
240
+ };
241
+
242
+ const Tabs = ({ items, activeKey, onChange, style, placement, size, className }) => {
243
+ let cls = "tabs";
244
+ if (style === "box") cls += " tabs-box";
245
+ if (style === "border") cls += " tabs-border";
246
+ if (style === "lift") cls += " tabs-lift";
247
+ if (placement === "bottom") cls += " tabs-bottom";
248
+ if (size) cls += ` tabs-${size}`;
249
+ if (className) cls += ` ${className}`;
250
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "tablist", className: cls, children: items.map((it) => /* @__PURE__ */ jsxRuntime.jsx(
251
+ "button",
252
+ {
253
+ role: "tab",
254
+ className: `tab ${activeKey === it.key ? "tab-active" : ""} ${it.disabled ? "tab-disabled" : ""} ${it.className ?? ""}`,
255
+ disabled: it.disabled,
256
+ onClick: () => !it.disabled && onChange && onChange(it.key),
257
+ children: it.label
258
+ },
259
+ it.key
260
+ )) });
261
+ };
262
+
263
+ const Badge = ({
264
+ variant,
265
+ size,
266
+ outline,
267
+ dash,
268
+ soft,
269
+ ghost,
270
+ className,
271
+ children
272
+ }) => {
273
+ let cls = "badge";
274
+ if (variant) cls += ` badge-${variant}`;
275
+ if (size) cls += ` badge-${size}`;
276
+ if (outline) cls += ` badge-outline`;
277
+ if (dash) cls += ` badge-dash`;
278
+ if (soft) cls += ` badge-soft`;
279
+ if (ghost) cls += ` badge-ghost`;
280
+ if (className) cls += ` ${className}`;
281
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
282
+ };
283
+
284
+ const Diff = ({ className, tabIndex, children }) => {
285
+ let cls = "diff";
286
+ if (className) cls += ` ${className}`;
287
+ return /* @__PURE__ */ jsxRuntime.jsx("figure", { className: cls, tabIndex, children });
288
+ };
289
+ const Item1 = ({ className, role, tabIndex, children }) => {
290
+ let cls = "diff-item-1";
291
+ if (className) cls += ` ${className}`;
292
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, role, tabIndex, children });
293
+ };
294
+ const Item2 = ({ className, role, tabIndex, children }) => {
295
+ let cls = "diff-item-2";
296
+ if (className) cls += ` ${className}`;
297
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, role, tabIndex, children });
298
+ };
299
+ const Resizer = ({ className }) => {
300
+ let cls = "diff-resizer";
301
+ if (className) cls += ` ${className}`;
302
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls });
303
+ };
304
+ const DiffCompound = Object.assign(Diff, {
305
+ Item1,
306
+ Item2,
307
+ Resizer
308
+ });
309
+
310
+ const OverlayDivs = () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
311
+ /* @__PURE__ */ jsxRuntime.jsx("div", {}),
312
+ /* @__PURE__ */ jsxRuntime.jsx("div", {}),
313
+ /* @__PURE__ */ jsxRuntime.jsx("div", {}),
314
+ /* @__PURE__ */ jsxRuntime.jsx("div", {}),
315
+ /* @__PURE__ */ jsxRuntime.jsx("div", {}),
316
+ /* @__PURE__ */ jsxRuntime.jsx("div", {}),
317
+ /* @__PURE__ */ jsxRuntime.jsx("div", {}),
318
+ /* @__PURE__ */ jsxRuntime.jsx("div", {})
319
+ ] });
320
+ const Hover3D = ({ as = "div", href, className, overlays = true, children }) => {
321
+ const cls = className ? `hover-3d ${className}` : "hover-3d";
322
+ if (as === "a") {
323
+ return /* @__PURE__ */ jsxRuntime.jsxs("a", { href, className: cls, children: [
324
+ children,
325
+ overlays ? /* @__PURE__ */ jsxRuntime.jsx(OverlayDivs, {}) : null
326
+ ] });
327
+ }
328
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cls, children: [
329
+ children,
330
+ overlays ? /* @__PURE__ */ jsxRuntime.jsx(OverlayDivs, {}) : null
331
+ ] });
332
+ };
333
+
334
+ const Timeline = ({
335
+ direction,
336
+ snapIcon,
337
+ compact,
338
+ className,
339
+ children,
340
+ items
341
+ }) => {
342
+ let cls = "timeline";
343
+ if (direction) cls += ` timeline-${direction}`;
344
+ if (snapIcon) cls += ` timeline-snap-icon`;
345
+ if (compact) cls += ` timeline-compact`;
346
+ if (className) cls += ` ${className}`;
347
+ if (items && items.length) {
348
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cls, children: items.map((it, i) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: it.liClassName, children: [
349
+ it.beforeLine ? /* @__PURE__ */ jsxRuntime.jsx("hr", {}) : null,
350
+ it.start ? /* @__PURE__ */ jsxRuntime.jsx(Start, { box: it.start.box, className: it.start.className, children: it.start.content }) : null,
351
+ it.middle ? /* @__PURE__ */ jsxRuntime.jsx(Middle, { className: it.middle.className, children: it.middle.content }) : null,
352
+ it.end ? /* @__PURE__ */ jsxRuntime.jsx(End, { box: it.end.box, className: it.end.className, children: it.end.content }) : null,
353
+ it.afterLine ? /* @__PURE__ */ jsxRuntime.jsx("hr", {}) : null
354
+ ] }, i)) });
355
+ }
356
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cls, children });
357
+ };
358
+ const Start = ({ box, className, children }) => {
359
+ let cls = "timeline-start";
360
+ if (box) cls += ` timeline-box`;
361
+ if (className) cls += ` ${className}`;
362
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
363
+ };
364
+ const Middle = ({ className, children }) => {
365
+ let cls = "timeline-middle";
366
+ if (className) cls += ` ${className}`;
367
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
368
+ };
369
+ const End = ({ box, className, children }) => {
370
+ let cls = "timeline-end";
371
+ if (box) cls += ` timeline-box`;
372
+ if (className) cls += ` ${className}`;
373
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
374
+ };
375
+ const TimelineCompound = Object.assign(Timeline, {
376
+ Start,
377
+ Middle,
378
+ End
379
+ });
380
+
381
+ const TextRotate = ({ className, children, items, innerClassName }) => {
382
+ let cls = "text-rotate";
383
+ if (className) cls += ` ${className}`;
384
+ if (items && items.length) {
385
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cls, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: innerClassName, children: items.map((m, i) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: m.className, children: m.text }, i)) }) });
386
+ }
387
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cls, children });
388
+ };
389
+
390
+ const Status = ({ as = "span", ariaLabel, size, color, className, children }) => {
391
+ let cls = "status";
392
+ if (size) cls += ` status-${size}`;
393
+ if (color) cls += ` status-${color}`;
394
+ if (className) cls += ` ${className}`;
395
+ const common = { className: cls, "aria-label": ariaLabel };
396
+ if (as === "div") {
397
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...common, children });
398
+ }
399
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ...common, children });
400
+ };
401
+
402
+ const Stat = ({ direction, className, children, items }) => {
403
+ let cls = "stats";
404
+ if (direction) cls += ` stats-${direction}`;
405
+ if (className) cls += ` ${className}`;
406
+ if (items && items.length) {
407
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children: items.map((m, i) => {
408
+ const itemCls = m.className;
409
+ return (
410
+ /* 单项:按 center/figure/title/value/desc/actions 组合 */
411
+ /* @__PURE__ */ jsxRuntime.jsxs(Item$5, { center: m.center, className: itemCls, children: [
412
+ m.figure ? /* @__PURE__ */ jsxRuntime.jsx(Figure, { className: m.figureClassName, children: m.figure }) : null,
413
+ m.title ? /* @__PURE__ */ jsxRuntime.jsx(Title$2, { className: m.titleClassName, children: m.title }) : null,
414
+ m.value ? /* @__PURE__ */ jsxRuntime.jsx(Value$1, { className: m.valueClassName, children: m.value }) : null,
415
+ m.desc ? /* @__PURE__ */ jsxRuntime.jsx(Desc, { className: m.descClassName, children: m.desc }) : null,
416
+ m.actions ? /* @__PURE__ */ jsxRuntime.jsx(Actions, { className: m.actionsClassName, children: m.actions }) : null
417
+ ] }, i)
418
+ );
419
+ }) });
420
+ }
421
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
422
+ };
423
+ const Item$5 = ({ center, className, children }) => {
424
+ let cls = "stat";
425
+ if (center) cls += ` place-items-center`;
426
+ if (className) cls += ` ${className}`;
427
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
428
+ };
429
+ const Title$2 = ({ className, children }) => {
430
+ let cls = "stat-title";
431
+ if (className) cls += ` ${className}`;
432
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
433
+ };
434
+ const Value$1 = ({ className, children }) => {
435
+ let cls = "stat-value";
436
+ if (className) cls += ` ${className}`;
437
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
438
+ };
439
+ const Desc = ({ className, children }) => {
440
+ let cls = "stat-desc";
441
+ if (className) cls += ` ${className}`;
442
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
443
+ };
444
+ const Figure = ({ className, children }) => {
445
+ let cls = "stat-figure";
446
+ if (className) cls += ` ${className}`;
447
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
448
+ };
449
+ const Actions = ({ className, children }) => {
450
+ let cls = "stat-actions";
451
+ if (className) cls += ` ${className}`;
452
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
453
+ };
454
+ const StatCompound = Object.assign(Stat, {
455
+ Item: Item$5,
456
+ Title: Title$2,
457
+ Value: Value$1,
458
+ Desc,
459
+ Figure,
460
+ Actions
461
+ });
462
+
463
+ const Carousel = ({
464
+ align = "start",
465
+ direction = "horizontal",
466
+ auto = false,
467
+ interval = 3e3,
468
+ loop = true,
469
+ autoDirection = "forward",
470
+ activeIndex,
471
+ onIndexChange,
472
+ className,
473
+ children,
474
+ items
475
+ }) => {
476
+ const containerRef = runtime.useRef();
477
+ let cls = "carousel";
478
+ if (align === "center") cls += ` carousel-center`;
479
+ if (align === "end") cls += ` carousel-end`;
480
+ if (direction === "vertical") cls += ` carousel-vertical`;
481
+ else cls += ` carousel-horizontal`;
482
+ if (className) cls += ` ${className}`;
483
+ const getItems = () => {
484
+ const el = containerRef.current;
485
+ if (!el) return [];
486
+ return Array.from(el.querySelectorAll(".carousel-item"));
487
+ };
488
+ const scrollToIndex = (i) => {
489
+ const items2 = getItems();
490
+ if (!items2.length) return;
491
+ const idx = Math.max(0, Math.min(i, items2.length - 1));
492
+ const target = items2[idx];
493
+ const el = containerRef.current;
494
+ if (!el || !target) return;
495
+ const canScrollTo = typeof el.scrollTo === "function";
496
+ if (direction === "vertical") {
497
+ if (canScrollTo) el.scrollTo({ top: target.offsetTop, behavior: "smooth" });
498
+ else el.scrollTop = target.offsetTop;
499
+ } else {
500
+ if (canScrollTo) el.scrollTo({ left: target.offsetLeft, behavior: "smooth" });
501
+ else el.scrollLeft = target.offsetLeft;
502
+ }
503
+ if (onIndexChange) onIndexChange(idx);
504
+ };
505
+ const getCurrentIndex = () => {
506
+ const items2 = getItems();
507
+ const el = containerRef.current;
508
+ if (!el || !items2.length) return 0;
509
+ const pos = direction === "vertical" ? el.scrollTop : el.scrollLeft;
510
+ let idx = 0;
511
+ for (let i = 0; i < items2.length; i++) {
512
+ const off = direction === "vertical" ? items2[i].offsetTop : items2[i].offsetLeft;
513
+ if (off <= pos + 1) idx = i;
514
+ else break;
515
+ }
516
+ return idx;
517
+ };
518
+ let timer = null;
519
+ const smoothScrollTo = (pos) => {
520
+ const el = containerRef.current;
521
+ if (!el) return;
522
+ const canScrollTo = typeof el.scrollTo === "function";
523
+ if (direction === "vertical") {
524
+ requestAnimationFrame(() => {
525
+ if (canScrollTo) el.scrollTo({ top: pos, behavior: "smooth" });
526
+ else el.scrollTop = pos;
527
+ });
528
+ } else {
529
+ requestAnimationFrame(() => {
530
+ if (canScrollTo) el.scrollTo({ left: pos, behavior: "smooth" });
531
+ else el.scrollLeft = pos;
532
+ });
533
+ }
534
+ };
535
+ const scrollByPage = (dir) => {
536
+ const el = containerRef.current;
537
+ if (!el) return;
538
+ const delta = direction === "vertical" ? el.clientHeight : el.clientWidth;
539
+ const pos = direction === "vertical" ? el.scrollTop : el.scrollLeft;
540
+ const max = direction === "vertical" ? el.scrollHeight : el.scrollWidth;
541
+ let nextPos = pos;
542
+ if (dir === "forward") {
543
+ if (loop) {
544
+ if (pos - delta >= 0) {
545
+ nextPos = pos - delta;
546
+ } else {
547
+ nextPos = Math.max(0, max - delta);
548
+ }
549
+ } else {
550
+ nextPos = Math.max(pos - delta, 0);
551
+ }
552
+ } else {
553
+ if (loop) {
554
+ if (pos + delta <= Math.max(0, max - delta)) {
555
+ nextPos = pos + delta;
556
+ } else {
557
+ nextPos = 0;
558
+ }
559
+ } else {
560
+ nextPos = Math.min(pos + delta, Math.max(0, max - delta));
561
+ }
562
+ }
563
+ smoothScrollTo(nextPos);
564
+ const idx = getCurrentIndex();
565
+ if (onIndexChange) onIndexChange(idx);
566
+ };
567
+ const startAuto = () => {
568
+ if (!auto) return;
569
+ stopAuto();
570
+ timer = setInterval(() => {
571
+ if (autoDirection === "backward") scrollByPage("backward");
572
+ else scrollByPage("forward");
573
+ }, interval);
574
+ };
575
+ const stopAuto = () => {
576
+ if (timer) {
577
+ clearInterval(timer);
578
+ timer = null;
579
+ }
580
+ };
581
+ runtime.onMounted(() => {
582
+ const el = containerRef.current;
583
+ if (el && loop) {
584
+ const delta = direction === "vertical" ? el.clientHeight : el.clientWidth;
585
+ const max = direction === "vertical" ? el.scrollHeight : el.scrollWidth;
586
+ if (autoDirection === "forward") {
587
+ if (direction === "vertical") el.scrollTop = Math.max(0, max - delta);
588
+ else {
589
+ el.scrollLeft = Math.max(0, max - delta);
590
+ }
591
+ } else {
592
+ if (direction === "vertical") el.scrollTop = 0;
593
+ else el.scrollLeft = 0;
594
+ }
595
+ }
596
+ startAuto();
597
+ });
598
+ runtime.onUnmounted(() => {
599
+ stopAuto();
600
+ });
601
+ runtime.watch(
602
+ () => activeIndex,
603
+ (v) => {
604
+ if (typeof v === "number") {
605
+ scrollToIndex(v);
606
+ }
607
+ },
608
+ { immediate: true }
609
+ );
610
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: cls, children: items && items.length ? items.map((it, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: `carousel-item${it.className ? ` ${it.className}` : ""}`, children: it.content }, i)) : children });
611
+ };
612
+ const Item$4 = ({ className, children }) => {
613
+ let cls = "carousel-item";
614
+ if (className) cls += ` ${className}`;
615
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
616
+ };
617
+ const CarouselCompound = Object.assign(Carousel, {
618
+ Item: Item$4
619
+ });
620
+
621
+ const Chat = ({ placement, className, children, items }) => {
622
+ if (items && items.length) {
623
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: items.map((m, i) => {
624
+ let cls2 = "chat";
625
+ cls2 += ` chat-${m.placement}`;
626
+ if (className) cls2 += ` ${className}`;
627
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cls2, children: [
628
+ m.imageSrc ? /* @__PURE__ */ jsxRuntime.jsx(Image, { className: m.imageClassName, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-10 rounded-full", children: /* @__PURE__ */ jsxRuntime.jsx("img", { alt: m.imageAlt ?? "chat image", src: m.imageSrc }) }) }) : null,
629
+ m.headerName || m.headerTime ? /* @__PURE__ */ jsxRuntime.jsxs(Header, { className: m.headerClassName, children: [
630
+ m.headerName,
631
+ " ",
632
+ m.headerTime ? /* @__PURE__ */ jsxRuntime.jsx("time", { className: "text-xs opacity-50", children: m.headerTime }) : null
633
+ ] }) : null,
634
+ /* @__PURE__ */ jsxRuntime.jsx(Bubble, { color: m.color, children: m.text }),
635
+ m.footer ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { className: m.footerClassName, children: m.footer }) : null
636
+ ] }, i);
637
+ }) });
638
+ }
639
+ let cls = "chat";
640
+ cls += ` chat-${placement}`;
641
+ if (className) cls += ` ${className}`;
642
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
643
+ };
644
+ const Bubble = ({ color, className, children }) => {
645
+ let cls = "chat-bubble";
646
+ if (color) cls += ` chat-bubble-${color}`;
647
+ if (className) cls += ` ${className}`;
648
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
649
+ };
650
+ const Header = ({ className, children }) => {
651
+ let cls = "chat-header";
652
+ if (className) cls += ` ${className}`;
653
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
654
+ };
655
+ const Footer = ({ className, children }) => {
656
+ let cls = "chat-footer";
657
+ if (className) cls += ` ${className}`;
658
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
659
+ };
660
+ const Image = ({ className, children }) => {
661
+ let cls = "chat-image";
662
+ if (className) cls += ` ${className}`;
663
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
664
+ };
665
+ const ChatCompound = Object.assign(Chat, {
666
+ Bubble,
667
+ Header,
668
+ Footer,
669
+ Image
670
+ });
671
+
672
+ const Collapse = ({
673
+ arrow,
674
+ plus,
675
+ open,
676
+ close,
677
+ tabIndex,
678
+ tag = "div",
679
+ className,
680
+ children
681
+ }) => {
682
+ let cls = "collapse";
683
+ if (arrow) cls += " collapse-arrow";
684
+ if (plus) cls += " collapse-plus";
685
+ if (open) cls += " collapse-open";
686
+ if (close) cls += " collapse-close";
687
+ if (className) cls += ` ${className}`;
688
+ if (tag === "details") {
689
+ return /* @__PURE__ */ jsxRuntime.jsx("details", { className: cls, children });
690
+ }
691
+ const props = { className: cls };
692
+ if (typeof tabIndex === "number") props.tabIndex = tabIndex;
693
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, children });
694
+ };
695
+ const Title$1 = ({ as = "div", className, children }) => {
696
+ let cls = "collapse-title";
697
+ if (className) cls += ` ${className}`;
698
+ if (as === "summary") return /* @__PURE__ */ jsxRuntime.jsx("summary", { className: cls, children });
699
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
700
+ };
701
+ const Content = ({ className, children }) => {
702
+ let cls = "collapse-content";
703
+ if (className) cls += ` ${className}`;
704
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
705
+ };
706
+ const CollapseCompound = Object.assign(Collapse, {
707
+ Title: Title$1,
708
+ Content
709
+ });
710
+
711
+ const Countdown = ({ className, children, items }) => {
712
+ let cls = "countdown";
713
+ if (className) cls += ` ${className}`;
714
+ if (items && items.length) {
715
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cls, children: items.map((it, i) => {
716
+ if ("value" in it) {
717
+ const { value, digits, className: vCls, ariaLive, ariaLabel, children: children2 } = it;
718
+ return /* @__PURE__ */ jsxRuntime.jsx(
719
+ Value,
720
+ {
721
+ value,
722
+ digits,
723
+ className: vCls,
724
+ ariaLive,
725
+ ariaLabel,
726
+ children: children2
727
+ },
728
+ i
729
+ );
730
+ }
731
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: it.className, children: it.content }, i);
732
+ }) });
733
+ }
734
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cls, children });
735
+ };
736
+ const Value = ({
737
+ value,
738
+ digits,
739
+ className,
740
+ ariaLive = "polite",
741
+ ariaLabel,
742
+ children
743
+ }) => {
744
+ const styleAttr = `--value:${value};${digits != null ? ` --digits:${digits};` : ""}`;
745
+ let cls = "";
746
+ if (className) cls += ` ${className}`;
747
+ return /* @__PURE__ */ jsxRuntime.jsx(
748
+ "span",
749
+ {
750
+ style: styleAttr,
751
+ "aria-live": ariaLive,
752
+ "aria-label": ariaLabel ?? String(value),
753
+ className: cls.trim(),
754
+ children: children != null ? children : runtime.h("div", null, String(value))
755
+ }
756
+ );
757
+ };
758
+ const CountdownCompound = Object.assign(Countdown, {
759
+ Value
760
+ });
761
+
762
+ const HoverGallery = ({ as = "figure", className, children, items }) => {
763
+ let cls = "hover-gallery";
764
+ if (className) cls += ` ${className}`;
765
+ const content = items && items.length ? items.map((it, i) => {
766
+ if (typeof it === "string") {
767
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { src: it, alt: "" }, i);
768
+ }
769
+ if (it && typeof it === "object") {
770
+ const obj = it;
771
+ if (obj.node) return obj.node;
772
+ if (obj.src)
773
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { src: obj.src, alt: obj.alt ?? "", className: obj.className }, i);
774
+ }
775
+ return it;
776
+ }) : children;
777
+ return as === "figure" ? /* @__PURE__ */ jsxRuntime.jsx("figure", { className: cls, children: content }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children: content });
778
+ };
779
+
780
+ const Kbd = ({ size, className, children }) => {
781
+ let cls = "kbd";
782
+ if (size) cls += ` kbd-${size}`;
783
+ if (className) cls += ` ${className}`;
784
+ return /* @__PURE__ */ jsxRuntime.jsx("kbd", { className: cls, children });
785
+ };
786
+
787
+ const List = ({ className, children, items }) => {
788
+ let cls = "list";
789
+ if (className) cls += ` ${className}`;
790
+ if (items && items.length) {
791
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cls, children: items.map((m, i) => {
792
+ const t = m.type ?? (m.cols ? "row" : "item");
793
+ if (t === "item") {
794
+ const liCls2 = m.className ? `${m.className}` : "";
795
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { className: liCls2 || void 0, children: m.content }, i);
796
+ }
797
+ if (m.normal) {
798
+ const liCls2 = m.className ? `${m.className}` : "";
799
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: liCls2 || void 0, children: [
800
+ m.content,
801
+ m.cols?.map((c, ci) => {
802
+ if (c.type === "grow")
803
+ return /* @__PURE__ */ jsxRuntime.jsx(ColGrow, { as: c.as, className: c.className, children: c.content }, ci);
804
+ return /* @__PURE__ */ jsxRuntime.jsx(ColWrap, { as: c.as, className: c.className, children: c.content }, ci);
805
+ })
806
+ ] }, i);
807
+ }
808
+ let liCls = "list-row";
809
+ if (m.className) liCls += ` ${m.className}`;
810
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: liCls, children: [
811
+ m.content,
812
+ m.cols?.map((c, ci) => {
813
+ if (c.type === "grow")
814
+ return /* @__PURE__ */ jsxRuntime.jsx(ColGrow, { as: c.as, className: c.className, children: c.content }, ci);
815
+ return /* @__PURE__ */ jsxRuntime.jsx(ColWrap, { as: c.as, className: c.className, children: c.content }, ci);
816
+ })
817
+ ] }, i);
818
+ }) });
819
+ }
820
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cls, children });
821
+ };
822
+ const Row = ({ normal, className, children }) => {
823
+ if (normal) {
824
+ const cls2 = className ? `${className}` : "";
825
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { className: cls2 || void 0, children });
826
+ }
827
+ let cls = "list-row";
828
+ if (className) cls += ` ${className}`;
829
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { className: cls, children });
830
+ };
831
+ const ColGrow = ({ as = "div", className, children }) => {
832
+ let cls = "list-col-grow";
833
+ if (className) cls += ` ${className}`;
834
+ if (as === "p") return /* @__PURE__ */ jsxRuntime.jsx("p", { className: cls, children });
835
+ if (as === "span") return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cls, children });
836
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
837
+ };
838
+ const ColWrap = ({ as = "div", className, children }) => {
839
+ let cls = "list-col-wrap";
840
+ if (className) cls += ` ${className}`;
841
+ if (as === "p") return /* @__PURE__ */ jsxRuntime.jsx("p", { className: cls, children });
842
+ if (as === "span") return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cls, children });
843
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
844
+ };
845
+ const Item$3 = ({ className, children }) => {
846
+ let cls = "";
847
+ if (className) cls += ` ${className}`;
848
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { className: cls.trim(), children });
849
+ };
850
+ const ListCompound = Object.assign(List, {
851
+ Row,
852
+ ColGrow,
853
+ ColWrap,
854
+ Item: Item$3
855
+ });
856
+
857
+ const getVal = (record, dataIndex) => {
858
+ if (!dataIndex) return void 0;
859
+ if (Array.isArray(dataIndex)) {
860
+ let cur = record;
861
+ for (const k of dataIndex) {
862
+ if (cur == null) return void 0;
863
+ cur = cur[k];
864
+ }
865
+ return cur;
866
+ }
867
+ return record?.[dataIndex];
868
+ };
869
+ const alignClass = (align) => {
870
+ if (align === "right") return "text-right";
871
+ if (align === "center") return "text-center";
872
+ return "text-left";
873
+ };
874
+ const Table = ({
875
+ size,
876
+ zebra,
877
+ pinRows,
878
+ pinCols,
879
+ className,
880
+ children,
881
+ dataSource,
882
+ columns,
883
+ rowKey = "key",
884
+ showHeader = true,
885
+ onRow,
886
+ onHeaderRow,
887
+ onChange,
888
+ rowSelection,
889
+ pagination,
890
+ expandable,
891
+ rowClassName,
892
+ summary,
893
+ emptyText,
894
+ title,
895
+ footer,
896
+ rowHoverable = false,
897
+ rowHoverClass,
898
+ tableLayout,
899
+ scroll,
900
+ height,
901
+ onScroll
902
+ }) => {
903
+ let cls = "table";
904
+ if (size) cls += ` table-${size}`;
905
+ if (zebra) cls += ` table-zebra`;
906
+ if (pinRows) cls += ` table-pin-rows`;
907
+ if (pinCols) cls += ` table-pin-cols`;
908
+ if (className) cls += ` ${className}`;
909
+ const hasChildren = !(children === void 0 || children === null || Array.isArray(children) && children.length === 0);
910
+ if (hasChildren) return /* @__PURE__ */ jsxRuntime.jsx("table", { className: cls, children });
911
+ if (Array.isArray(columns) && Array.isArray(dataSource)) {
912
+ const tableId = Math.random().toString(36).slice(2);
913
+ const headerProps = onHeaderRow ? onHeaderRow(columns, 0) || {} : {};
914
+ const visibleColumns = columns.filter((col) => !col.hidden);
915
+ let sortColIndex = null;
916
+ let sortOrder = null;
917
+ visibleColumns.forEach((col, i) => {
918
+ if (col.sortOrder != null) {
919
+ sortColIndex = i;
920
+ sortOrder = col.sortOrder;
921
+ } else if (sortColIndex == null && col.defaultSortOrder) {
922
+ sortColIndex = i;
923
+ sortOrder = col.defaultSortOrder;
924
+ }
925
+ });
926
+ let workingData = dataSource.slice();
927
+ const activeFilters = {};
928
+ const getColKey = (col) => typeof col.dataIndex === "string" ? col.dataIndex : Array.isArray(col.dataIndex) ? col.dataIndex.join(".") : col.key;
929
+ visibleColumns.forEach((col) => {
930
+ const vals = col.filteredValue ?? col.defaultFilteredValue;
931
+ if (Array.isArray(vals) && vals.length > 0) {
932
+ const key = getColKey(col);
933
+ if (key) activeFilters[key] = vals;
934
+ workingData = workingData.filter((rec) => {
935
+ if (col.onFilter) {
936
+ if (col.filterCombine === "and") {
937
+ return vals.every((v) => col.onFilter(v, rec));
938
+ }
939
+ return vals.some((v) => col.onFilter(v, rec));
940
+ }
941
+ const rv = getVal(rec, col.dataIndex);
942
+ return vals.includes(rv);
943
+ });
944
+ }
945
+ });
946
+ if (sortColIndex != null && sortOrder && visibleColumns[sortColIndex]) {
947
+ const col = visibleColumns[sortColIndex];
948
+ const cmp = typeof col.sorter === "function" ? col.sorter : (a, b) => {
949
+ const va = getVal(a, col.dataIndex);
950
+ const vb = getVal(b, col.dataIndex);
951
+ if (va == null && vb == null) return 0;
952
+ if (va == null) return -1;
953
+ if (vb == null) return 1;
954
+ if (va > vb) return 1;
955
+ if (va < vb) return -1;
956
+ return 0;
957
+ };
958
+ workingData.sort((a, b) => sortOrder === "ascend" ? cmp(a, b) : -cmp(a, b));
959
+ }
960
+ let page = 1;
961
+ let pageSize = workingData.length;
962
+ if (pagination !== false && pagination != null) {
963
+ page = pagination.current || 1;
964
+ pageSize = pagination.pageSize || 10;
965
+ }
966
+ const total = workingData.length;
967
+ const pageCount = Math.ceil(total / pageSize) || 1;
968
+ const start = (page - 1) * pageSize;
969
+ const end = start + pageSize;
970
+ const pageData = workingData.slice(start, end);
971
+ const hasSelection = !!rowSelection;
972
+ const hasExpand = !!expandable && typeof expandable.expandedRowRender === "function";
973
+ const expKeys = new Set(
974
+ expandable?.expandedRowKeys || (expandable?.defaultExpandAllRows ? workingData.map((rec) => typeof rowKey === "function" ? rowKey(rec) : rec?.[rowKey]) : [])
975
+ );
976
+ const selectedBase = rowSelection?.selectedRowKeys ?? rowSelection?.defaultSelectedRowKeys ?? [];
977
+ const isSelected = (key) => Array.isArray(selectedBase) && selectedBase.includes(key);
978
+ const onHeaderSortClick = (i) => {
979
+ const col = visibleColumns[i];
980
+ if (!col.sorter) return;
981
+ let next = "ascend";
982
+ if (sortColIndex === i && sortOrder === "ascend") next = "descend";
983
+ else if (sortColIndex === i && sortOrder === "descend") next = null;
984
+ if (onChange)
985
+ onChange(
986
+ { current: page, pageSize },
987
+ activeFilters,
988
+ { column: col, order: next },
989
+ { action: "sort", currentDataSource: pageData }
990
+ );
991
+ };
992
+ const onPageChange = (p) => {
993
+ if (pagination !== false && pagination != null && pagination.onChange)
994
+ pagination.onChange(p, pageSize);
995
+ if (onChange)
996
+ onChange(
997
+ { current: p, pageSize },
998
+ activeFilters,
999
+ { order: sortOrder, column: sortColIndex != null ? visibleColumns[sortColIndex] : null },
1000
+ { action: "paginate", currentDataSource: pageData }
1001
+ );
1002
+ };
1003
+ const onHeaderSetSort = (i, order) => {
1004
+ const col = visibleColumns[i];
1005
+ if (!col.sorter) return;
1006
+ if (onChange)
1007
+ onChange(
1008
+ { current: page, pageSize },
1009
+ activeFilters,
1010
+ { column: col, order },
1011
+ { action: "sort", currentDataSource: pageData }
1012
+ );
1013
+ };
1014
+ const resetHeaderFilterMenu = (i, menuEl) => {
1015
+ const col = visibleColumns[i];
1016
+ const el = menuEl || document.getElementById(`table-filter-menu-${i}`);
1017
+ if (!col || !el) return;
1018
+ const defaults = col.filterResetToDefaultFilteredValue ? col.defaultFilteredValue ?? [] : [];
1019
+ const inputs = el.querySelectorAll(
1020
+ 'input[type="checkbox"], input[type="radio"]'
1021
+ );
1022
+ inputs.forEach((inp) => {
1023
+ const v = inp.getAttribute("data-value") || inp.value;
1024
+ if (inp.type === "checkbox") {
1025
+ inp.checked = defaults.includes(v);
1026
+ } else {
1027
+ inp.checked = defaults[0] === v;
1028
+ }
1029
+ });
1030
+ };
1031
+ const ensureOutsideCloseRegistered = (id) => {
1032
+ const g = globalThis;
1033
+ const key = `__rue_table_outside_close_${id}`;
1034
+ if (g[key]) return;
1035
+ const handler = (e) => {
1036
+ const target = e.target;
1037
+ const withinIcon = target.closest(`[data-rue-table-id="${id}"] .rue-table-filter-icon`);
1038
+ const withinMenu = target.closest(`[data-rue-table-id="${id}"] .rue-table-filter-menu`);
1039
+ if (!withinIcon && !withinMenu) {
1040
+ const tableEl = document.querySelector(
1041
+ `table[data-rue-table-id="${id}"]`
1042
+ );
1043
+ if (!tableEl) return;
1044
+ const menus = tableEl.querySelectorAll(".rue-table-filter-menu");
1045
+ menus.forEach((m) => m.style.display = "none");
1046
+ }
1047
+ };
1048
+ if (g && g.addEventListener) g.addEventListener("pointerdown", handler);
1049
+ g[key] = handler;
1050
+ };
1051
+ ensureOutsideCloseRegistered(tableId);
1052
+ const toggleHeaderFilterMenu = (i, open, anchor) => {
1053
+ let el = null;
1054
+ if (anchor) {
1055
+ const cell = anchor.closest("th, td");
1056
+ el = cell ? cell.querySelector(".rue-table-filter-menu") : null;
1057
+ }
1058
+ if (!el) el = document.getElementById(`table-filter-menu-${i}`);
1059
+ if (!el) return;
1060
+ const hidden = el.style.display === "none";
1061
+ const shouldOpen = open != null ? open : hidden;
1062
+ if (!shouldOpen) {
1063
+ el.style.display = "none";
1064
+ return;
1065
+ }
1066
+ el.style.position = "fixed";
1067
+ el.style.visibility = "hidden";
1068
+ el.style.display = "";
1069
+ const anchorEl = anchor || el;
1070
+ const rect = anchorEl.getBoundingClientRect();
1071
+ const menuW = el.offsetWidth || 176;
1072
+ const menuH = el.offsetHeight || 160;
1073
+ const gap = 8;
1074
+ const vw = window.innerWidth;
1075
+ const vh = window.innerHeight;
1076
+ let top = rect.bottom + gap;
1077
+ let left = rect.left;
1078
+ if (vh - rect.bottom < menuH + gap) top = Math.max(8, rect.top - menuH - gap);
1079
+ if (vw - rect.left < menuW + 8) left = Math.max(8, rect.right - menuW);
1080
+ el.style.visibility = "";
1081
+ el.style.top = `${top}px`;
1082
+ el.style.left = `${left}px`;
1083
+ el.style.maxHeight = "calc(100vh - 16px)";
1084
+ el.style.overflow = "auto";
1085
+ el.style.zIndex = "50";
1086
+ };
1087
+ const collectHeaderFilterValues = (i, menuEl) => {
1088
+ const el = menuEl || document.getElementById(`table-filter-menu-${i}`);
1089
+ if (!el) return [];
1090
+ const inputs = el.querySelectorAll(
1091
+ 'input[type="checkbox"], input[type="radio"]'
1092
+ );
1093
+ const vals = [];
1094
+ inputs.forEach((inp) => {
1095
+ const v = inp.getAttribute("data-value") || inp.value;
1096
+ if (inp.checked) vals.push(v);
1097
+ });
1098
+ return vals;
1099
+ };
1100
+ const onHeaderFilterApply = (i, vals, menuEl) => {
1101
+ const col = visibleColumns[i];
1102
+ if (!col || !Array.isArray(col.filters) || col.filters.length === 0) return;
1103
+ const key = getColKey(col);
1104
+ const cur = Array.isArray(vals) ? vals : collectHeaderFilterValues(i, menuEl);
1105
+ const nextFilters = { ...activeFilters };
1106
+ if (key) nextFilters[key] = cur;
1107
+ if (onChange)
1108
+ onChange(
1109
+ { current: page, pageSize },
1110
+ nextFilters,
1111
+ { order: sortOrder, column: sortColIndex != null ? visibleColumns[sortColIndex] : null },
1112
+ { action: "filter", currentDataSource: pageData }
1113
+ );
1114
+ toggleHeaderFilterMenu(i, false, menuEl || void 0);
1115
+ };
1116
+ const toggleExpand = (key, record, e) => {
1117
+ const btnEl = e?.currentTarget;
1118
+ const rowEl = btnEl ? btnEl.closest("tr") : null;
1119
+ const expRow = rowEl?.nextElementSibling;
1120
+ if (expRow) {
1121
+ const hidden = expRow.style.display === "none";
1122
+ expRow.style.display = hidden ? "" : "none";
1123
+ if (btnEl) btnEl.textContent = hidden ? "-" : "+";
1124
+ }
1125
+ const has = expKeys.has(key);
1126
+ if (expandable?.onExpand) expandable.onExpand(!has, record);
1127
+ };
1128
+ const selectAll = (checked) => {
1129
+ if (!rowSelection || rowSelection.type === "radio") return;
1130
+ const keys = checked ? pageData.map((rec) => typeof rowKey === "function" ? rowKey(rec) : rec?.[rowKey]) : [];
1131
+ if (rowSelection.onChange) {
1132
+ const rows = workingData.filter(
1133
+ (rec) => keys.includes(typeof rowKey === "function" ? rowKey(rec) : rec?.[rowKey])
1134
+ );
1135
+ rowSelection.onChange(keys, rows, { type: "checkbox" });
1136
+ }
1137
+ if (rowSelection.onSelectAll) {
1138
+ const rows = workingData.filter(
1139
+ (rec) => keys.includes(typeof rowKey === "function" ? rowKey(rec) : rec?.[rowKey])
1140
+ );
1141
+ rowSelection.onSelectAll(checked, rows);
1142
+ }
1143
+ };
1144
+ const pageKeys = pageData.map(
1145
+ (rec) => typeof rowKey === "function" ? rowKey(rec) : rec?.[rowKey]
1146
+ );
1147
+ const allSelectedOnPage = pageKeys.length > 0 && pageKeys.every((k) => isSelected(k));
1148
+ const someSelectedOnPage = pageKeys.some((k) => isSelected(k)) && !allSelectedOnPage;
1149
+ const tableStyle = {};
1150
+ const needFixedLayout = visibleColumns.some((c) => !!c.ellipsis);
1151
+ if (tableLayout) tableStyle.tableLayout = tableLayout;
1152
+ else if (needFixedLayout) tableStyle.tableLayout = "fixed";
1153
+ const wrapperNeeded = !!(scroll?.x || scroll?.y || typeof height !== "undefined" || onScroll);
1154
+ const wrapperStyle = {};
1155
+ const wrapperCls = `${scroll?.x ? "overflow-x-auto" : ""} ${scroll?.y || typeof height !== "undefined" ? "overflow-y-auto" : ""}`.trim() || void 0;
1156
+ if (typeof scroll?.y !== "undefined") {
1157
+ const maxH = typeof scroll.y === "number" ? `${scroll.y}px` : scroll.y;
1158
+ wrapperStyle.maxHeight = maxH;
1159
+ }
1160
+ if (typeof height !== "undefined") {
1161
+ const h = typeof height === "number" ? `${height}px` : height;
1162
+ wrapperStyle.height = h;
1163
+ }
1164
+ return wrapperNeeded ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperCls, style: wrapperStyle, onScroll, children: [
1165
+ typeof title === "function" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2", children: title(pageData) }) : null,
1166
+ /* @__PURE__ */ jsxRuntime.jsxs("table", { className: cls, style: tableStyle, "data-rue-table-id": tableId, children: [
1167
+ showHeader ? /* @__PURE__ */ jsxRuntime.jsx("thead", { ...headerProps, children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1168
+ hasExpand ? /* @__PURE__ */ jsxRuntime.jsx("th", { className: alignClass("center") }) : null,
1169
+ hasSelection ? /* @__PURE__ */ jsxRuntime.jsx(
1170
+ "th",
1171
+ {
1172
+ style: rowSelection?.columnWidth ? { width: rowSelection.columnWidth } : void 0,
1173
+ className: alignClass("center"),
1174
+ children: rowSelection?.type !== "radio" ? /* @__PURE__ */ jsxRuntime.jsx("label", { children: /* @__PURE__ */ jsxRuntime.jsx(
1175
+ "input",
1176
+ {
1177
+ type: "checkbox",
1178
+ className: "checkbox",
1179
+ checked: allSelectedOnPage,
1180
+ "aria-checked": someSelectedOnPage ? "mixed" : allSelectedOnPage ? "true" : "false",
1181
+ disabled: !!rowSelection?.disabled,
1182
+ onChange: (e) => selectAll(e.target.checked)
1183
+ }
1184
+ ) }) : null
1185
+ }
1186
+ ) : null,
1187
+ visibleColumns.map((col, i) => {
1188
+ const cellProps = col.onHeaderCell ? col.onHeaderCell(col, i) || {} : {};
1189
+ const keyVal = col.key ?? col.dataIndex ?? i;
1190
+ const className2 = `${alignClass(col.align)}${col.className ? ` ${col.className}` : ""}${cellProps.className ? ` ${cellProps.className}` : ""}`.trim() || void 0;
1191
+ const style = col.width ? { width: col.width } : cellProps.style;
1192
+ if (pinCols && !col.fixedCol) {
1193
+ return /* @__PURE__ */ jsxRuntime.jsx(
1194
+ "td",
1195
+ {
1196
+ className: className2,
1197
+ style,
1198
+ onClick: () => onHeaderSortClick(i),
1199
+ ...cellProps,
1200
+ children: col.title
1201
+ },
1202
+ keyVal
1203
+ );
1204
+ }
1205
+ return /* @__PURE__ */ jsxRuntime.jsx(
1206
+ "th",
1207
+ {
1208
+ className: className2,
1209
+ style,
1210
+ onClick: () => onHeaderSortClick(i),
1211
+ ...cellProps,
1212
+ children: col.title
1213
+ },
1214
+ keyVal
1215
+ );
1216
+ })
1217
+ ] }) }) : null,
1218
+ /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
1219
+ pageData.map((record, rowIndex) => {
1220
+ const key = typeof rowKey === "function" ? rowKey(record) : record?.[rowKey];
1221
+ const rowProps = onRow ? onRow(record, rowIndex) || {} : {};
1222
+ const baseCls = typeof rowClassName === "function" ? rowClassName(record, rowIndex) : "";
1223
+ const hoverCls = rowHoverable ? rowHoverClass || "hover:bg-base-200" : "";
1224
+ const rowCls = `${baseCls}${hoverCls ? ` ${hoverCls}` : ""}`.trim() || void 0;
1225
+ const colSpan = (visibleColumns.length || 0) + (hasSelection ? 1 : 0) + (hasExpand ? 1 : 0);
1226
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1227
+ /* @__PURE__ */ jsxRuntime.jsxs(
1228
+ "tr",
1229
+ {
1230
+ ...rowProps,
1231
+ className: rowCls || rowProps.className,
1232
+ children: [
1233
+ hasExpand ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: alignClass("center"), children: /* @__PURE__ */ jsxRuntime.jsx(
1234
+ "button",
1235
+ {
1236
+ className: "btn btn-ghost btn-xs",
1237
+ onClick: (e) => toggleExpand(key, record, e),
1238
+ children: expKeys.has(key) ? "-" : "+"
1239
+ }
1240
+ ) }) : null,
1241
+ hasSelection ? /* @__PURE__ */ jsxRuntime.jsx(
1242
+ "td",
1243
+ {
1244
+ className: alignClass("center"),
1245
+ style: rowSelection?.columnWidth ? { width: rowSelection.columnWidth } : void 0,
1246
+ children: /* @__PURE__ */ jsxRuntime.jsx("label", { children: rowSelection?.type === "radio" ? /* @__PURE__ */ jsxRuntime.jsx(
1247
+ "input",
1248
+ {
1249
+ type: "radio",
1250
+ className: "radio",
1251
+ checked: !!isSelected(key),
1252
+ onChange: () => {
1253
+ const keys = [key];
1254
+ if (rowSelection?.onChange) {
1255
+ const rows = workingData.filter(
1256
+ (rec) => keys.includes(
1257
+ typeof rowKey === "function" ? rowKey(rec) : rec?.[rowKey]
1258
+ )
1259
+ );
1260
+ rowSelection.onChange(keys, rows, { type: "radio" });
1261
+ }
1262
+ },
1263
+ ...rowSelection?.getCheckboxProps ? rowSelection.getCheckboxProps(record) : {}
1264
+ }
1265
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1266
+ "input",
1267
+ {
1268
+ type: "checkbox",
1269
+ className: "checkbox",
1270
+ checked: !!isSelected(key),
1271
+ onChange: (e) => {
1272
+ const checked = e.target.checked;
1273
+ const base = rowSelection?.selectedRowKeys ?? rowSelection?.defaultSelectedRowKeys ?? [];
1274
+ const set = new Set(base);
1275
+ if (checked) set.add(key);
1276
+ else set.delete(key);
1277
+ const keys = Array.from(set);
1278
+ if (rowSelection?.onChange) {
1279
+ const rows = workingData.filter(
1280
+ (rec) => keys.includes(
1281
+ typeof rowKey === "function" ? rowKey(rec) : rec?.[rowKey]
1282
+ )
1283
+ );
1284
+ rowSelection.onChange(keys, rows, { type: "checkbox" });
1285
+ }
1286
+ },
1287
+ ...rowSelection?.getCheckboxProps ? rowSelection.getCheckboxProps(record) : {}
1288
+ }
1289
+ ) })
1290
+ }
1291
+ ) : null,
1292
+ visibleColumns.map((col, colIndex) => {
1293
+ const val = getVal(record, col.dataIndex);
1294
+ const node = col.render ? col.render(val, record, rowIndex) : val;
1295
+ const cellCls = `${alignClass(col.align)}${col.className ? ` ${col.className}` : ""}${col.ellipsis ? " truncate" : ""}`;
1296
+ const cellProps = col.onCell ? col.onCell(record, rowIndex) || {} : {};
1297
+ const keyVal = col.key ?? `${rowIndex}-${colIndex}`;
1298
+ const className2 = `${cellCls}${cellProps.className ? ` ${cellProps.className}` : ""}`.trim() || void 0;
1299
+ const style = col.width ? { width: col.width } : cellProps.style;
1300
+ if (pinCols && col.fixedCol) {
1301
+ return /* @__PURE__ */ jsxRuntime.jsx("th", { className: className2, style, ...cellProps, children: node }, keyVal);
1302
+ }
1303
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { className: className2, style, ...cellProps, children: node }, keyVal);
1304
+ })
1305
+ ]
1306
+ },
1307
+ key ?? rowIndex
1308
+ ),
1309
+ hasExpand && expandable?.expandedRowRender ? /* @__PURE__ */ jsxRuntime.jsx("tr", { style: { display: expKeys.has(key) ? "" : "none" }, children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, children: expandable.expandedRowRender(record, rowIndex) }) }, `expanded-${key}`) : null
1310
+ ] });
1311
+ }),
1312
+ pageData.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
1313
+ "td",
1314
+ {
1315
+ colSpan: (visibleColumns.length || 0) + (hasSelection ? 1 : 0) + (hasExpand ? 1 : 0),
1316
+ className: alignClass("center"),
1317
+ children: typeof emptyText !== "undefined" ? emptyText : "No Data"
1318
+ }
1319
+ ) }) : null
1320
+ ] }),
1321
+ (() => {
1322
+ const colSpan = (visibleColumns.length || 0) + (hasSelection ? 1 : 0) + (hasExpand ? 1 : 0);
1323
+ const summaryInfo = { total, page, pageSize };
1324
+ const pageDataWithTotal = pageData.slice();
1325
+ pageDataWithTotal.total = total;
1326
+ const summaryNode = typeof summary === "function" ? summary(pageDataWithTotal, summaryInfo) : null;
1327
+ const showPager = pagination !== false && pagination != null && !(pagination.hideOnSinglePage && pageCount <= 1);
1328
+ if (!summaryNode && !showPager) return null;
1329
+ return /* @__PURE__ */ jsxRuntime.jsxs("tfoot", { children: [
1330
+ summaryNode ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, children: summaryNode }) }) : null,
1331
+ showPager ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-2 p-2", children: [
1332
+ /* @__PURE__ */ jsxRuntime.jsx(
1333
+ "button",
1334
+ {
1335
+ className: "btn btn-ghost btn-xs",
1336
+ disabled: page <= 1,
1337
+ onClick: () => onPageChange(page - 1),
1338
+ children: "Prev"
1339
+ }
1340
+ ),
1341
+ Array.from({ length: pageCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
1342
+ "button",
1343
+ {
1344
+ className: `btn btn-ghost btn-xs${page === i + 1 ? " btn-active" : ""}`,
1345
+ onClick: () => onPageChange(i + 1),
1346
+ children: i + 1
1347
+ },
1348
+ i
1349
+ )),
1350
+ /* @__PURE__ */ jsxRuntime.jsx(
1351
+ "button",
1352
+ {
1353
+ className: "btn btn-ghost btn-xs",
1354
+ disabled: page >= pageCount,
1355
+ onClick: () => onPageChange(page + 1),
1356
+ children: "Next"
1357
+ }
1358
+ )
1359
+ ] }) }) }) : null
1360
+ ] });
1361
+ })()
1362
+ ] }),
1363
+ typeof footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2", children: footer(pageData) }) : null
1364
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("table", { className: cls, style: tableStyle, "data-rue-table-id": tableId, children: [
1365
+ showHeader ? /* @__PURE__ */ jsxRuntime.jsx("thead", { ...headerProps, children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1366
+ hasExpand ? /* @__PURE__ */ jsxRuntime.jsx("th", { className: alignClass("center") }) : null,
1367
+ hasSelection ? /* @__PURE__ */ jsxRuntime.jsx(
1368
+ "th",
1369
+ {
1370
+ style: rowSelection?.columnWidth ? { width: rowSelection.columnWidth } : void 0,
1371
+ className: alignClass("center"),
1372
+ children: rowSelection?.type !== "radio" ? /* @__PURE__ */ jsxRuntime.jsx("label", { children: /* @__PURE__ */ jsxRuntime.jsx(
1373
+ "input",
1374
+ {
1375
+ type: "checkbox",
1376
+ className: "checkbox",
1377
+ checked: allSelectedOnPage,
1378
+ "aria-checked": someSelectedOnPage ? "mixed" : allSelectedOnPage ? "true" : "false",
1379
+ disabled: !!rowSelection?.disabled,
1380
+ onChange: (e) => selectAll(e.target.checked)
1381
+ }
1382
+ ) }) : null
1383
+ }
1384
+ ) : null,
1385
+ visibleColumns.map((col, i) => {
1386
+ const cellProps = col.onHeaderCell ? col.onHeaderCell(col, i) || {} : {};
1387
+ const keyVal = col.key ?? col.dataIndex ?? i;
1388
+ const className2 = `${alignClass(col.align)}${col.className ? ` ${col.className}` : ""}${cellProps.className ? ` ${cellProps.className}` : ""}`.trim() || void 0;
1389
+ const style = col.width ? { width: col.width } : cellProps.style;
1390
+ if (pinCols && !col.fixedCol) {
1391
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1392
+ "td",
1393
+ {
1394
+ className: className2,
1395
+ style,
1396
+ onClick: () => onHeaderSortClick(i),
1397
+ ...cellProps,
1398
+ children: [
1399
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center relative", children: [
1400
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: col.title }),
1401
+ col.sorter ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-1 inline-flex flex-col leading-none", children: [
1402
+ /* @__PURE__ */ jsxRuntime.jsx(
1403
+ "span",
1404
+ {
1405
+ className: `${sortColIndex === i && sortOrder === "ascend" ? "text-base-content" : "opacity-40"} cursor-pointer`,
1406
+ onClick: (e) => {
1407
+ e.stopPropagation();
1408
+ onHeaderSetSort(i, "ascend");
1409
+ },
1410
+ children: "\u25B2"
1411
+ }
1412
+ ),
1413
+ /* @__PURE__ */ jsxRuntime.jsx(
1414
+ "span",
1415
+ {
1416
+ className: `${sortColIndex === i && sortOrder === "descend" ? "text-base-content" : "opacity-40"} cursor-pointer -mt-0.5`,
1417
+ onClick: (e) => {
1418
+ e.stopPropagation();
1419
+ onHeaderSetSort(i, "descend");
1420
+ },
1421
+ children: "\u25BC"
1422
+ }
1423
+ )
1424
+ ] }) : null,
1425
+ Array.isArray(col.filters) && col.filters.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1426
+ "span",
1427
+ {
1428
+ className: `rue-table-filter-icon ml-2 cursor-pointer ${activeFilters[getColKey(col)]?.length ? "text-base-content" : "opacity-40"}`,
1429
+ onClick: (e) => {
1430
+ e.stopPropagation();
1431
+ toggleHeaderFilterMenu(i, void 0, e.currentTarget);
1432
+ },
1433
+ children: "\u2630"
1434
+ }
1435
+ ) : null
1436
+ ] }),
1437
+ Array.isArray(col.filters) && col.filters.length > 0 ? (() => {
1438
+ const menuGroup = `header-filter-${i}-${Math.random().toString(36).slice(2)}`;
1439
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1440
+ "div",
1441
+ {
1442
+ id: `table-filter-menu-${i}`,
1443
+ className: "rue-table-filter-menu fixed z-50 w-44 rounded-box border border-base-content/10 bg-base-100 p-2 shadow",
1444
+ style: { display: "none" },
1445
+ children: [
1446
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: col.filters.map((f) => /* @__PURE__ */ jsxRuntime.jsxs(
1447
+ "label",
1448
+ {
1449
+ className: "flex items-center gap-2",
1450
+ children: [
1451
+ /* @__PURE__ */ jsxRuntime.jsx(
1452
+ "input",
1453
+ {
1454
+ type: col.filterMultiple === false ? "radio" : "checkbox",
1455
+ name: menuGroup,
1456
+ className: col.filterMultiple === false ? "radio radio-xs" : "checkbox checkbox-xs",
1457
+ defaultChecked: (activeFilters[getColKey(col)] ?? col.defaultFilteredValue ?? []).includes(f.value),
1458
+ "data-value": String(f.value),
1459
+ onChange: (e) => {
1460
+ if (col.filterOnClose) return;
1461
+ const menuEl = e.currentTarget.closest(
1462
+ ".rue-table-filter-menu"
1463
+ );
1464
+ onHeaderFilterApply(i, void 0, menuEl || void 0);
1465
+ }
1466
+ }
1467
+ ),
1468
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: f.text })
1469
+ ]
1470
+ },
1471
+ f.value ?? String(f.text)
1472
+ )) }),
1473
+ col.filterOnClose ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 flex justify-end gap-2", children: [
1474
+ /* @__PURE__ */ jsxRuntime.jsx(
1475
+ "button",
1476
+ {
1477
+ className: "btn btn-ghost btn-xs",
1478
+ onClick: (e) => {
1479
+ const menuEl = e.currentTarget.closest(
1480
+ ".rue-table-filter-menu"
1481
+ );
1482
+ resetHeaderFilterMenu(i, menuEl || void 0);
1483
+ },
1484
+ children: "\u91CD\u7F6E"
1485
+ }
1486
+ ),
1487
+ /* @__PURE__ */ jsxRuntime.jsx(
1488
+ "button",
1489
+ {
1490
+ className: "btn btn-primary btn-xs",
1491
+ onClick: (e) => {
1492
+ const menuEl = e.currentTarget.closest(
1493
+ ".rue-table-filter-menu"
1494
+ );
1495
+ onHeaderFilterApply(i, void 0, menuEl || void 0);
1496
+ },
1497
+ children: "\u5E94\u7528"
1498
+ }
1499
+ )
1500
+ ] }) : null
1501
+ ]
1502
+ }
1503
+ );
1504
+ })() : null
1505
+ ]
1506
+ },
1507
+ keyVal
1508
+ );
1509
+ }
1510
+ return /* @__PURE__ */ jsxRuntime.jsx(
1511
+ "th",
1512
+ {
1513
+ className: className2,
1514
+ style,
1515
+ onClick: () => onHeaderSortClick(i),
1516
+ ...cellProps,
1517
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center relative", children: [
1518
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: col.title }),
1519
+ col.sorter ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-1 inline-flex flex-col leading-none", children: [
1520
+ /* @__PURE__ */ jsxRuntime.jsx(
1521
+ "span",
1522
+ {
1523
+ className: `${sortColIndex === i && sortOrder === "ascend" ? "text-base-content" : "opacity-40"} cursor-pointer`,
1524
+ onClick: (e) => {
1525
+ e.stopPropagation();
1526
+ onHeaderSetSort(i, "ascend");
1527
+ },
1528
+ children: "\u25B2"
1529
+ }
1530
+ ),
1531
+ /* @__PURE__ */ jsxRuntime.jsx(
1532
+ "span",
1533
+ {
1534
+ className: `${sortColIndex === i && sortOrder === "descend" ? "text-base-content" : "opacity-40"} cursor-pointer -mt-0.5`,
1535
+ onClick: (e) => {
1536
+ e.stopPropagation();
1537
+ onHeaderSetSort(i, "descend");
1538
+ },
1539
+ children: "\u25BC"
1540
+ }
1541
+ )
1542
+ ] }) : null,
1543
+ Array.isArray(col.filters) && col.filters.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1544
+ "span",
1545
+ {
1546
+ className: `rue-table-filter-icon ml-2 cursor-pointer ${activeFilters[getColKey(col)]?.length ? "text-base-content" : "opacity-40"}`,
1547
+ onClick: (e) => {
1548
+ e.stopPropagation();
1549
+ toggleHeaderFilterMenu(i, void 0, e.currentTarget);
1550
+ },
1551
+ children: "\u2630"
1552
+ }
1553
+ ) : null,
1554
+ Array.isArray(col.filters) && col.filters.length > 0 ? (() => {
1555
+ const menuGroup = `header-filter-${i}-${Math.random().toString(36).slice(2)}`;
1556
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1557
+ "div",
1558
+ {
1559
+ id: `table-filter-menu-${i}`,
1560
+ className: "rue-table-filter-menu fixed z-50 w-44 rounded-box border border-base-content/10 bg-base-100 p-2 shadow",
1561
+ style: { display: "none" },
1562
+ children: [
1563
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: col.filters.map((f) => /* @__PURE__ */ jsxRuntime.jsxs(
1564
+ "label",
1565
+ {
1566
+ className: "flex items-center gap-2",
1567
+ children: [
1568
+ /* @__PURE__ */ jsxRuntime.jsx(
1569
+ "input",
1570
+ {
1571
+ type: col.filterMultiple === false ? "radio" : "checkbox",
1572
+ name: menuGroup,
1573
+ className: col.filterMultiple === false ? "radio radio-xs" : "checkbox checkbox-xs",
1574
+ defaultChecked: (activeFilters[getColKey(col)] ?? col.defaultFilteredValue ?? []).includes(f.value),
1575
+ "data-value": String(f.value),
1576
+ onChange: (e) => {
1577
+ if (col.filterOnClose) return;
1578
+ const menuEl = e.currentTarget.closest(
1579
+ ".rue-table-filter-menu"
1580
+ );
1581
+ onHeaderFilterApply(i, void 0, menuEl || void 0);
1582
+ }
1583
+ }
1584
+ ),
1585
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: f.text })
1586
+ ]
1587
+ },
1588
+ f.value ?? String(f.text)
1589
+ )) }),
1590
+ col.filterOnClose ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 flex justify-end gap-2", children: [
1591
+ /* @__PURE__ */ jsxRuntime.jsx(
1592
+ "button",
1593
+ {
1594
+ className: "btn btn-ghost btn-xs",
1595
+ onClick: (e) => {
1596
+ const menuEl = e.currentTarget.closest(
1597
+ ".rue-table-filter-menu"
1598
+ );
1599
+ resetHeaderFilterMenu(i, menuEl || void 0);
1600
+ },
1601
+ children: "\u91CD\u7F6E"
1602
+ }
1603
+ ),
1604
+ /* @__PURE__ */ jsxRuntime.jsx(
1605
+ "button",
1606
+ {
1607
+ className: "btn btn-primary btn-xs",
1608
+ onClick: (e) => {
1609
+ const menuEl = e.currentTarget.closest(
1610
+ ".rue-table-filter-menu"
1611
+ );
1612
+ onHeaderFilterApply(i, void 0, menuEl || void 0);
1613
+ },
1614
+ children: "\u5E94\u7528"
1615
+ }
1616
+ )
1617
+ ] }) : null
1618
+ ]
1619
+ }
1620
+ );
1621
+ })() : null
1622
+ ] })
1623
+ },
1624
+ keyVal
1625
+ );
1626
+ })
1627
+ ] }) }) : null,
1628
+ /* @__PURE__ */ jsxRuntime.jsxs("tbody", { children: [
1629
+ pageData.map((record, rowIndex) => {
1630
+ const key = typeof rowKey === "function" ? rowKey(record) : record?.[rowKey];
1631
+ const rowProps = onRow ? onRow(record, rowIndex) || {} : {};
1632
+ const baseCls = typeof rowClassName === "function" ? rowClassName(record, rowIndex) : "";
1633
+ const hoverCls = rowHoverable ? rowHoverClass || "hover:bg-base-200" : "";
1634
+ const rowCls = `${baseCls}${hoverCls ? ` ${hoverCls}` : ""}`.trim() || void 0;
1635
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1636
+ /* @__PURE__ */ jsxRuntime.jsxs(
1637
+ "tr",
1638
+ {
1639
+ ...rowProps,
1640
+ className: rowCls || rowProps.className,
1641
+ children: [
1642
+ hasExpand ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: alignClass("center"), children: /* @__PURE__ */ jsxRuntime.jsx(
1643
+ "button",
1644
+ {
1645
+ className: "btn btn-ghost btn-xs",
1646
+ onClick: (e) => toggleExpand(key, record, e),
1647
+ children: expKeys.has(key) ? "-" : "+"
1648
+ }
1649
+ ) }) : null,
1650
+ hasSelection ? /* @__PURE__ */ jsxRuntime.jsx(
1651
+ "td",
1652
+ {
1653
+ className: alignClass("center"),
1654
+ style: rowSelection?.columnWidth ? { width: rowSelection.columnWidth } : void 0,
1655
+ children: /* @__PURE__ */ jsxRuntime.jsx("label", { children: (() => {
1656
+ const cbProps = rowSelection?.getCheckboxProps ? { ...rowSelection.getCheckboxProps(record) } : {};
1657
+ if (rowSelection?.disabled) cbProps.disabled = true;
1658
+ if (rowSelection?.type === "radio") {
1659
+ return /* @__PURE__ */ jsxRuntime.jsx(
1660
+ "input",
1661
+ {
1662
+ type: "radio",
1663
+ className: "radio",
1664
+ checked: !!isSelected(key),
1665
+ onChange: () => {
1666
+ const keys = [key];
1667
+ if (rowSelection?.onChange) {
1668
+ const rows = workingData.filter(
1669
+ (rec) => keys.includes(
1670
+ typeof rowKey === "function" ? rowKey(rec) : rec?.[rowKey]
1671
+ )
1672
+ );
1673
+ rowSelection.onChange(keys, rows, { type: "radio" });
1674
+ }
1675
+ },
1676
+ ...cbProps
1677
+ }
1678
+ );
1679
+ }
1680
+ return /* @__PURE__ */ jsxRuntime.jsx(
1681
+ "input",
1682
+ {
1683
+ type: "checkbox",
1684
+ className: "checkbox",
1685
+ checked: !!isSelected(key),
1686
+ onChange: (e) => {
1687
+ const checked = e.target.checked;
1688
+ const base = rowSelection?.selectedRowKeys ?? rowSelection?.defaultSelectedRowKeys ?? [];
1689
+ const set = new Set(base);
1690
+ if (checked) set.add(key);
1691
+ else set.delete(key);
1692
+ const keys = Array.from(set);
1693
+ if (rowSelection?.onChange) {
1694
+ const rows = workingData.filter(
1695
+ (rec) => keys.includes(
1696
+ typeof rowKey === "function" ? rowKey(rec) : rec?.[rowKey]
1697
+ )
1698
+ );
1699
+ rowSelection.onChange(keys, rows, { type: "checkbox" });
1700
+ }
1701
+ },
1702
+ ...cbProps
1703
+ }
1704
+ );
1705
+ })() })
1706
+ }
1707
+ ) : null,
1708
+ visibleColumns.map((col, colIndex) => {
1709
+ const val = getVal(record, col.dataIndex);
1710
+ const node = col.render ? col.render(val, record, rowIndex) : val;
1711
+ const cellCls = `${alignClass(col.align)}${col.className ? ` ${col.className}` : ""}${col.ellipsis ? " truncate" : ""}`;
1712
+ const cellProps = col.onCell ? col.onCell(record, rowIndex) || {} : {};
1713
+ const keyVal = col.key ?? `${rowIndex}-${colIndex}`;
1714
+ const className2 = `${cellCls}${cellProps.className ? ` ${cellProps.className}` : ""}`.trim() || void 0;
1715
+ const style = col.width ? { width: col.width } : cellProps.style;
1716
+ if (pinCols && col.fixedCol) {
1717
+ return /* @__PURE__ */ jsxRuntime.jsx("th", { className: className2, style, ...cellProps, children: node }, keyVal);
1718
+ }
1719
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { className: className2, style, ...cellProps, children: node }, keyVal);
1720
+ })
1721
+ ]
1722
+ },
1723
+ key ?? rowIndex
1724
+ ),
1725
+ hasExpand && expandable?.expandedRowRender ? /* @__PURE__ */ jsxRuntime.jsx("tr", { style: { display: expKeys.has(key) ? "" : "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(
1726
+ "td",
1727
+ {
1728
+ colSpan: (visibleColumns.length || 0) + (hasSelection ? 1 : 0) + (hasExpand ? 1 : 0),
1729
+ children: expandable.expandedRowRender(record, rowIndex)
1730
+ }
1731
+ ) }, `expanded-${key}`) : null
1732
+ ] });
1733
+ }),
1734
+ pageData.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx(
1735
+ "td",
1736
+ {
1737
+ colSpan: (visibleColumns.length || 0) + (hasSelection ? 1 : 0) + (hasExpand ? 1 : 0),
1738
+ className: alignClass("center"),
1739
+ children: typeof emptyText !== "undefined" ? emptyText : "No Data"
1740
+ }
1741
+ ) }) : null
1742
+ ] }),
1743
+ (() => {
1744
+ const colSpan = (visibleColumns.length || 0) + (hasSelection ? 1 : 0) + (hasExpand ? 1 : 0);
1745
+ const summaryInfo = { total, page, pageSize };
1746
+ const pageDataWithTotal = pageData.slice();
1747
+ pageDataWithTotal.total = total;
1748
+ const summaryNode = typeof summary === "function" ? summary(pageDataWithTotal, summaryInfo) : null;
1749
+ const showPager = pagination !== false && pagination != null && !(pagination.hideOnSinglePage && pageCount <= 1);
1750
+ if (!summaryNode && !showPager) return null;
1751
+ return /* @__PURE__ */ jsxRuntime.jsxs("tfoot", { children: [
1752
+ summaryNode ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, children: summaryNode }) }) : null,
1753
+ showPager ? /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-2 p-2", children: [
1754
+ /* @__PURE__ */ jsxRuntime.jsx(
1755
+ "button",
1756
+ {
1757
+ className: "btn btn-ghost btn-xs",
1758
+ disabled: page <= 1,
1759
+ onClick: () => onPageChange(page - 1),
1760
+ children: "Prev"
1761
+ }
1762
+ ),
1763
+ Array.from({ length: pageCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
1764
+ "button",
1765
+ {
1766
+ className: `btn btn-ghost btn-xs${page === i + 1 ? " btn-active" : ""}`,
1767
+ onClick: () => onPageChange(i + 1),
1768
+ children: i + 1
1769
+ },
1770
+ i
1771
+ )),
1772
+ /* @__PURE__ */ jsxRuntime.jsx(
1773
+ "button",
1774
+ {
1775
+ className: "btn btn-ghost btn-xs",
1776
+ disabled: page >= pageCount,
1777
+ onClick: () => onPageChange(page + 1),
1778
+ children: "Next"
1779
+ }
1780
+ )
1781
+ ] }) }) }) : null
1782
+ ] });
1783
+ })()
1784
+ ] });
1785
+ }
1786
+ return /* @__PURE__ */ jsxRuntime.jsx("table", { className: cls });
1787
+ };
1788
+ const Head = ({ className, children }) => {
1789
+ const cls = className ? className : void 0;
1790
+ return /* @__PURE__ */ jsxRuntime.jsx("thead", { className: cls, children });
1791
+ };
1792
+ const Body = ({ className, children }) => {
1793
+ const cls = className ? className : void 0;
1794
+ return /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: cls, children });
1795
+ };
1796
+ const Foot = ({ className, children }) => {
1797
+ const cls = className ? className : void 0;
1798
+ return /* @__PURE__ */ jsxRuntime.jsx("tfoot", { className: cls, children });
1799
+ };
1800
+ const TR = ({ className, children }) => {
1801
+ const cls = className ? className : void 0;
1802
+ return /* @__PURE__ */ jsxRuntime.jsx("tr", { className: cls, children });
1803
+ };
1804
+ const TH = ({ className, children }) => {
1805
+ let cls = "";
1806
+ if (className) cls += ` ${className}`;
1807
+ return /* @__PURE__ */ jsxRuntime.jsx("th", { className: cls.trim() || void 0, children });
1808
+ };
1809
+ const TD = ({ className, children }) => {
1810
+ let cls = "";
1811
+ if (className) cls += ` ${className}`;
1812
+ return /* @__PURE__ */ jsxRuntime.jsx("td", { className: cls.trim() || void 0, children });
1813
+ };
1814
+ const TableCompound = Object.assign(Table, {
1815
+ Head,
1816
+ Body,
1817
+ Foot,
1818
+ TR,
1819
+ TH,
1820
+ TD
1821
+ });
1822
+
1823
+ const Breadcrumbs = ({ className, children, items }) => {
1824
+ let cls = "breadcrumbs";
1825
+ if (className) cls += ` ${className}`;
1826
+ if (items && items.length) {
1827
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children: items.map((it, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: it.className ?? "", children: it.href ? /* @__PURE__ */ jsxRuntime.jsxs("a", { className: it.linkClassName ?? "", href: it.href, children: [
1828
+ it.icon ?? null,
1829
+ it.label
1830
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: it.linkClassName ?? "", children: [
1831
+ it.icon ?? null,
1832
+ it.label
1833
+ ] }) }, i)) }) });
1834
+ } else {
1835
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children: /* @__PURE__ */ jsxRuntime.jsx("ul", { children }) });
1836
+ }
1837
+ };
1838
+ const Item$2 = ({ className, children }) => {
1839
+ let cls = "";
1840
+ if (className) cls += ` ${className}`;
1841
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { className: cls.trim(), children });
1842
+ };
1843
+ const BreadcrumbsCompound = Object.assign(Breadcrumbs, {
1844
+ Item: Item$2
1845
+ });
1846
+
1847
+ const Dock = ({ size, className, items, activeIndex, onChange, children }) => {
1848
+ let cls = "dock";
1849
+ if (size) cls += ` dock-${size}`;
1850
+ if (className) cls += ` ${className}`;
1851
+ if (items && items.length) {
1852
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children: items.map((it, idx) => (
1853
+ /* 渲染单个停靠项,active 来源于 activeIndex 或自身 active */
1854
+ /* @__PURE__ */ jsxRuntime.jsxs(
1855
+ Item$1,
1856
+ {
1857
+ as: it.as,
1858
+ className: it.className,
1859
+ active: activeIndex != null ? activeIndex === idx : !!it.active,
1860
+ href: it.href,
1861
+ onClick: () => onChange && onChange(idx),
1862
+ children: [
1863
+ it.icon,
1864
+ it.label != null ? /* @__PURE__ */ jsxRuntime.jsx(Label, { children: it.label }) : null
1865
+ ]
1866
+ },
1867
+ idx
1868
+ )
1869
+ )) });
1870
+ }
1871
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, children });
1872
+ };
1873
+ const Item$1 = ({ as = "button", active, className, href, onClick, children }) => {
1874
+ let cls = "";
1875
+ if (active) cls += " dock-active";
1876
+ if (className) cls += ` ${className}`;
1877
+ const clsTrim = cls.trim();
1878
+ if (as === "a")
1879
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, className: clsTrim, onClick, children });
1880
+ if (as === "div")
1881
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsTrim, onClick, children });
1882
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { className: clsTrim, onClick, children });
1883
+ };
1884
+ const Label = ({ className, children }) => {
1885
+ let cls = "dock-label";
1886
+ if (className) cls += ` ${className}`;
1887
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cls, children });
1888
+ };
1889
+ const DockCompound = Object.assign(Dock, {
1890
+ Item: Item$1,
1891
+ Label
1892
+ });
1893
+
1894
+ const Link = ({
1895
+ href = "#",
1896
+ target,
1897
+ rel,
1898
+ to,
1899
+ onClick,
1900
+ variant,
1901
+ hover,
1902
+ className,
1903
+ children
1904
+ }) => {
1905
+ let cls = "link";
1906
+ if (variant) cls += ` link-${variant}`;
1907
+ if (hover) cls += ` link-hover`;
1908
+ if (className) cls += ` ${className}`;
1909
+ return to ? /* @__PURE__ */ jsxRuntime.jsx(router.RouterLink, { className: cls, to, onClick, children }) : /* @__PURE__ */ jsxRuntime.jsx("a", { className: cls, href, target, rel, onClick, children });
1910
+ };
1911
+
1912
+ const renderEntry = (m, idx) => {
1913
+ if (m.kind === "title") {
1914
+ return /* @__PURE__ */ jsxRuntime.jsx(Title, { as: m.as, className: m.className, children: m.children }, idx);
1915
+ }
1916
+ const innerClasses = [
1917
+ m.disabled ? "menu-disabled" : "",
1918
+ m.active ? "menu-active" : "",
1919
+ m.focus ? "menu-focus" : "",
1920
+ m.className ?? ""
1921
+ ].filter(Boolean).join(" ").trim();
1922
+ const liCls = m.liClassName ? m.liClassName : void 0;
1923
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: liCls, children: [
1924
+ m.as === "button" ? /* @__PURE__ */ jsxRuntime.jsx("button", { className: innerClasses || void 0, ...m, children: m.children }) : m.as === "span" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: innerClasses || void 0, ...m, children: m.children }) : m.to ? /* @__PURE__ */ jsxRuntime.jsx(router.RouterLink, { className: innerClasses || void 0, to: m.to, onClick: m.onClick, children: m.children }) : m.href ? /* @__PURE__ */ jsxRuntime.jsx(
1925
+ "a",
1926
+ {
1927
+ className: innerClasses || void 0,
1928
+ href: m.href,
1929
+ target: m.target,
1930
+ rel: m.rel,
1931
+ onClick: m.onClick,
1932
+ children: m.children
1933
+ }
1934
+ ) : /* @__PURE__ */ jsxRuntime.jsx("a", { className: innerClasses || void 0, onClick: m.onClick, children: m.children }),
1935
+ m.dropdownToggle ? /* @__PURE__ */ jsxRuntime.jsx(DropdownToggle, { visible: m.dropdownToggle.visible, className: m.dropdownToggle.className, children: m.dropdownToggle.children }) : null,
1936
+ m.dropdown ? /* @__PURE__ */ jsxRuntime.jsx(Dropdown, { visible: m.dropdown.visible, className: m.dropdown.className, children: m.dropdown.items?.map((child, i) => renderEntry(child, i)) }) : null,
1937
+ m.submenu ? /* @__PURE__ */ jsxRuntime.jsx(Submenu, { className: m.submenu.className, children: m.submenu.items?.map((child, i) => renderEntry(child, i)) }) : null
1938
+ ] }, idx);
1939
+ };
1940
+ const Menu = ({ size, direction = "vertical", className, children, items }) => {
1941
+ let cls = "menu";
1942
+ if (direction === "horizontal") cls += ` menu-horizontal`;
1943
+ else if (direction === "vertical") cls += ` menu-vertical`;
1944
+ if (size) cls += ` menu-${size}`;
1945
+ if (className) cls += ` ${className}`;
1946
+ if (items && items.length)
1947
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cls, children: items.map((m, i) => renderEntry(m, i)) });
1948
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cls, children });
1949
+ };
1950
+ const Item = ({
1951
+ as = "a",
1952
+ href,
1953
+ to,
1954
+ target,
1955
+ rel,
1956
+ onClick,
1957
+ disabled,
1958
+ active,
1959
+ focus,
1960
+ liClassName,
1961
+ className,
1962
+ children,
1963
+ ...rest
1964
+ }) => {
1965
+ const innerClasses = [
1966
+ disabled ? "menu-disabled" : "",
1967
+ active ? "menu-active" : "",
1968
+ focus ? "menu-focus" : "",
1969
+ className ?? ""
1970
+ ].filter(Boolean).join(" ").trim();
1971
+ const liCls = liClassName ? liClassName : void 0;
1972
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { className: liCls, children: as === "button" ? /* @__PURE__ */ jsxRuntime.jsx("button", { className: innerClasses || void 0, onClick, ...rest, children }) : as === "span" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: innerClasses || void 0, onClick, ...rest, children }) : to ? /* @__PURE__ */ jsxRuntime.jsx(router.RouterLink, { className: innerClasses || void 0, to, onClick, children }) : href ? /* @__PURE__ */ jsxRuntime.jsx(
1973
+ "a",
1974
+ {
1975
+ className: innerClasses || void 0,
1976
+ href,
1977
+ target,
1978
+ rel,
1979
+ onClick,
1980
+ ...rest,
1981
+ children
1982
+ }
1983
+ ) : /* @__PURE__ */ jsxRuntime.jsx("a", { className: innerClasses || void 0, onClick, ...rest, children }) });
1984
+ };
1985
+ const Title = ({ as = "li", className, children }) => {
1986
+ let cls = "menu-title";
1987
+ if (className) cls += ` ${className}`;
1988
+ if (as === "h2") return /* @__PURE__ */ jsxRuntime.jsx("h2", { className: cls, children });
1989
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { className: cls, children });
1990
+ };
1991
+ const Dropdown = ({ visible, className, children }) => {
1992
+ let cls = "menu-dropdown";
1993
+ if (visible) cls += ` menu-dropdown-visible`;
1994
+ if (className) cls += ` ${className}`;
1995
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cls, children });
1996
+ };
1997
+ const DropdownToggle = ({ visible, className, children }) => {
1998
+ let cls = "menu-dropdown-toggle";
1999
+ if (visible) cls += ` menu-dropdown-visible`;
2000
+ if (className) cls += ` ${className}`;
2001
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cls, children });
2002
+ };
2003
+ const Submenu = ({ className, children }) => {
2004
+ const cls = className ? className : void 0;
2005
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: cls, children });
2006
+ };
2007
+ const MenuCompound = Object.assign(Menu, {
2008
+ Item,
2009
+ Title,
2010
+ Dropdown,
2011
+ DropdownToggle,
2012
+ Submenu
2013
+ });
2014
+
2015
+ exports.Accordion = AccordionCompound;
2016
+ exports.Alert = Alert;
2017
+ exports.Avatar = AvatarCompound;
2018
+ exports.Badge = Badge;
2019
+ exports.Breadcrumbs = BreadcrumbsCompound;
2020
+ exports.Button = Button;
2021
+ exports.Card = CardCompound;
2022
+ exports.Carousel = CarouselCompound;
2023
+ exports.Chat = ChatCompound;
2024
+ exports.Collapse = CollapseCompound;
2025
+ exports.Countdown = CountdownCompound;
2026
+ exports.Diff = DiffCompound;
2027
+ exports.Divider = Divider;
2028
+ exports.Dock = DockCompound;
2029
+ exports.Footer = Footer$1;
2030
+ exports.Hover3D = Hover3D;
2031
+ exports.HoverGallery = HoverGallery;
2032
+ exports.Kbd = Kbd;
2033
+ exports.Link = Link;
2034
+ exports.List = ListCompound;
2035
+ exports.Menu = MenuCompound;
2036
+ exports.Modal = Modal;
2037
+ exports.Stat = StatCompound;
2038
+ exports.Status = Status;
2039
+ exports.Table = TableCompound;
2040
+ exports.Tabs = Tabs;
2041
+ exports.TextRotate = TextRotate;
2042
+ exports.Timeline = TimelineCompound;
2043
+
2044
+ return exports;
2045
+
2046
+ })({}, jsxRuntime, runtime, router);