refactor: renamed emit event and removed action slot

This commit is contained in:
Joel Jacob Stephen
2023-07-20 21:51:08 +05:30
parent 24f32d79b3
commit d5e4211347
4 changed files with 87 additions and 88 deletions

View File

@@ -21,27 +21,26 @@
<td
v-for="(data, colIndex) in item"
:key="colIndex"
@click="$emit('goToDetails', item)"
@click="$emit('openRowContent', item)"
class="max-w-40"
:class="cellStyles"
>
<!-- Custom implementation of the particular column -->
<div class="flex items-center">
<div v-if="modifyColNames?.includes(colIndex.toString())">
<slot :name="colIndex.toString()" :item="item"></slot>
</div>
<!-- Generic implementation of the column -->
<div v-else class="flex flex-col truncate text-center">
<span v-if="data" class="truncate">
{{ data }}
</span>
<span v-else class=""> - </span>
</div>
<div v-if="modifyColNames?.includes(colIndex.toString())">
<slot :name="colIndex.toString()" :item="item"></slot>
</div>
<!-- Generic implementation of the column -->
<div v-else class="flex flex-col truncate">
<span v-if="data" class="truncate">
{{ data }}
</span>
<span v-else class=""> - </span>
</div>
</td>
<slot name="action" :item="item"></slot>
<!-- <slot name="action" :item="item"></slot> -->
</tr>
</tbody>
</table>
@@ -63,6 +62,6 @@ defineProps<{
}>()
defineEmits<{
(event: "goToDetails", item: Item): void
(event: "openRowContent", item: Item): void
}>()
</script>