Skip to content

A self-hosted media server and file management system

fix: table toolbars are interactable while loading data

aminnausin6dcdc8854b19
diff --git a/resources/js/components/cedar-ui/table/TableBase.vue b/resources/js/components/cedar-ui/table/TableBase.vue
index ce2b33aa..7bbfa6a0 100644
--- a/resources/js/components/cedar-ui/table/TableBase.vue
+++ b/resources/js/components/cedar-ui/table/TableBase.vue
@@ -102,8 +102,15 @@ onMounted(() => {
v-if="model !== undefined"
v-model="model"
:placeholder="`Search ${props.itemName ? `${props.itemName}...` : ''}`"
- :class="cn('ring-r-button hocus:ring-2 dark:bg-surface-2 h-(--table-input-height) w-full ring-1', { 'sm:w-70 xl:w-80': !forceVerticalToolbar })"
+ :class="
+ cn(
+ 'ring-r-button hocus:ring-2 dark:bg-surface-2 h-(--table-input-height) w-full ring-1',
+ { 'sm:w-70 xl:w-80': !forceVerticalToolbar },
+ { 'button-disabled pointer-events-none': loading },
+ )
+ "
title="Search with..."
+ :disabled="loading"
/>
<div
@@ -116,10 +123,12 @@ onMounted(() => {
:prefix="'By '"
:options="sortingOptions"
:defaultItem="0"
- class="h-(--table-input-height) w-full"
+ :class="cn('h-(--table-input-height) w-full')"
title="Sort by..."
@selectItem="handleSortChange"
:menu-margin="{ bottom: 'mb-10', top: 'mt-10' }"
+ :disabled="loading"
+ :load-default-on-disabled="true"
/>
</div>
<ButtonIcon
@@ -130,6 +139,7 @@ onMounted(() => {
:title="`Reorder Results...`"
:aria-label="`Reorder Results`"
class="inline-flex size-(--table-input-height) p-1"
+ :disabled="loading"
>
<template #icon>
<!-- Arrow Pointing Down if ascending and then Up otherwise (arrow shows what to change to ?? idk descending points up actually)-->
@@ -166,7 +176,7 @@ onMounted(() => {
</section>
<TablePagination
v-if="usePagination"
- :class="paginationClass"
+ :class="cn({ 'button-disabled pointer-events-none': loading }, paginationClass)"
:listLength="props.data?.length ?? 0"
:itemsPerPage="itemsPerPage"
:currentPage="currentPage"
diff --git a/resources/js/components/cedar-ui/table/TablePaginationButton.vue b/resources/js/components/cedar-ui/table/TablePaginationButton.vue
index b3319fba..1a90a9f3 100644
--- a/resources/js/components/cedar-ui/table/TablePaginationButton.vue
+++ b/resources/js/components/cedar-ui/table/TablePaginationButton.vue
@@ -1,7 +1,8 @@
<script setup lang="ts">
-import { cn, type TablePaginationButtonProps } from '@aminnausin/cedar-ui';
+import type { TablePaginationButtonProps } from '@aminnausin/cedar-ui';
-import { ButtonBase } from '../button';
+import { ButtonBase } from '@/components/cedar-ui/button';
+import { cn } from '@aminnausin/cedar-ui';
const props = withDefaults(defineProps<TablePaginationButtonProps>(), {
underline: false,
@@ -14,7 +15,7 @@ const props = withDefaults(defineProps<TablePaginationButtonProps>(), {
<li :class="{ hidden: currentPage !== pageNumber && !text && !sticky }" class="h-full @xs:block">
<button-base
:class="
- cn('group hover:text-foreground-0 disabled:text-foreground-2/60 pointer-events-auto! flex h-full flex-col gap-0 rounded-none py-0 opacity-100!', {
+ cn('group hover:text-foreground-0 disabled:text-foreground-2/60 flex h-full flex-col gap-0 rounded-none py-0 opacity-100!', {
'text-foreground-0 bg-overlay-accent': currentPage === pageNumber,
'hover:bg-overlay-accent': !disabled,
'px-3': !underline && $slots.content,