refactor: adopt canonical component model structure schema

This commit is contained in:
MatthieuTD
2025-10-01 14:26:31 +02:00
parent d3f8ac3649
commit 386a1c9d1b
9 changed files with 470 additions and 146 deletions

View File

@@ -320,13 +320,13 @@
</div>
<!-- Sub Components -->
<div v-if="component.subComponents && component.subComponents.length > 0" class="space-y-3">
<div v-if="childComponents.length > 0" class="space-y-3">
<h4 class="font-semibold text-gray-700">
Sous-composants
</h4>
<div class="space-y-3 pl-4 border-l-2 border-gray-200">
<ComponentItem
v-for="subComponent in component.subComponents"
v-for="subComponent in childComponents"
:key="subComponent.id"
:component="subComponent"
:is-edit-mode="isEditMode"
@@ -415,6 +415,10 @@ const componentModelOptionsList = computed(() => {
return Array.isArray(provided) && provided.length ? provided : props.componentModelOptions
})
const pieceModelOptionsList = computed(() => props.pieceModelOptionsProvider(props.component) || [])
const childComponents = computed(() => {
const list = props.component.subcomponents || props.component.subComponents || []
return Array.isArray(list) ? list : []
})
function fieldKeyFromNameAndType(name, type) {
const normalizedName = typeof name === 'string' ? name : ''
const normalizedType = typeof type === 'string' ? type : ''