Skip to content

Commit f8ec6b8

Browse files
committed
feat(QExpansionItem): New prop -> "expanded-icon" quasarframework#4699
1 parent 4565d9c commit f8ec6b8

File tree

5 files changed

+23
-16
lines changed

5 files changed

+23
-16
lines changed

ui/dev/components/components/list-expansion-item.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
expand-separator
4242
icon="perm_identity"
4343
label="With a model and events - decoupled"
44+
expand-icon="text_rotation_down"
45+
expanded-icon="text_rotate_up"
4446
>
4547
<q-card>
4648
<q-card-section>

ui/src/api.extends.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
"text-color": {
2323
"type": "String",
24-
"desc": "Overrides text color (if needed); color name from the Quasar Color Palette",
24+
"desc": "Overrides text color (if needed); Color name from the Quasar Color Palette",
2525
"examples": [ "primary", "teal-10" ],
2626
"category": "style"
2727
},
@@ -47,7 +47,7 @@
4747

4848
"icon": {
4949
"type": "String",
50-
"desc": "Icon name following Quasar convention; make sure you have the icon library installed unless you are using 'img:' prefix",
50+
"desc": "Icon name following Quasar convention; Make sure you have the icon library installed unless you are using 'img:' prefix",
5151
"examples": [
5252
"map",
5353
"ion-add",

ui/src/components/btn/QBtn.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,19 +228,15 @@ export default Vue.extend({
228228
}]
229229
}
230230

231-
if (this.icon !== void 0) {
232-
inner.push(
233-
h(QIcon, {
234-
props: { name: this.icon, left: this.stack === false && this.hasLabel === true }
235-
})
236-
)
237-
}
231+
this.icon !== void 0 && inner.push(
232+
h(QIcon, {
233+
props: { name: this.icon, left: this.stack === false && this.hasLabel === true }
234+
})
235+
)
238236

239-
if (this.hasLabel === true) {
240-
inner.push(
241-
h('div', [ this.label ])
242-
)
243-
}
237+
this.hasLabel === true && inner.push(
238+
h('div', [ this.label ])
239+
)
244240

245241
const def = slot(this, 'default')
246242
def !== void 0 && inner.push(def)

ui/src/components/expansion-item/QExpansionItem.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export default Vue.extend({
3232
dense: Boolean,
3333

3434
expandIcon: String,
35+
expandedIcon: String,
3536
expandIconClass: [ Array, String, Object ],
3637
duration: Number,
3738

@@ -93,7 +94,9 @@ export default Vue.extend({
9394
},
9495

9596
expansionIcon () {
96-
return this.expandIcon || (this.denseToggle ? this.$q.iconSet.expansionItem.denseIcon : this.$q.iconSet.expansionItem.icon)
97+
return this.expandedIcon !== void 0 && this.showing === true
98+
? this.expandedIcon
99+
: this.expandIcon || this.$q.iconSet.expansionItem[this.denseToggle === true ? 'denseIcon' : 'icon']
97100
},
98101

99102
activeToggleIcon () {
@@ -137,7 +140,7 @@ export default Vue.extend({
137140
h(QIcon, {
138141
staticClass: 'q-expansion-item__toggle-icon q-focusable',
139142
class: {
140-
'rotate-180': this.showing,
143+
'rotate-180': this.expandedIcon === void 0 ? this.showing : false,
141144
invisible: this.disable
142145
},
143146
props: {

ui/src/components/expansion-item/QExpansionItem.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
"extends": "icon"
1616
},
1717

18+
"expanded-icon": {
19+
"extends": "icon",
20+
"desc": "Expand icon name (following Quasar convention) for when QExpansionItem is expanded; When used, it also disables the rotation animation of the expand icon; Make sure you have the icon library installed unless you are using 'img:' prefix",
21+
"addedIn": "v1.4.5"
22+
},
23+
1824
"expand-icon-class": {
1925
"type": [ "Array", "String", "Object" ],
2026
"desc": "Apply custom class(es) to the expand icon item section",

0 commit comments

Comments
 (0)