Skip to content

Commit 2b9b2c0

Browse files
committed
feat(QStepper): allow done/error/active-icon props to have "none" value, in which case defer to prefix or regular icon #8640 #10671
1 parent 4096740 commit 2b9b2c0

File tree

7 files changed

+44
-34
lines changed

7 files changed

+44
-34
lines changed

ui/dev/src/pages/Index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<div class="q-layout-padding q-mx-auto" style="max-width: 500px">
44
<router-link tag="a" to="/layout-quick/a" class="cursor-pointer row justify-center" style="margin-bottom: 25px">
5-
<img src="https://cdn.quasar.dev/logo-v2/128/logo.png">
5+
<img style="height:128px;width:128px" src="https://cdn.quasar.dev/logo-v2/128/logo.png">
66
</router-link>
77
<div class="text-caption text-center">
88
Quasar v{{ $q.version }}

ui/dev/src/pages/components/stepper.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
<q-toggle label="Global Navigation" v-model="globalNav" />
1616
<q-toggle label="Caption" v-model="caption" />
1717
<q-toggle label="Prefix" v-model="prefix" />
18-
<q-toggle label="Hide active icon" v-model="hideActiveIcon" />
19-
<q-toggle label="Hide error icon" v-model="hideErrorIcon" />
18+
<q-toggle label="No active icon" v-model="noActiveIcon" />
19+
<q-toggle label="No error icon" v-model="noErrorIcon" />
20+
<q-toggle label="No done icon" v-model="noDoneIcon" />
2021
<q-toggle label="Use 'done' prop" v-model="useDone" />
2122

2223
<q-toggle label="Step 4 disable" v-model="stepDisable" />
@@ -37,8 +38,9 @@
3738
:flat="flat"
3839
:bordered="bordered"
3940
:header-nav="headerNav"
40-
:hide-active-icon="hideActiveIcon"
41-
:hide-error-icon="hideErrorIcon"
41+
:active-icon="noActiveIcon ? 'none' : void 0"
42+
:error-icon="noErrorIcon ? 'none' : void 0"
43+
:done-icon="noDoneIcon ? 'none' : void 0"
4244
:color="color"
4345
ref="stepper"
4446
v-model="step"
@@ -225,8 +227,9 @@ export default {
225227
globalNav: false,
226228
caption: false,
227229
prefix: false,
228-
hideActiveIcon: false,
229-
hideErrorIcon: false,
230+
noActiveIcon: false,
231+
noErrorIcon: false,
232+
noDoneIcon: false,
230233
useDone: false,
231234
headerNavStep: false,
232235

ui/src/components/icon/QIcon.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default createComponent({
6969
let cls
7070
let icon = props.name
7171

72-
if (!icon) {
72+
if (!icon || icon === 'none') {
7373
return { none: true }
7474
}
7575

@@ -78,6 +78,9 @@ export default createComponent({
7878
if (res !== void 0) {
7979
if (res.icon !== void 0) {
8080
icon = res.icon
81+
if (icon === 'none') {
82+
return { none: true }
83+
}
8184
}
8285
else {
8386
return {

ui/src/components/stepper/QStepper.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ export default createComponent({
3939
doneIcon: String,
4040
doneColor: String,
4141
activeIcon: String,
42-
hideActiveIcon: Boolean,
4342
activeColor: String,
4443
errorIcon: String,
45-
hideErrorIcon: Boolean,
4644
errorColor: String
4745
},
4846

ui/src/components/stepper/QStepper.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
"done-icon": {
5656
"extends": "icon",
57+
"desc": "Icon name following Quasar convention; If 'none' (String) is used as value, then it will defer to prefix or the regular icon for this state; Make sure you have the icon library installed unless you are using 'img:' prefix",
5758
"category": "header"
5859
},
5960

@@ -64,31 +65,21 @@
6465

6566
"active-icon": {
6667
"extends": "icon",
68+
"desc": "Icon name following Quasar convention; If 'none' (String) is used as value, then it will defer to prefix or the regular icon for this state; Make sure you have the icon library installed unless you are using 'img:' prefix",
6769
"category": "header"
6870
},
6971

70-
"hide-active-icon": {
71-
"type": "Boolean",
72-
"desc": "Don't show the active icon when a step is active. Instead the step 'icon' will be shown or the step 'prefix' if it is defined.",
73-
"category": "header|behavior"
74-
},
75-
7672
"active-color": {
7773
"extends": "color",
7874
"category": "header"
7975
},
8076

8177
"error-icon": {
8278
"extends": "icon",
79+
"desc": "Icon name following Quasar convention; If 'none' (String) is used as value, then it will defer to prefix or the regular icon for this state; Make sure you have the icon library installed unless you are using 'img:' prefix",
8380
"category": "header"
8481
},
8582

86-
"hide-error-icon": {
87-
"type": "Boolean",
88-
"desc": "Don't show the error icon when a step has an error. Instead the step 'icon' will be shown or the step 'prefix' if it is defined.",
89-
"category": "header|behavior"
90-
},
91-
9283
"error-color": {
9384
"extends": "color",
9485
"category": "header"

ui/src/components/stepper/QStepper.sass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@
5252
&--error
5353
color: var(--q-negative)
5454

55+
&--error-with-icon
5556
.q-stepper__dot
5657
background: transparent !important
5758
span
5859
color: currentColor
59-
.q-icon
6060
font-size: 24px
6161

6262
&__header

ui/src/components/stepper/StepHeader.js

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,36 @@ export default createComponent({
4747

4848
const hasPrefix = computed(() => {
4949
return props.step.prefix
50-
&& (props.stepper.hideActiveIcon || isActive.value === false)
51-
&& (props.stepper.hideErrorIcon || isError.value === false)
52-
&& (props.stepper.hideErrorIcon || isDone.value === false)
50+
&& (isActive.value === false || props.stepper.activeIcon === 'none')
51+
&& (isError.value === false || props.stepper.errorIcon === 'none')
52+
&& (isDone.value === false || props.stepper.doneIcon === 'none')
5353
})
5454

5555
const icon = computed(() => {
56-
if (!props.stepper.hideActiveIcon && isActive.value === true) {
57-
return props.step.activeIcon || props.stepper.activeIcon || $q.iconSet.stepper.active
56+
const defaultIcon = props.step.icon || props.stepper.inactiveIcon
57+
58+
if (isActive.value === true) {
59+
const icon = props.step.activeIcon || props.stepper.activeIcon
60+
return icon === 'none'
61+
? defaultIcon
62+
: icon || $q.iconSet.stepper.active
5863
}
59-
if (!props.stepper.hideErrorIcon && isError.value === true) {
60-
return props.step.errorIcon || props.stepper.errorIcon || $q.iconSet.stepper.error
64+
65+
if (isError.value === true) {
66+
const icon = props.step.errorIcon || props.stepper.errorIcon
67+
return icon === 'none'
68+
? defaultIcon
69+
: icon || $q.iconSet.stepper.error
6170
}
62-
if (isDisable.value === false && isError.value === false && isDone.value === true) {
63-
return props.step.doneIcon || props.stepper.doneIcon || $q.iconSet.stepper.done
71+
72+
if (isDisable.value === false && isDone.value === true) {
73+
const icon = props.step.doneIcon || props.stepper.doneIcon
74+
return icon === 'none'
75+
? defaultIcon
76+
: icon || $q.iconSet.stepper.done
6477
}
6578

66-
return props.step.icon || props.stepper.inactiveIcon
79+
return defaultIcon
6780
})
6881

6982
const color = computed(() => {
@@ -90,7 +103,9 @@ export default createComponent({
90103
const classes = computed(() => {
91104
return 'q-stepper__tab col-grow flex items-center no-wrap relative-position'
92105
+ (color.value !== void 0 ? ` text-${ color.value }` : '')
93-
+ (isError.value === true ? ' q-stepper__tab--error' : '')
106+
+ (isError.value === true
107+
? ' q-stepper__tab--error q-stepper__tab--error-with-' + (hasPrefix.value ? 'prefix' : 'icon')
108+
: '')
94109
+ (isActive.value === true ? ' q-stepper__tab--active' : '')
95110
+ (isDone.value === true ? ' q-stepper__tab--done' : '')
96111
+ (headerNav.value === true ? ' q-stepper__tab--navigation q-focusable q-hoverable' : '')

0 commit comments

Comments
 (0)