🌐 AI搜索 & 代理 主页

UNPKG

bootstrap-vue

Version:

BootstrapVue, with over 40 plugins and more than 75 custom components, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated WAI-ARIA accessibility markup.

1,551 lines (1,329 loc) 727 kB
/*! * BoostrapVue 2.0.0-rc.27 * * @link https://bootstrap-vue.js.org * @source https://github.com/bootstrap-vue/bootstrap-vue * @copyright (c) 2016-2019 BootstrapVue * @license MIT * https://github.com/bootstrap-vue/bootstrap-vue/blob/master/LICENSE */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vue')) : typeof define === 'function' && define.amd ? define(['vue'], factory) : (global = global || self, global.bootstrapVue = factory(global.Vue)); }(this, function (Vue) { 'use strict'; Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(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 _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 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 _objectSpread2(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 _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 _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } 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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } 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; } } function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } // /** * Utilities to get information about the current environment */ // --- Constants --- var hasWindowSupport = typeof window !== 'undefined'; var hasDocumentSupport = typeof document !== 'undefined'; var hasNavigatorSupport = typeof navigator !== 'undefined'; var hasPromiseSupport = typeof Promise !== 'undefined'; var hasMutationObserverSupport = typeof MutationObserver !== 'undefined' || typeof WebKitMutationObserver !== 'undefined' || typeof MozMutationObserver !== 'undefined'; var isBrowser = hasWindowSupport && hasDocumentSupport && hasNavigatorSupport; // Browser type sniffing var userAgent = isBrowser ? window.navigator.userAgent.toLowerCase() : ''; var isJSDOM = userAgent.indexOf('jsdom') > 0; var isIE = /msie|trident/.test(userAgent); // Determine if the browser supports the option passive for events var hasPassiveEventSupport = function () { var passiveEventSupported = false; if (isBrowser) { try { var options = { get passive() { // This function will be called when the browser // attempts to access the passive property. /* istanbul ignore next: will never be called in JSDOM */ passiveEventSupported = true; } }; window.addEventListener('test', options, options); window.removeEventListener('test', options, options); } catch (err) { /* istanbul ignore next: will never be called in JSDOM */ passiveEventSupported = false; } } return passiveEventSupported; }(); var hasTouchSupport = isBrowser && ('ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0); var hasPointerEventSupport = isBrowser && Boolean(window.PointerEvent || window.MSPointerEvent); var hasIntersectionObserverSupport = isBrowser && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && // Edge 15 and UC Browser lack support for `isIntersecting` // but we an use intersectionRatio > 0 instead // 'isIntersecting' in window.IntersectionObserverEntry.prototype && 'intersectionRatio' in window.IntersectionObserverEntry.prototype; // --- Getters --- var getEnv = function getEnv(key) { var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var env = typeof process !== 'undefined' && process ? process.env || {} : {}; if (!key) { /* istanbul ignore next */ return env; } return env[key] || fallback; }; var getNoWarn = function getNoWarn() { return getEnv('BOOTSTRAP_VUE_NO_WARN'); }; /** * Log a warning message to the console with BootstrapVue formatting * @param {string} message */ var warn = function warn(message) /* istanbul ignore next */ { if (!getNoWarn()) { console.warn("[BootstrapVue warn]: ".concat(message)); } }; /** * Warn when no Promise support is given * @param {string} source * @returns {boolean} warned */ var warnNotClient = function warnNotClient(source) { /* istanbul ignore else */ if (isBrowser) { return false; } else { warn("".concat(source, ": Can not be called during SSR.")); return true; } }; /** * Warn when no Promise support is given * @param {string} source * @returns {boolean} warned */ var warnNoPromiseSupport = function warnNoPromiseSupport(source) { /* istanbul ignore else */ if (hasPromiseSupport) { return false; } else { warn("".concat(source, ": Requires Promise support.")); return true; } }; /** * Warn when no MutationObserver support is given * @param {string} source * @returns {boolean} warned */ var warnNoMutationObserverSupport = function warnNoMutationObserverSupport(source) { /* istanbul ignore else */ if (hasMutationObserverSupport) { return false; } else { warn("".concat(source, ": Requires MutationObserver support.")); return true; } }; // Default export // --- Static --- var from = Array.from; var isArray = Array.isArray; // --- Instance --- var arrayIncludes = function arrayIncludes(array, value) { return array.indexOf(value) !== -1; }; var concat = function concat() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return Array.prototype.concat.apply([], args); }; var assign = Object.assign; var getOwnPropertyNames = Object.getOwnPropertyNames; var keys = Object.keys; var defineProperties = Object.defineProperties; var defineProperty = Object.defineProperty; var freeze = Object.freeze; var create = Object.create; var hasOwnProperty = function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }; var toString = function toString(obj) { return Object.prototype.toString.call(obj); }; // --- Utilities --- /** * Quick object check - this is primarily used to tell * Objects from primitive values when we know the value * is a JSON-compliant type. * Note object could be a complex type like array, date, etc. */ var isObject = function isObject(obj) { return obj !== null && _typeof(obj) === 'object'; }; /** * Strict object type check. Only returns true * for plain JavaScript objects. */ var isPlainObject = function isPlainObject(obj) { return Object.prototype.toString.call(obj) === '[object Object]'; }; // @link https://gist.github.com/bisubus/2da8af7e801ffd813fab7ac221aa7afc var omit = function omit(obj, props) { return keys(obj).filter(function (key) { return props.indexOf(key) === -1; }).reduce(function (result, key) { return _objectSpread2({}, result, _defineProperty({}, key, obj[key])); }, {}); }; var readonlyDescriptor = function readonlyDescriptor() { return { enumerable: true, configurable: false, writable: false }; }; /** * Deep-freezes and object, making it immutable / read-only. * Returns the same object passed-in, but frozen. * Freezes inner object/array/values first. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze * Note: this method will not work for property values using Symbol() as a key */ var deepFreeze = function deepFreeze(obj) { // Retrieve the property names defined on object/array // Note: `keys` will ignore properties that are keyed by a `Symbol()` var props = keys(obj); // Iterate over each prop and recursively freeze it props.forEach(function (prop) { var value = obj[prop]; // If value is a plain object or array, we deepFreeze it obj[prop] = value && (isPlainObject(value) || isArray(value)) ? deepFreeze(value) : value; }); return freeze(obj); }; var toType = function toType(val) { return _typeof(val); }; var toRawType = function toRawType(val) { return Object.prototype.toString.call(val).slice(8, -1); }; var isUndefined = function isUndefined(val) { return val === undefined; }; var isNull = function isNull(val) { return val === null; }; var isUndefinedOrNull = function isUndefinedOrNull(val) { return isUndefined(val) || isNull(val); }; var isFunction = function isFunction(val) { return toType(val) === 'function'; }; var isBoolean = function isBoolean(val) { return toType(val) === 'boolean'; }; var isString = function isString(val) { return toType(val) === 'string'; }; var isNumber = function isNumber(val) { return toType(val) === 'number'; }; var isDate = function isDate(val) { return val instanceof Date; }; var isEvent = function isEvent(val) { return val instanceof Event; }; var isRegExp = function isRegExp(val) { return toRawType(val) === 'RegExp'; }; var isPromise = function isPromise(val) { return !isUndefinedOrNull(val) && isFunction(val.then) && isFunction(val.catch); }; // Extra convenience named re-exports var cloneDeep = function cloneDeep(obj) { var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : obj; if (isArray(obj)) { return obj.reduce(function (result, val) { return [].concat(_toConsumableArray(result), [cloneDeep(val, val)]); }, []); } if (isPlainObject(obj)) { return keys(obj).reduce(function (result, key) { return _objectSpread2({}, result, _defineProperty({}, key, cloneDeep(obj[key], obj[key]))); }, {}); } return defaultValue; }; /** * Get property defined by dot/array notation in string. * * @link https://gist.github.com/jeneg/9767afdcca45601ea44930ea03e0febf#gistcomment-1935901 * * @param {Object} obj * @param {string|Array} path * @param {*} defaultValue (optional) * @return {*} */ var get = function get(obj, path) { var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; // Handle array of path values path = isArray(path) ? path.join('.') : path; // If no path or no object passed if (!path || !isObject(obj)) { return defaultValue; } // Handle edge case where user has dot(s) in top-level item field key // See https://github.com/bootstrap-vue/bootstrap-vue/issues/2762 // Switched to `in` operator vs `hasOwnProperty` to handle obj.prototype getters // https://github.com/bootstrap-vue/bootstrap-vue/issues/3463 if (path in obj) { return obj[path]; } // Handle string array notation (numeric indices only) path = String(path).replace(/\[(\d+)]/g, '.$1'); var steps = path.split('.').filter(Boolean); // Handle case where someone passes a string of only dots if (steps.length === 0) { return defaultValue; } // Traverse path in object to find result // We use `!=` vs `!==` to test for both `null` and `undefined` // Switched to `in` operator vs `hasOwnProperty` to handle obj.prototype getters // https://github.com/bootstrap-vue/bootstrap-vue/issues/3463 return steps.every(function (step) { return isObject(obj) && step in obj && (obj = obj[step]) != null; }) ? obj : defaultValue; }; // // BREAKPOINT DEFINITIONS // // Some components (BCol and BFormGroup) generate props based on breakpoints, and this // occurs when the component is first loaded (evaluated), which may happen before the // config is created/modified // // To get around this we make these components async (lazy evaluation) // The component definition is only called/executed when the first access to the // component is used (and cached on subsequent uses) // // See: https://vuejs.org/v2/guide/components-dynamic-async.html#Async-Components // // PROP DEFAULTS // // For default values on props, we use the default value factory function approach so // so that the default values are pulled in at each component instantiation // // props: { // variant: { // type: String, // default: () => getConfigComponent('BAlert', 'variant') // } // } // prettier-ignore var DEFAULTS = deepFreeze({ // Breakpoints breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'], // Component Specific defaults are keyed by the component // name (PascalCase) and prop name (camelCase) BAlert: { dismissLabel: 'Close', variant: 'info' }, BBadge: { variant: 'secondary' }, BButton: { variant: 'secondary' }, BButtonClose: { // `textVariant` is `null` to inherit the current text color textVariant: null, ariaLabel: 'Close' }, BCardSubTitle: { // BCard and BCardBody also inherit this prop subTitleTextVariant: 'muted' }, BCarousel: { labelPrev: 'Previous Slide', labelNext: 'Next Slide', labelGotoSlide: 'Goto Slide', labelIndicators: 'Select a slide to display' }, BDropdown: { toggleText: 'Toggle Dropdown', variant: 'secondary', splitVariant: null }, BFormFile: { browseText: 'Browse', // Chrome default file prompt placeholder: 'No file chosen', dropPlaceholder: 'Drop files here' }, BFormText: { textVariant: 'muted' }, BImg: { blankColor: 'transparent' }, BImgLazy: { blankColor: 'transparent' }, BJumbotron: { bgVariant: null, borderVariant: null, textVariant: null }, BListGroupItem: { variant: null }, BModal: { titleTag: 'h5', size: 'md', headerBgVariant: null, headerBorderVariant: null, headerTextVariant: null, headerCloseVariant: null, bodyBgVariant: null, bodyTextVariant: null, footerBgVariant: null, footerBorderVariant: null, footerTextVariant: null, cancelTitle: 'Cancel', cancelVariant: 'secondary', okTitle: 'OK', okVariant: 'primary', headerCloseLabel: 'Close' }, BNavbar: { variant: null }, BNavbarToggle: { label: 'Toggle navigation' }, BPopover: { boundary: 'scrollParent', boundaryPadding: 5, customClass: null, delay: 0, variant: null }, BProgress: { variant: null }, BProgressBar: { variant: null }, BSpinner: { variant: null }, BTable: { selectedVariant: 'primary', headVariant: null, footVariant: null }, BToast: { toaster: 'b-toaster-top-right', autoHideDelay: 5000, variant: null, toastClass: null, headerClass: null, bodyClass: null, solid: false }, BToaster: { ariaLive: null, ariaAtomic: null, role: null }, BTooltip: { boundary: 'scrollParent', boundaryPadding: 5, customClass: null, delay: 0, variant: null } }); var PROP_NAME = '$bvConfig'; // Config manager class var BvConfig = /*#__PURE__*/ function () { function BvConfig() { _classCallCheck(this, BvConfig); // TODO: pre-populate with default config values (needs updated tests) // this.$_config = cloneDeep(DEFAULTS) this.$_config = {}; this.$_cachedBreakpoints = null; } _createClass(BvConfig, [{ key: "getDefaults", // Returns the defaults value: function getDefaults() /* istanbul ignore next */ { return this.defaults; } // Method to merge in user config parameters }, { key: "setConfig", value: function setConfig() { var _this = this; var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; if (!isPlainObject(config)) { /* istanbul ignore next */ return; } var configKeys = getOwnPropertyNames(config); configKeys.forEach(function (cmpName) { /* istanbul ignore next */ if (!hasOwnProperty(DEFAULTS, cmpName)) { warn("config: unknown config property \"".concat(cmpName, "\"")); return; } var cmpConfig = config[cmpName]; if (cmpName === 'breakpoints') { // Special case for breakpoints var breakpoints = config.breakpoints; /* istanbul ignore if */ if (!isArray(breakpoints) || breakpoints.length < 2 || breakpoints.some(function (b) { return !isString(b) || b.length === 0; })) { warn('config: "breakpoints" must be an array of at least 2 breakpoint names'); } else { _this.$_config.breakpoints = cloneDeep(breakpoints); } } else if (isPlainObject(cmpConfig)) { // Component prop defaults var props = getOwnPropertyNames(cmpConfig); props.forEach(function (prop) { /* istanbul ignore if */ if (!hasOwnProperty(DEFAULTS[cmpName], prop)) { warn("config: unknown config property \"".concat(cmpName, ".{$prop}\"")); } else { // TODO: If we pre-populate the config with defaults, we can skip this line _this.$_config[cmpName] = _this.$_config[cmpName] || {}; if (!isUndefined(cmpConfig[prop])) { _this.$_config[cmpName][prop] = cloneDeep(cmpConfig[prop]); } } }); } }); } // Clear the config. For testing purposes only }, { key: "resetConfig", value: function resetConfig() { this.$_config = {}; } // Returns a deep copy of the user config }, { key: "getConfig", value: function getConfig() { return cloneDeep(this.$_config); } }, { key: "getConfigValue", value: function getConfigValue(key) { // First we try the user config, and if key not found we fall back to default value // NOTE: If we deep clone DEFAULTS into config, then we can skip the fallback for get return cloneDeep(get(this.$_config, key, get(DEFAULTS, key))); } }, { key: "defaults", get: function get() /* istanbul ignore next */ { return DEFAULTS; } }], [{ key: "Defaults", get: function get() /* istanbul ignore next */ { return DEFAULTS; } }]); return BvConfig; }(); // Method for applying a global config var setConfig = function setConfig() { var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var Vue$1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Vue; // Ensure we have a $bvConfig Object on the Vue prototype. // We set on Vue and OurVue just in case consumer has not set an alias of `vue`. Vue$1.prototype[PROP_NAME] = Vue.prototype[PROP_NAME] = Vue$1.prototype[PROP_NAME] || Vue.prototype[PROP_NAME] || new BvConfig(); // Apply the config values Vue$1.prototype[PROP_NAME].setConfig(config); }; // Method for resetting the user config. Exported for testing purposes only. /** * Checks if there are multiple instances of Vue, and warns (once) about possible issues. * @param {object} Vue */ var checkMultipleVue = function () { var checkMultipleVueWarned = false; var MULTIPLE_VUE_WARNING = ['Multiple instances of Vue detected!', 'You may need to set up an alias for Vue in your bundler config.', 'See: https://bootstrap-vue.js.org/docs#using-module-bundlers'].join('\n'); return function (Vue$1) { /* istanbul ignore next */ if (!checkMultipleVueWarned && Vue !== Vue$1 && !isJSDOM) { warn(MULTIPLE_VUE_WARNING); } checkMultipleVueWarned = true; }; }(); /** * Plugin install factory function. * @param {object} { components, directives } * @returns {function} plugin install function */ var installFactory = function installFactory() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, components = _ref.components, directives = _ref.directives, plugins = _ref.plugins; var install = function install(Vue) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (install.installed) { /* istanbul ignore next */ return; } install.installed = true; checkMultipleVue(Vue); setConfig(config, Vue); registerComponents(Vue, components); registerDirectives(Vue, directives); registerPlugins(Vue, plugins); }; install.installed = false; return install; }; /** * Plugin object factory function. * @param {object} { components, directives, plugins } * @returns {object} plugin install object */ var pluginFactory = function pluginFactory() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var extend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return _objectSpread2({}, extend, { install: installFactory(opts) }); }; /** * Load a group of plugins. * @param {object} Vue * @param {object} Plugin definitions */ var registerPlugins = function registerPlugins(Vue) { var plugins = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; for (var plugin in plugins) { if (plugin && plugins[plugin]) { Vue.use(plugins[plugin]); } } }; /** * Load a component. * @param {object} Vue * @param {string} Component name * @param {object} Component definition */ var registerComponent = function registerComponent(Vue, name, def) { if (Vue && name && def) { Vue.component(name, def); } }; /** * Load a group of components. * @param {object} Vue * @param {object} Object of component definitions */ var registerComponents = function registerComponents(Vue) { var components = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; for (var component in components) { registerComponent(Vue, component, components[component]); } }; /** * Load a directive. * @param {object} Vue * @param {string} Directive name * @param {object} Directive definition */ var registerDirective = function registerDirective(Vue, name, def) { if (Vue && name && def) { // Ensure that any leading V is removed from the // name, as Vue adds it automatically Vue.directive(name.replace(/^VB/, 'B'), def); } }; /** * Load a group of directives. * @param {object} Vue * @param {object} Object of directive definitions */ var registerDirectives = function registerDirectives(Vue) { var directives = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; for (var directive in directives) { registerDirective(Vue, directive, directives[directive]); } }; /** * Install plugin if window.Vue available * @param {object} Plugin definition */ var vueUse = function vueUse(VuePlugin) { /* istanbul ignore next */ if (hasWindowSupport && window.Vue) { window.Vue.use(VuePlugin); } }; var memoize = function memoize(fn) { var cache = create(null); return function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var argsKey = JSON.stringify(args); return cache[argsKey] = cache[argsKey] || fn.apply(null, args); }; }; var PROP_NAME$1 = '$bvConfig'; var VueProto = Vue.prototype; // --- Getter methods --- var getConfigValue = function getConfigValue(key) { return VueProto[PROP_NAME$1] ? VueProto[PROP_NAME$1].getConfigValue(key) : cloneDeep(get(DEFAULTS, key)); }; // Method to grab a config value for a particular component var getComponentConfig = function getComponentConfig(cmpName) { var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; // Return the particular config value for key for if specified, // otherwise we return the full config (or an empty object if not found) return key ? getConfigValue("".concat(cmpName, ".").concat(key)) : getConfigValue(cmpName) || {}; }; // Convenience method for getting all breakpoint names var getBreakpoints = function getBreakpoints() { return getConfigValue('breakpoints'); }; // Private function for caching / locking-in breakpoint names var _getBreakpointsCached = memoize(function () { return getBreakpoints(); }); // Convenience method for getting all breakpoint names. // Caches the results after first access. var getBreakpointsCached = function getBreakpointsCached() { return cloneDeep(_getBreakpointsCached()); }; // Convenience method for getting breakpoints with // the smallest breakpoint set as ''. // Useful for components that create breakpoint specific props. // Caches the results after first access. var getBreakpointsUpCached = memoize(function () { var breakpoints = getBreakpointsCached(); breakpoints[0] = ''; return breakpoints; }); // Convenience method for getting breakpoints with var w = hasWindowSupport ? window : {}; var d = hasDocumentSupport ? document : {}; var elProto = typeof Element !== 'undefined' ? Element.prototype : {}; // --- Normalization utils --- // See: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill /* istanbul ignore next */ var matchesEl = elProto.matches || elProto.msMatchesSelector || elProto.webkitMatchesSelector; // See: https://developer.mozilla.org/en-US/docs/Web/API/Element/closest /* istanbul ignore next */ var closestEl = elProto.closest || function (sel) /* istanbul ignore next */ { var el = this; do { // Use our "patched" matches function if (matches(el, sel)) { return el; } el = el.parentElement || el.parentNode; } while (!isNull(el) && el.nodeType === Node.ELEMENT_NODE); return null; }; // `requestAnimationFrame()` convenience method var requestAF = w.requestAnimationFrame || w.webkitRequestAnimationFrame || w.mozRequestAnimationFrame || w.msRequestAnimationFrame || w.oRequestAnimationFrame || // Fallback, but not a true polyfill // Only needed for Opera Mini /* istanbul ignore next */ function (cb) { return setTimeout(cb, 16); }; var MutationObs = w.MutationObserver || w.WebKitMutationObserver || w.MozMutationObserver || null; // --- Utils --- // Normalize event options based on support of passive option // Exported only for testing purposes var parseEventOptions = function parseEventOptions(options) { /* istanbul ignore else: can't test in JSDOM, as it supports passive */ if (hasPassiveEventSupport) { return isObject(options) ? options : { useCapture: Boolean(options || false) }; } else { // Need to translate to actual Boolean value return Boolean(isObject(options) ? options.useCapture : options); } }; // Attach an event listener to an element var eventOn = function eventOn(el, evtName, handler, options) { if (el && el.addEventListener) { el.addEventListener(evtName, handler, parseEventOptions(options)); } }; // Remove an event listener from an element var eventOff = function eventOff(el, evtName, handler, options) { if (el && el.removeEventListener) { el.removeEventListener(evtName, handler, parseEventOptions(options)); } }; // Determine if an element is an HTML Element var isElement = function isElement(el) { return Boolean(el && el.nodeType === Node.ELEMENT_NODE); }; // Determine if an HTML element is visible - Faster than CSS check var isVisible = function isVisible(el) { if (!isElement(el) || !contains(d.body, el)) { return false; } if (el.style.display === 'none') { // We do this check to help with vue-test-utils when using v-show /* istanbul ignore next */ return false; } // All browsers support getBoundingClientRect(), except JSDOM as it returns all 0's for values :( // So any tests that need isVisible will fail in JSDOM // Except when we override the getBCR prototype in some tests var bcr = getBCR(el); return Boolean(bcr && bcr.height > 0 && bcr.width > 0); }; // Determine if an element is disabled var isDisabled = function isDisabled(el) { return !isElement(el) || el.disabled || Boolean(getAttr(el, 'disabled')) || hasClass(el, 'disabled'); }; // Cause/wait-for an element to reflow it's content (adjusting it's height/width) var reflow = function reflow(el) { // Requesting an elements offsetHight will trigger a reflow of the element content /* istanbul ignore next: reflow doesn't happen in JSDOM */ return isElement(el) && el.offsetHeight; }; // Select all elements matching selector. Returns `[]` if none found var selectAll = function selectAll(selector, root) { return from((isElement(root) ? root : d).querySelectorAll(selector)); }; // Select a single element, returns `null` if not found var select = function select(selector, root) { return (isElement(root) ? root : d).querySelector(selector) || null; }; // Determine if an element matches a selector var matches = function matches(el, selector) { if (!isElement(el)) { return false; } return matchesEl.call(el, selector); }; // Finds closest element matching selector. Returns `null` if not found var closest = function closest(selector, root) { if (!isElement(root)) { return null; } var el = closestEl.call(root, selector); // Emulate jQuery closest and return `null` if match is the passed in element (root) return el === root ? null : el; }; // Returns true if the parent element contains the child element var contains = function contains(parent, child) { if (!parent || !isFunction(parent.contains)) { return false; } return parent.contains(child); }; // Get an element given an ID var getById = function getById(id) { return d.getElementById(/^#/.test(id) ? id.slice(1) : id) || null; }; // Add a class to an element var addClass = function addClass(el, className) { // We are checking for `el.classList` existence here since IE 11 // returns `undefined` for some elements (e.g. SVG elements) // See https://github.com/bootstrap-vue/bootstrap-vue/issues/2713 if (className && isElement(el) && el.classList) { el.classList.add(className); } }; // Remove a class from an element var removeClass = function removeClass(el, className) { // We are checking for `el.classList` existence here since IE 11 // returns `undefined` for some elements (e.g. SVG elements) // See https://github.com/bootstrap-vue/bootstrap-vue/issues/2713 if (className && isElement(el) && el.classList) { el.classList.remove(className); } }; // Test if an element has a class var hasClass = function hasClass(el, className) { // We are checking for `el.classList` existence here since IE 11 // returns `undefined` for some elements (e.g. SVG elements) // See https://github.com/bootstrap-vue/bootstrap-vue/issues/2713 if (className && isElement(el) && el.classList) { return el.classList.contains(className); } return false; }; // Set an attribute on an element var setAttr = function setAttr(el, attr, val) { if (attr && isElement(el)) { el.setAttribute(attr, val); } }; // Remove an attribute from an element var removeAttr = function removeAttr(el, attr) { if (attr && isElement(el)) { el.removeAttribute(attr); } }; // Get an attribute value from an element // Returns `null` if not found var getAttr = function getAttr(el, attr) { return attr && isElement(el) ? el.getAttribute(attr) : null; }; // Determine if an attribute exists on an element // Returns `true` or `false`, or `null` if element not found var hasAttr = function hasAttr(el, attr) { return attr && isElement(el) ? el.hasAttribute(attr) : null; }; // Return the Bounding Client Rect of an element // Returns `null` if not an element /* istanbul ignore next: getBoundingClientRect() doesn't work in JSDOM */ var getBCR = function getBCR(el) { return isElement(el) ? el.getBoundingClientRect() : null; }; // Get computed style object for an element /* istanbul ignore next: getComputedStyle() doesn't work in JSDOM */ var getCS = function getCS(el) { return hasWindowSupport && isElement(el) ? w.getComputedStyle(el) : {}; }; // Returns a `Selection` object representing the range of text selected // Returns `null` if no window support is given /* istanbul ignore next: getSelection() doesn't work in JSDOM */ var getSel = function getSel() { return hasWindowSupport && w.getSelection ? w.getSelection() : null; }; // Return an element's offset with respect to document element // https://j11y.io/jquery/#v=git&fn=jQuery.fn.offset var offset = function offset(el) /* istanbul ignore next: getBoundingClientRect(), getClientRects() doesn't work in JSDOM */ { var _offset = { top: 0, left: 0 }; if (!isElement(el) || el.getClientRects().length === 0) { return _offset; } var bcr = getBCR(el); if (bcr) { var win = el.ownerDocument.defaultView; _offset.top = bcr.top + win.pageYOffset; _offset.left = bcr.left + win.pageXOffset; } return _offset; }; // Return an element's offset with respect to to it's offsetParent // https://j11y.io/jquery/#v=git&fn=jQuery.fn.position var position = function position(el) /* istanbul ignore next: getBoundingClientRect() doesn't work in JSDOM */ { var _offset = { top: 0, left: 0 }; if (!isElement(el)) { return _offset; } var parentOffset = { top: 0, left: 0 }; var elStyles = getCS(el); if (elStyles.position === 'fixed') { _offset = getBCR(el) || _offset; } else { _offset = offset(el); var doc = el.ownerDocument; var offsetParent = el.offsetParent || doc.documentElement; while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && getCS(offsetParent).position === 'static') { offsetParent = offsetParent.parentNode; } if (offsetParent && offsetParent !== el && offsetParent.nodeType === Node.ELEMENT_NODE) { parentOffset = offset(offsetParent); var offsetParentStyles = getCS(offsetParent); parentOffset.top += parseFloat(offsetParentStyles.borderTopWidth); parentOffset.left += parseFloat(offsetParentStyles.borderLeftWidth); } } return { top: _offset.top - parentOffset.top - parseFloat(elStyles.marginTop), left: _offset.left - parentOffset.left - parseFloat(elStyles.marginLeft) }; }; var e=function(){return (e=Object.assign||function(e){for(var t,r=1,s=arguments.length;r<s;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},t={kebab:/-(\w)/g,styleProp:/:(.*)/,styleList:/;(?![^(]*\))/g};function r(e,t){return t?t.toUpperCase():""}function s(e){for(var s,a={},c=0,o=e.split(t.styleList);c<o.length;c++){var n=o[c].split(t.styleProp),i=n[0],l=n[1];(i=i.trim())&&("string"==typeof l&&(l=l.trim()),a[(s=i,s.replace(t.kebab,r))]=l);}return a}function a(){for(var t,r,a={},c=arguments.length;c--;)for(var o=0,n=Object.keys(arguments[c]);o<n.length;o++)switch(t=n[o]){case"class":case"style":case"directives":if(Array.isArray(a[t])||(a[t]=[]),"style"===t){var i=void 0;i=Array.isArray(arguments[c].style)?arguments[c].style:[arguments[c].style];for(var l=0;l<i.length;l++){var y=i[l];"string"==typeof y&&(i[l]=s(y));}arguments[c].style=i;}a[t]=a[t].concat(arguments[c][t]);break;case"staticClass":if(!arguments[c][t])break;void 0===a[t]&&(a[t]=""),a[t]&&(a[t]+=" "),a[t]+=arguments[c][t].trim();break;case"on":case"nativeOn":a[t]||(a[t]={});for(var p=0,f=Object.keys(arguments[c][t]||{});p<f.length;p++)r=f[p],a[t][r]?a[t][r]=[].concat(a[t][r],arguments[c][t][r]):a[t][r]=arguments[c][t][r];break;case"attrs":case"props":case"domProps":case"scopedSlots":case"staticStyle":case"hook":case"transition":a[t]||(a[t]={}),a[t]=e({},arguments[c][t],a[t]);break;case"slot":case"key":case"ref":case"tag":case"show":case"keepAlive":default:a[t]||(a[t]=arguments[c][t]);}return a} var NO_FADE_PROPS = { name: '', enterClass: '', enterActiveClass: '', enterToClass: 'show', leaveClass: 'show', leaveActiveClass: '', leaveToClass: '' }; var FADE_PROPS = _objectSpread2({}, NO_FADE_PROPS, { enterActiveClass: 'fade', leaveActiveClass: 'fade' }); var BVTransition = /*#__PURE__*/ Vue.extend({ name: 'BVTransition', functional: true, props: { noFade: { // Only applicable to the built in transition // Has no effect if `trans-props` provided type: Boolean, default: false }, mode: { type: String // default: undefined }, // For user supplied transitions (if needed) transProps: { type: Object, default: null } }, render: function render(h, _ref) { var children = _ref.children, data = _ref.data, listeners = _ref.listeners, props = _ref.props; var transProps = props.transProps; if (!isPlainObject(transProps)) { transProps = props.noFade ? NO_FADE_PROPS : FADE_PROPS; } transProps = _objectSpread2({ mode: props.mode }, transProps, { // We always need `css` true css: true }); return h('transition', // Any listeners will get merged here a(data, { props: transProps }), children); } }); // In functional components, `slots` is a function so it must be called // first before passing to the below methods. `scopedSlots` is always an // object and may be undefined (for Vue < 2.6.x) /** * Returns true if either scoped or unscoped named slot exists * * @param {String} name * @param {Object} scopedSlots * @param {Object} slots * @returns {Array|undefined} vNodes */ var hasNormalizedSlot = function hasNormalizedSlot(name) { var $scopedSlots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var $slots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; // Returns true if the either a $scopedSlot or $slot exists with the specified name return Boolean($scopedSlots[name] || $slots[name]); }; /** * Returns vNodes for named slot either scoped or unscoped * * @param {String} name * @param {String} scope * @param {Object} scopedSlots * @param {Object} slots * @returns {Array|undefined} vNodes */ var normalizeSlot = function normalizeSlot(name) { var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var $scopedSlots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var $slots = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; // Note: in Vue 2.6.x, all names slots are also scoped slots var slot = $scopedSlots[name] || $slots[name]; return isFunction(slot) ? slot(scope) : slot; }; // Named exports var normalizeSlotMixin = { methods: { hasNormalizedSlot: function hasNormalizedSlot$1(name) { // Returns true if the either a $scopedSlot or $slot exists with the specified name return hasNormalizedSlot(name, this.$scopedSlots, this.$slots); }, normalizeSlot: function normalizeSlot$1(name) { var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // Returns an array of rendered vNodes if slot found. // Returns undefined if not found. var vNodes = normalizeSlot(name, scope, this.$scopedSlots, this.$slots); return vNodes ? concat(vNodes) : vNodes; } } }; var NAME = 'BButtonClose'; var props = { disabled: { type: Boolean, default: false }, ariaLabel: { type: String, default: function _default() { return getComponentConfig(NAME, 'ariaLabel'); } }, textVariant: { type: String, default: function _default() { return getComponentConfig(NAME, 'textVariant'); } } // @vue/component }; var BButtonClose = /*#__PURE__*/ Vue.extend({ name: NAME, functional: true, props: props, render: function render(h, _ref) { var props = _ref.props, data = _ref.data, listeners = _ref.listeners, slots = _ref.slots, scopedSlots = _ref.scopedSlots; var $slots = slots(); var $scopedSlots = scopedSlots || {}; var componentData = { staticClass: 'close', class: _defineProperty({}, "text-".concat(props.textVariant), props.textVariant), attrs: { type: 'button', disabled: props.disabled, 'aria-label': props.ariaLabel ? String(props.ariaLabel) : null }, on: { click: function click(evt) { // Ensure click on button HTML content is also disabled /* istanbul ignore if: bug in JSDOM still emits click on inner element */ if (props.disabled && isEvent(evt)) { evt.stopPropagation(); evt.preventDefault(); } } } // Careful not to override the default slot with innerHTML }; if (!hasNormalizedSlot('default', $scopedSlots, $slots)) { componentData.domProps = { innerHTML: '&times;' }; } return h('button', a(data, componentData), normalizeSlot('default', {}, $scopedSlots, $slots)); } }); var NAME$1 = 'BAlert'; // Convert `show` value to a number var parseCountDown = function parseCountDown(show) { if (show === '' || isBoolean(show)) { return 0; } show = parseInt(show, 10); return show > 0 ? show : 0; }; // Convert `show` value to a boolean var parseShow = function parseShow(show) { if (show === '' || show === true) { return true; } if (parseInt(show, 10) < 1) { // Boolean will always return false for the above comparison return false; } return Boolean(show); }; // Is a value number like (i.e. a number or a number as string) var isNumericLike = function isNumericLike(value) { return !isNaN(parseInt(value, 10)); }; // @vue/component var BAlert = /*#__PURE__*/ Vue.extend({ name: NAME$1, mixins: [normalizeSlotMixin], model: { prop: 'show', event: 'input' }, props: { variant: { type: String, default: function _default() { return getComponentConfig(NAME$1, 'variant'); } }, dismissible: { type: Boolean, default: false }, dismissLabel: { type: String, default: function _default() { return getComponentConfig(NAME$1, 'dismissLabel'); } }, show: { type: [Boolean, Number, String], default: false }, fade: { type: Boolean, default: false } }, data: function data() { return { countDownTimerId: null, countDown: 0, // If initially shown, we need to set these for SSR localShow: parseShow(this.show) }; }, watch: { show: function show(newVal) { this.countDown = parseCountDown(newVal); this.localShow = parseShow(newVal); }, countDown: function countDown(newVal) { var _this = this; this.clearTimer(); if (isNumericLike(this.show)) { // Ignore if this.show transitions to a boolean value. this.$emit('dismiss-count-down', newVal); if (this.show !== newVal) { // Update the v-model if needed this.$emit('input', newVal); } if (newVal > 0) { this.localShow = true; this.countDownTimerId = setTimeout(function () { _this.countDown--; }, 1000); } else { // Slightly delay the hide to allow any UI updates this.$nextTick(function () { requestAF(function () { _this.localShow = false; }); }); } } }, localShow: function localShow(newVal) { if (!newVal && (this.dismissible || isNumericLike(this.show))) { // Only emit dismissed events for dismissible or auto dismissing alerts this.$emit('dismissed'); } if (!isNumericLike(this.show) && this.show !== newVal) { // Only emit booleans if we weren'