first commit

This commit is contained in:
DanielRamirezGe
2020-01-14 20:43:08 -06:00
parent 3557894f7f
commit 5eecfbf6cd
26326 changed files with 2434803 additions and 0 deletions
@@ -0,0 +1,65 @@
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
import { BvEvent } from '../../../utils/bv-event.class';
import { defineProperties, readonlyDescriptor } from '../../../utils/object';
var BvModalEvent =
/*#__PURE__*/
function (_BvEvent) {
_inherits(BvModalEvent, _BvEvent);
function BvModalEvent(type) {
var _this;
var eventInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, BvModalEvent);
_this = _possibleConstructorReturn(this, _getPrototypeOf(BvModalEvent).call(this, type, eventInit)); // Freeze our new props as readonly, but leave them enumerable
defineProperties(_assertThisInitialized(_this), {
trigger: readonlyDescriptor()
});
return _this;
}
_createClass(BvModalEvent, null, [{
key: "Defaults",
get: function get() {
return _objectSpread({}, _get(_getPrototypeOf(BvModalEvent), "Defaults", this), {
trigger: null
});
}
}]);
return BvModalEvent;
}(BvEvent); // Named exports
export { BvModalEvent };
+314
View File
@@ -0,0 +1,314 @@
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
// Plugin for adding `$bvModal` property to all Vue instances
import { BModal, props as modalProps } from '../modal';
import { concat } from '../../../utils/array';
import { getComponentConfig } from '../../../utils/config';
import { isUndefined, isFunction } from '../../../utils/inspect';
import { assign, keys, omit, defineProperty, defineProperties, readonlyDescriptor } from '../../../utils/object';
import { pluginFactory } from '../../../utils/plugins';
import { warn, warnNotClient, warnNoPromiseSupport } from '../../../utils/warn'; // --- Constants ---
var PROP_NAME = '$bvModal';
var PROP_NAME_PRIV = '_bv__modal'; // Base modal props that are allowed
// Some may be ignored or overridden on some message boxes
// Prop ID is allowed, but really only should be used for testing
// We need to add it in explicitly as it comes from the `idMixin`
var BASE_PROPS = ['id'].concat(_toConsumableArray(keys(omit(modalProps, ['busy', 'lazy', 'noStacking', "static", 'visible'])))); // Fallback event resolver (returns undefined)
var defaultResolver = function defaultResolver(bvModalEvt) {}; // Map prop names to modal slot names
var propsToSlots = {
msgBoxContent: 'default',
title: 'modal-title',
okTitle: 'modal-ok',
cancelTitle: 'modal-cancel'
}; // --- Utility methods ---
// Method to filter only recognized props that are not undefined
var filterOptions = function filterOptions(options) {
return BASE_PROPS.reduce(function (memo, key) {
if (!isUndefined(options[key])) {
memo[key] = options[key];
}
return memo;
}, {});
}; // Method to install `$bvModal` VM injection
var plugin = function plugin(Vue) {
// Create a private sub-component that extends BModal
// which self-destructs after hidden
// @vue/component
var BMsgBox = Vue.extend({
name: 'BMsgBox',
extends: BModal,
destroyed: function destroyed() {
// Make sure we not in document any more
if (this.$el && this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el);
}
},
mounted: function mounted() {
var _this = this;
// Self destruct handler
var handleDestroy = function handleDestroy() {
var self = _this;
_this.$nextTick(function () {
// In a `setTimeout()` to release control back to application
setTimeout(function () {
return self.$destroy();
}, 0);
});
}; // Self destruct if parent destroyed
this.$parent.$once('hook:destroyed', handleDestroy); // Self destruct after hidden
this.$once('hidden', handleDestroy); // Self destruct on route change
/* istanbul ignore if */
if (this.$router && this.$route) {
// Destroy ourselves if route changes
/* istanbul ignore next */
this.$once('hook:beforeDestroy', this.$watch('$router', handleDestroy));
} // Show the `BMsgBox`
this.show();
}
}); // Method to generate the on-demand modal message box
// Returns a promise that resolves to a value returned by the resolve
var asyncMsgBox = function asyncMsgBox($parent, props) {
var resolver = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultResolver;
if (warnNotClient(PROP_NAME) || warnNoPromiseSupport(PROP_NAME)) {
/* istanbul ignore next */
return;
} // Create an instance of `BMsgBox` component
var msgBox = new BMsgBox({
// We set parent as the local VM so these modals can emit events on
// the app `$root`, as needed by things like tooltips and popovers
// And it helps to ensure `BMsgBox` is destroyed when parent is destroyed
parent: $parent,
// Preset the prop values
propsData: _objectSpread({}, filterOptions(getComponentConfig('BModal') || {}), {
// Defaults that user can override
hideHeaderClose: true,
hideHeader: !(props.title || props.titleHtml)
}, omit(props, keys(propsToSlots)), {
// Props that can't be overridden
lazy: false,
busy: false,
visible: false,
noStacking: false,
noEnforceFocus: false
})
}); // Convert certain props to scoped slots
keys(propsToSlots).forEach(function (prop) {
if (!isUndefined(props[prop])) {
// Can be a string, or array of VNodes.
// Alternatively, user can use HTML version of prop to pass an HTML string.
msgBox.$slots[propsToSlots[prop]] = concat(props[prop]);
}
}); // Return a promise that resolves when hidden, or rejects on destroyed
return new Promise(function (resolve, reject) {
var resolved = false;
msgBox.$once('hook:destroyed', function () {
if (!resolved) {
/* istanbul ignore next */
reject(new Error('BootstrapVue MsgBox destroyed before resolve'));
}
});
msgBox.$on('hide', function (bvModalEvt) {
if (!bvModalEvt.defaultPrevented) {
var result = resolver(bvModalEvt); // If resolver didn't cancel hide, we resolve
if (!bvModalEvt.defaultPrevented) {
resolved = true;
resolve(result);
}
}
}); // Create a mount point (a DIV) and mount the msgBo which will trigger it to show
var div = document.createElement('div');
document.body.appendChild(div);
msgBox.$mount(div);
});
}; // Private utility method to open a user defined message box and returns a promise.
// Not to be used directly by consumers, as this method may change calling syntax
var makeMsgBox = function makeMsgBox($parent, content) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var resolver = arguments.length > 3 ? arguments[3] : undefined;
if (!content || warnNoPromiseSupport(PROP_NAME) || warnNotClient(PROP_NAME) || !isFunction(resolver)) {
/* istanbul ignore next */
return;
}
return asyncMsgBox($parent, _objectSpread({}, filterOptions(options), {
msgBoxContent: content
}), resolver);
}; // BvModal instance class
var BvModal =
/*#__PURE__*/
function () {
function BvModal(vm) {
_classCallCheck(this, BvModal);
// Assign the new properties to this instance
assign(this, {
_vm: vm,
_root: vm.$root
}); // Set these properties as read-only and non-enumerable
defineProperties(this, {
_vm: readonlyDescriptor(),
_root: readonlyDescriptor()
});
} // --- Instance methods ---
// Show modal with the specified ID args are for future use
_createClass(BvModal, [{
key: "show",
value: function show(id) {
if (id && this._root) {
var _this$_root;
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
(_this$_root = this._root).$emit.apply(_this$_root, ['bv::show::modal', id].concat(args));
}
} // Hide modal with the specified ID args are for future use
}, {
key: "hide",
value: function hide(id) {
if (id && this._root) {
var _this$_root2;
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
(_this$_root2 = this._root).$emit.apply(_this$_root2, ['bv::hide::modal', id].concat(args));
}
} // The following methods require Promise support!
// IE 11 and others do not support Promise natively, so users
// should have a Polyfill loaded (which they need anyways for IE 11 support)
// Open a message box with OK button only and returns a promise
}, {
key: "msgBoxOk",
value: function msgBoxOk(message) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// Pick the modal props we support from options
var props = _objectSpread({}, options, {
// Add in overrides and our content prop
okOnly: true,
okDisabled: false,
hideFooter: false,
msgBoxContent: message
});
return makeMsgBox(this._vm, message, props, function (bvModalEvt) {
// Always resolve to true for OK
return true;
});
} // Open a message box modal with OK and CANCEL buttons
// and returns a promise
}, {
key: "msgBoxConfirm",
value: function msgBoxConfirm(message) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// Set the modal props we support from options
var props = _objectSpread({}, options, {
// Add in overrides and our content prop
okOnly: false,
okDisabled: false,
cancelDisabled: false,
hideFooter: false
});
return makeMsgBox(this._vm, message, props, function (bvModalEvt) {
var trigger = bvModalEvt.trigger;
return trigger === 'ok' ? true : trigger === 'cancel' ? false : null;
});
}
}]);
return BvModal;
}(); // Add our instance mixin
Vue.mixin({
beforeCreate: function beforeCreate() {
// Because we need access to `$root` for `$emits`, and VM for parenting,
// we have to create a fresh instance of `BvModal` for each VM
this[PROP_NAME_PRIV] = new BvModal(this);
}
}); // Define our read-only `$bvModal` instance property
// Placed in an if just in case in HMR mode
// eslint-disable-next-line no-prototype-builtins
if (!Vue.prototype.hasOwnProperty(PROP_NAME)) {
defineProperty(Vue.prototype, PROP_NAME, {
get: function get() {
/* istanbul ignore next */
if (!this || !this[PROP_NAME_PRIV]) {
warn("'".concat(PROP_NAME, "' must be accessed from a Vue instance 'this' context"));
}
return this[PROP_NAME_PRIV];
}
});
}
};
export var BVModalPlugin =
/*#__PURE__*/
pluginFactory({
plugins: {
plugin: plugin
}
});
@@ -0,0 +1,236 @@
/**
* Private ModalManager helper
* Handles controlling modal stacking zIndexes and body adjustments/classes
*/
import Vue from '../../../utils/vue';
import { getAttr, hasAttr, removeAttr, setAttr, addClass, removeClass, getBCR, getCS, selectAll, requestAF } from '../../../utils/dom';
import { isBrowser } from '../../../utils/env';
import { isNull } from '../../../utils/inspect'; // --- Constants ---
// Default modal backdrop z-index
var DEFAULT_ZINDEX = 1040; // Selectors for padding/margin adjustments
var Selector = {
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
STICKY_CONTENT: '.sticky-top',
NAVBAR_TOGGLER: '.navbar-toggler'
}; // @vue/component
var ModalManager =
/*#__PURE__*/
Vue.extend({
data: function data() {
return {
modals: [],
baseZIndex: null,
scrollbarWidth: null,
isBodyOverflowing: false
};
},
computed: {
modalCount: function modalCount() {
return this.modals.length;
},
modalsAreOpen: function modalsAreOpen() {
return this.modalCount > 0;
}
},
watch: {
modalCount: function modalCount(newCount, oldCount) {
if (isBrowser) {
this.getScrollbarWidth();
if (newCount > 0 && oldCount === 0) {
// Transitioning to modal(s) open
this.checkScrollbar();
this.setScrollbar();
addClass(document.body, 'modal-open');
} else if (newCount === 0 && oldCount > 0) {
// Transitioning to modal(s) closed
this.resetScrollbar();
removeClass(document.body, 'modal-open');
}
setAttr(document.body, 'data-modal-open-count', String(newCount));
}
},
modals: function modals(newVal, oldVal) {
var _this = this;
this.checkScrollbar();
requestAF(function () {
_this.updateModals(newVal || []);
});
}
},
methods: {
// Public methods
registerModal: function registerModal(modal) {
var _this2 = this;
// Register the modal if not already registered
if (modal && this.modals.indexOf(modal) === -1) {
// Add modal to modals array
this.modals.push(modal);
modal.$once('hook:beforeDestroy', function () {
_this2.unregisterModal(modal);
});
}
},
unregisterModal: function unregisterModal(modal) {
var index = this.modals.indexOf(modal);
if (index > -1) {
// Remove modal from modals array
this.modals.splice(index, 1); // Reset the modal's data
if (!(modal._isBeingDestroyed || modal._isDestroyed)) {
this.resetModal(modal);
}
}
},
getBaseZIndex: function getBaseZIndex() {
if (isNull(this.baseZIndex) && isBrowser) {
// Create a temporary `div.modal-backdrop` to get computed z-index
var div = document.createElement('div');
div.className = 'modal-backdrop d-none';
div.style.display = 'none';
document.body.appendChild(div);
this.baseZIndex = parseInt(getCS(div).zIndex || DEFAULT_ZINDEX, 10);
document.body.removeChild(div);
}
return this.baseZIndex || DEFAULT_ZINDEX;
},
getScrollbarWidth: function getScrollbarWidth() {
if (isNull(this.scrollbarWidth) && isBrowser) {
// Create a temporary `div.measure-scrollbar` to get computed z-index
var div = document.createElement('div');
div.className = 'modal-scrollbar-measure';
document.body.appendChild(div);
this.scrollbarWidth = getBCR(div).width - div.clientWidth;
document.body.removeChild(div);
}
return this.scrollbarWidth || 0;
},
// Private methods
updateModals: function updateModals(modals) {
var _this3 = this;
var baseZIndex = this.getBaseZIndex();
var scrollbarWidth = this.getScrollbarWidth();
modals.forEach(function (modal, index) {
// We update data values on each modal
modal.zIndex = baseZIndex + index;
modal.scrollbarWidth = scrollbarWidth;
modal.isTop = index === _this3.modals.length - 1;
modal.isBodyOverflowing = _this3.isBodyOverflowing;
});
},
resetModal: function resetModal(modal) {
if (modal) {
modal.zIndex = this.getBaseZIndex();
modal.isTop = true;
modal.isBodyOverflowing = false;
}
},
checkScrollbar: function checkScrollbar() {
// Determine if the body element is overflowing
var _getBCR = getBCR(document.body),
left = _getBCR.left,
right = _getBCR.right;
this.isBodyOverflowing = left + right < window.innerWidth;
},
setScrollbar: function setScrollbar() {
var body = document.body; // Storage place to cache changes to margins and padding
// Note: This assumes the following element types are not added to the
// document after the modal has opened.
body._paddingChangedForModal = body._paddingChangedForModal || [];
body._marginChangedForModal = body._marginChangedForModal || [];
if (this.isBodyOverflowing) {
var scrollbarWidth = this.scrollbarWidth; // Adjust fixed content padding
/* istanbul ignore next: difficult to test in JSDOM */
selectAll(Selector.FIXED_CONTENT).forEach(function (el) {
var actualPadding = el.style.paddingRight;
var calculatedPadding = getCS(el).paddingRight || 0;
setAttr(el, 'data-padding-right', actualPadding);
el.style.paddingRight = "".concat(parseFloat(calculatedPadding) + scrollbarWidth, "px");
body._paddingChangedForModal.push(el);
}); // Adjust sticky content margin
/* istanbul ignore next: difficult to test in JSDOM */
selectAll(Selector.STICKY_CONTENT).forEach(function (el)
/* istanbul ignore next */
{
var actualMargin = el.style.marginRight;
var calculatedMargin = getCS(el).marginRight || 0;
setAttr(el, 'data-margin-right', actualMargin);
el.style.marginRight = "".concat(parseFloat(calculatedMargin) - scrollbarWidth, "px");
body._marginChangedForModal.push(el);
}); // Adjust <b-navbar-toggler> margin
/* istanbul ignore next: difficult to test in JSDOM */
selectAll(Selector.NAVBAR_TOGGLER).forEach(function (el)
/* istanbul ignore next */
{
var actualMargin = el.style.marginRight;
var calculatedMargin = getCS(el).marginRight || 0;
setAttr(el, 'data-margin-right', actualMargin);
el.style.marginRight = "".concat(parseFloat(calculatedMargin) + scrollbarWidth, "px");
body._marginChangedForModal.push(el);
}); // Adjust body padding
var actualPadding = body.style.paddingRight;
var calculatedPadding = getCS(body).paddingRight;
setAttr(body, 'data-padding-right', actualPadding);
body.style.paddingRight = "".concat(parseFloat(calculatedPadding) + scrollbarWidth, "px");
}
},
resetScrollbar: function resetScrollbar() {
var body = document.body;
if (body._paddingChangedForModal) {
// Restore fixed content padding
body._paddingChangedForModal.forEach(function (el) {
/* istanbul ignore next: difficult to test in JSDOM */
if (hasAttr(el, 'data-padding-right')) {
el.style.paddingRight = getAttr(el, 'data-padding-right') || '';
removeAttr(el, 'data-padding-right');
}
});
}
if (body._marginChangedForModal) {
// Restore sticky content and navbar-toggler margin
body._marginChangedForModal.forEach(function (el) {
/* istanbul ignore next: difficult to test in JSDOM */
if (hasAttr(el, 'data-margin-right')) {
el.style.marginRight = getAttr(el, 'data-margin-right') || '';
removeAttr(el, 'data-margin-right');
}
});
}
body._paddingChangedForModal = null;
body._marginChangedForModal = null; // Restore body padding
if (hasAttr(body, 'data-padding-right')) {
body.style.paddingRight = getAttr(body, 'data-padding-right') || '';
removeAttr(body, 'data-padding-right');
}
}
}
}); // Create and export our modal manager instance
export var modalManager = new ModalManager();
+95
View File
@@ -0,0 +1,95 @@
// --- Modals ---
import Vue, { VNode } from 'vue'
import { BvPlugin, BvComponent, BvEvent } from '../../'
// Modal plugin
export declare const ModalPlugin: BvPlugin
// Component: <b-modal>
export declare class BModal extends BvComponent {
// Public methods
show: () => void
hide: (trigger?: string) => void
}
// --- Types ---
export type BvMsgBoxData = boolean | null | BvModalEvent | any
// --- Interfaces ---
export interface BvModalEvent extends BvEvent {
readonly trigger: string | null
// Future
// details: any | null
}
export interface BvMsgBoxOptions {
title?: string | VNode | Array<VNode>
titleTag?: string
size?: string
centered?: boolean
scrollable?: boolean
noFade?: boolean
noCloseOnBackdrop?: boolean
noCloseOnEsc?: boolean
headerBgVariant?: string
headerBorderVariant?: string
headerTextVariant?: string
headerCloseVariant?: string
headerClass?: string | string[] | Array<any>
bodyBgVariant?: string
bodyBorderVariant?: string
bodyTextVariant?: string
bodyClass?: string | string[] | Array<any>
footerBgVariant?: string
footerBorderVariant?: string
footerTextVariant?: string
footerClass?: string | string[] | Array<any>
headerCloseLabel?: string
buttonSize?: string
cancelTitle?: string
cancelVariant?: string
okTitle?: string
okVariant?: string
// Catch all
[key: string]: any
}
export interface BvModalMsgBoxResolver {
(evt: BvModalEvent): any
}
export interface BvModalMsgBoxShortcutMethod {
(message: string | Array<VNode>, options?: BvMsgBoxOptions): Promise<BvMsgBoxData>
// Future
// (options?: BvMsgBoxOptions): Promise<BvMsgBoxData>
// (message: string | Array<VNode>, title: string | Array<VNode>, options?: BvMsgBoxOptions): Promise<BvMsgBoxData>
}
// Not yet documented or implemented (Future)
// export interface BvModalMsgBoxMethod {
// (options: BvMsgBoxOptions, resolver: BvModalMsgBoxResolver): Promise<BvMsgBoxData>
// (message: string | Array<VNode>, options: BvMsgBoxOptions, resolver: BvModalMsgBoxResolver): Promise<BvMsgBoxData>
// (message: string | Array<VNode>, title: string | Array<VNode>, options: BvMsgBoxOptions, resolver: BvModalMsgBoxResolver): Promise<BvMsgBoxData>
// }
export interface BvModal {
// Show OK MsgBox
msgBoxOk: BvModalMsgBoxShortcutMethod
// Show Confirm MsgBox
msgBoxConfirm: BvModalMsgBoxShortcutMethod
// Show a modal by id
show: (id: string) => void
// Hide a modal by id
hide: (id: string) => void
}
// --- Vue prototype injections ---
declare module 'vue/types/vue' {
interface Vue {
// Modal injection
readonly $bvModal: BvModal
}
}
+19
View File
@@ -0,0 +1,19 @@
import { BModal } from './modal';
import { VBModal } from '../../directives/modal/modal';
import { BVModalPlugin } from './helpers/bv-modal';
import { pluginFactory } from '../../utils/plugins';
var ModalPlugin =
/*#__PURE__*/
pluginFactory({
components: {
BModal: BModal
},
directives: {
VBModal: VBModal
},
// $bvModal injection
plugins: {
BVModalPlugin: BVModalPlugin
}
});
export { ModalPlugin, BModal };
File diff suppressed because it is too large Load Diff