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