From 8289e9bd112b1869a87935a0f24e17849c798ecf Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Tue, 16 May 2023 16:37:42 +0200 Subject: [PATCH] Form overhaul: Adjustment form --- .../client/ui/properties/PropertyForm.vue | 13 +++- .../ui/properties/forms/AdjustmentForm.vue | 76 ++++++++++--------- .../properties/forms/shared/FormSection.vue | 4 +- .../properties/forms/shared/FormSections.vue | 2 + 4 files changed, 53 insertions(+), 42 deletions(-) diff --git a/app/imports/client/ui/properties/PropertyForm.vue b/app/imports/client/ui/properties/PropertyForm.vue index a5293b08..40301e3f 100644 --- a/app/imports/client/ui/properties/PropertyForm.vue +++ b/app/imports/client/ui/properties/PropertyForm.vue @@ -7,6 +7,7 @@ style="gap: 8px" > - @@ -190,6 +191,7 @@ import CreaturePropertiesTree from '/imports/client/ui/creature/creatureProperti import OutlinedInput from '/imports/client/ui/properties/viewers/shared/OutlinedInput.vue'; import { getSuggestedChildren } from '/imports/constants/PROPERTIES.js'; import PROPERTIES from '/imports/constants/PROPERTIES.js'; +import propertySchemasIndex from '/imports/api/properties/computedPropertySchemasIndex.js'; const slotTypes = []; for (let key in PROPERTIES) { @@ -231,6 +233,11 @@ export default { if (!this.model?.type) return; return getSuggestedChildren(this.model.type); }, + schemaHasName() { + if (!this.model?.type) return true; + const schema = propertySchemasIndex[this.model.type]; + return schema.allowsKey('name'); + } }, mounted() { // Don't autofocus on mobile, it brings up the on-screen keyboard diff --git a/app/imports/client/ui/properties/forms/AdjustmentForm.vue b/app/imports/client/ui/properties/forms/AdjustmentForm.vue index 38a9a507..74d7a34c 100644 --- a/app/imports/client/ui/properties/forms/AdjustmentForm.vue +++ b/app/imports/client/ui/properties/forms/AdjustmentForm.vue @@ -7,7 +7,7 @@ > - - - + + + + + + + + + + + {{ name }} - + @@ -13,7 +13,7 @@ {{ name }} - + diff --git a/app/imports/client/ui/properties/forms/shared/FormSections.vue b/app/imports/client/ui/properties/forms/shared/FormSections.vue index 6010fb96..e9f06985 100644 --- a/app/imports/client/ui/properties/forms/shared/FormSections.vue +++ b/app/imports/client/ui/properties/forms/shared/FormSections.vue @@ -1,7 +1,9 @@