diff --git a/frontend/src/components/DynamicItemInput/DynamicItemInput.vue b/frontend/src/components/DynamicItemInput/DynamicItemInput.vue index 29165de..0b77a2b 100644 --- a/frontend/src/components/DynamicItemInput/DynamicItemInput.vue +++ b/frontend/src/components/DynamicItemInput/DynamicItemInput.vue @@ -44,6 +44,7 @@ type ButtonConfig = { label: string; color: string; type: string; + editable: boolean; }; export default defineComponent({ @@ -55,10 +56,10 @@ export default defineComponent({ ShowDialog }, props: { - canInput: { - type: Boolean, - default: false - }, + // canInput: { + // type: Boolean, + // default: false + // }, appId: { type: String, }, @@ -79,11 +80,14 @@ export default defineComponent({ const currentComponent = ref('FieldAdd'); const sharedText = ref(props.selectedObject?.sharedText ?? ''); const inputRef = ref(); + const canInput = ref(true); + const editable = ref(false); const openDialog = (button: ButtonConfig) => { currentDialogName.value = button.label; currentComponent.value = button.type; dialogVisible.value = true; + editable.value = button.editable ?? true; }; const closeDialog = () => { @@ -100,20 +104,22 @@ export default defineComponent({ // const textAfter = sharedText.value.substring(cursorPosition); // sharedText.value = `${textBefore}${value._t}${textAfter}`; // } - + + if (value && value._t && (value._t as string).length > 0) { + canInput.value = editable.value; + } emit('update:selectedObject', { sharedText: sharedText.value, ...value }); dialogVisible.value = false; }; const clearSharedText = () => { sharedText.value = ''; + canInput.value = true; emit('update:selectedObject', {}); } const updateSharedText = (value) => { sharedText.value = value; - emit('update:selectedObject', { ...props.selectedObject, sharedText: value }); - console.log(props.selectedObject); } return { @@ -121,6 +127,7 @@ export default defineComponent({ dialogVisible, currentDialogName, currentComponent, + canInput, openDialog, closeDialog, handleSelect,