2026-01-02 13:41:09 +00:00
|
|
|
<!-- Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/ -->
|
2025-01-24 08:08:23 +00:00
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { useSharedVisualConfig } from '#shared/composables/useSharedVisualConfig.ts'
|
|
|
|
|
import type { ObjectAttribute } from '#shared/entities/object-attributes/types/store.ts'
|
|
|
|
|
import type { ObjectLike } from '#shared/types/utils.ts'
|
|
|
|
|
|
|
|
|
|
import { useDisplayObjectAttribute } from './useDisplayObjectAttributes.ts'
|
|
|
|
|
import { isEmpty } from './utils.ts'
|
|
|
|
|
|
|
|
|
|
import type { OutputMode } from './types.ts'
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
object: ObjectLike
|
|
|
|
|
attribute: ObjectAttribute
|
2025-11-10 15:42:05 +00:00
|
|
|
mode?: OutputMode
|
|
|
|
|
inlineEditable?: string[]
|
2025-01-24 08:08:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
|
|
|
mode: 'view',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const { objectAttributes: objectAttributesConfig } = useSharedVisualConfig()
|
|
|
|
|
const { field } = useDisplayObjectAttribute(props)
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<template v-if="field && !isEmpty(field.value)">
|
|
|
|
|
<CommonLink
|
|
|
|
|
v-if="field.link"
|
2025-04-29 05:56:44 +00:00
|
|
|
v-bind="$attrs"
|
2025-01-24 08:08:23 +00:00
|
|
|
:link="field.link"
|
|
|
|
|
:class="objectAttributesConfig.classes.link"
|
|
|
|
|
>
|
|
|
|
|
<Component
|
|
|
|
|
:is="field.component"
|
|
|
|
|
:attribute="field.attribute"
|
|
|
|
|
:value="field.value"
|
|
|
|
|
:config="objectAttributesConfig"
|
|
|
|
|
:mode="mode"
|
|
|
|
|
/>
|
|
|
|
|
</CommonLink>
|
|
|
|
|
<Component
|
2025-04-29 05:56:44 +00:00
|
|
|
v-bind="$attrs"
|
2025-01-24 08:08:23 +00:00
|
|
|
:is="field.component"
|
|
|
|
|
v-else
|
|
|
|
|
:attribute="field.attribute"
|
|
|
|
|
:value="field.value"
|
|
|
|
|
:config="objectAttributesConfig"
|
|
|
|
|
:mode="mode"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
2025-04-29 05:56:44 +00:00
|
|
|
<template v-else>
|
|
|
|
|
<span v-bind="$attrs"> - </span>
|
|
|
|
|
</template>
|
2025-01-24 08:08:23 +00:00
|
|
|
</template>
|