@svadmin/ui 0.26.1 → 0.26.3
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/package.json +7 -7
- package/src/components/AutoTable.svelte +12 -1
- package/src/components/ListPage.svelte +1 -1
- package/src/components/MarkdownRenderer.svelte +3 -2
- package/src/components/RolesSettings.svelte +4 -2
- package/src/components/Toast.svelte +14 -12
- package/src/components/TooltipButton.svelte +2 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/ui",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.3",
|
|
4
4
|
"description": "Pre-built admin UI components — AdminApp, AutoTable, AutoForm, Sidebar, Layout",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@lucide/svelte": "^
|
|
52
|
+
"@lucide/svelte": "^1.7.0",
|
|
53
53
|
"@tanstack/svelte-table": "^9.0.0-alpha.10",
|
|
54
|
-
"bits-ui": "^2.
|
|
55
|
-
"clsx": "^2.
|
|
54
|
+
"bits-ui": "^2.16.5",
|
|
55
|
+
"clsx": "^2.1.1",
|
|
56
56
|
"cmdk-sv": "^0.0.19",
|
|
57
|
-
"lucide-svelte": "^0.
|
|
57
|
+
"lucide-svelte": "^1.0.1",
|
|
58
58
|
"sonner-svelte": "^0.3.3",
|
|
59
|
-
"tailwind-merge": "^3.
|
|
60
|
-
"tailwind-variants": "^3.
|
|
59
|
+
"tailwind-merge": "^3.5.0",
|
|
60
|
+
"tailwind-variants": "^3.2.2"
|
|
61
61
|
},
|
|
62
62
|
"license": "MIT",
|
|
63
63
|
"author": "zuohuadong",
|
|
@@ -120,7 +120,18 @@
|
|
|
120
120
|
const activeFilters = $derived.by(() => {
|
|
121
121
|
const result: Filter[] = [...filters];
|
|
122
122
|
if (searchText.trim() && searchableFields.length > 0) {
|
|
123
|
-
|
|
123
|
+
if (searchableFields.length === 1) {
|
|
124
|
+
result.push({ field: searchableFields[0].key, operator: 'contains', value: searchText });
|
|
125
|
+
} else {
|
|
126
|
+
result.push({
|
|
127
|
+
operator: 'or',
|
|
128
|
+
value: searchableFields.map(f => ({
|
|
129
|
+
field: f.key,
|
|
130
|
+
operator: 'contains',
|
|
131
|
+
value: searchText
|
|
132
|
+
}))
|
|
133
|
+
} as any);
|
|
134
|
+
}
|
|
124
135
|
}
|
|
125
136
|
// Add popover filters
|
|
126
137
|
for (const [key, value] of Object.entries(filterValues)) {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
// Only safely import css if hljs exists
|
|
15
15
|
if (hljsModule && Object.keys(hljsModule).length > 0) {
|
|
16
|
+
// @ts-ignore
|
|
16
17
|
import("highlight.js/styles/github-dark.css").catch(() => {});
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
|
|
28
29
|
let { content, streaming = false, class: className = "" }: Props = $props();
|
|
29
30
|
|
|
30
|
-
const hasMarkdownDeps = !!(Marked &&
|
|
31
|
+
const hasMarkdownDeps = !!(Marked && Object.keys(DOMPurify || {}).length > 0);
|
|
31
32
|
|
|
32
33
|
// Configure marked with syntax highlighting if available
|
|
33
34
|
const markedObj = hasMarkdownDeps ? new Marked(
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
// Render HTML safely
|
|
44
45
|
const html = $derived(
|
|
45
46
|
hasMarkdownDeps
|
|
46
|
-
? DOMPurify.sanitize(markedObj
|
|
47
|
+
? DOMPurify.sanitize(markedObj!.parse(content || "") as string)
|
|
47
48
|
: `<div style="white-space: pre-wrap">${String(content || "").replace(/</g, "<").replace(/>/g, ">")}</div>`
|
|
48
49
|
);
|
|
49
50
|
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import { t } from '@svadmin/core/i18n';
|
|
3
3
|
import { getAuthProvider, getResources } from '@svadmin/core';
|
|
4
4
|
import type { Role } from '@svadmin/core';
|
|
5
|
-
import PermissionMatrix
|
|
5
|
+
import PermissionMatrix from './PermissionMatrix.svelte';
|
|
6
|
+
import type { RoleInfo, ResourceInfo, ActionInfo } from '../types.js';
|
|
6
7
|
import { toast } from '@svadmin/core/toast';
|
|
8
|
+
import { AlertCircle } from 'lucide-svelte';
|
|
7
9
|
|
|
8
10
|
const authProvider = getAuthProvider();
|
|
9
11
|
const rawResources = getResources();
|
|
@@ -42,7 +44,7 @@
|
|
|
42
44
|
}
|
|
43
45
|
try {
|
|
44
46
|
const fetchedRoles = await authProvider.getRoles();
|
|
45
|
-
roles = fetchedRoles.map(r => ({ code: r.id,
|
|
47
|
+
roles = fetchedRoles.map(r => ({ code: r.id, ...r }));
|
|
46
48
|
if (roles.length > 0 && !selectedRoleCode) {
|
|
47
49
|
selectedRoleCode = roles[0].code;
|
|
48
50
|
}
|
|
@@ -28,17 +28,19 @@
|
|
|
28
28
|
consumePromiseQueue();
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
|
|
32
|
+
const toasterProps = $derived({
|
|
33
|
+
position: "top-right",
|
|
34
|
+
richColors: true,
|
|
35
|
+
closeButton: true,
|
|
36
|
+
expand: true,
|
|
37
|
+
theme,
|
|
38
|
+
toastOptions: {
|
|
39
|
+
classes: {
|
|
40
|
+
toast: 'font-sans',
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
} as any);
|
|
31
44
|
</script>
|
|
32
45
|
|
|
33
|
-
<Toaster
|
|
34
|
-
position="top-right"
|
|
35
|
-
richColors
|
|
36
|
-
closeButton
|
|
37
|
-
expand
|
|
38
|
-
{theme}
|
|
39
|
-
toastOptions={{
|
|
40
|
-
classes: {
|
|
41
|
-
toast: 'font-sans',
|
|
42
|
-
},
|
|
43
|
-
}}
|
|
44
|
-
/>
|
|
46
|
+
<Toaster {...toasterProps} />
|
|
@@ -32,18 +32,8 @@
|
|
|
32
32
|
<Tooltip.Root>
|
|
33
33
|
<Tooltip.Trigger>
|
|
34
34
|
{#snippet child({ props })}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{...restProps}
|
|
38
|
-
{variant}
|
|
39
|
-
{size}
|
|
40
|
-
{type}
|
|
41
|
-
class={className}
|
|
42
|
-
aria-label={restProps['aria-label'] ?? tooltip}
|
|
43
|
-
{onclick}
|
|
44
|
-
{disabled}
|
|
45
|
-
{tabindex}
|
|
46
|
-
>
|
|
35
|
+
{@const buttonProps = { ...props, ...restProps, variant, size, type, class: className, 'aria-label': restProps['aria-label'] ?? tooltip, onclick, disabled, tabindex } as any}
|
|
36
|
+
<Button {...buttonProps}>
|
|
47
37
|
{@render children()}
|
|
48
38
|
</Button>
|
|
49
39
|
{/snippet}
|