@svadmin/ui 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component-registry.svelte.d.ts +2 -0
- package/dist/components/AdminApp.svelte +8 -2
- package/dist/components/AdminApp.svelte.d.ts +2 -1
- package/dist/components/AutoTable.svelte +50 -39
- package/dist/components/CancelTaskButton.svelte +60 -0
- package/dist/components/CancelTaskButton.svelte.d.ts +13 -0
- package/dist/components/Layout.svelte +13 -2
- package/dist/components/RetryTaskButton.svelte +60 -0
- package/dist/components/RetryTaskButton.svelte.d.ts +13 -0
- package/dist/components/TaskDetails.svelte +138 -0
- package/dist/components/TaskDetails.svelte.d.ts +19 -0
- package/dist/components/TaskList.svelte +150 -0
- package/dist/components/TaskList.svelte.d.ts +24 -0
- package/dist/components/TaskProgressBar.svelte +25 -0
- package/dist/components/TaskProgressBar.svelte.d.ts +8 -0
- package/dist/components/TaskQueueDrawer.svelte +318 -113
- package/dist/components/TaskQueueDrawer.svelte.d.ts +6 -6
- package/dist/components/TaskQueueDrawer.test.svelte.d.ts +1 -0
- package/dist/components/TaskQueueDrawer.test.svelte.js +143 -0
- package/dist/components/TaskStatusBadge.svelte +78 -0
- package/dist/components/TaskStatusBadge.svelte.d.ts +8 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -0
- package/dist/types.d.ts +0 -11
- package/package.json +18 -12
- package/src/app.css +0 -674
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { t } from '@svadmin/core/i18n';
|
|
3
|
+
import { Clock3, Loader2, CheckCircle2, AlertTriangle, CircleDashed } from '@lucide/svelte';
|
|
4
|
+
import { Badge } from './ui/badge/index.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
status = 'pending',
|
|
8
|
+
showIcon = true,
|
|
9
|
+
class: className = '',
|
|
10
|
+
} = $props<{
|
|
11
|
+
status?: string;
|
|
12
|
+
showIcon?: boolean;
|
|
13
|
+
class?: string;
|
|
14
|
+
}>();
|
|
15
|
+
|
|
16
|
+
const normalizedStatus = $derived(String(status || 'pending').toLowerCase());
|
|
17
|
+
|
|
18
|
+
function translateStatus(value: string) {
|
|
19
|
+
const key = `task.status.${value}`;
|
|
20
|
+
const translated = t(key);
|
|
21
|
+
if (translated !== key) return translated;
|
|
22
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const config = $derived.by(() => {
|
|
26
|
+
switch (normalizedStatus) {
|
|
27
|
+
case 'running':
|
|
28
|
+
case 'processing':
|
|
29
|
+
return {
|
|
30
|
+
label: translateStatus(normalizedStatus),
|
|
31
|
+
variant: 'default' as const,
|
|
32
|
+
icon: Loader2,
|
|
33
|
+
iconClass: 'animate-spin',
|
|
34
|
+
};
|
|
35
|
+
case 'completed':
|
|
36
|
+
case 'success':
|
|
37
|
+
case 'done':
|
|
38
|
+
return {
|
|
39
|
+
label: translateStatus(normalizedStatus),
|
|
40
|
+
variant: 'secondary' as const,
|
|
41
|
+
icon: CheckCircle2,
|
|
42
|
+
iconClass: 'text-green-600 dark:text-green-400',
|
|
43
|
+
};
|
|
44
|
+
case 'failed':
|
|
45
|
+
case 'error':
|
|
46
|
+
return {
|
|
47
|
+
label: translateStatus(normalizedStatus),
|
|
48
|
+
variant: 'destructive' as const,
|
|
49
|
+
icon: AlertTriangle,
|
|
50
|
+
iconClass: '',
|
|
51
|
+
};
|
|
52
|
+
case 'queued':
|
|
53
|
+
return {
|
|
54
|
+
label: t('task.status.queued'),
|
|
55
|
+
variant: 'outline' as const,
|
|
56
|
+
icon: CircleDashed,
|
|
57
|
+
iconClass: '',
|
|
58
|
+
};
|
|
59
|
+
case 'pending':
|
|
60
|
+
default:
|
|
61
|
+
return {
|
|
62
|
+
label: translateStatus(normalizedStatus),
|
|
63
|
+
variant: 'outline' as const,
|
|
64
|
+
icon: Clock3,
|
|
65
|
+
iconClass: '',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const Icon = $derived(config.icon);
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<Badge variant={config.variant} class={`gap-1.5 ${className}`.trim()}>
|
|
74
|
+
{#if showIcon}
|
|
75
|
+
<Icon class={`h-3.5 w-3.5 ${config.iconClass}`.trim()} />
|
|
76
|
+
{/if}
|
|
77
|
+
<span>{config.label}</span>
|
|
78
|
+
</Badge>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
status?: string;
|
|
3
|
+
showIcon?: boolean;
|
|
4
|
+
class?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const TaskStatusBadge: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type TaskStatusBadge = ReturnType<typeof TaskStatusBadge>;
|
|
8
|
+
export default TaskStatusBadge;
|
package/dist/index.d.ts
CHANGED
|
@@ -66,7 +66,12 @@ export { default as AuditLogViewer } from "./components/AuditLogViewer.svelte";
|
|
|
66
66
|
export { default as TenantSwitcher } from "./components/TenantSwitcher.svelte";
|
|
67
67
|
export type { Tenant } from "./types.js";
|
|
68
68
|
export { default as TaskQueueDrawer } from "./components/TaskQueueDrawer.svelte";
|
|
69
|
-
export
|
|
69
|
+
export { default as TaskStatusBadge } from "./components/TaskStatusBadge.svelte";
|
|
70
|
+
export { default as TaskProgressBar } from "./components/TaskProgressBar.svelte";
|
|
71
|
+
export { default as TaskList } from "./components/TaskList.svelte";
|
|
72
|
+
export { default as TaskDetails } from "./components/TaskDetails.svelte";
|
|
73
|
+
export { default as RetryTaskButton } from "./components/RetryTaskButton.svelte";
|
|
74
|
+
export { default as CancelTaskButton } from "./components/CancelTaskButton.svelte";
|
|
70
75
|
export { default as DraggableGrid } from "./components/DraggableGrid.svelte";
|
|
71
76
|
export type { GridModule } from "./types.js";
|
|
72
77
|
export { BarChart, LineChart, PieChart } from './components/charts/index.js';
|
package/dist/index.js
CHANGED
|
@@ -69,6 +69,12 @@ export { default as RolesSettings } from "./components/RolesSettings.svelte";
|
|
|
69
69
|
export { default as AuditLogViewer } from "./components/AuditLogViewer.svelte";
|
|
70
70
|
export { default as TenantSwitcher } from "./components/TenantSwitcher.svelte";
|
|
71
71
|
export { default as TaskQueueDrawer } from "./components/TaskQueueDrawer.svelte";
|
|
72
|
+
export { default as TaskStatusBadge } from "./components/TaskStatusBadge.svelte";
|
|
73
|
+
export { default as TaskProgressBar } from "./components/TaskProgressBar.svelte";
|
|
74
|
+
export { default as TaskList } from "./components/TaskList.svelte";
|
|
75
|
+
export { default as TaskDetails } from "./components/TaskDetails.svelte";
|
|
76
|
+
export { default as RetryTaskButton } from "./components/RetryTaskButton.svelte";
|
|
77
|
+
export { default as CancelTaskButton } from "./components/CancelTaskButton.svelte";
|
|
72
78
|
export { default as DraggableGrid } from "./components/DraggableGrid.svelte";
|
|
73
79
|
// Dashboard Charts (zero-dependency SVG)
|
|
74
80
|
export { BarChart, LineChart, PieChart } from './components/charts/index.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -20,17 +20,6 @@ export interface Tenant {
|
|
|
20
20
|
logo?: string;
|
|
21
21
|
[key: string]: unknown;
|
|
22
22
|
}
|
|
23
|
-
export type TaskStatus = 'pending' | 'running' | 'completed' | 'failed';
|
|
24
|
-
export interface BackgroundTask {
|
|
25
|
-
id: string;
|
|
26
|
-
title: string;
|
|
27
|
-
status: TaskStatus;
|
|
28
|
-
progress?: number;
|
|
29
|
-
message?: string;
|
|
30
|
-
createdAt: string | Date;
|
|
31
|
-
downloadUrl?: string;
|
|
32
|
-
[key: string]: unknown;
|
|
33
|
-
}
|
|
34
23
|
export interface GridModule {
|
|
35
24
|
id: string;
|
|
36
25
|
w: number;
|
package/package.json
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
7
|
-
"./
|
|
7
|
+
"./dist/app.css"
|
|
8
8
|
],
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
"src/app.css"
|
|
10
|
+
"dist"
|
|
12
11
|
],
|
|
13
12
|
"main": "dist/index.js",
|
|
14
13
|
"types": "dist/index.d.ts",
|
|
15
14
|
"exports": {
|
|
16
15
|
".": {
|
|
17
16
|
"types": "./dist/index.d.ts",
|
|
18
|
-
"svelte": "./
|
|
17
|
+
"svelte": "./dist/index.js",
|
|
19
18
|
"default": "./dist/index.js"
|
|
20
19
|
},
|
|
21
20
|
"./app.css": {
|
|
22
|
-
"svelte": "./
|
|
23
|
-
"import": "./
|
|
24
|
-
"style": "./
|
|
25
|
-
"default": "./
|
|
21
|
+
"svelte": "./dist/app.css",
|
|
22
|
+
"import": "./dist/app.css",
|
|
23
|
+
"style": "./dist/app.css",
|
|
24
|
+
"default": "./dist/app.css"
|
|
26
25
|
},
|
|
27
26
|
"./components/*": "./dist/components/*"
|
|
28
27
|
},
|
|
29
28
|
"peerDependencies": {
|
|
30
|
-
"@svadmin/core": "^0.
|
|
29
|
+
"@svadmin/core": "^0.25.0",
|
|
31
30
|
"@tanstack/svelte-query": "^6.0.0",
|
|
32
31
|
"highlight.js": "^11.11.1",
|
|
33
32
|
"isomorphic-dompurify": "^3.7.1",
|
|
@@ -83,9 +82,16 @@
|
|
|
83
82
|
"url": "https://github.com/zuohuadong/svadmin/issues"
|
|
84
83
|
},
|
|
85
84
|
"devDependencies": {
|
|
86
|
-
"@
|
|
85
|
+
"@happy-dom/global-registrator": "^20.9.0",
|
|
86
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
87
|
+
"@testing-library/dom": "^10.4.1",
|
|
88
|
+
"@testing-library/svelte": "^5.3.1",
|
|
89
|
+
"@testing-library/user-event": "^14.6.1",
|
|
90
|
+
"happy-dom": "^20.9.0",
|
|
91
|
+
"vitest": "^4.1.4"
|
|
87
92
|
},
|
|
88
93
|
"scripts": {
|
|
89
|
-
"build": "svelte-package -i src -o dist"
|
|
94
|
+
"build": "svelte-package -i src -o dist",
|
|
95
|
+
"test": "vitest run --config ./vitest.config.ts"
|
|
90
96
|
}
|
|
91
97
|
}
|