3 Commits

Author SHA1 Message Date
Francisco Gaona
f73a6b3edf WIP 2025-12-23 00:18:44 +01:00
Francisco Gaona
8090d6099c WIP - add drag functionallity for page layouts 2025-12-23 00:04:06 +01:00
Francisco Gaona
eff8f32c9d WIP - page layout first version working 2025-12-22 23:48:09 +01:00
2 changed files with 23 additions and 5 deletions

View File

@@ -1,14 +1,15 @@
<template> <template>
<div class="page-layout-renderer w-full"> <div class="page-layout-renderer">
<div <div
v-if="layout && layout.fields.length > 0" v-if="layout && layout.fields.length > 0"
class="grid grid-cols-6 gap-4 auto-rows-[80px]" class="grid gap-4"
: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="flex flex-col min-h-[60px]" class="field-container"
> >
<FieldRenderer <FieldRenderer
v-if="fieldItem.field" v-if="fieldItem.field"
@@ -25,7 +26,7 @@
<div <div
v-for="field in fields" v-for="field in fields"
:key="field.id" :key="field.id"
class="flex flex-col min-h-[60px]" class="field-container"
> >
<FieldRenderer <FieldRenderer
:field="field" :field="field"
@@ -56,6 +57,14 @@ 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 []
@@ -97,5 +106,13 @@ const handleFieldUpdate = (fieldName: string, value: any) => {
</script> </script>
<style scoped> <style scoped>
/* Additional styles if needed */ .page-layout-renderer {
width: 100%;
}
.field-container {
min-height: 60px;
display: flex;
flex-direction: column;
}
</style> </style>

View File

@@ -297,6 +297,7 @@ onMounted(async () => {
<style scoped> <style scoped>
.object-view-container { .object-view-container {
min-height: 100vh;
padding: 2rem; padding: 2rem;
} }
</style> </style>