pull/525/head
mertsincan 2020-09-27 19:21:02 +03:00
parent 94cb6d2185
commit aaadcd5770
3 changed files with 3 additions and 14 deletions

View File

@ -1,7 +1,6 @@
import Vue, {VNode} from 'vue'; import Vue, {VNode} from 'vue';
export declare class MultiSelect extends Vue { export declare class MultiSelect extends Vue {
id?: string;
modelValue?: any; modelValue?: any;
options?: any[]; options?: any[];
optionLabel?: string; optionLabel?: string;

View File

@ -1,5 +1,5 @@
<template> <template>
<div ref="container" :id="containerId" :class="containerClass" @click="onClick"> <div ref="container" :class="containerClass" @click="onClick">
<div class="p-hidden-accessible"> <div class="p-hidden-accessible">
<input ref="focusInput" type="text" role="listbox" :id="inputId" readonly :disabled="disabled" @focus="onFocus" @blur="onBlur" @keydown="onKeyDown" :tabindex="tabindex" <input ref="focusInput" type="text" role="listbox" :id="inputId" readonly :disabled="disabled" @focus="onFocus" @blur="onBlur" @keydown="onKeyDown" :tabindex="tabindex"
aria-haspopup="listbox" :aria-expanded="overlayVisible" :aria-labelledby="ariaLabelledBy"/> aria-haspopup="listbox" :aria-expanded="overlayVisible" :aria-labelledby="ariaLabelledBy"/>
@ -56,14 +56,12 @@
<script> <script>
import ConnectedOverlayScrollHandler from '../utils/ConnectedOverlayScrollHandler'; import ConnectedOverlayScrollHandler from '../utils/ConnectedOverlayScrollHandler';
import UniqueComponentId from '../utils/UniqueComponentId';
import ObjectUtils from '../utils/ObjectUtils'; import ObjectUtils from '../utils/ObjectUtils';
import DomHandler from '../utils/DomHandler'; import DomHandler from '../utils/DomHandler';
import Ripple from '../ripple/Ripple'; import Ripple from '../ripple/Ripple';
export default { export default {
props: { props: {
id: null,
modelValue: null, modelValue: null,
options: Array, options: Array,
optionLabel: null, optionLabel: null,
@ -317,7 +315,8 @@ export default {
}, },
bindScrollListener() { bindScrollListener() {
if (!this.scrollHandler) { if (!this.scrollHandler) {
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, this.containerId, () => { const { id } = this.$attrs;
this.scrollHandler = new ConnectedOverlayScrollHandler(this.$refs.container, id, () => {
if (this.overlayVisible) { if (this.overlayVisible) {
this.hide(); this.hide();
} }
@ -380,9 +379,6 @@ export default {
} }
}, },
computed: { computed: {
containerId() {
return this.id || UniqueComponentId();
},
visibleOptions() { visibleOptions() {
if (this.filterValue && this.filterValue.trim().length > 0) if (this.filterValue && this.filterValue.trim().length > 0)
return this.options.filter(option => this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale).indexOf(this.filterValue.toLocaleLowerCase(this.filterLocale)) > -1); return this.options.filter(option => this.getOptionLabel(option).toLocaleLowerCase(this.filterLocale).indexOf(this.filterValue.toLocaleLowerCase(this.filterLocale)) > -1);

View File

@ -84,12 +84,6 @@ data() {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<td>id</td>
<td>string</td>
<td>null</td>
<td>Unique identifier of the element.</td>
</tr>
<tr> <tr>
<td>modelValue</td> <td>modelValue</td>
<td>any</td> <td>any</td>