Skip to content

Commit 2c2bcad

Browse files
committed
feat(QScrollArea): Remove now obsolete prop "force-on-mobile" (it's on by default); Add "dark" prop
1 parent e20c143 commit 2c2bcad

File tree

5 files changed

+44
-31
lines changed

5 files changed

+44
-31
lines changed

ui/dev/src/pages/components/scroll-area.vue

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<div class="q-layout-padding">
33
<q-toggle v-model="horizontal" label="Horizontal" />
44
<q-toggle v-model="customStyle" label="Custom style" />
5-
<q-toggle v-model="forceOnMobile" label="Force on mobile" />
65
<q-checkbox v-model="alwaysVisible" toggle-indeterminate label="Always visible" />
76

87
<div style="height: 300px;" />
8+
99
<q-scroll-area
1010
ref="scroll"
1111
style="width: 400px; height: 500px;"
@@ -14,12 +14,29 @@
1414
:visible="alwaysVisible"
1515
:bar-style="customStyle === true ? customBarStyle : void 0"
1616
:thumb-style="customStyle === true ? customThumbStyle : void 0"
17-
:force-on-mobile="forceOnMobile"
1817
>
1918
<div :class="{ 'flex no-wrap' : horizontal }">
2019
<div style="margin-top: 150px" />
2120
<div style="margin-bottom: 25px" :style="horizontal ? 'width: 160px' : ''" v-for="n in number" :key="n">
22-
{{ n }} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <q-btn>Click</q-btn>
21+
{{ n }} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
22+
<q-btn label="Click" color="primary" />
23+
</div>
24+
</div>
25+
</q-scroll-area>
26+
27+
<q-scroll-area
28+
ref="scroll"
29+
style="width: 400px; height: 500px;"
30+
class="bg-dark text-white q-mt-lg"
31+
:horizontal="horizontal"
32+
:visible="alwaysVisible"
33+
dark
34+
>
35+
<div :class="{ 'flex no-wrap' : horizontal }">
36+
<div style="margin-top: 150px" />
37+
<div style="margin-bottom: 25px" :style="horizontal ? 'width: 160px' : ''" v-for="n in number" :key="n">
38+
{{ n }} Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
39+
<q-btn label="Click" color="primary" />
2340
</div>
2441
</div>
2542
</q-scroll-area>
@@ -49,8 +66,7 @@ export default {
4966
number: 10,
5067
horizontal: false,
5168
alwaysVisible: true,
52-
customStyle: true,
53-
forceOnMobile: false
69+
customStyle: true
5470
}
5571
},
5672

ui/src/components/scroll-area/QScrollArea.js

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ import { cache } from '../../utils/vm.js'
88
import QResizeObserver from '../resize-observer/QResizeObserver.js'
99
import QScrollObserver from '../scroll-observer/QScrollObserver.js'
1010
import TouchPan from '../../directives/TouchPan.js'
11+
import DarkMixin from '../../mixins/dark.js'
1112

1213
export default Vue.extend({
1314
name: 'QScrollArea',
1415

16+
mixins: [ DarkMixin ],
17+
1518
directives: {
1619
TouchPan
1720
},
1821

1922
props: {
20-
forceOnMobile: Boolean,
21-
2223
barStyle: [ Array, String, Object ],
2324
thumbStyle: Object,
2425
contentStyle: [ Array, String, Object ],
@@ -55,6 +56,11 @@ export default Vue.extend({
5556
},
5657

5758
computed: {
59+
classes () {
60+
return 'q-scrollarea' +
61+
(this.isDark === true ? ' q-scrollarea--dark' : '')
62+
},
63+
5864
thumbHidden () {
5965
return this.scrollSize <= this.containerSize ||
6066
(this.active === false && this.hover === false)
@@ -78,7 +84,8 @@ export default Vue.extend({
7884
this.horizontal === true
7985
? {
8086
left: `${pos}px`,
81-
width: `${this.thumbSize}px` }
87+
width: `${this.thumbSize}px`
88+
}
8289
: {
8390
top: `${pos}px`,
8491
height: `${this.thumbSize}px`
@@ -104,9 +111,7 @@ export default Vue.extend({
104111
},
105112

106113
containerSize () {
107-
return this.horizontal === true
108-
? this.containerWidth
109-
: this.containerHeight
114+
return this[`container${this.horizontal === true ? 'Width' : 'Height'}`]
110115
},
111116

112117
dirProps () {
@@ -239,20 +244,8 @@ export default Vue.extend({
239244
},
240245

241246
render (h) {
242-
if (this.forceOnMobile !== true && this.$q.platform.is.desktop !== true) {
243-
return h('div', {
244-
staticClass: 'q-scrollarea',
245-
style: this.contentStyle
246-
}, [
247-
h('div', {
248-
ref: 'target',
249-
staticClass: 'scroll relative-position fit'
250-
}, slot(this, 'default'))
251-
])
252-
}
253-
254247
return h('div', {
255-
staticClass: 'q-scrollarea',
248+
class: this.classes,
256249
on: this.visible === null
257250
? cache(this, 'desk', {
258251
mouseenter: () => { this.hover = true },

ui/src/components/scroll-area/QScrollArea.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
},
55

66
"props": {
7+
"dark": {
8+
"extends": "dark",
9+
"addedIn": "v1.9.0"
10+
},
11+
712
"bar-style": {
813
"type": [ "Array", "String", "Object"],
914
"desc": "Object with CSS properties and values for styling the custom scrollbar",
@@ -52,13 +57,6 @@
5257
"type": "Boolean",
5358
"desc": "Register for horizontal scroll instead of vertical (which is default)",
5459
"category": "behavior"
55-
},
56-
57-
"force-on-mobile": {
58-
"type": "Boolean",
59-
"desc": "Use custom scrollbar on mobile too; The scroll area will not benefit from inertial scrolling on mobile",
60-
"category": "behavior",
61-
"addedIn": "v1.5.11"
6260
}
6361
},
6462

ui/src/components/scroll-area/QScrollArea.sass

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@
3030
&--invisible
3131
&:hover
3232
cursor: inherit
33+
34+
&--dark .q-scrollarea__thumb
35+
background: #fff

ui/src/components/scroll-area/QScrollArea.styl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@
3030
&--invisible
3131
&:hover
3232
cursor: inherit
33+
34+
&--dark .q-scrollarea__thumb
35+
background: #fff

0 commit comments

Comments
 (0)