WIP - quick fix to page layout grid
This commit is contained in:
@@ -1,15 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page-layout-renderer">
|
<div class="page-layout-renderer w-full">
|
||||||
<div
|
<div
|
||||||
v-if="layout && layout.fields.length > 0"
|
v-if="layout && layout.fields.length > 0"
|
||||||
class="grid gap-4"
|
class="grid grid-cols-6 gap-4 auto-rows-[80px]"
|
||||||
:style="gridStyle"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-for="fieldItem in sortedFields"
|
v-for="fieldItem in sortedFields"
|
||||||
:key="fieldItem.fieldId"
|
:key="fieldItem.fieldId"
|
||||||
:style="getFieldStyle(fieldItem)"
|
:style="getFieldStyle(fieldItem)"
|
||||||
class="field-container"
|
class="flex flex-col min-h-[60px]"
|
||||||
>
|
>
|
||||||
<FieldRenderer
|
<FieldRenderer
|
||||||
v-if="fieldItem.field"
|
v-if="fieldItem.field"
|
||||||
@@ -26,7 +25,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="field in fields"
|
v-for="field in fields"
|
||||||
:key="field.id"
|
:key="field.id"
|
||||||
class="field-container"
|
class="flex flex-col min-h-[60px]"
|
||||||
>
|
>
|
||||||
<FieldRenderer
|
<FieldRenderer
|
||||||
:field="field"
|
:field="field"
|
||||||
@@ -57,14 +56,6 @@ const emit = defineEmits<{
|
|||||||
'update:modelValue': [value: Record<string, any>]
|
'update:modelValue': [value: Record<string, any>]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
// Grid configuration for 6 columns
|
|
||||||
const GRID_COLUMNS = 6
|
|
||||||
const gridStyle = computed(() => ({
|
|
||||||
display: 'grid',
|
|
||||||
gridTemplateColumns: `repeat(${GRID_COLUMNS}, 1fr)`,
|
|
||||||
gap: '1rem',
|
|
||||||
}))
|
|
||||||
|
|
||||||
// Map field IDs to field objects and sort by position
|
// Map field IDs to field objects and sort by position
|
||||||
const sortedFields = computed(() => {
|
const sortedFields = computed(() => {
|
||||||
if (!props.layout || !props.layout.fields) return []
|
if (!props.layout || !props.layout.fields) return []
|
||||||
@@ -106,13 +97,5 @@ const handleFieldUpdate = (fieldName: string, value: any) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.page-layout-renderer {
|
/* Additional styles if needed */
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-container {
|
|
||||||
min-height: 60px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user