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"> |
<script setup lang="ts"> |
||||||
import { message } from 'ant-design-vue' |
|
||||||
import { CellValueInj, inject } from '#imports' |
import { CellValueInj, inject } from '#imports' |
||||||
|
|
||||||
const value = inject(CellValueInj) |
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) => { |
useSelectedCellKeyupListener(inject(ActiveCellInj, ref(false)), (e: KeyboardEvent) => { |
||||||
switch (e.key) { |
switch (e.key) { |
||||||
case 'Enter': |
case 'Enter': |
||||||
message.warning('Computed field: unable to edit') |
showEditWarningMessage() |
||||||
break |
break |
||||||
case 'Delete': |
case 'Delete': |
||||||
message.warning('Computed field: unable to clear text') |
showClearWarningMessage() |
||||||
break |
break |
||||||
} |
} |
||||||
}) |
}) |
||||||
</script> |
</script> |
||||||
|
|
||||||
<template> |
<template> |
||||||
|
<div> |
||||||
<span class="text-center pl-3"> |
<span class="text-center pl-3"> |
||||||
{{ value }} |
{{ value }} |
||||||
</span> |
</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> |
</template> |
||||||
|
Loading…
Reference in new issue