diff --git a/Frontend/src/components/xml/TabComponent.vue b/Frontend/src/components/xml/TabComponent.vue
index 479bf5e..480d9b6 100644
--- a/Frontend/src/components/xml/TabComponent.vue
+++ b/Frontend/src/components/xml/TabComponent.vue
@@ -8,25 +8,25 @@ const props = defineProps({
isActive: {
type: Boolean,
default: false,
- required: true
+ required: false
}
})
-const emit = defineEmits(["activate", "remove"])
+const emit = defineEmits(["click:activate", "click:remove"])
-function click() {
- emit("activate", props.id);
+function activate() {
+ emit("click:activate", props.id);
}
function remove() {
- emit("remove", props.id);
+ emit("click:remove", props.id);
}
-
- x
+
+ x
\ No newline at end of file
diff --git a/Frontend/src/components/xml/TabbedInputComponent.vue b/Frontend/src/components/xml/TabbedInputComponent.vue
index 1d7072e..b42dc5b 100644
--- a/Frontend/src/components/xml/TabbedInputComponent.vue
+++ b/Frontend/src/components/xml/TabbedInputComponent.vue
@@ -38,7 +38,7 @@ function addTab() {
- {{ item }}
+
New
diff --git a/Frontend/src/components/xml/XmlTabbedInputComponent.vue b/Frontend/src/components/xml/XmlTabbedInputComponent.vue
index d44b3d2..aabb036 100644
--- a/Frontend/src/components/xml/XmlTabbedInputComponent.vue
+++ b/Frontend/src/components/xml/XmlTabbedInputComponent.vue
@@ -5,6 +5,15 @@ import XMLButtonFormatterComponent from '@components/formatter/XMLButtonFormatte
import { ref } from 'vue'
import CodeEditor from '../CodeEditorComponent.vue'
+const newTabId = ref(0);
+const activeTabId = ref(0)
+const tabs = ref(new Array
);
+tabs.value.push({
+ id: newTabId.value++,
+ name: "XML1",
+ data: "",
+})
+
const data = ref('')
const inputFile = ref()
@@ -16,6 +25,12 @@ const props = defineProps(
)
const emit = defineEmits(['update'])
+interface TabData {
+ id: number;
+ name: string;
+ data: string;
+}
+
function sendValue() {
emit('update', data.value)
}
@@ -53,21 +68,57 @@ function readFile(file : any) {
reader.readAsText(file.target.files[0])
}
+function changeActiveTab(id : number) {
+ let index = findIndexWithID(activeTabId.value);
+ let newIndex = findIndexWithID(id);
+
+ tabs.value.at(index)!.data = data.value;
+ activeTabId.value = id;
+ data.value = tabs.value.at(newIndex)!.data;
+}
+
+function addTab() {
+ tabs.value.push({
+ id: newTabId.value++,
+ name: "XML" + newTabId.value,
+ data: ""
+ })
+}
+
+function removeTab(id : number) {
+ if (tabs.value.length == 1)
+ return
+
+ let index = findIndexWithID(activeTabId.value);
+ tabs.value.splice(index, 1);
+ if (activeTabId.value == id) {
+ activeTabId.value = tabs.value.at(0)!.id;
+ data.value = tabs.value.at(0)!.data;
+ }
+
+}
+
+function findIndexWithID(id : number) : number {
+ for (let i = 0; tabs.value.length; i++)
+ if (tabs.value.at(i)!.id == id)
+ return i;
+
+ return -1;
+}
+