Skip to content

Commit 4adfcbd

Browse files
committed
feat(QStepper): flag to disable navigation through header quasarframework#1716
1 parent 516238c commit 4adfcbd

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
lines changed

dev/components/components/stepper.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
<div class="layout-padding">
44
<q-toggle label="Alternative Labels" v-model="alt" />
55
<q-toggle label="Contractable" v-model="contractable" />
6+
<q-toggle label="Header Step Navigation (Back)" v-model="backnav" />
67
<br><br>
78

8-
<q-stepper :color="color" flat ref="stepper" v-model="step" :alternative-labels="alt" :contractable="contractable">
9+
<q-stepper :no-header-navigation="!backnav" :color="color" flat ref="stepper" v-model="step" :alternative-labels="alt" :contractable="contractable">
910
<q-step default name="first" title="Ad style">
1011
<div v-for="n in 10">Step 1</div>
1112
<q-stepper-navigation>
@@ -50,7 +51,7 @@
5051

5152
<br><br>
5253

53-
<q-stepper ref="stepper2" :color="color" v-model="step2" :alternative-labels="alt" vertical>
54+
<q-stepper :no-header-navigation="!backnav" ref="stepper2" :color="color" v-model="step2" :alternative-labels="alt" vertical>
5455
<q-step default name="first" title="Ad style">
5556
<div v-for="n in 10">Step 1</div>
5657
<q-stepper-navigation>
@@ -99,6 +100,7 @@ export default {
99100
step2: 'first',
100101
alt: false,
101102
contractable: false,
103+
backnav: true,
102104
color: 'secondary',
103105
text: ''
104106
}

src/components/stepper/QStepper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default {
1111
color: String,
1212
vertical: Boolean,
1313
alternativeLabels: Boolean,
14+
noHeaderNavigation: Boolean,
1415
contractable: Boolean,
1516
doneIcon: Boolean,
1617
activeIcon: Boolean,

src/components/stepper/StepTab.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ export default {
1111
},
1212
props: ['vm'],
1313
computed: {
14+
hasNavigation () {
15+
return !this.vm.__stepper.noHeaderNavigation
16+
},
1417
classes () {
1518
return {
1619
'step-error': this.vm.error,
1720
'step-active': this.vm.active,
1821
'step-done': this.vm.done,
22+
'step-navigation': this.vm.done && this.hasNavigation,
1923
'step-waiting': this.vm.waiting,
2024
'step-disabled': this.vm.disable,
2125
'step-colored': this.vm.active || this.vm.done,
@@ -28,7 +32,9 @@ export default {
2832
},
2933
methods: {
3034
__select () {
31-
this.vm.select()
35+
if (this.hasNavigation) {
36+
this.vm.select()
37+
}
3238
}
3339
},
3440
render (h) {
@@ -42,7 +48,7 @@ export default {
4248
on: {
4349
click: this.__select
4450
},
45-
directives: __THEME__ === 'mat'
51+
directives: __THEME__ === 'mat' && this.hasNavigation
4652
? [{
4753
name: 'ripple',
4854
value: this.vm.done

src/components/stepper/stepper.ios.styl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
color black
3030
.q-stepper-dot
3131
color $stepper-label-inactive-color
32-
&.step-done
33-
cursor pointer
32+
&.step-navigation
3433
user-select none
34+
cursor pointer
3535
&:active
3636
background $stepper-active-background !important
3737
&.step-color
@@ -144,7 +144,7 @@
144144
top 100%
145145
margin-top 8px
146146

147-
body.desktop .q-stepper-tab.step-done:hover
147+
body.desktop .q-stepper-tab.step-navigation:hover
148148
background $stepper-hover-background
149149

150150
@media (max-width $breakpoint-sm-max)

src/components/stepper/stepper.mat.styl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
color black
3030
.q-stepper-dot
3131
color $stepper-label-inactive-color
32-
&.step-done
33-
cursor pointer
32+
&.step-navigation
3433
user-select none
34+
cursor pointer
3535
&.step-color
3636
color currentColor
3737
&.step-active .q-stepper-title
@@ -142,7 +142,7 @@
142142
top 100%
143143
margin-top 8px
144144

145-
body.desktop .q-stepper-tab.step-done:hover
145+
body.desktop .q-stepper-tab.step-navigation:hover
146146
background $stepper-hover-background
147147

148148
@media (max-width $breakpoint-sm-max)

0 commit comments

Comments
 (0)