Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 76x 6x 323x 76x 76x 76x 323x 76x 76x 76x | <template>
<div
ref="rootEl"
class="system-item-header card"
data-testid="system-item-header"
:style="{ marginLeft: `${marginLeft}px`, marginRight: `${marginRight}px` }"
>
<div class="card-body d-flex align-items-center gap-2">
<div class="system-item-row" :style="{ gridTemplateColumns: gridTemplateColumns }">
<div v-for="field in fields" :key="field.fieldId" class="system-item-cell">
{{ getTranslation(field.name) }}
<span v-if="field.mandatory" class="text-danger">*</span>
</div>
</div>
<div v-if="showActions" class="card-actions-column">
{{ actionsLabel ?? t('common.actions') }}
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import type { SystemField } from '@/types/systemField'
import { useHeaderRowAlignment } from '@/composables/useHeaderRowAlignment'
import { useUILanguage } from '@/composables/useUILanguage'
const props = withDefaults(
defineProps<{
fields: SystemField[]
getTranslation: (value: string | Record<string, string> | null | undefined) => string
scrollbarWidth?: number
showActions?: boolean
/** Header of the actions column, "Actions" by default ('' for a column of toggles) */
actionsLabel?: string
}>(),
{ scrollbarWidth: 0, showActions: true, actionsLabel: undefined }
)
const { t } = useUILanguage()
const gridTemplateColumns = computed(() =>
props.fields.map((field) => `${field.width}fr`).join(' ')
)
const rootEl = ref<HTMLElement | null>(null)
const { marginLeft, marginRight } = useHeaderRowAlignment(
rootEl,
computed(() => props.scrollbarWidth)
)
</script>
<style scoped>
.system-item-header {
border-radius: 0.375rem 0.375rem 0 0;
}
.system-item-header .card-body {
padding-top: 0.65rem;
padding-bottom: 0.65rem;
}
.system-item-row {
flex: 1 1 auto;
min-width: 0;
display: grid;
gap: 0.75rem;
align-items: center;
}
.system-item-cell {
min-width: 0;
font-size: 0.8rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.03em;
color: var(--bw-text-muted);
}
.card-actions-column {
flex: 0 0 8rem;
text-align: right;
font-size: 0.8rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.03em;
color: var(--bw-text-muted);
}
@media (max-width: 767px) {
.system-item-header {
display: none;
}
}
</style>
|