Skip to content

Commit 99eb1d1

Browse files
committed
feat: add dynamic width adjustment
1 parent b49e575 commit 99eb1d1

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

adminforth/spa/src/components/ResourceListTable.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,15 @@
342342
</span>
343343
<div v-if="totalRows > 0 && pageSizeOptionsComputed?.length"
344344
class="flex items-center gap-2 ml-auto" >
345-
<span class="text-sm text-lightListTablePaginationHelpText dark:text-darkListTablePaginationHelpText">
345+
<span class="text-sm text-lightListTablePaginationHelpText dark:text-darkListTablePaginationHelpText whitespace-nowrap">
346346
{{ $t('Rows per page') }}
347347
</span>
348-
<Select v-model="pageSizeInternal"
348+
<Select
349+
v-model="pageSizeInternal"
349350
:options="pageSizeOptionsComputed"
350351
:searchDisabled="true"
351-
class="text-sm w-[68px]"
352+
:style="{ width: selectDynamicWidth }"
353+
class="text-sm "
352354
classesForInput="h-[34px] min-h-0 py-1 pl-2 pr-6 text-sm rounded-md cursor-pointer af-button-shadow
353355
bg-lightDropdownButtonsBackground text-lightDropdownButtonsText border-lightDropdownButtonsBorder
354356
dark:bg-darkDropdownButtonsBackground dark:text-darkDropdownButtonsText dark:border-darkDropdownButtonsBorder"
@@ -418,6 +420,12 @@ const rowsToRender = computed(() => {
418420
}
419421
});
420422
423+
const selectDynamicWidth = computed(() => {
424+
const length = pageSizeInternal.value?.toString().length || 2;
425+
const calculatedWidth = length * 9 + 50;
426+
return `${Math.max(68, calculatedWidth)}px`;
427+
});
428+
421429
// emits, update page
422430
const emits = defineEmits([
423431
'update:page',

0 commit comments

Comments
 (0)