pull/525/head
mertsincan 2020-09-27 19:15:46 +03:00
parent 5efcd01077
commit 94cb6d2185
3 changed files with 6 additions and 16 deletions

View File

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

View File

@ -1,5 +1,5 @@
<template> <template>
<span ref="container" :id="containerId" :class="containerClass" aria-haspopup="listbox" :aria-owns="listId" :aria-expanded="overlayVisible" :style="style"> <span ref="container" :class="containerClass" aria-haspopup="listbox" :aria-owns="listId" :aria-expanded="overlayVisible" :style="style">
<input ref="input" :class="inputClass" v-bind="$attrs" :value="inputValue" @input="onInput" @focus="onFocus" @blur="onBlur" @keydown="onKeyDown" type="text" autoComplete="off" v-if="!multiple" <input ref="input" :class="inputClass" v-bind="$attrs" :value="inputValue" @input="onInput" @focus="onFocus" @blur="onBlur" @keydown="onKeyDown" type="text" autoComplete="off" v-if="!multiple"
role="searchbox" aria-autocomplete="list" :aria-controls="listId"> role="searchbox" aria-autocomplete="list" :aria-controls="listId">
<ul ref="multiContainer" :class="multiContainerClass" v-if="multiple" @click="onMultiContainerClick"> <ul ref="multiContainer" :class="multiContainerClass" v-if="multiple" @click="onMultiContainerClick">
@ -39,7 +39,6 @@ import Ripple from '../ripple/Ripple';
export default { export default {
inheritAttrs: false, inheritAttrs: false,
props: { props: {
id: null,
modelValue: null, modelValue: null,
suggestions: { suggestions: {
type: Array, type: Array,
@ -144,7 +143,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.hideOverlay(); this.hideOverlay();
} }
@ -407,12 +407,6 @@ export default {
} }
}, },
computed: { computed: {
containerId() {
return this.id || UniqueComponentId();
},
listId() {
return this.containerId + '_list';
},
containerClass() { containerClass() {
return ['p-autocomplete p-component p-inputwrapper', this.class, { return ['p-autocomplete p-component p-inputwrapper', this.class, {
'p-autocomplete-dd': this.dropdown, 'p-autocomplete-dd': this.dropdown,
@ -445,6 +439,9 @@ export default {
else { else {
return ''; return '';
} }
},
listId() {
return UniqueComponentId() + '_list';
} }
}, },
components: { components: {

View File

@ -94,12 +94,6 @@ export default {
</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>