Skip to content

Commit 79924e6

Browse files
committed
fix(ui): range-type and DateTime have issue recalculating body height
1 parent 544c3ff commit 79924e6

File tree

5 files changed

+26
-14
lines changed

5 files changed

+26
-14
lines changed

ui/src/component/QDateRangeScroller.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ export default {
275275
noMonths: this.startNoMonths,
276276
noYears: this.startNoYears,
277277
yearBegin: this.startYearBegin,
278-
yearStop: this.startYearStop
278+
yearStop: this.startYearStop,
279+
childHeight: this.bodyHeight
279280
},
280281
class: {
281282
'q-scroller__vertical-bar': this.verticalBar === true
@@ -319,7 +320,8 @@ export default {
319320
noMonths: this.endNoMonths,
320321
noYears: this.endNoYears,
321322
yearBegin: this.endYearBegin,
322-
yearStop: this.endYearStop
323+
yearStop: this.endYearStop,
324+
childHeight: this.bodyHeight
323325
},
324326
on: {
325327
input: v => { this.endDate = v }

ui/src/component/QDateTimeScroller.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ export default {
221221
showWeekdayLabel: this.showWeekdayLabel,
222222
noDays: this.noDays,
223223
noMonths: this.noMonths,
224-
noYears: this.noYears
224+
noYears: this.noYears,
225+
childHeight: this.bodyHeight
225226
},
226227
class: {
227228
'q-scroller__vertical-bar': this.verticalBar === true
@@ -258,7 +259,8 @@ export default {
258259
disabledHours: this.disabledHours,
259260
disabledMinutes: this.disabledMinutes,
260261
noMinutes: this.noMinutes,
261-
noHours: this.noHours
262+
noHours: this.noHours,
263+
childHeight: this.bodyHeight
262264
},
263265
on: {
264266
input: v => { this.time = v }

ui/src/component/QTimeRangeScroller.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ export default {
264264
disabledHours: this.startDisabledHours,
265265
disabledMinutes: this.startDisabledMinutes,
266266
noMinutes: this.startNoMinutes,
267-
noHours: this.startNoHours
267+
noHours: this.startNoHours,
268+
childHeight: this.bodyHeight
268269
},
269270
class: {
270271
'q-scroller__vertical-bar': this.verticalBar === true
@@ -302,7 +303,8 @@ export default {
302303
disabledHours: this.endDisabledHours,
303304
disabledMinutes: this.endDisabledMinutes,
304305
noMinutes: this.endNoMinutes,
305-
noHours: this.endNoHours
306+
noHours: this.endNoHours,
307+
childHeight: this.bodyHeight
306308
},
307309
on: {
308310
input: v => { this.endTime = v }

ui/src/component/mixins/common.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default {
99
let style = {}
1010
style['--scroller-border-color'] = this.calculateColor(this.borderColor)
1111
style['--scroller-bar-color'] = this.calculateColor(this.barColor)
12+
style.height = this.bodyHeight
1213
return style
1314
}
1415
},
@@ -44,12 +45,16 @@ export default {
4445
let self = this
4546
// this.$nextTick(() => {
4647
setTimeout(() => {
47-
self.headerHeight = self.noHeader === true ? 0 : self.dense === true ? 25 : 50
48-
self.footerHeight = self.noFooter === true ? 0 : self.dense === true ? 25 : 50
49-
self.height = self.$el.getBoundingClientRect().height
50-
self.bodyHeight = self.height - self.headerHeight - self.footerHeight
51-
if (self.noHeader !== true && self.noFooter !== true && self.noBorder !== true) {
52-
self.bodyHeight -= 2
48+
if (this.childHeight === void 0) {
49+
self.headerHeight = self.noHeader === true ? 0 : self.dense === true ? 25 : 50
50+
self.footerHeight = self.noFooter === true ? 0 : self.dense === true ? 25 : 50
51+
self.height = self.$el.getBoundingClientRect().height
52+
self.bodyHeight = self.height - self.headerHeight - self.footerHeight
53+
if (self.noHeader !== true && self.noFooter !== true && self.noBorder !== true) {
54+
self.bodyHeight -= 2
55+
}
56+
} else {
57+
self.bodyHeight = this.childHeight
5358
}
5459
}, 200)
5560
},
@@ -65,7 +70,7 @@ export default {
6570
'q-scroller__overflow-hidden': this.$q.platform.is.mobile !== true
6671
},
6772
style: {
68-
height: this.bodyHeight + 'px'
73+
height: (this.childHeight === void 0 ? this.bodyHeight : this.childHeight) + 'px'
6974
}
7075
}), [
7176
this.__renderScrollers(h)

ui/src/component/utils/props.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export default {
2727
disabledTextColor: {
2828
type: String,
2929
default: 'grey-7'
30-
}
30+
},
31+
childHeight: [Number, String]
3132
},
3233
base: {
3334
value: null, // [Number, String, Object, Array, Date, Function],

0 commit comments

Comments
 (0)