Skip to content

Commit

Permalink
First tab showed
Browse files Browse the repository at this point in the history
Signed-off-by: Zubairrafi <[email protected]>
  • Loading branch information
walleeva2018 committed Mar 15, 2024
1 parent 7ec6569 commit 4899498
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/ObjectForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
:schema="properties[key]"
:errors="errors"
:reference-model="referenceModel[key] || {}"
:tab-counter="2"
@update:modelValue="handleChange"
/>
</v-field>
Expand Down
7 changes: 6 additions & 1 deletion src/components/ObjectFormWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!-- show errors-->
<component-errors :errors="calcFormErrors(errors, fieldName)" />
</h6>
<tabs v-if="!onlyJson" v-model="activeTab" />
<tabs v-if="!onlyJson" v-model="activeTab" :showTabCounter="tabCounter" />
</div>
<!-- form for all the object's properties -->
<object-form
Expand All @@ -39,6 +39,7 @@
:is-self-folded="isFolded"
:reference-model="referenceModel || {}"
:errors="errors"
:tab-counter="tabCounter"
/>
<!-- declared in tabs component -->
<yaml-form
Expand Down Expand Up @@ -98,6 +99,10 @@ export default defineComponent({
type: Number,
default: 1,
},
tabCounter: {
type: Number,
default: 0,
}
},
});
</script>
40 changes: 39 additions & 1 deletion src/components/Tabs.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
<template>
<div class="tabs ac-tabs is-line">
<div v-if="showTabCounter===1" class="tabs is-line">

<ul>
<li :class="{ 'is-active': activeTab === 'form' }">
<a @click.prevent="showForm()">
<span class="icon is-small"
><i
class="fa fa-file-text fa-flip-horizontal"
aria-hidden="true"
></i
></span>
<span>Form</span>
</a>
</li>
<li :class="{ 'is-active': activeTab === 'yaml' }">
<a @click.prevent="showYaml()">
<span class="icon is-small"
><i class="fa fa-code" aria-hidden="true"></i
></span>
<span>YAML</span>
</a>
</li>
<li :class="{ 'is-active': activeTab === 'json' }">
<a @click.prevent="showJson()">
<span class="icon is-small"
><i class="fa fa-code" aria-hidden="true"></i
></span>
<span>JSON</span>
</a>
</li>
</ul>
</div>
<div v-else class="tabs ac-tabs is-line">

<ul>
<li :class="{ 'is-active': activeTab === 'form' }">
<a @click.prevent="showForm()">
Expand Down Expand Up @@ -30,6 +63,7 @@
</li>
</ul>
</div>

</template>

<script>
Expand All @@ -42,6 +76,10 @@ export default defineComponent({
type: String,
default: 'form',
},
showTabCounter: {
type: Number,
default: 0,
}
},
emits: ['update:modelValue'],
Expand Down
1 change: 1 addition & 0 deletions src/components/VueOpenapiForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
:schema="extendedSchema"
:reference-model="referenceModel || {}"
:errors="errors"
:tab-counter =1
@update:modelValue="handleChange"
/>
</v-field>
Expand Down

0 comments on commit 4899498

Please sign in to comment.