Skip to content

Commit 4417682

Browse files
committed
feat(QSplitter): New Boolean prop ("emit-immediately") quasarframework#5632
1 parent 073581c commit 4417682

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

ui/dev/components/components/splitter.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<q-toggle v-model="disable" label="Disable" />
88
<q-toggle v-model="funkyLimits" label="Funky limits" />
99
<q-toggle v-model="showSeparator" label="Show separator" />
10+
<q-toggle v-model="emitImmediately" label="Emit immediately" />
1011
<q-input
1112
v-model="model"
1213
standout
@@ -33,6 +34,7 @@
3334
:unit="modelUnit"
3435
:limits="limits"
3536
:disable="disable"
37+
:emit-immediately="emitImmediately"
3638

3739
class="q-mt-md"
3840
style="height: 700px; border: 1px solid black"
@@ -75,6 +77,7 @@
7577
:unit="modelUnit"
7678
:limits="limits"
7779
:disable="disable"
80+
:emit-immediately="emitImmediately"
7881

7982
class="q-mt-md stylish-splitter"
8083
separator-class="bg-deep-orange"
@@ -182,7 +185,8 @@ export default {
182185
modelUnit: '%',
183186
funkyLimits: false,
184187
disable: false,
185-
showSeparator: true
188+
showSeparator: true,
189+
emitImmediately: false
186190
}
187191
},
188192

ui/src/components/splitter/QSplitter.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export default Vue.extend({
3636
}
3737
},
3838

39+
emitImmediately: Boolean,
40+
3941
horizontal: Boolean,
4042
disable: Boolean,
4143

@@ -128,6 +130,10 @@ export default Vue.extend({
128130
this.__normalized = Math.min(this.__maxValue, this.computedLimits[1], Math.max(this.computedLimits[0], val))
129131

130132
this.$refs[this.side].style[this.prop] = this.__getCSSValue(this.__normalized)
133+
134+
if (this.emitImmediately === true && this.value !== this.__normalized) {
135+
this.$emit('input', this.__normalized)
136+
}
131137
},
132138

133139
__normalize (val, limits) {

ui/src/components/splitter/QSplitter.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
"addedIn": "v1.2.6"
2828
},
2929

30+
"emit-immediately": {
31+
"type": "Boolean",
32+
"desc": "Emit model while user is panning on the separator",
33+
"category": "model"
34+
},
35+
3036
"horizontal": {
3137
"type": "Boolean",
3238
"desc": "Allows the splitter to split its two panels horizontally, instead of vertically",

0 commit comments

Comments
 (0)