2023-12-07 03:53:11 +08:00
|
|
|
<template>
|
2024-03-28 23:33:11 +08:00
|
|
|
<div class="group relative flex items-center group-hover:marker text-xs h-full w-full"
|
|
|
|
:style="{ lineHeight: 'unset' }">
|
2024-03-26 19:37:48 +08:00
|
|
|
<div class="flex gap-2"
|
|
|
|
:class="{
|
|
|
|
'items-center': params.dtComponent.currentViewRender === 'table',
|
|
|
|
'items-end': params.dtComponent.currentViewRender === 'cards'
|
|
|
|
}">
|
2024-03-01 20:37:31 +08:00
|
|
|
<span v-if="shouldTruncateText"
|
|
|
|
class="cursor-pointer grow"
|
|
|
|
:class="{
|
|
|
|
'line-clamp-1': params.dtComponent.currentViewRender === 'table',
|
|
|
|
'line-clamp-2': params.dtComponent.currentViewRender === 'cards'
|
|
|
|
}"
|
|
|
|
@click.stop="showDescriptionModal"
|
|
|
|
v-html="params.data.sa_description">
|
|
|
|
</span>
|
2024-03-06 21:11:33 +08:00
|
|
|
<span v-else class="grow" v-html="params.data.sa_description"></span>
|
2024-03-25 19:54:23 +08:00
|
|
|
<span v-if="shouldTruncateText" @click.stop="showDescriptionModal" class="text-sn-blue cursor-pointer shrink-0 text-xs">{{ i18n.t('experiments.card.more') }}</span>
|
2024-03-01 20:37:31 +08:00
|
|
|
</div>
|
2023-12-07 03:53:11 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'DescriptionRenderer',
|
|
|
|
props: {
|
|
|
|
params: {
|
2024-03-01 20:37:31 +08:00
|
|
|
required: true
|
|
|
|
}
|
2023-12-07 03:53:11 +08:00
|
|
|
},
|
|
|
|
computed: {
|
2024-01-16 18:46:00 +08:00
|
|
|
shouldTruncateText() {
|
2024-03-14 17:17:56 +08:00
|
|
|
return this.params.data.description?.length > 80;
|
2024-03-01 20:37:31 +08:00
|
|
|
}
|
2023-12-07 03:53:11 +08:00
|
|
|
},
|
|
|
|
methods: {
|
2024-01-16 18:46:00 +08:00
|
|
|
showDescriptionModal() {
|
2023-12-11 16:18:22 +08:00
|
|
|
this.params.dtComponent.$emit('showDescription', null, [this.params.data]);
|
2023-12-07 03:53:11 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|