Skip to content

Commit

Permalink
option to disable listboxes, asc/desc listbox is now disabled if ther…
Browse files Browse the repository at this point in the history
…e is no sortable col selected
  • Loading branch information
Robin Kaggl committed May 15, 2024
1 parent ff2c923 commit 7bed47d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/generic-listbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ defineProps<{
items: Array<{ label: string; value: string }>;
defaultLabel?: string;
buttonClass?: string;
disabled?: boolean;
}>();
defineEmits(["change"]);
Expand All @@ -27,6 +28,7 @@ defineEmits(["change"]);
<!-- eslint-disable tailwindcss/no-contradicting-classname -->
<Listbox
v-model="model"
:disabled="disabled"
as="div"
class="relative"
@update:model-value="(to) => $emit('change', to)"
Expand All @@ -41,7 +43,7 @@ defineEmits(["change"]);
portal
adaptive-width
>
<div class="flex w-full items-center gap-4">
<div class="flex w-full items-center gap-4" :class="disabled && 'opacity-50'">
<ListboxLabel v-if="$slots.label">
<slot name="label" />
</ListboxLabel>
Expand Down
1 change: 1 addition & 0 deletions components/sort-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const direction = computed({
</GenericListbox>
<GenericListbox
v-model="direction"
:disabled="!sortedCol"
button-class="shadow-none"
:items="[
{ value: 'asc', label: t('collection-keys.generic.asc') },
Expand Down

0 comments on commit 7bed47d

Please sign in to comment.