Skip to content

Commit 360d17c

Browse files
committed
chore: fix typesript errors in ShowTable/ ShowView partially
1 parent d59f938 commit 360d17c

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

adminforth/spa/src/components/ShowTable.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@
6262
import { getCustomComponent } from '@/utils';
6363
import { useCoreStore } from '@/stores/core';
6464
import { computed } from 'vue';
65+
import type { AdminForthResourceCommon } from '@/types/Common';
6566
const props = withDefaults(defineProps<{
6667
columns: Array<{
6768
name: string;
68-
label: string;
69+
label?: string;
6970
components?: {
7071
show?: {
7172
file: string;
@@ -77,10 +78,9 @@
7778
};
7879
};
7980
}>;
80-
source: string;
8181
groupName?: string | null;
8282
noTitle?: boolean;
83-
resource: Record<string, any>;
83+
resource: AdminForthResourceCommon | null;
8484
record: Record<string, any>;
8585
isRounded?: boolean;
8686
}>(), {

adminforth/spa/src/views/ShowView.vue

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
v-if="!loading"
55
v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.beforeBreadcrumbs || []"
66
:is="getCustomComponent(c)"
7-
:meta="c.meta"
7+
:meta="(c as AdminForthComponentDeclarationFull).meta"
88
:record="coreStore.record"
99
:resource="coreStore.resource"
1010
:adminUser="coreStore.adminUser"
1111
/>
1212
<BreadcrumbsWithButtons>
13-
<template v-if="coreStore.resource?.options?.actions">
13+
<template v-if="coreStore.resource?.options?.bulkActions">
1414
<button
15-
v-for="action in coreStore.resource.options.actions.filter(a => a.showIn?.showButton)"
15+
v-for="action in coreStore.resource.options.bulkActions.filter(a => a.showIn?.showButton)"
1616
:key="action.id"
1717
@click="startCustomAction(action.id)"
1818
:disabled="actionLoadingStates[action.id]"
@@ -49,15 +49,19 @@
4949
</button>
5050

5151
<ThreeDotsMenu
52-
:threeDotsDropdownItems="coreStore.resourceOptions?.pageInjections?.show?.threeDotsDropdownItems"
53-
:customActions="customActions"
52+
:threeDotsDropdownItems="Array.isArray(coreStore.resourceOptions?.pageInjections?.show?.threeDotsDropdownItems)
53+
? coreStore.resourceOptions.pageInjections.show.threeDotsDropdownItems
54+
: coreStore.resourceOptions?.pageInjections?.show?.threeDotsDropdownItems
55+
? [coreStore.resourceOptions.pageInjections.show.threeDotsDropdownItems]
56+
: undefined"
57+
:customActions="customActions"
5458
></ThreeDotsMenu>
5559
</BreadcrumbsWithButtons>
5660

5761
<component
5862
v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.afterBreadcrumbs || []"
5963
:is="getCustomComponent(c)"
60-
:meta="c.meta"
64+
:meta="(c as AdminForthComponentDeclarationFull).meta"
6165
:record="coreStore.record"
6266
:resource="coreStore.resource"
6367
:adminUser="coreStore.adminUser"
@@ -78,9 +82,9 @@
7882
>
7983
<div v-if="!groups.length && allColumns.length">
8084
<ShowTable
81-
:columns="allColumns"
8285
:resource="coreStore.resource"
8386
:record="coreStore.record"
87+
:columns="allColumns as Array<{ name: string; label?: string; components?: any }>"
8488
/>
8589
</div>
8690
<template v-else>
@@ -95,10 +99,10 @@
9599
</template>
96100
<template v-if="otherColumns.length > 0">
97101
<ShowTable
98-
:columns="otherColumns"
99102
groupName="Other Fields"
100103
:resource="coreStore.resource"
101104
:record="coreStore.record"
105+
:columns="otherColumns as Array<{ name: string; label?: string; components?: any }>"
102106
/>
103107
</template>
104108
</template>
@@ -112,8 +116,7 @@
112116
v-if="!loading"
113117
v-for="c in coreStore?.resourceOptions?.pageInjections?.show?.bottom || []"
114118
:is="getCustomComponent(c)"
115-
:meta="c.meta"
116-
:column="column"
119+
:meta="(c as AdminForthComponentDeclarationFull).meta"
117120
:record="coreStore.record"
118121
:resource="coreStore.resource"
119122
:adminUser="coreStore.adminUser"
@@ -140,6 +143,7 @@ import ShowTable from '@/components/ShowTable.vue';
140143
import adminforth from "@/adminforth";
141144
import { useI18n } from 'vue-i18n';
142145
import { getIcon } from '@/utils';
146+
import { type AdminForthComponentDeclarationFull } from '@/types/Common.js';
143147
144148
const route = useRoute();
145149
const router = useRouter();

0 commit comments

Comments
 (0)