fix go to step

pull/349/head
Pete Matsyburka 1 year ago
parent 561b16e9fb
commit 000f3c72fc

@ -1,6 +1,6 @@
<template> <template>
<template <template
v-for="step in steps" v-for="(step, stepIndex) in steps"
:key="step[0].uuid" :key="step[0].uuid"
> >
<template <template
@ -31,7 +31,7 @@
:with-label="withLabel && !withFieldPlaceholder" :with-label="withLabel && !withFieldPlaceholder"
:is-value-set="step.some((f) => f.uuid in values)" :is-value-set="step.some((f) => f.uuid in values)"
:attachments-index="attachmentsIndex" :attachments-index="attachmentsIndex"
@click="$emit('focus-step', step)" @click="$emit('focus-step', stepIndex)"
/> />
</Teleport> </Teleport>
</template> </template>

@ -453,7 +453,7 @@
href="#" href="#"
class="inline border border-base-300 h-3 w-3 rounded-full mx-1 mt-1" class="inline border border-base-300 h-3 w-3 rounded-full mx-1 mt-1"
:class="{ 'bg-base-300': index === currentStep, 'bg-base-content': (index < currentStep && stepFields[index].every((f) => !f.required || ![null, undefined, ''].includes(values[f.uuid]))) || isCompleted, 'bg-white': index > currentStep }" :class="{ 'bg-base-300': index === currentStep, 'bg-base-content': (index < currentStep && stepFields[index].every((f) => !f.required || ![null, undefined, ''].includes(values[f.uuid]))) || isCompleted, 'bg-white': index > currentStep }"
@click.prevent="isCompleted ? '' : [saveStep(), goToStep(step, true)]" @click.prevent="isCompleted ? '' : [saveStep(), goToStep(index, true)]"
/> />
</div> </div>
</div> </div>
@ -1024,8 +1024,8 @@ export default {
return null return null
} }
}, },
goToStep (step, scrollToArea = false, clickUpload = false) { goToStep (stepIndex, scrollToArea = false, clickUpload = false) {
this.currentStep = this.stepFields.indexOf(step) this.currentStep = stepIndex
this.showFillAllRequiredFields = false this.showFillAllRequiredFields = false
this.$nextTick(() => { this.$nextTick(() => {
@ -1033,7 +1033,7 @@ export default {
if (!this.isCompleted) { if (!this.isCompleted) {
if (scrollToArea) { if (scrollToArea) {
this.scrollIntoField(step[0]) this.scrollIntoField(this.currentField)
} }
this.enableScrollIntoField = false this.enableScrollIntoField = false
@ -1140,7 +1140,7 @@ export default {
this.isFormVisible = false this.isFormVisible = false
} }
this.goToStep(nextStep, this.autoscrollFields) this.goToStep(this.stepFields.indexOf(nextStep), this.autoscrollFields)
if (emptyRequiredField === nextStep) { if (emptyRequiredField === nextStep) {
this.showFillAllRequiredFields = true this.showFillAllRequiredFields = true

Loading…
Cancel
Save