Allow for desecting communications
This commit is contained in:
parent
a4a8bcdaa9
commit
11f56bfd1c
2 changed files with 10 additions and 1 deletions
|
|
@ -151,6 +151,7 @@ interface Props {
|
|||
selectedId?: string | null;
|
||||
}
|
||||
interface Emits {
|
||||
(e: "deselect", id: string): void;
|
||||
(e: "select", id: string): void;
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +161,11 @@ const props = withDefaults(defineProps<Props>(), {
|
|||
|
||||
const emit = defineEmits<Emits>();
|
||||
const handleClick = (id: string) => {
|
||||
emit("select", id);
|
||||
if (props.selectedId == null) {
|
||||
emit("select", id);
|
||||
} else {
|
||||
emit("deselect", id);
|
||||
}
|
||||
};
|
||||
const searchFilter = ref("");
|
||||
const typeFilter = ref("all");
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<template #left>
|
||||
<CommunicationColumnList
|
||||
:all="communication.all"
|
||||
@deselect="handleDeselect"
|
||||
:loading="loading"
|
||||
:selected-id="selectedId"
|
||||
@select="handleSelect"
|
||||
|
|
@ -105,6 +106,9 @@ const selectedCommunication = computed<Communication | null>(() => {
|
|||
const result = communication.all.find((c) => c.id == selectedId.value);
|
||||
return result;
|
||||
});
|
||||
const handleDeselect = (id: string) => {
|
||||
selectedId.value = null;
|
||||
};
|
||||
const handleSelect = (id: string) => {
|
||||
selectedId.value = id;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue