Skip to content

Commit d06d876

Browse files
committed
chore: enhance type safety by replacing 'any' with 'HTMLElement' in ResourceListTable and ResourceListTableVirtual, and add 'FieldGroup' type in ShowView
1 parent 27094c9 commit d06d876

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

adminforth/spa/src/components/ResourceListTable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,8 @@ const rowHeights = ref<number[]>([]);
390390
const columnWidths = ref<number[]>([]);
391391
watch(() => props.rows, (newRows) => {
392392
// rows are set to null when new records are loading
393-
rowHeights.value = newRows || !rowRefs.value ? [] : rowRefs.value.map((el: any) => el.offsetHeight);
394-
columnWidths.value = newRows || !headerRefs.value ? [] : [48, ...headerRefs.value.map((el: any) => el.offsetWidth)];
393+
rowHeights.value = newRows || !rowRefs.value ? [] : rowRefs.value.map((el: HTMLElement) => el.offsetHeight);
394+
columnWidths.value = newRows || !headerRefs.value ? [] : [48, ...headerRefs.value.map((el: HTMLElement) => el.offsetWidth)];
395395
});
396396
397397
function addToCheckedValues(id: string) {

adminforth/spa/src/components/ResourceListTableVirtual.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ const rowHeights = ref<number[]>([]);
410410
const columnWidths = ref<number[]>([]);
411411
watch(() => props.rows, (newRows) => {
412412
// rows are set to null when new records are loading
413-
rowHeights.value = newRows || !rowRefs.value ? [] : rowRefs.value.map((el: any) => el.offsetHeight);
414-
columnWidths.value = newRows || !headerRefs.value ? [] : [48, ...headerRefs.value.map((el: any) => el.offsetWidth)];
413+
rowHeights.value = newRows || !rowRefs.value ? [] : rowRefs.value.map((el: HTMLElement) => el.offsetHeight);
414+
columnWidths.value = newRows || !headerRefs.value ? [] : [48, ...headerRefs.value.map((el: HTMLElement) => el.offsetWidth)];
415415
});
416416
417417
function addToCheckedValues(id: any) {

adminforth/spa/src/views/ShowView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ import ShowTable from '@/components/ShowTable.vue';
139139
import adminforth from "@/adminforth";
140140
import { useI18n } from 'vue-i18n';
141141
import { getIcon } from '@/utils';
142-
import { type AdminForthComponentDeclarationFull, type AdminForthResourceColumnCommon } from '@/types/Common.js';
142+
import { type AdminForthComponentDeclarationFull, type AdminForthResourceColumnCommon, type FieldGroup } from '@/types/Common.js';
143143
144144
const route = useRoute();
145145
const router = useRouter();
@@ -183,7 +183,7 @@ const groups = computed(() => {
183183
}
184184
const activeGroups: typeof fieldGroupType | [] = fieldGroupType ?? [];
185185
186-
return activeGroups.map((group: any) => ({
186+
return activeGroups.map((group: FieldGroup) => ({
187187
...group,
188188
columns: coreStore.resource?.columns.filter(
189189
col => group.columns.includes(col.name) && col.showIn?.show

0 commit comments

Comments
 (0)