CoreFiles by mySites.guru
modal.vue75 lines, 2,139 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
f62b2dea4bf48be8a4d6f0bdf5ea7094
sha1
8d5de569811d201bec4f5b4f061663359f9ed9e2
sha256
7346672a4cc13808f0501bea2c912053bbfb715610ea5e628791cdef980b7f2d
<template>
    <div class="media-modal-backdrop" @click="close()">
        <div class="modal" @click.stop style="display: flex">
			<tab-lock>
				<slot name="backdrop-close"></slot>
				<div class="modal-dialog" :class="modalClass" role="dialog" :aria-labelledby="labelElement">
					<div class="modal-content">
						<div class="modal-header">
							<slot name="header"></slot>
							<button type="button" v-if="showClose" class="close" @click="close()"
									aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
						</div>
						<div class="modal-body">
							<slot name="body"></slot>
						</div>
						<div class="modal-footer">
							<slot name="footer"></slot>
						</div>
					</div>
				</div>
			</tab-lock>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'media-modal',
        props: {
            /* Whether or not the close button in the header should be shown */
            showClose: {
                type: Boolean,
                default: true,
            },
            /* The size of the modal */
            size: {
                type: String,
            },
            labelElement: {
                type: String,
                required: true
            }
        },
        computed: {
            /* Get the modal css class */
            modalClass() {
                return {
                    'modal-sm': this.size === 'sm',
                }
            },
        },
        methods: {
            /* Close the modal instance */
            close() {
                this.$emit('close');
            },
            /* Handle keydown events */
            onKeyDown(event) {
                if (event.keyCode === 27) {
                    this.close();
                }
            }
        },
        mounted() {
            // Listen to keydown events on the document
            document.addEventListener("keydown", this.onKeyDown);
        },
        beforeDestroy() {
            // Remove the keydown event listener
            document.removeEventListener('keydown', this.onKeyDown);
        },
    }
</script>

The same content is in 4 releases, Joomla 4.0.0-alpha9 to 4.0.0-alpha12. See them all, or every version of this file.