Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 1x 1x 11x 15x 15x 15x 15x 15x 15x 4x 4x 4x 3x 15x 4x 15x 4x 3x 1x 15x 15x 15x 12x 3x 3x 29x 29x 7x 22x | // @ts-check import $ from "jquery"; import Vue from "vue"; import HasSlotMixin from "./mixins/BaseHasSlotMixin"; import BaseKeyboardEventMixin from "./mixins/BaseKeyboardEventMixin"; import { BaseStoreMixin } from "./store/utils"; const options = { /** @type {JQuery<Element> | null} */ _elt: null }; const component = /** @type {V.Constructor<typeof options, any>} */ (Vue).extend({ name: "BaseModal", ...options, mixins: [ HasSlotMixin, BaseStoreMixin, BaseKeyboardEventMixin({ local: true }) ], props: { title: { type: String, default: "" }, visible: { type: Boolean, default: false } }, computed: { /** * @return {boolean} */ showKeyHints() { return this.getBaseState([ "ui", "showKeyHints" ]); } }, watch: { /** * @param {boolean} value */ visible(value) { this.show(value); } }, mounted() { const elt = $(this.$el); /* enable closure by pressing 'Esc' key if slot 'title' is not overridden */ if (!this.hasSlot("title")) { this.onKey("esc", () => elt.modal("hide")); } elt.data("b-destroyed", false); elt.data("b-hidden", true); this.$options._elt = elt; this.$options._elt.on("hidden.bs.modal", () => { elt.data("b-hidden", true); this.$emit("hidden", true); if (elt.data("b-destroyed")) { // @ts-ignore: modal is a bootstrap plugin elt.modal("dispose").off(); } }); this.$options._elt.on("show.bs.modal", () => { elt.data("b-hidden", false); }); this.$options._elt.on("shown.bs.modal", () => { if (elt.data("b-destroyed")) { // @ts-ignore: modal is a bootstrap plugin elt.modal("hide"); } else { this.$emit("hidden", false); } }); this.show(this.visible); }, beforeDestroy() { const elt = this.$options._elt; if (elt && elt.data("b-hidden")) { // @ts-ignore: modal is a bootstrap plugin elt.modal("dispose").off(); } else Eif (elt) { elt.hide().data("b-destroyed", true); } }, methods: { /** * @param {boolean} value */ show(value = true) { Iif (!this.$options._elt) { return; } if (value) { // @ts-ignore: modal is a bootstrap plugin this.$options._elt.modal("show"); } else { // @ts-ignore: modal is a bootstrap plugin this.$options._elt.modal("hide"); } }, toggle() { if (!this.$options._elt) { return; } // @ts-ignore: modal is a bootstrap plugin this.$options._elt.modal("toggle"); } } }); export default component; |