Fixed 224 for SplitButton

pull/227/head
cagataycivici 2020-03-04 14:47:12 +03:00
parent 819b5d5ac7
commit 2ecd1bda48
4 changed files with 19 additions and 10 deletions

View File

@ -41,10 +41,6 @@ export default {
baseZIndex: { baseZIndex: {
type: Number, type: Number,
default: 0 default: 0
},
align: {
type: Boolean,
default: true
} }
}, },
data() { data() {
@ -87,11 +83,9 @@ export default {
hide() { hide() {
this.visible = false; this.visible = false;
}, },
onEnter() { onEnter(element) {
this.appendContainer(); this.appendContainer();
if (this.align) { this.alignOverlay();
this.alignOverlay();
}
this.bindOutsideClickListener(); this.bindOutsideClickListener();
this.bindResizeListener(); this.bindResizeListener();
@ -104,7 +98,10 @@ export default {
this.unbindResizeListener(); this.unbindResizeListener();
}, },
alignOverlay() { alignOverlay() {
DomHandler.absolutePosition(this.$refs.container, this.target); if (this.appendTo)
DomHandler.absolutePosition(this.$refs.container, this.target);
else
DomHandler.relativePosition(this.$refs.container, this.target);
}, },
bindOutsideClickListener() { bindOutsideClickListener() {
if (!this.outsideClickListener) { if (!this.outsideClickListener) {

View File

@ -8,5 +8,6 @@ export declare class SplitButton extends Vue {
tabindex?: string; tabindex?: string;
autoZIndex?: boolean; autoZIndex?: boolean;
baseZIndex?: number; baseZIndex?: number;
appendTo?: string;
$emit(eventName: 'click', event: Event): this; $emit(eventName: 'click', event: Event): this;
} }

View File

@ -3,7 +3,8 @@
<PVSButton type="button" :icon="icon" :label="label" @click="onClick" :disabled="disabled" :tabindex="tabindex" /> <PVSButton type="button" :icon="icon" :label="label" @click="onClick" :disabled="disabled" :tabindex="tabindex" />
<PVSButton type="button" class="p-splitbutton-menubutton" icon="pi pi-caret-down" @click="onDropdownButtonClick" :disabled="disabled" <PVSButton type="button" class="p-splitbutton-menubutton" icon="pi pi-caret-down" @click="onDropdownButtonClick" :disabled="disabled"
aria-haspopup="true" :aria-controls="ariaId + '_overlay'"/> aria-haspopup="true" :aria-controls="ariaId + '_overlay'"/>
<PVSMenu :id="ariaId + '_overlay'" ref="menu" :model="model" :popup="true" :autoZIndex="autoZIndex" :baseZIndex="baseZIndex" :align="false" /> <PVSMenu :id="ariaId + '_overlay'" ref="menu" :model="model" :popup="true" :autoZIndex="autoZIndex"
:baseZIndex="baseZIndex" :appendTo="appendTo"/>
</div> </div>
</template> </template>
@ -41,6 +42,10 @@ export default {
baseZIndex: { baseZIndex: {
type: Number, type: Number,
default: 0 default: 0
},
appendTo: {
type: String,
default: null
} }
}, },
methods: { methods: {

View File

@ -128,6 +128,12 @@ export default {
<td>number</td> <td>number</td>
<td>0</td> <td>0</td>
<td>Base zIndex value to use in layering.</td> <td>Base zIndex value to use in layering.</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>