@svadmin/ui 0.41.0 → 0.41.1
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.
|
@@ -262,10 +262,12 @@
|
|
|
262
262
|
const acEnabled = $derived(!!adminContext.accessControlProvider);
|
|
263
263
|
const canCreatePerm = useCan(() => ({ resource: resourceName, action: 'create', queryOptions: { enabled: acEnabled } }));
|
|
264
264
|
const canEditPerm = useCan(() => ({ resource: resourceName, action: 'edit', queryOptions: { enabled: acEnabled } }));
|
|
265
|
+
const canShowPerm = useCan(() => ({ resource: resourceName, action: 'show', queryOptions: { enabled: acEnabled } }));
|
|
265
266
|
const canDeletePerm = useCan(() => ({ resource: resourceName, action: 'delete', queryOptions: { enabled: acEnabled } }));
|
|
266
267
|
const canExportPerm = useCan(() => ({ resource: resourceName, action: 'export', queryOptions: { enabled: acEnabled } }));
|
|
267
268
|
const canCreate = $derived(canCreatePerm.allowed && resource.canCreate !== false);
|
|
268
269
|
const canEdit = $derived(canEditPerm.allowed && resource.canEdit !== false);
|
|
270
|
+
const canShow = $derived(canShowPerm.allowed && resource.canShow !== false);
|
|
269
271
|
const canDelete = $derived(canDeletePerm.allowed && resource.canDelete !== false);
|
|
270
272
|
const canExport = $derived(canExportPerm.allowed);
|
|
271
273
|
|
|
@@ -837,9 +839,11 @@
|
|
|
837
839
|
<Pencil class="h-4 w-4" /> {i18n.t('common.edit')}
|
|
838
840
|
</ContextMenu.Item>
|
|
839
841
|
{/if}
|
|
840
|
-
|
|
841
|
-
<
|
|
842
|
-
|
|
842
|
+
{#if canShow}
|
|
843
|
+
<ContextMenu.Item onclick={() => adminContext.navigate(`/${resourceName}/show/${id}`)} class="gap-2">
|
|
844
|
+
<Eye class="h-4 w-4" /> {i18n.t('common.detail')}
|
|
845
|
+
</ContextMenu.Item>
|
|
846
|
+
{/if}
|
|
843
847
|
<ContextMenu.Item onclick={() => navigator.clipboard?.writeText(String(id))} class="gap-2">
|
|
844
848
|
<Copy class="h-4 w-4" /> {i18n.t('common.copyId')}
|
|
845
849
|
</ContextMenu.Item>
|
|
@@ -913,9 +917,11 @@
|
|
|
913
917
|
<Pencil class="h-4 w-4" />
|
|
914
918
|
</TooltipButton>
|
|
915
919
|
{/if}
|
|
916
|
-
|
|
917
|
-
<
|
|
918
|
-
|
|
920
|
+
{#if canShow}
|
|
921
|
+
<TooltipButton tooltip={i18n.t('common.detail')} variant="ghost" size="icon-sm" onclick={() => adminContext.navigate(`/${resourceName}/show/${id}`)}>
|
|
922
|
+
<Eye class="h-4 w-4" />
|
|
923
|
+
</TooltipButton>
|
|
924
|
+
{/if}
|
|
919
925
|
{#if canDelete}
|
|
920
926
|
<TooltipButton tooltip={i18n.t('common.delete')} variant="ghost" size="icon-sm" onclick={() => confirmDelete(id)} class="hover:text-destructive">
|
|
921
927
|
<Trash2 class="h-4 w-4" />
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import {
|
|
6
6
|
captureAdminContext,
|
|
7
7
|
getColorTheme,
|
|
8
|
-
getResources,
|
|
9
8
|
getTheme,
|
|
10
9
|
} from '@svadmin/core';
|
|
11
10
|
import { useTranslation } from '@svadmin/core/i18n';
|
|
@@ -85,13 +84,7 @@
|
|
|
85
84
|
};
|
|
86
85
|
});
|
|
87
86
|
|
|
88
|
-
const resources = $derived.
|
|
89
|
-
try {
|
|
90
|
-
return getResources();
|
|
91
|
-
} catch {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
87
|
+
const resources = $derived(adminContext.resources);
|
|
95
88
|
const path = $derived(adminContext.currentPath());
|
|
96
89
|
const theme = $derived(getTheme());
|
|
97
90
|
const colorTheme = $derived(getColorTheme());
|