From 1f555cf695079d6cc85581a480f375210b0c045c Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Thu, 15 Feb 2024 14:45:59 +0000 Subject: Add handling for 'string-list' and fix 'material-list' --- .../Editor/Quest/Task/TaskConfiguration.vue | 2 +- .../Editor/Quest/Task/TaskConfigurationRow.vue | 55 +++++++++++++++++----- 2 files changed, 45 insertions(+), 12 deletions(-) (limited to 'src/components/Editor/Quest/Task') diff --git a/src/components/Editor/Quest/Task/TaskConfiguration.vue b/src/components/Editor/Quest/Task/TaskConfiguration.vue index 5c6613a..c31a87d 100644 --- a/src/components/Editor/Quest/Task/TaskConfiguration.vue +++ b/src/components/Editor/Quest/Task/TaskConfiguration.vue @@ -101,7 +101,7 @@ const deleteValue = (fieldName: string) => {
{ const { description, note } = toRefs(definition.value); const showDescription = ref(false); -const currentValue = ref(props.initialValue); +const currentValue = ref(props.initialValue || + (props.type === 'boolean' + ? false + : (props.type === 'material-list' || props.type === 'string-list' + ? [] + : '' + ))); + +if (props.initialValue !== currentValue.value) { + emit('update', currentValue.value); +} -const error = computed(() => currentValue.value === undefined || currentValue.value === null || currentValue.value === ''); +const error = computed(() => currentValue.value === undefined || currentValue.value === null || currentValue.value === '' || (Array.isArray(currentValue.value) && currentValue.value.length === 0)); const updateValue = (value: any) => { currentValue.value = value; }; watch(currentValue, () => { - emit('update', currentValue.value); + emit('update', currentValue.value); }); +const addValue = (searchQuery: any) => { + currentValue.value.push(searchQuery); +}; +