From 62b5c9b2973c9f205ced20059f7dee43e33e9acb Mon Sep 17 00:00:00 2001
From: Matthieu
Date: Thu, 16 Oct 2025 08:51:18 +0200
Subject: [PATCH] Add new dropdown search
---
.../ComponentModelStructureEditor.vue | 16 +++
.../ComponentStructureAssignmentNode.vue | 132 ++++++++++++------
app/components/StructureNodeEditor.vue | 19 ++-
.../TypeEditComponentRequirementsSection.vue | 3 +-
.../TypeEditPieceRequirementsSection.vue | 3 +-
.../common/RequirementListEditor.vue | 63 ++++++---
app/components/model-types/ModelTypeForm.vue | 8 +-
app/pages/component-category/[id]/edit.vue | 1 +
app/pages/component-category/new.vue | 1 +
app/pages/component/create.vue | 31 ++--
10 files changed, 197 insertions(+), 80 deletions(-)
diff --git a/app/components/ComponentModelStructureEditor.vue b/app/components/ComponentModelStructureEditor.vue
index a3a596b..ced3aca 100644
--- a/app/components/ComponentModelStructureEditor.vue
+++ b/app/components/ComponentModelStructureEditor.vue
@@ -7,6 +7,7 @@
:piece-types="availablePieceTypes"
:lock-type="lockRootType"
:locked-type-label="displayedRootTypeLabel"
+ :allow-subcomponents="allowSubcomponents"
is-root
/>
@@ -43,6 +44,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
+ allowSubcomponents: {
+ type: Boolean,
+ default: true,
+ },
})
const emit = defineEmits(['update:modelValue'])
@@ -55,6 +60,7 @@ const { componentTypes, loadComponentTypes } = useComponentTypes()
const availablePieceTypes = computed(() => pieceTypes.value ?? [])
const availableComponentTypes = computed(() => componentTypes.value ?? [])
+const allowSubcomponents = computed(() => props.allowSubcomponents !== false)
const fallbackRootTypeLabel = computed(() => {
if (!props.rootTypeId) {
@@ -156,4 +162,14 @@ onMounted(async () => {
}
syncRootType()
})
+
+watch(
+ allowSubcomponents,
+ (allowed) => {
+ if (!allowed && Array.isArray(localStructure.subcomponents) && localStructure.subcomponents.length) {
+ localStructure.subcomponents = []
+ }
+ },
+ { immediate: true }
+)
diff --git a/app/components/ComponentStructureAssignmentNode.vue b/app/components/ComponentStructureAssignmentNode.vue
index 50a299a..fa9ed1d 100644
--- a/app/components/ComponentStructureAssignmentNode.vue
+++ b/app/components/ComponentStructureAssignmentNode.vue
@@ -14,21 +14,17 @@
-
+ { assignment.selectedComponentId = normalizeSelectionValue(value); }"
+ />
@@ -56,21 +52,17 @@
-
+ { pieceAssignment.selectedPieceId = normalizeSelectionValue(value); }"
+ />
@@ -90,6 +82,8 @@
:assignment="subAssignment"
:pieces="pieces"
:components="components"
+ :components-loading="componentsLoading"
+ :pieces-loading="piecesLoading"
:depth="depth + 1"
/>
@@ -98,6 +92,7 @@