fix: added tooltip for listview column cells
This commit is contained in:
parent
46bcdf7a5d
commit
66420a1444
@ -1,15 +1,38 @@
|
|||||||
<template>
|
<template>
|
||||||
<slot name="prefix"></slot>
|
<Tooltip :text="tooltipText" class="flex items-center space-x-2.5">
|
||||||
<slot v-if="$slots.default" />
|
<slot name="prefix"></slot>
|
||||||
<div v-else class="text-base text-gray-900 truncate">
|
<div class="text-base truncate">
|
||||||
{{ value }}
|
{{ label }}
|
||||||
</div>
|
</div>
|
||||||
|
</Tooltip>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { dateFormat, timeAgo, dateTooltipFormat } from '@/utils'
|
||||||
|
import { Tooltip } from 'frappe-ui'
|
||||||
|
import { computed } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: 'text',
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: [String, Number, Object],
|
||||||
|
default: '',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const tooltipText = computed(() => {
|
||||||
|
if (props.type === 'pretty_date') {
|
||||||
|
return dateFormat(props.value, dateTooltipFormat)
|
||||||
|
}
|
||||||
|
return props.value?.toString()
|
||||||
|
})
|
||||||
|
|
||||||
|
const label = computed(() => {
|
||||||
|
if (props.type === 'pretty_date') {
|
||||||
|
return timeAgo(props.value)
|
||||||
|
}
|
||||||
|
return props.value?.toString()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -39,10 +39,9 @@
|
|||||||
<div
|
<div
|
||||||
v-for="column in columns"
|
v-for="column in columns"
|
||||||
:key="column.key"
|
:key="column.key"
|
||||||
class="flex items-center space-x-2.5"
|
|
||||||
:class="[column.size, column.align]"
|
:class="[column.size, column.align]"
|
||||||
>
|
>
|
||||||
<ListRowItem :value="getValue(row[column.key]).label">
|
<ListRowItem :value="getValue(row[column.key]).label" :type="column.type">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<div v-if="column.type === 'indicator'">
|
<div v-if="column.type === 'indicator'">
|
||||||
<IndicatorIcon :class="getValue(row[column.key]).color" />
|
<IndicatorIcon :class="getValue(row[column.key]).color" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user