mirror of https://github.com/nocodb/nocodb
Pranav C
2 years ago
4 changed files with 137 additions and 73 deletions
@ -1,23 +1,55 @@
|
||||
<script setup lang="ts"> |
||||
import { message } from 'ant-design-vue' |
||||
import { CellValueInj, inject } from '#imports' |
||||
|
||||
const value = inject(CellValueInj) |
||||
|
||||
const showEditWarning = ref(false) |
||||
|
||||
const showClearWarning = ref(false) |
||||
|
||||
const showEditWarningMessage = () => { |
||||
showEditWarning.value = true |
||||
|
||||
setTimeout(() => { |
||||
showEditWarning.value = false |
||||
}, 3000) |
||||
} |
||||
|
||||
const showClearWarningMessage = () => { |
||||
showClearWarning.value = true |
||||
|
||||
setTimeout(() => { |
||||
showClearWarning.value = false |
||||
}, 3000) |
||||
} |
||||
|
||||
useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEvent) => { |
||||
switch (e.key) { |
||||
case 'Enter': |
||||
message.warning('Computed field: unable to edit') |
||||
showEditWarningMessage() |
||||
break |
||||
case 'Delete': |
||||
message.warning('Computed field: unable to clear text') |
||||
showClearWarningMessage() |
||||
break |
||||
} |
||||
}) |
||||
</script> |
||||
|
||||
<template> |
||||
<div> |
||||
<span class="text-center pl-3"> |
||||
{{ value }} |
||||
</span> |
||||
|
||||
<div> |
||||
<div v-if="showEditWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs"> |
||||
<!-- TODO: i18n --> |
||||
Warning: Computed field - unable to edit content. |
||||
</div> |
||||
<div v-if="showClearWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs"> |
||||
<!-- TODO: i18n --> |
||||
Warning: Computed field - unable to clear content. |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
Loading…
Reference in new issue