mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 06:15:46 +00:00
42 lines
703 B
Vue
42 lines
703 B
Vue
<script lang="ts" setup>
|
|
const props = defineProps<{
|
|
active?: boolean
|
|
}>()
|
|
|
|
const { active } = toRefs(props)
|
|
|
|
const el = ref<HTMLElement>()
|
|
|
|
const cellClickHook = createEventHook()
|
|
|
|
const cellEventHook = createEventHook()
|
|
|
|
provide(CellClickHookInj, cellClickHook)
|
|
|
|
provide(CellEventHookInj, cellEventHook)
|
|
|
|
provide(CurrentCellInj, el)
|
|
|
|
const handleClick = (event: MouseEvent) => {
|
|
cellClickHook.trigger(event)
|
|
cellEventHook.trigger(event)
|
|
}
|
|
|
|
useActiveKeydownListener(
|
|
active,
|
|
(event) => {
|
|
cellEventHook.trigger(event)
|
|
},
|
|
{
|
|
isGridCell: true,
|
|
immediate: true,
|
|
},
|
|
)
|
|
</script>
|
|
|
|
<template>
|
|
<td ref="el" class="select-none" @click="handleClick">
|
|
<slot />
|
|
</td>
|
|
</template>
|