mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
Co-authored-by: Vladimir Sheremet <vs@zammad.com> Co-authored-by: Martin Gruner <mg@zammad.com>
50 lines
1.6 KiB
Vue
50 lines
1.6 KiB
Vue
<!-- Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ -->
|
|
|
|
<script setup lang="ts">
|
|
import type { ObjectManagerFrontendAttribute } from '@shared/graphql/types'
|
|
import type { ObjectLike } from '@shared/types/utils'
|
|
import { objectAttributesConfig } from './config'
|
|
import { useDisplayObjectAttributes } from './useDisplayObjectAttributes'
|
|
|
|
export interface Props {
|
|
object: ObjectLike
|
|
attributes: ObjectManagerFrontendAttribute[]
|
|
skipAttributes?: string[]
|
|
accessors?: Record<string, string>
|
|
}
|
|
|
|
const props = defineProps<Props>()
|
|
|
|
const { fields } = useDisplayObjectAttributes(props)
|
|
</script>
|
|
|
|
<template>
|
|
<Component :is="objectAttributesConfig.outer" v-if="fields.length">
|
|
<template v-for="field of fields" :key="field.attribute.name">
|
|
<Component
|
|
:is="objectAttributesConfig.wrapper"
|
|
:label="field.attribute.display"
|
|
>
|
|
<!-- TODO link template might have #{}, but we don't have access to those, it should come from backend -->
|
|
<CommonLink
|
|
v-if="field.attribute.dataOption?.linktemplate"
|
|
:link="field.attribute.dataOption?.linktemplate"
|
|
:class="objectAttributesConfig.classes.link"
|
|
>
|
|
<Component
|
|
:is="field.component"
|
|
:attribute="field.attribute"
|
|
:value="field.value"
|
|
/>
|
|
</CommonLink>
|
|
<Component
|
|
:is="field.component"
|
|
v-else
|
|
:attribute="field.attribute"
|
|
:value="field.value"
|
|
/>
|
|
</Component>
|
|
</template>
|
|
<slot name="after-fields" />
|
|
</Component>
|
|
</template>
|