Fixed #57 - MultiSelect filter cannot be turned off

pull/104/head
cagataycivici 2019-10-01 15:42:24 +03:00
parent 8e7c89965c
commit a8893d657c
2 changed files with 8 additions and 8 deletions

View File

@ -24,7 +24,7 @@
<span :class="['p-checkbox-icon p-c', {'pi pi-check': allSelected}]"></span> <span :class="['p-checkbox-icon p-c', {'pi pi-check': allSelected}]"></span>
</div> </div>
</div> </div>
<div class="p-multiselect-filter-container"> <div v-if="filter" class="p-multiselect-filter-container">
<input type="text" v-model="filterValue" class="p-multiselect-filter p-component p-inputtext p-component" :placeholder="filterPlaceholder"> <input type="text" v-model="filterValue" class="p-multiselect-filter p-component p-inputtext p-component" :placeholder="filterPlaceholder">
<span class="p-multiselect-filter-icon pi pi-search"></span> <span class="p-multiselect-filter-icon pi pi-search"></span>
</div> </div>
@ -129,7 +129,7 @@ export default {
this.headerCheckboxFocused = false; this.headerCheckboxFocused = false;
}, },
onClick() { onClick() {
if (!this.$refs.overlay || !this.$refs.overlay.contains(event.target)) { if (!this.disabled && (!this.$refs.overlay || !this.$refs.overlay.contains(event.target))) {
this.overlayVisible = !this.overlayVisible; this.overlayVisible = !this.overlayVisible;
this.$refs.focusInput.focus(); this.$refs.focusInput.focus();
} }
@ -143,7 +143,7 @@ export default {
case 40: case 40:
if (this.visibleOptions && !this.overlayVisible && event.altKey) { if (this.visibleOptions && !this.overlayVisible && event.altKey) {
this.overlayVisible = true; this.overlayVisible = true;
} }
break; break;
//space //space
@ -190,7 +190,7 @@ export default {
}, },
onOptionKeyDown(event, option) { onOptionKeyDown(event, option) {
let listItem = event.target; let listItem = event.target;
switch(event.which) { switch(event.which) {
//down //down
case 40: case 40:
@ -201,7 +201,7 @@ export default {
event.preventDefault(); event.preventDefault();
break; break;
//up //up
case 38: case 38:
var prevItem = this.findPrevItem(listItem); var prevItem = this.findPrevItem(listItem);
@ -211,7 +211,7 @@ export default {
event.preventDefault(); event.preventDefault();
break; break;
//enter //enter
case 13: case 13:
this.onOptionSelect(event, option); this.onOptionSelect(event, option);
@ -351,7 +351,7 @@ export default {
} }
else { else {
return this.value && this.options && (this.value.length > 0 && this.value.length === this.options.length); return this.value && this.options && (this.value.length > 0 && this.value.length === this.options.length);
} }
} }
} }
} }

View File

@ -127,7 +127,7 @@ data() {
<tr> <tr>
<td>filter</td> <td>filter</td>
<td>boolean</td> <td>boolean</td>
<td>true</td> <td>false</td>
<td>When specified, displays an input field to filter the items on keyup.</td> <td>When specified, displays an input field to filter the items on keyup.</td>
</tr> </tr>
<tr> <tr>