mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.3 KiB
45 lines
1.3 KiB
3 years ago
|
<script lang="ts" setup>
|
||
2 years ago
|
import { CellValueInj, ColumnInj, computed, handleTZ, inject, ref, replaceUrlsWithLink, useProject } from '#imports'
|
||
2 years ago
|
|
||
2 years ago
|
// todo: column type doesn't have required property `error` - throws in typecheck
|
||
|
const column: any = inject(ColumnInj)
|
||
2 years ago
|
|
||
2 years ago
|
const value = inject(CellValueInj)
|
||
3 years ago
|
|
||
|
const { isPg } = useProject()
|
||
|
|
||
|
const showEditFormulaWarning = ref(false)
|
||
|
|
||
|
const showEditFormulaWarningMessage = () => {
|
||
|
showEditFormulaWarning.value = true
|
||
2 years ago
|
|
||
3 years ago
|
setTimeout(() => {
|
||
|
showEditFormulaWarning.value = false
|
||
|
}, 3000)
|
||
|
}
|
||
|
|
||
2 years ago
|
const result = isPg ? handleTZ(value) : value
|
||
3 years ago
|
|
||
2 years ago
|
const urls = computed(() => replaceUrlsWithLink(result.value))
|
||
3 years ago
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<div>
|
||
2 years ago
|
<a-tooltip v-if="column && column.colOptions && column.colOptions.error" placement="bottom" class="text-orange-700">
|
||
|
<template #title>
|
||
|
<span class="font-bold">{{ column.colOptions.error }}</span>
|
||
3 years ago
|
</template>
|
||
2 years ago
|
<span>ERR!</span>
|
||
|
</a-tooltip>
|
||
2 years ago
|
|
||
2 years ago
|
<div class="p-2" @dblclick="showEditFormulaWarningMessage">
|
||
3 years ago
|
<div v-if="urls" v-html="urls" />
|
||
2 years ago
|
<div v-else>{{ result }}</div>
|
||
2 years ago
|
<div v-if="showEditFormulaWarning" class="text-left text-wrap mt-2 text-[#e65100]">
|
||
3 years ago
|
<!-- TODO: i18n -->
|
||
|
Warning: Formula fields should be configured in the field menu dropdown.
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|