CoreFiles by mySites.guru
modal.vue71 lines, 2,295 bytes, from Joomla_4.0.0-alpha8-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha7
md5
c3c91877166eb0a485c3a11d69ffa7f7
sha1
7d169c48b24452000d09b8b989924788535cbf6d
sha256
5068c6f370001df8aa72c1b0817f728353316515dab892ae3e4584f54fd75930
<template>
    <div class="media-modal-backdrop" @click="close()">
        <div class="modal" @click.stop style="display: flex">
            <slot name="backdrop-close"></slot>
            <div class="modal-dialog" :class="modalClass" role="alertdialog">
                <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>
        </div>
    </div>
</template>

<script>
    import * as types from "./../../store/mutation-types";

    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,
            }
        },
        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 2 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha8. See them all, or every version of this file.