Skip to content

Commit 6972c86

Browse files
committed
ColorPicker & scrollPanel input fix
1 parent 2956da8 commit 6972c86

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/components/colorpicker/colorpicker.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div ref="pickerPanel"
1212
:class="{'ui-colorpicker-panel ui-corner-all': true, 'ui-colorpicker-overlay-panel ui-shadow':!inline, 'ui-state-disabled': disabled}"
1313
@click="onPanelClick()"
14-
v-show="inline || panelVisible">
14+
v-show="display()">
1515
<div class="ui-colorpicker-content">
1616
<div ref="colorSelector" class="ui-colorpicker-color-selector" @mousedown="onColorMousedown($event)">
1717
<div class="ui-colorpicker-color">
@@ -100,7 +100,7 @@
100100
},
101101
inputValue (value) {
102102
this.writeValue(value);
103-
this.$emit('input', value);
103+
this.$emit('input', this.getValueToUpdate());
104104
}
105105
},
106106
methods: {
@@ -156,7 +156,7 @@
156156
157157
this.updateUI();
158158
this.updateModel();
159-
this.$emit('change', {originalEvent: event, value: this.getValueToUpdate()});
159+
this.$emit('input', this.getValueToUpdate());
160160
},
161161
162162
getValueToUpdate () {
@@ -183,7 +183,7 @@
183183
},
184184
185185
writeValue (value) {
186-
if (value) {
186+
if (value && typeof value === 'string') {
187187
switch (this.format) {
188188
case 'hex':
189189
this.inputValue = this.HEXtoHSB(value);
@@ -263,7 +263,6 @@
263263
264264
onPanelClick () {
265265
this.selfClick = true;
266-
this.panelVisible = !this.panelVisible;
267266
},
268267
269268
setDisabledState (val) {
@@ -459,12 +458,17 @@
459458
460459
updateFilled (value) {
461460
this.filled = value && value.length;
461+
},
462+
463+
display () {
464+
return (this.inline || this.panelVisible);
462465
}
463466
},
464467
created () {
465468
this.updateFilled(this.inputValue);
466469
},
467470
mounted () {
471+
this.writeValue(this.value);
468472
if (this.appendTo) {
469473
if (this.appendTo === 'body') { document.body.appendChild(this.$refs.pickerPanel); } else { domHandler.appendChild(this.$refs.pickerPanel, this.appendTo); }
470474
}

src/components/scrollpanel/scrollpanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
name: 'p-scrollPanel',
1616
props: {
1717
scrollpanelStyle: {
18-
type: String,
18+
type: Object,
1919
default: null
2020
},
2121
scrollpanelStyleClass: {

0 commit comments

Comments
 (0)