123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->
- <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 { useDisplayObjectAttributes } from './useDisplayObjectAttributes.ts'
- export interface Props {
- object: ObjectLike
- attributes: ObjectAttribute[]
- skipAttributes?: string[]
- accessors?: Record<string, string>
- alwaysShowAfterFields?: boolean
- }
- const props = defineProps<Props>()
- const { fields } = useDisplayObjectAttributes(props)
- const { objectAttributes: objectAttributesConfig } = useSharedVisualConfig()
- </script>
- <template>
- <Component
- :is="objectAttributesConfig.outer"
- v-if="fields.length || props.alwaysShowAfterFields"
- >
- <template v-for="field of fields" :key="field.attribute.name">
- <Component
- :is="objectAttributesConfig.wrapper"
- :label="field.attribute.display"
- >
- <CommonLink
- v-if="field.link"
- :link="field.link"
- :class="objectAttributesConfig.classes.link"
- >
- <Component
- :is="field.component"
- :attribute="field.attribute"
- :value="field.value"
- :config="objectAttributesConfig"
- />
- </CommonLink>
- <Component
- :is="field.component"
- v-else
- :attribute="field.attribute"
- :value="field.value"
- :config="objectAttributesConfig"
- />
- </Component>
- </template>
- <slot name="after-fields" />
- </Component>
- </template>
|