Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New prop test #36

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
22 changes: 12 additions & 10 deletions src/HorizontalStepper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
}

.stepper-box {
background-color: white;
@include shadow(1);
background-color: transparent;
min-height: 200px;
.top {
.stepper-button-top {
Expand All @@ -57,8 +56,8 @@
align-items: center;
justify-content: space-between;
&.next {
border: 2px solid #3383c8;
color: #3383c8;
border: 2px solid #000;
color: #000;
right: 1%;
&.deactivated {
border: 2px solid #cccccc !important;
Expand All @@ -67,6 +66,7 @@
}
}
&.previous {
border: 2px solid #333333;
color: #333333;
left: 1%;
}
Expand Down Expand Up @@ -120,9 +120,9 @@
.circle {
margin-bottom: 1rem;
padding: 0 1rem;
background-color: white;
background-color: transparent;
i {
background-color: #3383c8;
background-color: #000;
color: #fff;
border-radius: 100rem;
padding: 1rem;
Expand Down Expand Up @@ -166,22 +166,24 @@
}
.stepper-button {
padding: .5rem 1rem;
border-radius: 30px;
box-shadow: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: space-between;
border-radius: 30px!important;
&.next {
background-color: #3383c8;
background-color: #d80000;
color: white;
@include shadow(1);
&.deactivated {
background-color: #cccccc !important;
cursor: not-allowed !important;
}
}
&.previous {
color: #333333;
color: #d80000;
}
}
}
}
}
39 changes: 34 additions & 5 deletions src/HorizontalStepper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
<transition :enter-active-class="enterAnimation" :leave-active-class="leaveAnimation" mode="out-in">
<!--If keep alive-->
<keep-alive v-if="keepAliveData">
<component :is="steps[currentStep.index].component" :clickedNext="nextButton[currentStep.name]" @can-continue="proceed" @change-next="changeNextBtnValue" :current-step="currentStep"></component>
<component :is="steps[currentStep.index].component" :isready="canContinue" :clickedNext="nextButton[currentStep.name]" @can-continue="proceed" @change-next="changeNextBtnValue" :current-step="currentStep"></component>
</keep-alive>
<!--If not show component and destroy it in each step change-->
<component v-else :is="steps[currentStep.index].component" :clickedNext="nextButton[currentStep.name]" @can-continue="proceed" @change-next="changeNextBtnValue" :current-step="currentStep"></component>
<component v-else :is="steps[currentStep.index].component" :isready="canContinue" :clickedNext="nextButton[currentStep.name]" @can-continue="proceed" @change-next="changeNextBtnValue" :current-step="currentStep"></component>
</transition>
</div>
<div :class="['bottom', (currentStep.index > 0) ? '' : 'only-next']">
Expand All @@ -42,7 +42,7 @@
<span>{{ 'back' | translate(locale) }}</span>
</div>
<div :class="['stepper-button next', !canContinue ? 'deactivated' : '']" @click="nextStep()">
<span>{{ (finalStep) ? 'finish' : 'next' | translate(locale) }}</span>
<span>{{ (finalStep) ? lastButton : 'Next' }}</span>
<i class="material-icons">keyboard_arrow_right</i>
</div>
</div>
Expand All @@ -64,6 +64,10 @@ export default {
type: String,
default: "en"
},
lastButton: {
type: String,
default: "Finish"
},
topButtons: {
type: Boolean,
default: false
Expand Down Expand Up @@ -94,6 +98,10 @@ export default {
reset: {
type: Boolean,
default: false
},
review: {
type: Boolean,
default: false
}
},

Expand Down Expand Up @@ -151,6 +159,17 @@ export default {
if (!back) {
this.$emit("completed-step", this.previousStep);
}

if(this.review) {
if(this.steps[index].completed) {
this.canContinue = true;
}
}

if (!this.steps[index].required) {
this.canContinue = true;
}

}
this.$emit("active-step", this.currentStep);
},
Expand All @@ -165,7 +184,13 @@ export default {

this.activateStep(currentIndex);
}
this.canContinue = false;

if (!this.steps[this.currentStep.index].required) {
this.canContinue = true;
} else {
this.canContinue = false;
}

this.$forceUpdate();
},

Expand All @@ -175,7 +200,11 @@ export default {
this.nextStepAction()
}

this.canContinue = false;
if (!this.steps[this.currentStep.index].required) {
this.canContinue = true;
} else {
this.canContinue = false;
}

this.$emit("before-next-step", { currentStep: this.currentStep }, (next = true) => {
this.canContinue = true;
Expand Down