commit
69c2ebd15b
|
@ -16,6 +16,7 @@ export declare class Dropdown extends Vue {
|
||||||
showClear?: boolean;
|
showClear?: boolean;
|
||||||
tabindex?: string;
|
tabindex?: string;
|
||||||
ariaLabelledBy?: string;
|
ariaLabelledBy?: string;
|
||||||
|
appendTo?: string;
|
||||||
$emit(eventName: 'input', value: string): this;
|
$emit(eventName: 'input', value: string): this;
|
||||||
$emit(eventName: 'change', e: { originalEvent: Event, value: string }): this;
|
$emit(eventName: 'change', e: { originalEvent: Event, value: string }): this;
|
||||||
$slot: {
|
$slot: {
|
||||||
|
|
|
@ -55,7 +55,11 @@ export default {
|
||||||
dataKey: null,
|
dataKey: null,
|
||||||
showClear: Boolean,
|
showClear: Boolean,
|
||||||
tabindex: String,
|
tabindex: String,
|
||||||
ariaLabelledBy: null
|
ariaLabelledBy: null,
|
||||||
|
appendTo: {
|
||||||
|
type: String,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -70,6 +74,7 @@ export default {
|
||||||
previousSearchChar: null,
|
previousSearchChar: null,
|
||||||
searchValue: null,
|
searchValue: null,
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
this.restoreAppend();
|
||||||
this.unbindOutsideClickListener();
|
this.unbindOutsideClickListener();
|
||||||
},
|
},
|
||||||
updated() {
|
updated() {
|
||||||
|
@ -267,6 +272,7 @@ export default {
|
||||||
this.$emit('input', event.target.value);
|
this.$emit('input', event.target.value);
|
||||||
},
|
},
|
||||||
onOverlayEnter() {
|
onOverlayEnter() {
|
||||||
|
this.appendContainer();
|
||||||
this.alignOverlay();
|
this.alignOverlay();
|
||||||
this.bindOutsideClickListener();
|
this.bindOutsideClickListener();
|
||||||
|
|
||||||
|
@ -278,7 +284,12 @@ export default {
|
||||||
this.unbindOutsideClickListener();
|
this.unbindOutsideClickListener();
|
||||||
},
|
},
|
||||||
alignOverlay() {
|
alignOverlay() {
|
||||||
DomHandler.relativePosition(this.$refs.overlay, this.$refs.container);
|
if (this.appendTo) {
|
||||||
|
DomHandler.absolutePosition(this.$refs.overlay, this.$refs.container);
|
||||||
|
this.$refs.overlay.style.width = DomHandler.getOuterWidth(this.$refs.container) + 'px';
|
||||||
|
} else {
|
||||||
|
DomHandler.relativePosition(this.$refs.overlay, this.$refs.container);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
updateModel(event, value) {
|
updateModel(event, value) {
|
||||||
this.$emit('input', value);
|
this.$emit('input', value);
|
||||||
|
@ -352,6 +363,22 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
},
|
||||||
|
appendContainer() {
|
||||||
|
if (this.appendTo) {
|
||||||
|
if (this.appendTo === 'body')
|
||||||
|
document.body.appendChild(this.$refs.overlay);
|
||||||
|
else
|
||||||
|
document.getElementById(this.appendTo).appendChild(this.$refs.overlay);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
restoreAppend() {
|
||||||
|
if (this.$refs.overlay && this.appendTo) {
|
||||||
|
if (this.appendTo === 'body')
|
||||||
|
document.body.removeChild(this.$refs.overlay);
|
||||||
|
else
|
||||||
|
document.getElementById(this.appendTo).removeChild(this.$refs.overlay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -155,6 +155,12 @@ data() {
|
||||||
<td>string</td>
|
<td>string</td>
|
||||||
<td>null</td>
|
<td>null</td>
|
||||||
<td>Establishes relationships between the component and label(s) where its value should be one or more element IDs.</td>
|
<td>Establishes relationships between the component and label(s) where its value should be one or more element IDs.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>appendTo</td>
|
||||||
|
<td>string</td>
|
||||||
|
<td>null</td>
|
||||||
|
<td>Id of the element or "body" for document where the overlay should be appended to.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue