@kb-labs/studio-ui-kit 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +270 -0
- package/dist/index.css +169 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +2249 -0
- package/dist/index.js +2029 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2029 @@
|
|
|
1
|
+
import { theme, Button, Typography, Form, Empty, Modal, message, notification, Space, Row, Col, Divider, Badge, Card, Tag, Avatar, Table, Statistic, Progress, Descriptions, Timeline, Tree, List, Input, Select, Checkbox, Switch, DatePicker, TimePicker, InputNumber, Radio, Upload, Slider, Breadcrumb, Collapse, Dropdown, Segmented, Steps, Menu, Alert, Skeleton, Spin, Result, Tooltip, Drawer, Popconfirm, Popover, Tabs } from 'antd';
|
|
2
|
+
import { typography, spacing } from '@kb-labs/studio-ui-core';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import * as React3 from 'react';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { Line, Column, Area, Pie, Bar } from '@ant-design/charts';
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
|
+
import { useSearchParams, useNavigate, useParams } from 'react-router-dom';
|
|
9
|
+
|
|
10
|
+
// src/primitives/UIText.tsx
|
|
11
|
+
var { useToken } = theme;
|
|
12
|
+
function UIText({
|
|
13
|
+
children,
|
|
14
|
+
size = "base",
|
|
15
|
+
weight = "normal",
|
|
16
|
+
color = "primary",
|
|
17
|
+
as: Component = "span",
|
|
18
|
+
className,
|
|
19
|
+
style: customStyle
|
|
20
|
+
}) {
|
|
21
|
+
const { token } = useToken();
|
|
22
|
+
const colorMap = {
|
|
23
|
+
primary: token.colorText,
|
|
24
|
+
secondary: token.colorTextSecondary,
|
|
25
|
+
success: token.colorSuccess,
|
|
26
|
+
warning: token.colorWarning,
|
|
27
|
+
error: token.colorError,
|
|
28
|
+
info: token.colorInfo
|
|
29
|
+
};
|
|
30
|
+
const baseStyle = {
|
|
31
|
+
fontSize: typography.fontSize[size][0],
|
|
32
|
+
lineHeight: typography.fontSize[size][1].lineHeight,
|
|
33
|
+
fontWeight: typography.fontWeight[weight],
|
|
34
|
+
color: colorMap[color]
|
|
35
|
+
};
|
|
36
|
+
const style = { ...baseStyle, ...customStyle };
|
|
37
|
+
return /* @__PURE__ */ jsx(Component, { style, className, children });
|
|
38
|
+
}
|
|
39
|
+
function UIBox({
|
|
40
|
+
children,
|
|
41
|
+
p,
|
|
42
|
+
pt,
|
|
43
|
+
pr,
|
|
44
|
+
pb,
|
|
45
|
+
pl,
|
|
46
|
+
m,
|
|
47
|
+
mt,
|
|
48
|
+
mr,
|
|
49
|
+
mb,
|
|
50
|
+
ml,
|
|
51
|
+
as: Component = "div",
|
|
52
|
+
className,
|
|
53
|
+
style: customStyle
|
|
54
|
+
}) {
|
|
55
|
+
const style = {
|
|
56
|
+
...p !== void 0 && { padding: spacing[p] },
|
|
57
|
+
...pt !== void 0 && { paddingTop: spacing[pt] },
|
|
58
|
+
...pr !== void 0 && { paddingRight: spacing[pr] },
|
|
59
|
+
...pb !== void 0 && { paddingBottom: spacing[pb] },
|
|
60
|
+
...pl !== void 0 && { paddingLeft: spacing[pl] },
|
|
61
|
+
...m !== void 0 && { margin: spacing[m] },
|
|
62
|
+
...mt !== void 0 && { marginTop: spacing[mt] },
|
|
63
|
+
...mr !== void 0 && { marginRight: spacing[mr] },
|
|
64
|
+
...mb !== void 0 && { marginBottom: spacing[mb] },
|
|
65
|
+
...ml !== void 0 && { marginLeft: spacing[ml] },
|
|
66
|
+
...customStyle
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ jsx(Component, { style, className, children });
|
|
69
|
+
}
|
|
70
|
+
function UIFlex({
|
|
71
|
+
children,
|
|
72
|
+
direction = "row",
|
|
73
|
+
justify = "start",
|
|
74
|
+
align = "stretch",
|
|
75
|
+
gap,
|
|
76
|
+
wrap = "nowrap",
|
|
77
|
+
as: Component = "div",
|
|
78
|
+
className,
|
|
79
|
+
style: customStyle
|
|
80
|
+
}) {
|
|
81
|
+
const justifyMap = {
|
|
82
|
+
start: "flex-start",
|
|
83
|
+
end: "flex-end",
|
|
84
|
+
center: "center",
|
|
85
|
+
between: "space-between",
|
|
86
|
+
around: "space-around",
|
|
87
|
+
evenly: "space-evenly"
|
|
88
|
+
};
|
|
89
|
+
const alignMap = {
|
|
90
|
+
start: "flex-start",
|
|
91
|
+
end: "flex-end",
|
|
92
|
+
center: "center",
|
|
93
|
+
baseline: "baseline",
|
|
94
|
+
stretch: "stretch"
|
|
95
|
+
};
|
|
96
|
+
const style = {
|
|
97
|
+
display: "flex",
|
|
98
|
+
flexDirection: direction,
|
|
99
|
+
justifyContent: justifyMap[justify],
|
|
100
|
+
alignItems: alignMap[align],
|
|
101
|
+
flexWrap: wrap,
|
|
102
|
+
...gap !== void 0 && { gap: spacing[gap] },
|
|
103
|
+
...customStyle
|
|
104
|
+
};
|
|
105
|
+
return /* @__PURE__ */ jsx(Component, { style, className, children });
|
|
106
|
+
}
|
|
107
|
+
function UITypographyText(props) {
|
|
108
|
+
return /* @__PURE__ */ jsx(Typography.Text, { ...props });
|
|
109
|
+
}
|
|
110
|
+
function UITypographyParagraph(props) {
|
|
111
|
+
return /* @__PURE__ */ jsx(Typography.Paragraph, { ...props });
|
|
112
|
+
}
|
|
113
|
+
function UITypographyLink(props) {
|
|
114
|
+
return /* @__PURE__ */ jsx(Typography.Link, { ...props });
|
|
115
|
+
}
|
|
116
|
+
function UIStack({
|
|
117
|
+
direction = "vertical",
|
|
118
|
+
spacing: spacing8 = 2,
|
|
119
|
+
align,
|
|
120
|
+
children,
|
|
121
|
+
as,
|
|
122
|
+
className,
|
|
123
|
+
style
|
|
124
|
+
}) {
|
|
125
|
+
return /* @__PURE__ */ jsx(
|
|
126
|
+
UIFlex,
|
|
127
|
+
{
|
|
128
|
+
direction: direction === "vertical" ? "column" : "row",
|
|
129
|
+
gap: spacing8,
|
|
130
|
+
align,
|
|
131
|
+
as,
|
|
132
|
+
className,
|
|
133
|
+
style,
|
|
134
|
+
children
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
function UISpace(props) {
|
|
139
|
+
return /* @__PURE__ */ jsx(Space, { ...props });
|
|
140
|
+
}
|
|
141
|
+
function UISpaceCompact(props) {
|
|
142
|
+
return /* @__PURE__ */ jsx(Space.Compact, { ...props });
|
|
143
|
+
}
|
|
144
|
+
function UIRow(props) {
|
|
145
|
+
return /* @__PURE__ */ jsx(Row, { ...props });
|
|
146
|
+
}
|
|
147
|
+
function UICol(props) {
|
|
148
|
+
return /* @__PURE__ */ jsx(Col, { ...props });
|
|
149
|
+
}
|
|
150
|
+
function UIDivider(props) {
|
|
151
|
+
return /* @__PURE__ */ jsx(Divider, { ...props });
|
|
152
|
+
}
|
|
153
|
+
var { useToken: useToken2 } = theme;
|
|
154
|
+
function UIBadge({ variant = "default", children, ...props }) {
|
|
155
|
+
const { token } = useToken2();
|
|
156
|
+
const statusMap = {
|
|
157
|
+
success: "success",
|
|
158
|
+
warning: "warning",
|
|
159
|
+
error: "error",
|
|
160
|
+
info: "processing",
|
|
161
|
+
default: "default"
|
|
162
|
+
};
|
|
163
|
+
const colorMap = {
|
|
164
|
+
success: token.colorSuccess,
|
|
165
|
+
warning: token.colorWarning,
|
|
166
|
+
error: token.colorError,
|
|
167
|
+
info: token.colorInfo,
|
|
168
|
+
default: token.colorTextSecondary
|
|
169
|
+
};
|
|
170
|
+
if (children) {
|
|
171
|
+
return /* @__PURE__ */ jsx(
|
|
172
|
+
Badge,
|
|
173
|
+
{
|
|
174
|
+
color: colorMap[variant],
|
|
175
|
+
text: children,
|
|
176
|
+
...props
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
return /* @__PURE__ */ jsx(
|
|
181
|
+
Badge,
|
|
182
|
+
{
|
|
183
|
+
status: statusMap[variant],
|
|
184
|
+
...props
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// src/core/UIButton.module.css
|
|
190
|
+
var UIButton_default = {};
|
|
191
|
+
var UIButton = React3.forwardRef(
|
|
192
|
+
function UIButton2({ variant = "default", className, ...rest }, ref) {
|
|
193
|
+
const combinedClassName = [UIButton_default.uiButton, className].filter(Boolean).join(" ");
|
|
194
|
+
return /* @__PURE__ */ jsx(
|
|
195
|
+
Button,
|
|
196
|
+
{
|
|
197
|
+
ref,
|
|
198
|
+
type: variant,
|
|
199
|
+
className: combinedClassName,
|
|
200
|
+
...rest
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
var { useToken: useToken3 } = theme;
|
|
206
|
+
var variantTokens = {
|
|
207
|
+
default: { tint: "transparent", accent: "transparent", border: "var(--border-primary, #e8eaed)" },
|
|
208
|
+
success: { tint: "rgba(82,196,26,0.07)", accent: "#52c41a", border: "rgba(82,196,26,0.25)" },
|
|
209
|
+
warning: { tint: "rgba(250,173,20,0.08)", accent: "#faad14", border: "rgba(250,173,20,0.30)" },
|
|
210
|
+
error: { tint: "rgba(255,77,79,0.07)", accent: "#ff4d4f", border: "rgba(255,77,79,0.25)" },
|
|
211
|
+
info: { tint: "rgba(12,102,255,0.07)", accent: "#0c66ff", border: "rgba(12,102,255,0.20)" }
|
|
212
|
+
};
|
|
213
|
+
function UICard({
|
|
214
|
+
title,
|
|
215
|
+
subtitle,
|
|
216
|
+
extra,
|
|
217
|
+
footer,
|
|
218
|
+
children,
|
|
219
|
+
size = "default",
|
|
220
|
+
bordered = true,
|
|
221
|
+
hoverable = false,
|
|
222
|
+
loading = false,
|
|
223
|
+
status = "default",
|
|
224
|
+
...rest
|
|
225
|
+
}) {
|
|
226
|
+
const { token } = useToken3();
|
|
227
|
+
const vt = variantTokens[status];
|
|
228
|
+
const cardTitle = title || subtitle ? /* @__PURE__ */ jsxs(UIBox, { children: [
|
|
229
|
+
title && (typeof title === "string" ? /* @__PURE__ */ jsx(UIText, { size: "lg", weight: "semibold", as: "div", children: title }) : title),
|
|
230
|
+
subtitle && /* @__PURE__ */ jsx(UIText, { size: "sm", color: "secondary", as: "div", style: { marginTop: token.marginXXS }, children: subtitle })
|
|
231
|
+
] }) : void 0;
|
|
232
|
+
return /* @__PURE__ */ jsxs(
|
|
233
|
+
Card,
|
|
234
|
+
{
|
|
235
|
+
title: cardTitle,
|
|
236
|
+
extra,
|
|
237
|
+
size,
|
|
238
|
+
variant: bordered ? "outlined" : "borderless",
|
|
239
|
+
hoverable,
|
|
240
|
+
loading,
|
|
241
|
+
...rest,
|
|
242
|
+
style: {
|
|
243
|
+
boxShadow: hoverable ? "0 4px 16px rgba(0,0,0,0.08)" : "0 1px 3px rgba(0,0,0,0.06)",
|
|
244
|
+
transition: "box-shadow 200ms ease, transform 200ms ease",
|
|
245
|
+
backgroundColor: status !== "default" ? vt.tint : void 0,
|
|
246
|
+
borderColor: vt.border,
|
|
247
|
+
borderTopColor: status !== "default" ? vt.accent : vt.border,
|
|
248
|
+
borderTopWidth: status !== "default" ? 3 : 1,
|
|
249
|
+
overflow: "hidden",
|
|
250
|
+
...rest.style
|
|
251
|
+
},
|
|
252
|
+
children: [
|
|
253
|
+
children,
|
|
254
|
+
footer && /* @__PURE__ */ jsx(UIBox, { mt: 3, pt: 3, style: { borderTop: `1px solid ${token.colorBorder}` }, children: footer })
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
var { useToken: useToken4 } = theme;
|
|
260
|
+
function UITag({
|
|
261
|
+
variant = "default",
|
|
262
|
+
color,
|
|
263
|
+
children,
|
|
264
|
+
closable,
|
|
265
|
+
onClose,
|
|
266
|
+
icon,
|
|
267
|
+
...rest
|
|
268
|
+
}) {
|
|
269
|
+
const { token } = useToken4();
|
|
270
|
+
const colorMap = {
|
|
271
|
+
success: token.colorSuccess,
|
|
272
|
+
warning: token.colorWarning,
|
|
273
|
+
error: token.colorError,
|
|
274
|
+
info: token.colorInfo,
|
|
275
|
+
default: token.colorPrimary,
|
|
276
|
+
neutral: token.colorTextSecondary
|
|
277
|
+
};
|
|
278
|
+
return /* @__PURE__ */ jsx(
|
|
279
|
+
Tag,
|
|
280
|
+
{
|
|
281
|
+
color: color ?? colorMap[variant],
|
|
282
|
+
closable,
|
|
283
|
+
onClose,
|
|
284
|
+
icon,
|
|
285
|
+
...rest,
|
|
286
|
+
children
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
var { Title: AntTitle } = Typography;
|
|
291
|
+
var { useToken: useToken5 } = theme;
|
|
292
|
+
function UITitle({
|
|
293
|
+
level = 1,
|
|
294
|
+
children,
|
|
295
|
+
subtitle,
|
|
296
|
+
className,
|
|
297
|
+
style
|
|
298
|
+
}) {
|
|
299
|
+
const { token: _token } = useToken5();
|
|
300
|
+
if (subtitle) {
|
|
301
|
+
return /* @__PURE__ */ jsxs(UIBox, { mb: subtitle ? 2 : 3, children: [
|
|
302
|
+
/* @__PURE__ */ jsx(AntTitle, { level, className, style: { margin: 0, ...style }, children }),
|
|
303
|
+
/* @__PURE__ */ jsx(
|
|
304
|
+
UIText,
|
|
305
|
+
{
|
|
306
|
+
size: "base",
|
|
307
|
+
color: "secondary",
|
|
308
|
+
as: "div",
|
|
309
|
+
style: { marginTop: spacing[1] },
|
|
310
|
+
children: subtitle
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
] });
|
|
314
|
+
}
|
|
315
|
+
return /* @__PURE__ */ jsx(AntTitle, { level, className, style: { marginBottom: spacing[3], ...style }, children });
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/core/UIIcon.module.css
|
|
319
|
+
var UIIcon_default = {};
|
|
320
|
+
var _iconRenderer = null;
|
|
321
|
+
function registerIconRenderer(renderer) {
|
|
322
|
+
_iconRenderer = renderer;
|
|
323
|
+
}
|
|
324
|
+
function UIIcon({
|
|
325
|
+
icon,
|
|
326
|
+
name,
|
|
327
|
+
size = "base",
|
|
328
|
+
color = "inherit",
|
|
329
|
+
spin = false,
|
|
330
|
+
onClick,
|
|
331
|
+
className,
|
|
332
|
+
style: customStyle
|
|
333
|
+
}) {
|
|
334
|
+
const classes = [
|
|
335
|
+
UIIcon_default.uiIcon,
|
|
336
|
+
"anticon",
|
|
337
|
+
UIIcon_default[`size-${size}`],
|
|
338
|
+
UIIcon_default[`color-${color}`],
|
|
339
|
+
spin && UIIcon_default.spin,
|
|
340
|
+
onClick && UIIcon_default.clickable,
|
|
341
|
+
className
|
|
342
|
+
].filter(Boolean).join(" ");
|
|
343
|
+
let iconElement = null;
|
|
344
|
+
const iconName = name || (typeof icon === "string" ? icon : null);
|
|
345
|
+
if (iconName) {
|
|
346
|
+
if (_iconRenderer) {
|
|
347
|
+
iconElement = _iconRenderer(iconName);
|
|
348
|
+
} else {
|
|
349
|
+
console.warn(`Icon "${iconName}" could not be loaded. Call registerIconRenderer() at app startup.`);
|
|
350
|
+
iconElement = null;
|
|
351
|
+
}
|
|
352
|
+
} else if (React3.isValidElement(icon)) {
|
|
353
|
+
iconElement = icon;
|
|
354
|
+
}
|
|
355
|
+
if (!iconElement) {
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
return /* @__PURE__ */ jsx(
|
|
359
|
+
"span",
|
|
360
|
+
{
|
|
361
|
+
className: classes,
|
|
362
|
+
style: customStyle,
|
|
363
|
+
onClick,
|
|
364
|
+
role: onClick ? "button" : void 0,
|
|
365
|
+
tabIndex: onClick ? 0 : void 0,
|
|
366
|
+
onKeyDown: onClick ? (e) => {
|
|
367
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
368
|
+
e.preventDefault();
|
|
369
|
+
onClick();
|
|
370
|
+
}
|
|
371
|
+
} : void 0,
|
|
372
|
+
children: iconElement
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
var UIIconButton = ({
|
|
377
|
+
icon,
|
|
378
|
+
name,
|
|
379
|
+
onClick,
|
|
380
|
+
size = "base",
|
|
381
|
+
color = "primary",
|
|
382
|
+
...props
|
|
383
|
+
}) => /* @__PURE__ */ jsx(
|
|
384
|
+
UIIcon,
|
|
385
|
+
{
|
|
386
|
+
icon,
|
|
387
|
+
name,
|
|
388
|
+
size,
|
|
389
|
+
color,
|
|
390
|
+
onClick,
|
|
391
|
+
style: { cursor: "pointer", transition: "opacity 0.2s", ...props.style },
|
|
392
|
+
...props
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
function UIAvatar(props) {
|
|
396
|
+
return /* @__PURE__ */ jsx(Avatar, { ...props });
|
|
397
|
+
}
|
|
398
|
+
function UIAvatarGroup(props) {
|
|
399
|
+
return /* @__PURE__ */ jsx(Avatar.Group, { ...props });
|
|
400
|
+
}
|
|
401
|
+
function useUITheme() {
|
|
402
|
+
const result = theme.useToken();
|
|
403
|
+
return result;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// src/core/UIShimmerText.module.css
|
|
407
|
+
var UIShimmerText_default = {};
|
|
408
|
+
function UIShimmerText({
|
|
409
|
+
children,
|
|
410
|
+
color = "var(--text-secondary, #9CA3AF)",
|
|
411
|
+
highlight = "var(--text-primary, #111827)",
|
|
412
|
+
duration = "2s",
|
|
413
|
+
className,
|
|
414
|
+
style
|
|
415
|
+
}) {
|
|
416
|
+
return /* @__PURE__ */ jsx(
|
|
417
|
+
"span",
|
|
418
|
+
{
|
|
419
|
+
className: [UIShimmerText_default.shimmer, className].filter(Boolean).join(" "),
|
|
420
|
+
style: {
|
|
421
|
+
"--shimmer-color-1": color,
|
|
422
|
+
"--shimmer-color-2": color,
|
|
423
|
+
"--shimmer-highlight": highlight,
|
|
424
|
+
"--shimmer-duration": duration,
|
|
425
|
+
...style
|
|
426
|
+
},
|
|
427
|
+
children
|
|
428
|
+
}
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
var { useToken: useToken6 } = theme;
|
|
432
|
+
function UIMetricCard({
|
|
433
|
+
label,
|
|
434
|
+
value,
|
|
435
|
+
trend = "neutral",
|
|
436
|
+
delta,
|
|
437
|
+
unit,
|
|
438
|
+
size = "default",
|
|
439
|
+
showDelta = true,
|
|
440
|
+
loading = false
|
|
441
|
+
}) {
|
|
442
|
+
const { token } = useToken6();
|
|
443
|
+
const trendColor = trend === "up" ? token.colorSuccess : trend === "down" ? token.colorError : token.colorText;
|
|
444
|
+
const trendIcon = trend === "up" ? "\u2191" : trend === "down" ? "\u2193" : "";
|
|
445
|
+
return /* @__PURE__ */ jsx(
|
|
446
|
+
Card,
|
|
447
|
+
{
|
|
448
|
+
size,
|
|
449
|
+
loading,
|
|
450
|
+
style: { height: "100%" },
|
|
451
|
+
children: /* @__PURE__ */ jsxs(UIBox, { children: [
|
|
452
|
+
/* @__PURE__ */ jsx(UIText, { size: "sm", color: "secondary", as: "div", children: label }),
|
|
453
|
+
/* @__PURE__ */ jsxs(UIFlex, { align: "baseline", gap: 2, style: { marginTop: token.marginXS }, children: [
|
|
454
|
+
/* @__PURE__ */ jsx(
|
|
455
|
+
UIText,
|
|
456
|
+
{
|
|
457
|
+
size: "2xl",
|
|
458
|
+
weight: "bold",
|
|
459
|
+
as: "div",
|
|
460
|
+
style: { color: trendColor },
|
|
461
|
+
children: value
|
|
462
|
+
}
|
|
463
|
+
),
|
|
464
|
+
unit && /* @__PURE__ */ jsx(UIText, { size: "base", color: "secondary", children: unit })
|
|
465
|
+
] }),
|
|
466
|
+
showDelta && delta !== void 0 && /* @__PURE__ */ jsx(
|
|
467
|
+
UIFlex,
|
|
468
|
+
{
|
|
469
|
+
align: "center",
|
|
470
|
+
gap: 1,
|
|
471
|
+
style: { marginTop: token.marginXS },
|
|
472
|
+
children: /* @__PURE__ */ jsxs(
|
|
473
|
+
UIText,
|
|
474
|
+
{
|
|
475
|
+
size: "sm",
|
|
476
|
+
style: { color: delta >= 0 ? token.colorSuccess : token.colorError },
|
|
477
|
+
children: [
|
|
478
|
+
trendIcon,
|
|
479
|
+
" ",
|
|
480
|
+
Math.abs(delta),
|
|
481
|
+
"%"
|
|
482
|
+
]
|
|
483
|
+
}
|
|
484
|
+
)
|
|
485
|
+
}
|
|
486
|
+
)
|
|
487
|
+
] })
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
function UITable({
|
|
492
|
+
columns,
|
|
493
|
+
dataSource,
|
|
494
|
+
rowKey = "id",
|
|
495
|
+
loading,
|
|
496
|
+
pagination,
|
|
497
|
+
rowSelection,
|
|
498
|
+
onRow,
|
|
499
|
+
size = "middle",
|
|
500
|
+
bordered = false,
|
|
501
|
+
expandable,
|
|
502
|
+
className,
|
|
503
|
+
style,
|
|
504
|
+
scroll
|
|
505
|
+
}) {
|
|
506
|
+
return /* @__PURE__ */ jsx(
|
|
507
|
+
Table,
|
|
508
|
+
{
|
|
509
|
+
columns,
|
|
510
|
+
dataSource,
|
|
511
|
+
rowKey,
|
|
512
|
+
loading,
|
|
513
|
+
pagination,
|
|
514
|
+
rowSelection,
|
|
515
|
+
onRow,
|
|
516
|
+
size,
|
|
517
|
+
bordered,
|
|
518
|
+
expandable,
|
|
519
|
+
className,
|
|
520
|
+
style,
|
|
521
|
+
scroll
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
function useChartColors() {
|
|
526
|
+
return useMemo(() => {
|
|
527
|
+
const colors = [
|
|
528
|
+
"#1677ff",
|
|
529
|
+
// Blue (colorInfo default)
|
|
530
|
+
"#52c41a",
|
|
531
|
+
// Green (colorSuccess default)
|
|
532
|
+
"#faad14",
|
|
533
|
+
// Orange (colorWarning default)
|
|
534
|
+
"#ff4d4f",
|
|
535
|
+
// Red (colorError default)
|
|
536
|
+
"#1890ff",
|
|
537
|
+
// Primary blue
|
|
538
|
+
"#722ed1",
|
|
539
|
+
// Purple
|
|
540
|
+
"#eb2f96",
|
|
541
|
+
// Magenta
|
|
542
|
+
"#13c2c2",
|
|
543
|
+
// Cyan
|
|
544
|
+
"#fa8c16",
|
|
545
|
+
// Volcano
|
|
546
|
+
"#2f54eb"
|
|
547
|
+
// Geek blue
|
|
548
|
+
];
|
|
549
|
+
console.log("[useChartColors] Created palette:", { colors });
|
|
550
|
+
const extendedColors = [
|
|
551
|
+
...colors,
|
|
552
|
+
"#e6f4ff",
|
|
553
|
+
// Light blue (colorInfoBg equivalent)
|
|
554
|
+
"#f6ffed",
|
|
555
|
+
// Light green (colorSuccessBg equivalent)
|
|
556
|
+
"#fffbe6",
|
|
557
|
+
// Light yellow (colorWarningBg equivalent)
|
|
558
|
+
"#fff2f0",
|
|
559
|
+
// Light red (colorErrorBg equivalent)
|
|
560
|
+
"#e6f4ff",
|
|
561
|
+
// Light blue (colorPrimaryBg equivalent)
|
|
562
|
+
"#f759ab",
|
|
563
|
+
// Light magenta
|
|
564
|
+
"#9254de",
|
|
565
|
+
// Light purple
|
|
566
|
+
"#40a9ff",
|
|
567
|
+
// Light blue
|
|
568
|
+
"#73d13d",
|
|
569
|
+
// Light green
|
|
570
|
+
"#ffc53d"
|
|
571
|
+
// Light yellow
|
|
572
|
+
];
|
|
573
|
+
const getColor = (index) => {
|
|
574
|
+
return colors[index % colors.length] || "#1890ff";
|
|
575
|
+
};
|
|
576
|
+
const mapColors = (data, colorField) => {
|
|
577
|
+
const uniqueValues = Array.from(
|
|
578
|
+
new Set(data.map((item) => String(item[colorField] ?? "")))
|
|
579
|
+
);
|
|
580
|
+
const colorMap = {};
|
|
581
|
+
uniqueValues.forEach((value, index) => {
|
|
582
|
+
colorMap[value] = getColor(index);
|
|
583
|
+
});
|
|
584
|
+
return colorMap;
|
|
585
|
+
};
|
|
586
|
+
return {
|
|
587
|
+
colors,
|
|
588
|
+
extendedColors,
|
|
589
|
+
getColor,
|
|
590
|
+
mapColors
|
|
591
|
+
};
|
|
592
|
+
}, []);
|
|
593
|
+
}
|
|
594
|
+
function createFillFunction(colorMap, colorField) {
|
|
595
|
+
return (datum) => {
|
|
596
|
+
const value = String(datum[colorField] ?? "");
|
|
597
|
+
const firstKey = Object.keys(colorMap)[0];
|
|
598
|
+
return colorMap[value] || (firstKey ? colorMap[firstKey] : "#1890ff") || "#1890ff";
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
var { useToken: useToken7 } = theme;
|
|
602
|
+
function useChartTheme() {
|
|
603
|
+
const { token } = useToken7();
|
|
604
|
+
return React3.useMemo(
|
|
605
|
+
() => ({
|
|
606
|
+
defaultColor: token.colorPrimary,
|
|
607
|
+
styleSheet: {
|
|
608
|
+
backgroundColor: token.colorBgContainer,
|
|
609
|
+
fontFamily: token.fontFamily,
|
|
610
|
+
fontSize: token.fontSize,
|
|
611
|
+
color: token.colorText
|
|
612
|
+
}
|
|
613
|
+
}),
|
|
614
|
+
[token]
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
function UILineChart({ colors, disableAutoColors, ...props }) {
|
|
618
|
+
const chartTheme = useChartTheme();
|
|
619
|
+
const palette = useChartColors();
|
|
620
|
+
const enhancedProps = React3.useMemo(() => {
|
|
621
|
+
const hasColorField = props.colorField || props.seriesField;
|
|
622
|
+
console.log("[UILineChart] Debug info:", {
|
|
623
|
+
hasColorField,
|
|
624
|
+
colorField: props.colorField,
|
|
625
|
+
seriesField: props.seriesField,
|
|
626
|
+
disableAutoColors,
|
|
627
|
+
hasData: !!props.data,
|
|
628
|
+
dataLength: props.data?.length,
|
|
629
|
+
customColors: colors,
|
|
630
|
+
paletteColors: palette.colors
|
|
631
|
+
});
|
|
632
|
+
if (disableAutoColors || !hasColorField || !props.data) {
|
|
633
|
+
console.log("[UILineChart] Skipping auto-colors:", {
|
|
634
|
+
disableAutoColors,
|
|
635
|
+
hasColorField,
|
|
636
|
+
hasData: !!props.data
|
|
637
|
+
});
|
|
638
|
+
return props;
|
|
639
|
+
}
|
|
640
|
+
const colorSource = colors || palette.colors;
|
|
641
|
+
console.log("[UILineChart] Applying colors:", {
|
|
642
|
+
source: colors ? "custom" : "palette",
|
|
643
|
+
colors: colorSource
|
|
644
|
+
});
|
|
645
|
+
return {
|
|
646
|
+
...props,
|
|
647
|
+
scale: {
|
|
648
|
+
...props.scale,
|
|
649
|
+
color: {
|
|
650
|
+
range: colorSource
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
}, [props, colors, palette.colors, disableAutoColors]);
|
|
655
|
+
return /* @__PURE__ */ jsx(Line, { ...enhancedProps, theme: chartTheme });
|
|
656
|
+
}
|
|
657
|
+
var { useToken: useToken8 } = theme;
|
|
658
|
+
function useChartTheme2() {
|
|
659
|
+
const { token } = useToken8();
|
|
660
|
+
return React3.useMemo(
|
|
661
|
+
() => ({
|
|
662
|
+
defaultColor: token.colorPrimary,
|
|
663
|
+
colors10: [
|
|
664
|
+
token.colorInfo,
|
|
665
|
+
token.colorSuccess,
|
|
666
|
+
token.colorWarning,
|
|
667
|
+
token.colorError,
|
|
668
|
+
token.colorPrimary,
|
|
669
|
+
token.colorInfoBg,
|
|
670
|
+
token.colorSuccessBg,
|
|
671
|
+
token.colorWarningBg,
|
|
672
|
+
token.colorErrorBg,
|
|
673
|
+
token.colorPrimaryBg
|
|
674
|
+
],
|
|
675
|
+
colors20: [
|
|
676
|
+
token.colorInfo,
|
|
677
|
+
token.colorSuccess,
|
|
678
|
+
token.colorWarning,
|
|
679
|
+
token.colorError,
|
|
680
|
+
token.colorPrimary,
|
|
681
|
+
token.colorInfoBg,
|
|
682
|
+
token.colorSuccessBg,
|
|
683
|
+
token.colorWarningBg,
|
|
684
|
+
token.colorErrorBg,
|
|
685
|
+
token.colorPrimaryBg,
|
|
686
|
+
token.colorInfoBorder,
|
|
687
|
+
token.colorSuccessBorder,
|
|
688
|
+
token.colorWarningBorder,
|
|
689
|
+
token.colorErrorBorder,
|
|
690
|
+
token.colorPrimaryBorder,
|
|
691
|
+
token.colorInfoText,
|
|
692
|
+
token.colorSuccessText,
|
|
693
|
+
token.colorWarningText,
|
|
694
|
+
token.colorErrorText,
|
|
695
|
+
token.colorPrimaryText
|
|
696
|
+
],
|
|
697
|
+
styleSheet: {
|
|
698
|
+
backgroundColor: token.colorBgContainer,
|
|
699
|
+
fontFamily: token.fontFamily,
|
|
700
|
+
fontSize: token.fontSize,
|
|
701
|
+
color: token.colorText
|
|
702
|
+
}
|
|
703
|
+
}),
|
|
704
|
+
[token]
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
function UIColumnChart({ colors, ...props }) {
|
|
708
|
+
const chartTheme = useChartTheme2();
|
|
709
|
+
const mergedTheme = colors ? {
|
|
710
|
+
...chartTheme,
|
|
711
|
+
colors10: colors,
|
|
712
|
+
colors20: colors
|
|
713
|
+
} : chartTheme;
|
|
714
|
+
return /* @__PURE__ */ jsx(Column, { ...props, theme: mergedTheme });
|
|
715
|
+
}
|
|
716
|
+
var { useToken: useToken9 } = theme;
|
|
717
|
+
function useChartTheme3() {
|
|
718
|
+
const { token } = useToken9();
|
|
719
|
+
return React3.useMemo(
|
|
720
|
+
() => ({
|
|
721
|
+
defaultColor: token.colorPrimary,
|
|
722
|
+
styleSheet: {
|
|
723
|
+
backgroundColor: token.colorBgContainer,
|
|
724
|
+
fontFamily: token.fontFamily,
|
|
725
|
+
fontSize: token.fontSize,
|
|
726
|
+
color: token.colorText
|
|
727
|
+
}
|
|
728
|
+
}),
|
|
729
|
+
[token]
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
function UIAreaChart({ colors, disableAutoColors, ...props }) {
|
|
733
|
+
const chartTheme = useChartTheme3();
|
|
734
|
+
const palette = useChartColors();
|
|
735
|
+
const enhancedProps = React3.useMemo(() => {
|
|
736
|
+
if (disableAutoColors || !props.colorField || !props.data) {
|
|
737
|
+
return props;
|
|
738
|
+
}
|
|
739
|
+
const colorSource = colors || palette.colors;
|
|
740
|
+
return {
|
|
741
|
+
...props,
|
|
742
|
+
scale: {
|
|
743
|
+
...props.scale,
|
|
744
|
+
color: {
|
|
745
|
+
range: colorSource
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
}, [props, colors, palette.colors, disableAutoColors]);
|
|
750
|
+
return /* @__PURE__ */ jsx(Area, { ...enhancedProps, theme: chartTheme });
|
|
751
|
+
}
|
|
752
|
+
var { useToken: useToken10 } = theme;
|
|
753
|
+
function useChartTheme4() {
|
|
754
|
+
const { token } = useToken10();
|
|
755
|
+
return React3.useMemo(
|
|
756
|
+
() => ({
|
|
757
|
+
defaultColor: token.colorPrimary,
|
|
758
|
+
styleSheet: {
|
|
759
|
+
backgroundColor: token.colorBgContainer,
|
|
760
|
+
fontFamily: token.fontFamily,
|
|
761
|
+
fontSize: token.fontSize,
|
|
762
|
+
color: token.colorText
|
|
763
|
+
}
|
|
764
|
+
}),
|
|
765
|
+
[token]
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
function UIPieChart({ colors, disableAutoColors, ...props }) {
|
|
769
|
+
const chartTheme = useChartTheme4();
|
|
770
|
+
const palette = useChartColors();
|
|
771
|
+
const enhancedProps = React3.useMemo(() => {
|
|
772
|
+
if (disableAutoColors || !props.colorField || !props.data) {
|
|
773
|
+
return props;
|
|
774
|
+
}
|
|
775
|
+
const colorSource = colors || palette.colors;
|
|
776
|
+
return {
|
|
777
|
+
...props,
|
|
778
|
+
scale: {
|
|
779
|
+
...props.scale,
|
|
780
|
+
color: {
|
|
781
|
+
range: colorSource
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
}, [props, colors, palette.colors, disableAutoColors]);
|
|
786
|
+
return /* @__PURE__ */ jsx(Pie, { ...enhancedProps, theme: chartTheme });
|
|
787
|
+
}
|
|
788
|
+
var { useToken: useToken11 } = theme;
|
|
789
|
+
function useChartTheme5() {
|
|
790
|
+
const { token } = useToken11();
|
|
791
|
+
return React3.useMemo(
|
|
792
|
+
() => ({
|
|
793
|
+
defaultColor: token.colorPrimary,
|
|
794
|
+
styleSheet: {
|
|
795
|
+
backgroundColor: token.colorBgContainer,
|
|
796
|
+
fontFamily: token.fontFamily,
|
|
797
|
+
fontSize: token.fontSize,
|
|
798
|
+
color: token.colorText
|
|
799
|
+
}
|
|
800
|
+
}),
|
|
801
|
+
[token]
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
function UIBarChart({ colors, disableAutoColors, ...props }) {
|
|
805
|
+
const chartTheme = useChartTheme5();
|
|
806
|
+
const palette = useChartColors();
|
|
807
|
+
const enhancedProps = React3.useMemo(() => {
|
|
808
|
+
if (disableAutoColors || !props.seriesField || !props.data) {
|
|
809
|
+
return props;
|
|
810
|
+
}
|
|
811
|
+
const colorSource = colors || palette.colors;
|
|
812
|
+
return {
|
|
813
|
+
...props,
|
|
814
|
+
scale: {
|
|
815
|
+
...props.scale,
|
|
816
|
+
color: {
|
|
817
|
+
range: colorSource
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
};
|
|
821
|
+
}, [props, colors, palette.colors, disableAutoColors]);
|
|
822
|
+
return /* @__PURE__ */ jsx(Bar, { ...enhancedProps, theme: chartTheme });
|
|
823
|
+
}
|
|
824
|
+
function UIStatisticsChart({
|
|
825
|
+
data,
|
|
826
|
+
loading = false,
|
|
827
|
+
title,
|
|
828
|
+
metrics = [],
|
|
829
|
+
xField = "date",
|
|
830
|
+
yField = "value",
|
|
831
|
+
colorField = "category",
|
|
832
|
+
style,
|
|
833
|
+
height = 350,
|
|
834
|
+
showLegend = true,
|
|
835
|
+
chartProps
|
|
836
|
+
}) {
|
|
837
|
+
const palette = useChartColors();
|
|
838
|
+
const chartColors = React3.useMemo(
|
|
839
|
+
() => palette.colors.slice(0, Math.max(metrics.length, 3)),
|
|
840
|
+
[palette.colors, metrics.length]
|
|
841
|
+
);
|
|
842
|
+
const chartData = React3.useMemo(() => {
|
|
843
|
+
if (!data) {
|
|
844
|
+
return [];
|
|
845
|
+
}
|
|
846
|
+
if (metrics.length === 0) {
|
|
847
|
+
return data;
|
|
848
|
+
}
|
|
849
|
+
return data.flatMap((stat) => {
|
|
850
|
+
const rows = [];
|
|
851
|
+
for (const metric of metrics) {
|
|
852
|
+
let value;
|
|
853
|
+
if (metric.key in stat && typeof stat[metric.key] === "number") {
|
|
854
|
+
value = stat[metric.key];
|
|
855
|
+
} else if (stat.metrics && metric.key in stat.metrics) {
|
|
856
|
+
value = stat.metrics[metric.key];
|
|
857
|
+
} else {
|
|
858
|
+
value = 0;
|
|
859
|
+
}
|
|
860
|
+
if (metric.transform) {
|
|
861
|
+
value = metric.transform(value);
|
|
862
|
+
}
|
|
863
|
+
rows.push({
|
|
864
|
+
[xField]: stat.date ? dayjs(stat.date).format("YYYY-MM-DD") : stat[xField],
|
|
865
|
+
[colorField]: metric.label,
|
|
866
|
+
[yField]: value
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
return rows;
|
|
870
|
+
});
|
|
871
|
+
}, [data, metrics, xField, yField, colorField]);
|
|
872
|
+
const renderLegend = () => {
|
|
873
|
+
if (!showLegend || metrics.length === 0) {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
return /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end", marginBottom: 12, gap: 16 }, children: metrics.map((metric, index) => /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
877
|
+
/* @__PURE__ */ jsx(
|
|
878
|
+
"span",
|
|
879
|
+
{
|
|
880
|
+
style: {
|
|
881
|
+
display: "inline-block",
|
|
882
|
+
width: 10,
|
|
883
|
+
height: 10,
|
|
884
|
+
borderRadius: "50%",
|
|
885
|
+
backgroundColor: chartColors[index % chartColors.length]
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
),
|
|
889
|
+
/* @__PURE__ */ jsx("span", { style: { fontSize: 13, fontWeight: 500 }, children: metric.label })
|
|
890
|
+
] }, metric.label)) });
|
|
891
|
+
};
|
|
892
|
+
const renderContent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
893
|
+
loading && /* @__PURE__ */ jsx("div", { style: { textAlign: "center", padding: "40px 0" }, children: /* @__PURE__ */ jsx(UIText, { color: "secondary", children: "Loading chart data..." }) }),
|
|
894
|
+
!loading && (!chartData || chartData.length === 0) && /* @__PURE__ */ jsx("div", { style: { textAlign: "center", padding: "40px 0" }, children: /* @__PURE__ */ jsx(UIText, { color: "secondary", children: "No data available for the selected date range" }) }),
|
|
895
|
+
!loading && chartData && chartData.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
896
|
+
renderLegend(),
|
|
897
|
+
/* @__PURE__ */ jsx(
|
|
898
|
+
UILineChart,
|
|
899
|
+
{
|
|
900
|
+
data: chartData,
|
|
901
|
+
xField,
|
|
902
|
+
yField,
|
|
903
|
+
colorField,
|
|
904
|
+
height,
|
|
905
|
+
colors: chartColors,
|
|
906
|
+
scale: {
|
|
907
|
+
color: {
|
|
908
|
+
range: chartColors
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
axis: {
|
|
912
|
+
x: {
|
|
913
|
+
label: {
|
|
914
|
+
autoRotate: false
|
|
915
|
+
}
|
|
916
|
+
},
|
|
917
|
+
y: {
|
|
918
|
+
label: {
|
|
919
|
+
formatter: (v) => {
|
|
920
|
+
const num = Number(v);
|
|
921
|
+
if (num >= 1e6) {
|
|
922
|
+
return `${(num / 1e6).toFixed(1)}M`;
|
|
923
|
+
}
|
|
924
|
+
if (num >= 1e3) {
|
|
925
|
+
return `${(num / 1e3).toFixed(1)}K`;
|
|
926
|
+
}
|
|
927
|
+
return num.toLocaleString();
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
style: {
|
|
933
|
+
shape: "smooth",
|
|
934
|
+
lineWidth: 2
|
|
935
|
+
},
|
|
936
|
+
legend: false,
|
|
937
|
+
tooltip: {
|
|
938
|
+
title: (d) => d[xField],
|
|
939
|
+
items: [
|
|
940
|
+
(d) => {
|
|
941
|
+
const metric = metrics.find((m) => m.label === d[colorField]);
|
|
942
|
+
const metricIndex = metrics.findIndex((m) => m.label === d[colorField]);
|
|
943
|
+
let formattedValue = d[yField]?.toLocaleString() || "0";
|
|
944
|
+
if (metric?.format && d[yField] != null) {
|
|
945
|
+
formattedValue = metric.format(d[yField]);
|
|
946
|
+
}
|
|
947
|
+
return {
|
|
948
|
+
name: d[colorField],
|
|
949
|
+
value: formattedValue,
|
|
950
|
+
color: chartColors[metricIndex >= 0 ? metricIndex : 0]
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
]
|
|
954
|
+
},
|
|
955
|
+
...chartProps
|
|
956
|
+
}
|
|
957
|
+
)
|
|
958
|
+
] })
|
|
959
|
+
] });
|
|
960
|
+
if (title) {
|
|
961
|
+
return /* @__PURE__ */ jsx(Card, { title, style: { marginTop: 16, ...style }, children: renderContent() });
|
|
962
|
+
}
|
|
963
|
+
return /* @__PURE__ */ jsx("div", { style, children: renderContent() });
|
|
964
|
+
}
|
|
965
|
+
function UIStatistic(props) {
|
|
966
|
+
return /* @__PURE__ */ jsx(Statistic, { ...props });
|
|
967
|
+
}
|
|
968
|
+
function UIStatisticCountdown(props) {
|
|
969
|
+
return /* @__PURE__ */ jsx(Statistic.Countdown, { ...props });
|
|
970
|
+
}
|
|
971
|
+
function UIProgress(props) {
|
|
972
|
+
return /* @__PURE__ */ jsx(Progress, { ...props });
|
|
973
|
+
}
|
|
974
|
+
function UIDescriptions(props) {
|
|
975
|
+
return /* @__PURE__ */ jsx(Descriptions, { ...props });
|
|
976
|
+
}
|
|
977
|
+
function UIDescriptionsItem(props) {
|
|
978
|
+
return /* @__PURE__ */ jsx(Descriptions.Item, { ...props });
|
|
979
|
+
}
|
|
980
|
+
function UITimeline(props) {
|
|
981
|
+
return /* @__PURE__ */ jsx(Timeline, { ...props });
|
|
982
|
+
}
|
|
983
|
+
function UITimelineItem(props) {
|
|
984
|
+
return /* @__PURE__ */ jsx(Timeline.Item, { ...props });
|
|
985
|
+
}
|
|
986
|
+
function UITree(props) {
|
|
987
|
+
return /* @__PURE__ */ jsx(Tree, { ...props });
|
|
988
|
+
}
|
|
989
|
+
function UITreeDirectoryTree(props) {
|
|
990
|
+
return /* @__PURE__ */ jsx(Tree.DirectoryTree, { ...props });
|
|
991
|
+
}
|
|
992
|
+
function UITreeNode(props) {
|
|
993
|
+
return /* @__PURE__ */ jsx(Tree.TreeNode, { ...props });
|
|
994
|
+
}
|
|
995
|
+
function UIList(props) {
|
|
996
|
+
return /* @__PURE__ */ jsx(List, { ...props });
|
|
997
|
+
}
|
|
998
|
+
function UIListItem(props) {
|
|
999
|
+
return /* @__PURE__ */ jsx(List.Item, { ...props });
|
|
1000
|
+
}
|
|
1001
|
+
function UIListItemMeta(props) {
|
|
1002
|
+
return /* @__PURE__ */ jsx(List.Item.Meta, { ...props });
|
|
1003
|
+
}
|
|
1004
|
+
function UIInput({
|
|
1005
|
+
value,
|
|
1006
|
+
defaultValue,
|
|
1007
|
+
placeholder,
|
|
1008
|
+
disabled,
|
|
1009
|
+
prefix,
|
|
1010
|
+
suffix,
|
|
1011
|
+
maxLength,
|
|
1012
|
+
showCount,
|
|
1013
|
+
allowClear,
|
|
1014
|
+
onChange,
|
|
1015
|
+
onPressEnter,
|
|
1016
|
+
...rest
|
|
1017
|
+
}) {
|
|
1018
|
+
const handleChange = (e) => {
|
|
1019
|
+
onChange?.(e.target.value);
|
|
1020
|
+
};
|
|
1021
|
+
return /* @__PURE__ */ jsx(
|
|
1022
|
+
Input,
|
|
1023
|
+
{
|
|
1024
|
+
value,
|
|
1025
|
+
defaultValue,
|
|
1026
|
+
placeholder,
|
|
1027
|
+
disabled,
|
|
1028
|
+
prefix,
|
|
1029
|
+
suffix,
|
|
1030
|
+
maxLength,
|
|
1031
|
+
showCount,
|
|
1032
|
+
allowClear,
|
|
1033
|
+
onChange: handleChange,
|
|
1034
|
+
onPressEnter,
|
|
1035
|
+
...rest
|
|
1036
|
+
}
|
|
1037
|
+
);
|
|
1038
|
+
}
|
|
1039
|
+
function UIInputPassword(props) {
|
|
1040
|
+
return /* @__PURE__ */ jsx(Input.Password, { ...props });
|
|
1041
|
+
}
|
|
1042
|
+
function UIInputTextArea(props) {
|
|
1043
|
+
return /* @__PURE__ */ jsx(Input.TextArea, { ...props });
|
|
1044
|
+
}
|
|
1045
|
+
function UIInputSearch(props) {
|
|
1046
|
+
return /* @__PURE__ */ jsx(Input.Search, { ...props });
|
|
1047
|
+
}
|
|
1048
|
+
function UISelect({
|
|
1049
|
+
options = [],
|
|
1050
|
+
value,
|
|
1051
|
+
defaultValue,
|
|
1052
|
+
placeholder,
|
|
1053
|
+
disabled,
|
|
1054
|
+
loading,
|
|
1055
|
+
allowClear,
|
|
1056
|
+
showSearch,
|
|
1057
|
+
mode,
|
|
1058
|
+
onChange,
|
|
1059
|
+
...rest
|
|
1060
|
+
}) {
|
|
1061
|
+
const transformedOptions = options.map((opt) => ({
|
|
1062
|
+
label: opt.icon || opt.description ? /* @__PURE__ */ jsxs(UIFlex, { align: "center", gap: 2, style: { width: "100%" }, children: [
|
|
1063
|
+
opt.icon && /* @__PURE__ */ jsx("span", { children: opt.icon }),
|
|
1064
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: opt.label }),
|
|
1065
|
+
opt.description && /* @__PURE__ */ jsx("span", { style: { fontSize: "0.85em", opacity: 0.7 }, children: opt.description })
|
|
1066
|
+
] }) : opt.label,
|
|
1067
|
+
value: opt.value,
|
|
1068
|
+
disabled: opt.disabled
|
|
1069
|
+
}));
|
|
1070
|
+
return /* @__PURE__ */ jsx(
|
|
1071
|
+
Select,
|
|
1072
|
+
{
|
|
1073
|
+
options: transformedOptions,
|
|
1074
|
+
value,
|
|
1075
|
+
defaultValue,
|
|
1076
|
+
placeholder,
|
|
1077
|
+
disabled,
|
|
1078
|
+
loading,
|
|
1079
|
+
allowClear,
|
|
1080
|
+
showSearch,
|
|
1081
|
+
mode,
|
|
1082
|
+
onChange,
|
|
1083
|
+
...rest
|
|
1084
|
+
}
|
|
1085
|
+
);
|
|
1086
|
+
}
|
|
1087
|
+
function UIForm({
|
|
1088
|
+
layout = "vertical",
|
|
1089
|
+
onFinish,
|
|
1090
|
+
onFinishFailed,
|
|
1091
|
+
initialValues,
|
|
1092
|
+
children,
|
|
1093
|
+
...rest
|
|
1094
|
+
}) {
|
|
1095
|
+
return /* @__PURE__ */ jsx(
|
|
1096
|
+
Form,
|
|
1097
|
+
{
|
|
1098
|
+
layout,
|
|
1099
|
+
onFinish,
|
|
1100
|
+
onFinishFailed,
|
|
1101
|
+
initialValues,
|
|
1102
|
+
...rest,
|
|
1103
|
+
children
|
|
1104
|
+
}
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
function UIFormItem(props) {
|
|
1108
|
+
return /* @__PURE__ */ jsx(Form.Item, { ...props });
|
|
1109
|
+
}
|
|
1110
|
+
var useUIForm = Form.useForm;
|
|
1111
|
+
function UIFormList(props) {
|
|
1112
|
+
return /* @__PURE__ */ jsx(Form.List, { ...props });
|
|
1113
|
+
}
|
|
1114
|
+
function UICheckbox({
|
|
1115
|
+
children,
|
|
1116
|
+
checked,
|
|
1117
|
+
defaultChecked,
|
|
1118
|
+
disabled,
|
|
1119
|
+
indeterminate,
|
|
1120
|
+
onChange,
|
|
1121
|
+
...rest
|
|
1122
|
+
}) {
|
|
1123
|
+
const handleChange = (e) => {
|
|
1124
|
+
onChange?.(e.target.checked);
|
|
1125
|
+
};
|
|
1126
|
+
return /* @__PURE__ */ jsx(
|
|
1127
|
+
Checkbox,
|
|
1128
|
+
{
|
|
1129
|
+
checked,
|
|
1130
|
+
defaultChecked,
|
|
1131
|
+
disabled,
|
|
1132
|
+
indeterminate,
|
|
1133
|
+
onChange: handleChange,
|
|
1134
|
+
...rest,
|
|
1135
|
+
children
|
|
1136
|
+
}
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
function UICheckboxGroup({
|
|
1140
|
+
options,
|
|
1141
|
+
value,
|
|
1142
|
+
defaultValue,
|
|
1143
|
+
disabled,
|
|
1144
|
+
gap = 2,
|
|
1145
|
+
onChange
|
|
1146
|
+
}) {
|
|
1147
|
+
return /* @__PURE__ */ jsx(Checkbox.Group, { value, defaultValue, disabled, onChange, children: /* @__PURE__ */ jsx(UIBox, { children: options.map((option, index) => /* @__PURE__ */ jsxs(UIBox, { mb: index < options.length - 1 ? gap : 0, children: [
|
|
1148
|
+
/* @__PURE__ */ jsx(Checkbox, { value: option.value, disabled: option.disabled, children: option.label }),
|
|
1149
|
+
option.description && /* @__PURE__ */ jsx(
|
|
1150
|
+
UIText,
|
|
1151
|
+
{
|
|
1152
|
+
size: "sm",
|
|
1153
|
+
color: "secondary",
|
|
1154
|
+
as: "div",
|
|
1155
|
+
style: { marginLeft: spacing[6], marginTop: spacing[1] },
|
|
1156
|
+
children: option.description
|
|
1157
|
+
}
|
|
1158
|
+
)
|
|
1159
|
+
] }, option.value)) }) });
|
|
1160
|
+
}
|
|
1161
|
+
function UISwitch({
|
|
1162
|
+
checked,
|
|
1163
|
+
defaultChecked,
|
|
1164
|
+
disabled,
|
|
1165
|
+
loading,
|
|
1166
|
+
size = "default",
|
|
1167
|
+
label,
|
|
1168
|
+
labelPosition = "right",
|
|
1169
|
+
checkedChildren,
|
|
1170
|
+
unCheckedChildren,
|
|
1171
|
+
onChange,
|
|
1172
|
+
...rest
|
|
1173
|
+
}) {
|
|
1174
|
+
const switchElement = /* @__PURE__ */ jsx(
|
|
1175
|
+
Switch,
|
|
1176
|
+
{
|
|
1177
|
+
checked,
|
|
1178
|
+
defaultChecked,
|
|
1179
|
+
disabled,
|
|
1180
|
+
loading,
|
|
1181
|
+
size,
|
|
1182
|
+
checkedChildren,
|
|
1183
|
+
unCheckedChildren,
|
|
1184
|
+
onChange,
|
|
1185
|
+
...rest
|
|
1186
|
+
}
|
|
1187
|
+
);
|
|
1188
|
+
if (!label) {
|
|
1189
|
+
return switchElement;
|
|
1190
|
+
}
|
|
1191
|
+
return /* @__PURE__ */ jsxs(UIFlex, { align: "center", gap: 2, children: [
|
|
1192
|
+
labelPosition === "left" && /* @__PURE__ */ jsx(UIText, { children: label }),
|
|
1193
|
+
switchElement,
|
|
1194
|
+
labelPosition === "right" && /* @__PURE__ */ jsx(UIText, { children: label })
|
|
1195
|
+
] });
|
|
1196
|
+
}
|
|
1197
|
+
function UIDatePicker({
|
|
1198
|
+
value,
|
|
1199
|
+
defaultValue,
|
|
1200
|
+
placeholder,
|
|
1201
|
+
disabled,
|
|
1202
|
+
format,
|
|
1203
|
+
allowClear = true,
|
|
1204
|
+
showTime,
|
|
1205
|
+
onChange,
|
|
1206
|
+
...rest
|
|
1207
|
+
}) {
|
|
1208
|
+
return /* @__PURE__ */ jsx(
|
|
1209
|
+
DatePicker,
|
|
1210
|
+
{
|
|
1211
|
+
value,
|
|
1212
|
+
defaultValue,
|
|
1213
|
+
placeholder,
|
|
1214
|
+
disabled,
|
|
1215
|
+
format,
|
|
1216
|
+
allowClear,
|
|
1217
|
+
showTime,
|
|
1218
|
+
onChange,
|
|
1219
|
+
...rest
|
|
1220
|
+
}
|
|
1221
|
+
);
|
|
1222
|
+
}
|
|
1223
|
+
function UITimePicker({
|
|
1224
|
+
value,
|
|
1225
|
+
defaultValue,
|
|
1226
|
+
placeholder,
|
|
1227
|
+
disabled,
|
|
1228
|
+
format,
|
|
1229
|
+
allowClear = true,
|
|
1230
|
+
onChange,
|
|
1231
|
+
...rest
|
|
1232
|
+
}) {
|
|
1233
|
+
return /* @__PURE__ */ jsx(
|
|
1234
|
+
TimePicker,
|
|
1235
|
+
{
|
|
1236
|
+
value,
|
|
1237
|
+
defaultValue,
|
|
1238
|
+
placeholder,
|
|
1239
|
+
disabled,
|
|
1240
|
+
format,
|
|
1241
|
+
allowClear,
|
|
1242
|
+
onChange,
|
|
1243
|
+
...rest
|
|
1244
|
+
}
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
function UIRangePicker(props) {
|
|
1248
|
+
return /* @__PURE__ */ jsx(DatePicker.RangePicker, { ...props });
|
|
1249
|
+
}
|
|
1250
|
+
function UIInputNumber(props) {
|
|
1251
|
+
return /* @__PURE__ */ jsx(InputNumber, { ...props });
|
|
1252
|
+
}
|
|
1253
|
+
function UIRadio(props) {
|
|
1254
|
+
return /* @__PURE__ */ jsx(Radio, { ...props });
|
|
1255
|
+
}
|
|
1256
|
+
function UIRadioGroup(props) {
|
|
1257
|
+
return /* @__PURE__ */ jsx(Radio.Group, { ...props });
|
|
1258
|
+
}
|
|
1259
|
+
function UIUpload(props) {
|
|
1260
|
+
return /* @__PURE__ */ jsx(Upload, { ...props });
|
|
1261
|
+
}
|
|
1262
|
+
function UIUploadDragger(props) {
|
|
1263
|
+
return /* @__PURE__ */ jsx(Upload.Dragger, { ...props });
|
|
1264
|
+
}
|
|
1265
|
+
function UISlider(props) {
|
|
1266
|
+
return /* @__PURE__ */ jsx(Slider, { ...props });
|
|
1267
|
+
}
|
|
1268
|
+
function UIBreadcrumb({
|
|
1269
|
+
items,
|
|
1270
|
+
separator,
|
|
1271
|
+
className
|
|
1272
|
+
}) {
|
|
1273
|
+
const breadcrumbItems = items.map((item) => ({
|
|
1274
|
+
title: item.icon ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
1275
|
+
item.icon,
|
|
1276
|
+
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
1277
|
+
] }) : item.title,
|
|
1278
|
+
href: item.href,
|
|
1279
|
+
onClick: item.onClick
|
|
1280
|
+
}));
|
|
1281
|
+
return /* @__PURE__ */ jsx(
|
|
1282
|
+
Breadcrumb,
|
|
1283
|
+
{
|
|
1284
|
+
items: breadcrumbItems,
|
|
1285
|
+
separator,
|
|
1286
|
+
className
|
|
1287
|
+
}
|
|
1288
|
+
);
|
|
1289
|
+
}
|
|
1290
|
+
function UITabsInner({
|
|
1291
|
+
items,
|
|
1292
|
+
syncUrl,
|
|
1293
|
+
activeKey: controlledActiveKey,
|
|
1294
|
+
defaultActiveKey,
|
|
1295
|
+
tabPosition = "top",
|
|
1296
|
+
type = "line",
|
|
1297
|
+
size = "middle",
|
|
1298
|
+
onChange,
|
|
1299
|
+
onEdit,
|
|
1300
|
+
className,
|
|
1301
|
+
style
|
|
1302
|
+
}) {
|
|
1303
|
+
const [searchParams, setSearchParams] = useSearchParams();
|
|
1304
|
+
const navigate = useNavigate();
|
|
1305
|
+
const params = useParams();
|
|
1306
|
+
const defaultKey = items[0]?.key ?? "";
|
|
1307
|
+
let activeKey = controlledActiveKey;
|
|
1308
|
+
const isSearch = syncUrl === true || syncUrl === "search";
|
|
1309
|
+
const isPath = syncUrl && typeof syncUrl === "object" && syncUrl.mode === "path";
|
|
1310
|
+
if (isSearch) {
|
|
1311
|
+
activeKey = searchParams.get("tab") ?? defaultKey;
|
|
1312
|
+
} else if (isPath) {
|
|
1313
|
+
activeKey = params.tab ?? defaultKey;
|
|
1314
|
+
}
|
|
1315
|
+
const handleChange = (key) => {
|
|
1316
|
+
if (isSearch) {
|
|
1317
|
+
setSearchParams(key === defaultKey ? {} : { tab: key });
|
|
1318
|
+
} else if (isPath && typeof syncUrl === "object") {
|
|
1319
|
+
const path = key === defaultKey ? syncUrl.basePath : `${syncUrl.basePath}/${key}`;
|
|
1320
|
+
navigate(path);
|
|
1321
|
+
}
|
|
1322
|
+
onChange?.(key);
|
|
1323
|
+
};
|
|
1324
|
+
const tabItems = items.map((item) => ({
|
|
1325
|
+
key: item.key,
|
|
1326
|
+
label: item.icon ? /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
|
|
1327
|
+
item.icon,
|
|
1328
|
+
/* @__PURE__ */ jsx("span", { children: item.label })
|
|
1329
|
+
] }) : item.label,
|
|
1330
|
+
children: item.children,
|
|
1331
|
+
disabled: item.disabled,
|
|
1332
|
+
closable: item.closable
|
|
1333
|
+
}));
|
|
1334
|
+
const handleEdit = onEdit ? (targetKey, action) => {
|
|
1335
|
+
const key = typeof targetKey === "string" ? targetKey : "";
|
|
1336
|
+
onEdit(key, action);
|
|
1337
|
+
} : void 0;
|
|
1338
|
+
return /* @__PURE__ */ jsx(
|
|
1339
|
+
Tabs,
|
|
1340
|
+
{
|
|
1341
|
+
items: tabItems,
|
|
1342
|
+
activeKey,
|
|
1343
|
+
defaultActiveKey: syncUrl ? void 0 : defaultActiveKey,
|
|
1344
|
+
tabPosition,
|
|
1345
|
+
type,
|
|
1346
|
+
size,
|
|
1347
|
+
onChange: handleChange,
|
|
1348
|
+
onEdit: handleEdit,
|
|
1349
|
+
className,
|
|
1350
|
+
style
|
|
1351
|
+
}
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1354
|
+
function UITabs(props) {
|
|
1355
|
+
return /* @__PURE__ */ jsx(UITabsInner, { ...props });
|
|
1356
|
+
}
|
|
1357
|
+
function UIAccordion({
|
|
1358
|
+
items,
|
|
1359
|
+
activeKey,
|
|
1360
|
+
defaultActiveKey,
|
|
1361
|
+
accordion = false,
|
|
1362
|
+
bordered = true,
|
|
1363
|
+
ghost = false,
|
|
1364
|
+
size = "middle",
|
|
1365
|
+
onChange,
|
|
1366
|
+
className,
|
|
1367
|
+
style
|
|
1368
|
+
}) {
|
|
1369
|
+
const collapseItems = items.map((item) => ({
|
|
1370
|
+
key: item.key,
|
|
1371
|
+
label: item.label,
|
|
1372
|
+
children: item.children,
|
|
1373
|
+
extra: item.extra,
|
|
1374
|
+
showArrow: item.showArrow,
|
|
1375
|
+
collapsible: item.collapsible
|
|
1376
|
+
}));
|
|
1377
|
+
return /* @__PURE__ */ jsx(
|
|
1378
|
+
Collapse,
|
|
1379
|
+
{
|
|
1380
|
+
items: collapseItems,
|
|
1381
|
+
activeKey,
|
|
1382
|
+
defaultActiveKey,
|
|
1383
|
+
accordion,
|
|
1384
|
+
bordered,
|
|
1385
|
+
ghost,
|
|
1386
|
+
size,
|
|
1387
|
+
onChange,
|
|
1388
|
+
className,
|
|
1389
|
+
style
|
|
1390
|
+
}
|
|
1391
|
+
);
|
|
1392
|
+
}
|
|
1393
|
+
function UIDropdown(props) {
|
|
1394
|
+
return /* @__PURE__ */ jsx(Dropdown, { ...props });
|
|
1395
|
+
}
|
|
1396
|
+
function UIDropdownButton(props) {
|
|
1397
|
+
return /* @__PURE__ */ jsx(Dropdown.Button, { ...props });
|
|
1398
|
+
}
|
|
1399
|
+
function UISegmented(props) {
|
|
1400
|
+
return /* @__PURE__ */ jsx(Segmented, { ...props });
|
|
1401
|
+
}
|
|
1402
|
+
function UISteps(props) {
|
|
1403
|
+
return /* @__PURE__ */ jsx(Steps, { ...props });
|
|
1404
|
+
}
|
|
1405
|
+
function UIMenu(props) {
|
|
1406
|
+
return /* @__PURE__ */ jsx(Menu, { ...props });
|
|
1407
|
+
}
|
|
1408
|
+
var { useToken: useToken12 } = theme;
|
|
1409
|
+
function UIPage({
|
|
1410
|
+
children,
|
|
1411
|
+
width = "default",
|
|
1412
|
+
variant = "default",
|
|
1413
|
+
className,
|
|
1414
|
+
style: customStyle
|
|
1415
|
+
}) {
|
|
1416
|
+
const { token } = useToken12();
|
|
1417
|
+
const maxWidthMap = {
|
|
1418
|
+
default: "1280px",
|
|
1419
|
+
wide: "1600px",
|
|
1420
|
+
full: "100%"
|
|
1421
|
+
};
|
|
1422
|
+
const isDocument = variant === "document";
|
|
1423
|
+
const style = {
|
|
1424
|
+
maxWidth: maxWidthMap[width],
|
|
1425
|
+
margin: "0 auto",
|
|
1426
|
+
padding: token.padding,
|
|
1427
|
+
...isDocument && {
|
|
1428
|
+
backgroundColor: token.colorBgContainer,
|
|
1429
|
+
borderRadius: token.borderRadiusLG,
|
|
1430
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.06)"
|
|
1431
|
+
},
|
|
1432
|
+
minHeight: isDocument ? void 0 : "100%",
|
|
1433
|
+
...customStyle
|
|
1434
|
+
};
|
|
1435
|
+
return /* @__PURE__ */ jsx(UIBox, { as: "main", className, style, children });
|
|
1436
|
+
}
|
|
1437
|
+
var { useToken: useToken13 } = theme;
|
|
1438
|
+
function UIHeader({
|
|
1439
|
+
title,
|
|
1440
|
+
subtitle,
|
|
1441
|
+
breadcrumb,
|
|
1442
|
+
actions,
|
|
1443
|
+
className,
|
|
1444
|
+
style: customStyle
|
|
1445
|
+
}) {
|
|
1446
|
+
const { token } = useToken13();
|
|
1447
|
+
const style = {
|
|
1448
|
+
borderBottom: `1px solid ${token.colorBorder}`,
|
|
1449
|
+
paddingBottom: spacing[4],
|
|
1450
|
+
marginBottom: spacing[6],
|
|
1451
|
+
...customStyle
|
|
1452
|
+
};
|
|
1453
|
+
return /* @__PURE__ */ jsxs(UIBox, { className, style, children: [
|
|
1454
|
+
breadcrumb && /* @__PURE__ */ jsx(UIBox, { mb: 2, children: breadcrumb }),
|
|
1455
|
+
/* @__PURE__ */ jsxs(UIFlex, { justify: "between", align: "start", gap: 4, children: [
|
|
1456
|
+
/* @__PURE__ */ jsxs(UIBox, { style: { flex: 1 }, children: [
|
|
1457
|
+
/* @__PURE__ */ jsx(UITitle, { level: 1, style: { marginBottom: subtitle ? spacing[2] : 0 }, children: title }),
|
|
1458
|
+
subtitle && /* @__PURE__ */ jsx(UIText, { size: "base", color: "secondary", children: subtitle })
|
|
1459
|
+
] }),
|
|
1460
|
+
actions && /* @__PURE__ */ jsx(UIBox, { style: { flexShrink: 0 }, children: actions })
|
|
1461
|
+
] })
|
|
1462
|
+
] });
|
|
1463
|
+
}
|
|
1464
|
+
var { useToken: useToken14 } = theme;
|
|
1465
|
+
function UIPageHeader({
|
|
1466
|
+
title,
|
|
1467
|
+
description,
|
|
1468
|
+
icon,
|
|
1469
|
+
breadcrumbs,
|
|
1470
|
+
actions,
|
|
1471
|
+
tabs,
|
|
1472
|
+
onBack,
|
|
1473
|
+
children
|
|
1474
|
+
}) {
|
|
1475
|
+
const { token } = useToken14();
|
|
1476
|
+
const hasTabs = !!tabs;
|
|
1477
|
+
return /* @__PURE__ */ jsxs("div", { style: { marginBottom: hasTabs ? 0 : 24 }, children: [
|
|
1478
|
+
(onBack || breadcrumbs && breadcrumbs.length > 0) && /* @__PURE__ */ jsxs(
|
|
1479
|
+
"div",
|
|
1480
|
+
{
|
|
1481
|
+
style: {
|
|
1482
|
+
display: "flex",
|
|
1483
|
+
alignItems: "center",
|
|
1484
|
+
gap: token.marginXS,
|
|
1485
|
+
marginBottom: token.marginXS
|
|
1486
|
+
},
|
|
1487
|
+
children: [
|
|
1488
|
+
onBack && /* @__PURE__ */ jsx(
|
|
1489
|
+
UIButton,
|
|
1490
|
+
{
|
|
1491
|
+
variant: "text",
|
|
1492
|
+
size: "small",
|
|
1493
|
+
icon: /* @__PURE__ */ jsx(UIIcon, { name: "ArrowLeftOutlined" }),
|
|
1494
|
+
onClick: onBack,
|
|
1495
|
+
style: { padding: "0 4px" }
|
|
1496
|
+
}
|
|
1497
|
+
),
|
|
1498
|
+
breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(
|
|
1499
|
+
UIBreadcrumb,
|
|
1500
|
+
{
|
|
1501
|
+
items: breadcrumbs.map((item) => ({
|
|
1502
|
+
title: item.title,
|
|
1503
|
+
...item.href ? { href: item.href } : {}
|
|
1504
|
+
}))
|
|
1505
|
+
}
|
|
1506
|
+
)
|
|
1507
|
+
]
|
|
1508
|
+
}
|
|
1509
|
+
),
|
|
1510
|
+
/* @__PURE__ */ jsxs(
|
|
1511
|
+
"div",
|
|
1512
|
+
{
|
|
1513
|
+
style: {
|
|
1514
|
+
display: "flex",
|
|
1515
|
+
alignItems: "flex-start",
|
|
1516
|
+
justifyContent: "space-between",
|
|
1517
|
+
gap: token.marginSM
|
|
1518
|
+
},
|
|
1519
|
+
children: [
|
|
1520
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: token.marginSM, minWidth: 0 }, children: [
|
|
1521
|
+
icon && /* @__PURE__ */ jsx(
|
|
1522
|
+
"span",
|
|
1523
|
+
{
|
|
1524
|
+
style: {
|
|
1525
|
+
fontSize: 24,
|
|
1526
|
+
color: token.colorPrimary,
|
|
1527
|
+
flexShrink: 0,
|
|
1528
|
+
display: "flex",
|
|
1529
|
+
alignItems: "center"
|
|
1530
|
+
},
|
|
1531
|
+
children: icon
|
|
1532
|
+
}
|
|
1533
|
+
),
|
|
1534
|
+
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
|
|
1535
|
+
typeof title === "string" ? /* @__PURE__ */ jsx(
|
|
1536
|
+
"h2",
|
|
1537
|
+
{
|
|
1538
|
+
style: {
|
|
1539
|
+
margin: 0,
|
|
1540
|
+
fontSize: token.fontSizeHeading3,
|
|
1541
|
+
fontWeight: token.fontWeightStrong,
|
|
1542
|
+
color: token.colorTextHeading,
|
|
1543
|
+
lineHeight: 1.3
|
|
1544
|
+
},
|
|
1545
|
+
children: title
|
|
1546
|
+
}
|
|
1547
|
+
) : title,
|
|
1548
|
+
description && /* @__PURE__ */ jsx("div", { style: { marginTop: 4 }, children: typeof description === "string" ? /* @__PURE__ */ jsx(UIText, { color: "secondary", size: "sm", children: description }) : description })
|
|
1549
|
+
] })
|
|
1550
|
+
] }),
|
|
1551
|
+
actions && /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: token.marginXS, flexShrink: 0 }, children: actions })
|
|
1552
|
+
]
|
|
1553
|
+
}
|
|
1554
|
+
),
|
|
1555
|
+
children && /* @__PURE__ */ jsx("div", { style: { marginTop: token.marginSM }, children }),
|
|
1556
|
+
hasTabs && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1557
|
+
/* @__PURE__ */ jsx(UIDivider, { style: { marginBottom: 0 } }),
|
|
1558
|
+
tabs
|
|
1559
|
+
] })
|
|
1560
|
+
] });
|
|
1561
|
+
}
|
|
1562
|
+
function UIPageSection({ children, gap = 24, style, ...rest }) {
|
|
1563
|
+
return /* @__PURE__ */ jsx("div", { style: { marginBottom: gap, ...style }, ...rest, children });
|
|
1564
|
+
}
|
|
1565
|
+
function UIAlert({
|
|
1566
|
+
variant = "info",
|
|
1567
|
+
title,
|
|
1568
|
+
message: message2,
|
|
1569
|
+
description,
|
|
1570
|
+
showIcon,
|
|
1571
|
+
closable,
|
|
1572
|
+
onClose,
|
|
1573
|
+
action,
|
|
1574
|
+
icon,
|
|
1575
|
+
className,
|
|
1576
|
+
style
|
|
1577
|
+
}) {
|
|
1578
|
+
return /* @__PURE__ */ jsx(
|
|
1579
|
+
Alert,
|
|
1580
|
+
{
|
|
1581
|
+
type: variant,
|
|
1582
|
+
message: title || message2,
|
|
1583
|
+
description: title ? description || message2 : description,
|
|
1584
|
+
showIcon,
|
|
1585
|
+
closable,
|
|
1586
|
+
onClose,
|
|
1587
|
+
action,
|
|
1588
|
+
icon,
|
|
1589
|
+
className,
|
|
1590
|
+
style
|
|
1591
|
+
}
|
|
1592
|
+
);
|
|
1593
|
+
}
|
|
1594
|
+
var { useToken: useToken15 } = theme;
|
|
1595
|
+
function UIEmptyState({
|
|
1596
|
+
icon,
|
|
1597
|
+
title,
|
|
1598
|
+
description,
|
|
1599
|
+
action,
|
|
1600
|
+
children,
|
|
1601
|
+
useDefaultImage,
|
|
1602
|
+
image,
|
|
1603
|
+
className,
|
|
1604
|
+
style: customStyle
|
|
1605
|
+
}) {
|
|
1606
|
+
const { token } = useToken15();
|
|
1607
|
+
const content = children ?? action;
|
|
1608
|
+
if (useDefaultImage || image !== void 0) {
|
|
1609
|
+
return /* @__PURE__ */ jsx(
|
|
1610
|
+
Empty,
|
|
1611
|
+
{
|
|
1612
|
+
description,
|
|
1613
|
+
image,
|
|
1614
|
+
className,
|
|
1615
|
+
style: customStyle,
|
|
1616
|
+
children: content
|
|
1617
|
+
}
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
const style = {
|
|
1621
|
+
padding: spacing[8],
|
|
1622
|
+
textAlign: "center",
|
|
1623
|
+
...customStyle
|
|
1624
|
+
};
|
|
1625
|
+
return /* @__PURE__ */ jsx(UIBox, { className, style, children: /* @__PURE__ */ jsxs(UIFlex, { direction: "column", align: "center", gap: 3, children: [
|
|
1626
|
+
icon && /* @__PURE__ */ jsx(UIBox, { style: { fontSize: "48px", color: token.colorTextSecondary }, children: icon }),
|
|
1627
|
+
title && /* @__PURE__ */ jsx(UIText, { size: "lg", weight: "semibold", children: title }),
|
|
1628
|
+
description && /* @__PURE__ */ jsx(UIText, { size: "base", color: "secondary", children: description }),
|
|
1629
|
+
content && /* @__PURE__ */ jsx(UIBox, { mt: 2, children: content })
|
|
1630
|
+
] }) });
|
|
1631
|
+
}
|
|
1632
|
+
UIEmptyState.PRESENTED_IMAGE_SIMPLE = Empty.PRESENTED_IMAGE_SIMPLE;
|
|
1633
|
+
UIEmptyState.PRESENTED_IMAGE_DEFAULT = Empty.PRESENTED_IMAGE_DEFAULT;
|
|
1634
|
+
var { useToken: useToken16 } = theme;
|
|
1635
|
+
function UIErrorState({
|
|
1636
|
+
icon,
|
|
1637
|
+
title = "Something went wrong",
|
|
1638
|
+
description,
|
|
1639
|
+
details,
|
|
1640
|
+
showRetry = false,
|
|
1641
|
+
retryText = "Try again",
|
|
1642
|
+
onRetry,
|
|
1643
|
+
action,
|
|
1644
|
+
className,
|
|
1645
|
+
style: customStyle
|
|
1646
|
+
}) {
|
|
1647
|
+
const { token } = useToken16();
|
|
1648
|
+
const style = {
|
|
1649
|
+
padding: spacing[8],
|
|
1650
|
+
textAlign: "center",
|
|
1651
|
+
...customStyle
|
|
1652
|
+
};
|
|
1653
|
+
return /* @__PURE__ */ jsx(UIBox, { className, style, children: /* @__PURE__ */ jsxs(UIFlex, { direction: "column", align: "center", gap: 3, children: [
|
|
1654
|
+
icon && /* @__PURE__ */ jsx(UIBox, { style: { fontSize: "48px", color: token.colorError }, children: icon }),
|
|
1655
|
+
/* @__PURE__ */ jsx(UIText, { size: "lg", weight: "semibold", color: "error", children: title }),
|
|
1656
|
+
description && /* @__PURE__ */ jsx(UIText, { size: "base", color: "secondary", children: description }),
|
|
1657
|
+
details && /* @__PURE__ */ jsx(
|
|
1658
|
+
UIBox,
|
|
1659
|
+
{
|
|
1660
|
+
p: 3,
|
|
1661
|
+
style: {
|
|
1662
|
+
backgroundColor: token.colorErrorBg,
|
|
1663
|
+
borderRadius: token.borderRadius,
|
|
1664
|
+
maxWidth: "600px",
|
|
1665
|
+
width: "100%"
|
|
1666
|
+
},
|
|
1667
|
+
children: /* @__PURE__ */ jsx(UIText, { size: "sm", as: "pre", style: { margin: 0, textAlign: "left", whiteSpace: "pre-wrap" }, children: details })
|
|
1668
|
+
}
|
|
1669
|
+
),
|
|
1670
|
+
(showRetry || action) && /* @__PURE__ */ jsx(UIBox, { mt: 2, children: action || /* @__PURE__ */ jsx(UIButton, { variant: "primary", onClick: onRetry, children: retryText }) })
|
|
1671
|
+
] }) });
|
|
1672
|
+
}
|
|
1673
|
+
function UISkeleton({
|
|
1674
|
+
loading = true,
|
|
1675
|
+
children,
|
|
1676
|
+
avatar,
|
|
1677
|
+
avatarShape = "circle",
|
|
1678
|
+
lines = 3,
|
|
1679
|
+
title = true,
|
|
1680
|
+
active = true,
|
|
1681
|
+
className,
|
|
1682
|
+
style
|
|
1683
|
+
}) {
|
|
1684
|
+
return /* @__PURE__ */ jsx(
|
|
1685
|
+
Skeleton,
|
|
1686
|
+
{
|
|
1687
|
+
loading,
|
|
1688
|
+
avatar: avatar ? { shape: avatarShape } : false,
|
|
1689
|
+
paragraph: { rows: lines },
|
|
1690
|
+
title,
|
|
1691
|
+
active,
|
|
1692
|
+
className,
|
|
1693
|
+
style,
|
|
1694
|
+
children
|
|
1695
|
+
}
|
|
1696
|
+
);
|
|
1697
|
+
}
|
|
1698
|
+
function UISkeletonButton(props) {
|
|
1699
|
+
return /* @__PURE__ */ jsx(Skeleton.Button, { ...props });
|
|
1700
|
+
}
|
|
1701
|
+
function UISkeletonInput(props) {
|
|
1702
|
+
return /* @__PURE__ */ jsx(Skeleton.Input, { ...props });
|
|
1703
|
+
}
|
|
1704
|
+
function UISkeletonImage(props) {
|
|
1705
|
+
return /* @__PURE__ */ jsx(Skeleton.Image, { ...props });
|
|
1706
|
+
}
|
|
1707
|
+
function UISkeletonNode(props) {
|
|
1708
|
+
return /* @__PURE__ */ jsx(Skeleton.Node, { ...props });
|
|
1709
|
+
}
|
|
1710
|
+
function UISkeletonText({
|
|
1711
|
+
width = "100%",
|
|
1712
|
+
height = "1em",
|
|
1713
|
+
gap = 6,
|
|
1714
|
+
className,
|
|
1715
|
+
style
|
|
1716
|
+
}) {
|
|
1717
|
+
const widths = Array.isArray(width) ? width : [width];
|
|
1718
|
+
return /* @__PURE__ */ jsx(
|
|
1719
|
+
"span",
|
|
1720
|
+
{
|
|
1721
|
+
className,
|
|
1722
|
+
style: { display: "inline-flex", flexDirection: "column", gap, ...style },
|
|
1723
|
+
children: widths.map((w, i) => /* @__PURE__ */ jsx(
|
|
1724
|
+
"span",
|
|
1725
|
+
{
|
|
1726
|
+
style: {
|
|
1727
|
+
display: "inline-block",
|
|
1728
|
+
width: w,
|
|
1729
|
+
height,
|
|
1730
|
+
overflow: "hidden",
|
|
1731
|
+
borderRadius: 4,
|
|
1732
|
+
flexShrink: 0
|
|
1733
|
+
},
|
|
1734
|
+
children: /* @__PURE__ */ jsx(
|
|
1735
|
+
Skeleton.Input,
|
|
1736
|
+
{
|
|
1737
|
+
active: true,
|
|
1738
|
+
size: "small",
|
|
1739
|
+
style: {
|
|
1740
|
+
width: "100%",
|
|
1741
|
+
minWidth: "unset",
|
|
1742
|
+
height: "100%",
|
|
1743
|
+
display: "block"
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
)
|
|
1747
|
+
},
|
|
1748
|
+
i
|
|
1749
|
+
))
|
|
1750
|
+
}
|
|
1751
|
+
);
|
|
1752
|
+
}
|
|
1753
|
+
function UISpin(props) {
|
|
1754
|
+
return /* @__PURE__ */ jsx(Spin, { ...props });
|
|
1755
|
+
}
|
|
1756
|
+
function UIResult(props) {
|
|
1757
|
+
return /* @__PURE__ */ jsx(Result, { ...props });
|
|
1758
|
+
}
|
|
1759
|
+
var UIMessage = message;
|
|
1760
|
+
function useUIMessage() {
|
|
1761
|
+
return message.useMessage();
|
|
1762
|
+
}
|
|
1763
|
+
var UINotification = notification;
|
|
1764
|
+
function useUINotification() {
|
|
1765
|
+
return notification.useNotification();
|
|
1766
|
+
}
|
|
1767
|
+
function UIModal({
|
|
1768
|
+
open,
|
|
1769
|
+
title,
|
|
1770
|
+
children,
|
|
1771
|
+
width = "default",
|
|
1772
|
+
closable = true,
|
|
1773
|
+
maskClosable = true,
|
|
1774
|
+
footer,
|
|
1775
|
+
okText,
|
|
1776
|
+
cancelText,
|
|
1777
|
+
confirmLoading,
|
|
1778
|
+
onOk,
|
|
1779
|
+
onCancel,
|
|
1780
|
+
onClose,
|
|
1781
|
+
className,
|
|
1782
|
+
style
|
|
1783
|
+
}) {
|
|
1784
|
+
const widthMap = {
|
|
1785
|
+
small: 416,
|
|
1786
|
+
default: 520,
|
|
1787
|
+
large: 800,
|
|
1788
|
+
full: window.innerWidth - 64
|
|
1789
|
+
};
|
|
1790
|
+
const modalWidth = typeof width === "number" ? width : widthMap[width];
|
|
1791
|
+
return /* @__PURE__ */ jsx(
|
|
1792
|
+
Modal,
|
|
1793
|
+
{
|
|
1794
|
+
open,
|
|
1795
|
+
title,
|
|
1796
|
+
width: modalWidth,
|
|
1797
|
+
closable,
|
|
1798
|
+
maskClosable,
|
|
1799
|
+
footer,
|
|
1800
|
+
okText,
|
|
1801
|
+
cancelText,
|
|
1802
|
+
confirmLoading,
|
|
1803
|
+
onOk,
|
|
1804
|
+
onCancel: onCancel || onClose,
|
|
1805
|
+
className,
|
|
1806
|
+
style,
|
|
1807
|
+
children
|
|
1808
|
+
}
|
|
1809
|
+
);
|
|
1810
|
+
}
|
|
1811
|
+
var UIModalConfirm = Modal.confirm;
|
|
1812
|
+
var UIModalInfo = Modal.info;
|
|
1813
|
+
var UIModalSuccess = Modal.success;
|
|
1814
|
+
var UIModalError = Modal.error;
|
|
1815
|
+
var UIModalWarning = Modal.warning;
|
|
1816
|
+
function UITooltip({
|
|
1817
|
+
title,
|
|
1818
|
+
children,
|
|
1819
|
+
placement = "top",
|
|
1820
|
+
arrow = true,
|
|
1821
|
+
trigger = "hover",
|
|
1822
|
+
open,
|
|
1823
|
+
className
|
|
1824
|
+
}) {
|
|
1825
|
+
return /* @__PURE__ */ jsx(
|
|
1826
|
+
Tooltip,
|
|
1827
|
+
{
|
|
1828
|
+
title,
|
|
1829
|
+
placement,
|
|
1830
|
+
arrow,
|
|
1831
|
+
trigger,
|
|
1832
|
+
open,
|
|
1833
|
+
className,
|
|
1834
|
+
children
|
|
1835
|
+
}
|
|
1836
|
+
);
|
|
1837
|
+
}
|
|
1838
|
+
function UIDrawer(props) {
|
|
1839
|
+
return /* @__PURE__ */ jsx(Drawer, { ...props });
|
|
1840
|
+
}
|
|
1841
|
+
function UIPopconfirm(props) {
|
|
1842
|
+
return /* @__PURE__ */ jsx(Popconfirm, { ...props });
|
|
1843
|
+
}
|
|
1844
|
+
function UIPopover(props) {
|
|
1845
|
+
return /* @__PURE__ */ jsx(Popover, { ...props });
|
|
1846
|
+
}
|
|
1847
|
+
var { useToken: useToken17 } = theme;
|
|
1848
|
+
function UIMarkdownViewer({
|
|
1849
|
+
content,
|
|
1850
|
+
className,
|
|
1851
|
+
style: customStyle
|
|
1852
|
+
}) {
|
|
1853
|
+
const { token } = useToken17();
|
|
1854
|
+
const style = {
|
|
1855
|
+
padding: token.padding,
|
|
1856
|
+
backgroundColor: token.colorBgContainer,
|
|
1857
|
+
borderRadius: token.borderRadius,
|
|
1858
|
+
border: `1px solid ${token.colorBorder}`,
|
|
1859
|
+
lineHeight: 1.6,
|
|
1860
|
+
...customStyle
|
|
1861
|
+
};
|
|
1862
|
+
const markdownStyles = {
|
|
1863
|
+
fontFamily: token.fontFamily,
|
|
1864
|
+
fontSize: token.fontSize,
|
|
1865
|
+
color: token.colorText
|
|
1866
|
+
};
|
|
1867
|
+
return /* @__PURE__ */ jsx(UIBox, { className, style, children: /* @__PURE__ */ jsx(
|
|
1868
|
+
"div",
|
|
1869
|
+
{
|
|
1870
|
+
style: markdownStyles,
|
|
1871
|
+
dangerouslySetInnerHTML: { __html: convertBasicMarkdown(content) }
|
|
1872
|
+
}
|
|
1873
|
+
) });
|
|
1874
|
+
}
|
|
1875
|
+
function convertBasicMarkdown(markdown) {
|
|
1876
|
+
let html = markdown;
|
|
1877
|
+
html = html.replace(/^### (.*$)/gim, "<h3>$1</h3>");
|
|
1878
|
+
html = html.replace(/^## (.*$)/gim, "<h2>$1</h2>");
|
|
1879
|
+
html = html.replace(/^# (.*$)/gim, "<h1>$1</h1>");
|
|
1880
|
+
html = html.replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>");
|
|
1881
|
+
html = html.replace(/\*(.*?)\*/g, "<em>$1</em>");
|
|
1882
|
+
html = html.replace(/`(.*?)`/g, "<code>$1</code>");
|
|
1883
|
+
html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
|
|
1884
|
+
html = html.replace(/\n/g, "<br />");
|
|
1885
|
+
return html;
|
|
1886
|
+
}
|
|
1887
|
+
var { useToken: useToken18 } = theme;
|
|
1888
|
+
function UIJsonViewer({
|
|
1889
|
+
data,
|
|
1890
|
+
collapsed: _collapsed = false,
|
|
1891
|
+
indent = 2,
|
|
1892
|
+
showLineNumbers = false,
|
|
1893
|
+
className,
|
|
1894
|
+
style: customStyle
|
|
1895
|
+
}) {
|
|
1896
|
+
const { token } = useToken18();
|
|
1897
|
+
const jsonString = React3.useMemo(() => {
|
|
1898
|
+
try {
|
|
1899
|
+
return JSON.stringify(data, null, indent);
|
|
1900
|
+
} catch (error) {
|
|
1901
|
+
return `Error: ${error instanceof Error ? error.message : "Invalid JSON"}`;
|
|
1902
|
+
}
|
|
1903
|
+
}, [data, indent]);
|
|
1904
|
+
const lines = jsonString.split("\n");
|
|
1905
|
+
const style = {
|
|
1906
|
+
backgroundColor: token.colorBgContainer,
|
|
1907
|
+
borderRadius: token.borderRadius,
|
|
1908
|
+
border: `1px solid ${token.colorBorder}`,
|
|
1909
|
+
overflow: "auto",
|
|
1910
|
+
maxHeight: "600px",
|
|
1911
|
+
...customStyle
|
|
1912
|
+
};
|
|
1913
|
+
const codeStyle = {
|
|
1914
|
+
display: "block",
|
|
1915
|
+
fontFamily: 'Consolas, Monaco, "Courier New", monospace',
|
|
1916
|
+
fontSize: "13px",
|
|
1917
|
+
lineHeight: "1.6",
|
|
1918
|
+
padding: token.padding,
|
|
1919
|
+
margin: 0,
|
|
1920
|
+
whiteSpace: "pre",
|
|
1921
|
+
color: token.colorText
|
|
1922
|
+
};
|
|
1923
|
+
const lineNumberStyle = {
|
|
1924
|
+
display: "inline-block",
|
|
1925
|
+
width: "40px",
|
|
1926
|
+
color: token.colorTextSecondary,
|
|
1927
|
+
userSelect: "none",
|
|
1928
|
+
textAlign: "right",
|
|
1929
|
+
marginRight: token.marginSM
|
|
1930
|
+
};
|
|
1931
|
+
const highlightedJson = highlightJson(jsonString, token);
|
|
1932
|
+
return /* @__PURE__ */ jsx(UIBox, { className, style, children: /* @__PURE__ */ jsx("pre", { style: codeStyle, children: showLineNumbers ? lines.map((line, index) => /* @__PURE__ */ jsxs("div", { children: [
|
|
1933
|
+
/* @__PURE__ */ jsx("span", { style: lineNumberStyle, children: index + 1 }),
|
|
1934
|
+
/* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: highlightJson(line, token) } })
|
|
1935
|
+
] }, index)) : /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: highlightedJson } }) }) });
|
|
1936
|
+
}
|
|
1937
|
+
function highlightJson(json, token) {
|
|
1938
|
+
json = json.replace(/"([^"]+)":/g, `<span style="color: ${token.colorPrimary}">"$1"</span>:`);
|
|
1939
|
+
json = json.replace(/: "([^"]*)"/g, `: <span style="color: ${token.colorSuccess}">"$1"</span>`);
|
|
1940
|
+
json = json.replace(/: (\d+)/g, `: <span style="color: ${token.colorWarning}">$1</span>`);
|
|
1941
|
+
json = json.replace(/: (true|false)/g, `: <span style="color: ${token.colorInfo}">$1</span>`);
|
|
1942
|
+
json = json.replace(/: (null)/g, `: <span style="color: ${token.colorTextSecondary}">$1</span>`);
|
|
1943
|
+
return json;
|
|
1944
|
+
}
|
|
1945
|
+
function getLineType(line) {
|
|
1946
|
+
if (line.startsWith("@@")) {
|
|
1947
|
+
return "header";
|
|
1948
|
+
}
|
|
1949
|
+
if (line.startsWith("+")) {
|
|
1950
|
+
return "add";
|
|
1951
|
+
}
|
|
1952
|
+
if (line.startsWith("-")) {
|
|
1953
|
+
return "remove";
|
|
1954
|
+
}
|
|
1955
|
+
return "context";
|
|
1956
|
+
}
|
|
1957
|
+
var LINE_STYLES = {
|
|
1958
|
+
add: { bg: "rgba(22, 163, 74, 0.12)", border: "var(--success, #16a34a)", color: "var(--success, #16a34a)" },
|
|
1959
|
+
remove: { bg: "rgba(220, 38, 38, 0.12)", border: "var(--error, #dc2626)", color: "var(--error, #dc2626)" },
|
|
1960
|
+
header: { bg: "var(--bg-tertiary, rgba(0,0,0,0.04))", border: "transparent", color: "var(--text-secondary, #6b7280)" },
|
|
1961
|
+
context: { bg: "transparent", border: "transparent", color: "inherit" }
|
|
1962
|
+
};
|
|
1963
|
+
function UIDiffViewer({
|
|
1964
|
+
diff,
|
|
1965
|
+
showLineNumbers = true,
|
|
1966
|
+
maxHeight = 500,
|
|
1967
|
+
className,
|
|
1968
|
+
style
|
|
1969
|
+
}) {
|
|
1970
|
+
if (!diff || diff.trim() === "") {
|
|
1971
|
+
return /* @__PURE__ */ jsx("div", { style: { padding: 16, textAlign: "center" }, children: /* @__PURE__ */ jsx(UITypographyText, { type: "secondary", children: "No changes to display" }) });
|
|
1972
|
+
}
|
|
1973
|
+
const lines = diff.split("\n");
|
|
1974
|
+
return /* @__PURE__ */ jsx(
|
|
1975
|
+
"div",
|
|
1976
|
+
{
|
|
1977
|
+
className,
|
|
1978
|
+
style: {
|
|
1979
|
+
background: "var(--bg-tertiary, rgba(0,0,0,0.02))",
|
|
1980
|
+
border: "1px solid var(--border-primary, rgba(0,0,0,0.1))",
|
|
1981
|
+
borderRadius: "var(--radius-md, 6px)",
|
|
1982
|
+
fontFamily: 'Monaco, Menlo, "Courier New", monospace',
|
|
1983
|
+
fontSize: 13,
|
|
1984
|
+
lineHeight: 1.5,
|
|
1985
|
+
maxHeight,
|
|
1986
|
+
overflow: "auto",
|
|
1987
|
+
...style
|
|
1988
|
+
},
|
|
1989
|
+
children: lines.map((line, i) => {
|
|
1990
|
+
const type = getLineType(line);
|
|
1991
|
+
const s = LINE_STYLES[type];
|
|
1992
|
+
const hasLeftBorder = type === "add" || type === "remove";
|
|
1993
|
+
return /* @__PURE__ */ jsxs(
|
|
1994
|
+
"div",
|
|
1995
|
+
{
|
|
1996
|
+
style: {
|
|
1997
|
+
display: "flex",
|
|
1998
|
+
background: s.bg,
|
|
1999
|
+
borderLeft: hasLeftBorder ? `3px solid ${s.border}` : "none",
|
|
2000
|
+
paddingLeft: hasLeftBorder ? 8 : 11
|
|
2001
|
+
},
|
|
2002
|
+
children: [
|
|
2003
|
+
showLineNumbers && /* @__PURE__ */ jsx(
|
|
2004
|
+
"span",
|
|
2005
|
+
{
|
|
2006
|
+
style: {
|
|
2007
|
+
minWidth: 44,
|
|
2008
|
+
textAlign: "right",
|
|
2009
|
+
paddingRight: 12,
|
|
2010
|
+
userSelect: "none",
|
|
2011
|
+
color: "var(--text-secondary, #6c757d)",
|
|
2012
|
+
fontSize: 12
|
|
2013
|
+
},
|
|
2014
|
+
children: i + 1
|
|
2015
|
+
}
|
|
2016
|
+
),
|
|
2017
|
+
/* @__PURE__ */ jsx("pre", { style: { margin: 0, padding: 0, color: s.color, whiteSpace: "pre", flex: 1 }, children: line })
|
|
2018
|
+
]
|
|
2019
|
+
},
|
|
2020
|
+
i
|
|
2021
|
+
);
|
|
2022
|
+
})
|
|
2023
|
+
}
|
|
2024
|
+
);
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
export { UIAccordion, UIAlert, UIAreaChart, UIAvatar, UIAvatarGroup, UIBadge, UIBarChart, UIBox, UIBreadcrumb, UIButton, UICard, UICheckbox, UICheckboxGroup, UICol, UIColumnChart, UIDatePicker, UIDescriptions, UIDescriptionsItem, UIDiffViewer, UIDivider, UIDrawer, UIDropdown, UIDropdownButton, UIEmptyState, UIErrorState, UIFlex, UIForm, UIFormItem, UIFormList, UIHeader, UIIcon, UIIconButton, UIInput, UIInputNumber, UIInputPassword, UIInputSearch, UIInputTextArea, UIJsonViewer, UILineChart, UIList, UIListItem, UIListItemMeta, UIMarkdownViewer, UIMenu, UIMessage, UIMetricCard, UIModal, UIModalConfirm, UIModalError, UIModalInfo, UIModalSuccess, UIModalWarning, UINotification, UIPage, UIPageHeader, UIPageSection, UIPieChart, UIPopconfirm, UIPopover, UIProgress, UIRadio, UIRadioGroup, UIRangePicker, UIResult, UIRow, UISegmented, UISelect, UIShimmerText, UISkeleton, UISkeletonButton, UISkeletonImage, UISkeletonInput, UISkeletonNode, UISkeletonText, UISlider, UISpace, UISpaceCompact, UISpin, UIStack, UIStatistic, UIStatisticCountdown, UIStatisticsChart, UISteps, UISwitch, UITable, UITabs, UITag, UIText, UITimePicker, UITimeline, UITimelineItem, UITitle, UITooltip, UITree, UITreeDirectoryTree, UITreeNode, UITypographyLink, UITypographyParagraph, UITypographyText, UIUpload, UIUploadDragger, createFillFunction, registerIconRenderer, useChartColors, useUIForm, useUIMessage, useUINotification, useUITheme };
|
|
2028
|
+
//# sourceMappingURL=index.js.map
|
|
2029
|
+
//# sourceMappingURL=index.js.map
|