bootstrap-vue
Version:
With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens
1,595 lines (1,392 loc) • 1.54 MB
JavaScript
/*!
* BootstrapVue 2.17.3
*
* @link https://bootstrap-vue.org
* @source https://github.com/bootstrap-vue/bootstrap-vue
* @copyright (c) 2016-2020 BootstrapVue
* @license MIT
* https://github.com/bootstrap-vue/bootstrap-vue/blob/master/LICENSE
*/
import Vue from 'vue';
import { mergeData } from 'vue-functional-data-merge';
import Popper from 'popper.js';
import { Wormhole, PortalTarget, Portal } from 'portal-vue';
function _typeof(obj) {
"@babel/helpers - typeof";
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(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(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 _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
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 _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
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 _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
}
function _iterableToArrayLimit(arr, i) {
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
/**
* 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';
/* istanbul ignore next: JSDOM always returns false */
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);
/* istanbul ignore next: JSDOM only checks for 'IntersectionObserver' */
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') || getEnv('NODE_ENV') === 'production';
};
var w = hasWindowSupport ? window : {};
var Element$1 = hasWindowSupport ? w.Element : /*#__PURE__*/function (_Object) {
_inherits(Element, _Object);
var _super = _createSuper(Element);
function Element() {
_classCallCheck(this, Element);
return _super.apply(this, arguments);
}
return Element;
}( /*#__PURE__*/_wrapNativeSuper(Object));
var HTMLElement = hasWindowSupport ? w.HTMLElement : /*#__PURE__*/function (_Element) {
_inherits(HTMLElement, _Element);
var _super2 = _createSuper(HTMLElement);
function HTMLElement() {
_classCallCheck(this, HTMLElement);
return _super2.apply(this, arguments);
}
return HTMLElement;
}(Element$1);
var SVGElement = hasWindowSupport ? w.SVGElement : /*#__PURE__*/function (_Element2) {
_inherits(SVGElement, _Element2);
var _super3 = _createSuper(SVGElement);
function SVGElement() {
_classCallCheck(this, SVGElement);
return _super3.apply(this, arguments);
}
return SVGElement;
}(Element$1);
var File = hasWindowSupport ? w.File : /*#__PURE__*/function (_Object2) {
_inherits(File, _Object2);
var _super4 = _createSuper(File);
function File() {
_classCallCheck(this, File);
return _super4.apply(this, arguments);
}
return File;
}( /*#__PURE__*/_wrapNativeSuper(Object));
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';
}; // Is a value number like (i.e. a number or a number as string)
var isNumeric = function isNumeric(value) {
return !isNaN(parseInt(value, 10));
};
var isArray = function isArray(val) {
return Array.isArray(val);
}; // 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]';
};
var isDate = function isDate(val) {
return val instanceof Date;
};
var isEvent = function isEvent(val) {
return val instanceof Event;
};
var isFile = function isFile(val) {
return val instanceof File;
};
var isRegExp = function isRegExp(val) {
return toRawType(val) === 'RegExp';
};
var isPromise = function isPromise(val) {
return !isUndefinedOrNull(val) && isFunction(val.then) && isFunction(val.catch);
};
var assign = function assign() {
return Object.assign.apply(Object, arguments);
};
var create = function create(proto, optionalProps) {
return Object.create(proto, optionalProps);
};
var defineProperties = function defineProperties(obj, props) {
return Object.defineProperties(obj, props);
};
var defineProperty = function defineProperty(obj, prop, descriptor) {
return Object.defineProperty(obj, prop, descriptor);
};
var freeze = function freeze(obj) {
return Object.freeze(obj);
};
var getOwnPropertyNames = function getOwnPropertyNames(obj) {
return Object.getOwnPropertyNames(obj);
};
var keys = function keys(obj) {
return Object.keys(obj);
}; // --- "Instance" ---
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 ---
/**
* Shallow copy an object. If the passed in object
* is null or undefined, returns an empty object
*/
var clone = function clone(obj) {
return _objectSpread2({}, obj);
};
/**
* Return a shallow copy of object with the specified properties only
* @link https://gist.github.com/bisubus/2da8af7e801ffd813fab7ac221aa7afc
*/
var pick = function pick(obj, props) {
return keys(obj).filter(function (key) {
return props.indexOf(key) !== -1;
}).reduce(function (result, key) {
return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, key, obj[key]));
}, {});
};
/**
* Return a shallow copy of object with the specified properties omitted
* @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(_objectSpread2({}, result), {}, _defineProperty({}, key, obj[key]));
}, {});
};
/**
* Merges two object deeply together
* @link https://gist.github.com/Salakar/1d7137de9cb8b704e48a
*/
var mergeDeep = function mergeDeep(target, source) {
if (isObject(target) && isObject(source)) {
keys(source).forEach(function (key) {
if (isObject(source[key])) {
if (!target[key] || !isObject(target[key])) {
target[key] = source[key];
}
mergeDeep(target[key], source[key]);
} else {
assign(target, _defineProperty({}, key, source[key]));
}
});
}
return target;
};
/**
* Convenience method to create a read-only descriptor
*/
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
* Note: This method will not work for property values using `Symbol()` as a key
* See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
*/
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 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(_objectSpread2({}, result), {}, _defineProperty({}, key, cloneDeep(obj[key], obj[key])));
}, {});
}
return defaultValue;
};
// --- General ---
var RX_ARRAY_NOTATION = /\[(\d+)]/g;
var RX_DIGITS = /^\d+$/;
var RX_EXTENSION = /^\..+/;
var RX_HASH = /^#/;
var RX_HASH_ID = /^#[A-Za-z]+[\w\-:.]*$/;
var RX_HTML_TAGS = /(<([^>]+)>)/gi;
var RX_HYPHENATE = /\B([A-Z])/g;
var RX_LOWER_UPPER = /([a-z])([A-Z])/g;
var RX_NUMBER = /^[0-9]*\.?[0-9]+$/;
var RX_PLUS = /\+/g;
var RX_REGEXP_REPLACE = /[-/\\^$*+?.()|[\]{}]/g;
var RX_SPACES = /[\s\uFEFF\xA0]+/g;
var RX_SPACE_SPLIT = /\s+/;
var RX_STAR = /\/\*$/;
var RX_START_SPACE_WORD = /(\s|^)(\w)/g;
var RX_TRIM_LEFT = /^\s+/;
var RX_UNDERSCORE = /_/g;
var RX_UN_KEBAB = /-(\w)/g; // --- Date ---
// Loose YYYY-MM-DD matching, ignores any appended time inforation
// Matches '1999-12-20', '1999-1-1', '1999-01-20T22:51:49.118Z', '1999-01-02 13:00:00'
var RX_DATE = /^\d+-\d\d?-\d\d?(?:\s|T|$)/; // Used to split off the date parts of the YYYY-MM-DD string
var RX_DATE_SPLIT = /-|\s|T/; // Time string RegEx (optional seconds)
var RX_TIME = /^([0-1]?[0-9]|2[0-3]):[0-5]?[0-9](:[0-5]?[0-9])?$/; // --- URL ---
// HREFs must end with a hash followed by at least one non-hash character
var RX_HREF = /^.*(#[^#]+)$/;
var RX_ENCODED_COMMA = /%2C/g;
var RX_ENCODE_REVERSE = /[!'()*]/g;
var RX_QUERY_START = /^(\?|#|&)/; // --- Aspect ---
var RX_ASPECT = /^\d+(\.\d*)?[/:]\d+(\.\d*)?$/;
var RX_ASPECT_SEPARATOR = /[/:]/; // --- Grid ---
var RX_COL_CLASS = /^col-/; // --- Icon ---
var RX_ICON_PREFIX = /^BIcon/; // --- Locale ---
var RX_STRIP_LOCALE_MODS = /-u-.+/;
var identity = function identity(x) {
return x;
};
/**
* Get property defined by dot/array notation in string, returns undefined if not found
*
* @link https://gist.github.com/jeneg/9767afdcca45601ea44930ea03e0febf#gistcomment-1935901
*
* @param {Object} obj
* @param {string|Array} path
* @return {*}
*/
var getRaw = function getRaw(obj, path) {
var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
// 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(RX_ARRAY_NOTATION, '.$1');
var steps = path.split('.').filter(identity); // Handle case where someone passes a string of only dots
if (steps.length === 0) {
return defaultValue;
} // Traverse path in object to find result
// 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 && !isUndefinedOrNull(obj = obj[step]);
}) ? obj : isNull(obj) ? null : 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;
var val = getRaw(obj, path);
return isUndefinedOrNull(val) ? defaultValue : val;
};
/**
* Log a warning message to the console with BootstrapVue formatting
* @param {string} message
*/
var warn = function warn(message)
/* istanbul ignore next */
{
var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
if (!getNoWarn()) {
console.warn("[BootstrapVue warn]: ".concat(source ? "".concat(source, " - ") : '').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;
}
};
var NAME_ALERT = 'BAlert';
var NAME_ASPECT = 'BAspect';
var NAME_AVATAR = 'BAvatar';
var NAME_AVATAR_GROUP = 'BAvatarGroup';
var NAME_BADGE = 'BBadge';
var NAME_BREADCRUMB = 'BBreadcrumb';
var NAME_BREADCRUMB_ITEM = 'BBreadcrumbItem';
var NAME_BREADCRUMB_LINK = 'BBreadcrumbLink';
var NAME_BUTTON = 'BButton';
var NAME_BUTTON_CLOSE = 'BButtonClose';
var NAME_BUTTON_GROUP = 'BButtonGroup';
var NAME_BUTTON_TOOLBAR = 'BButtonToolbar';
var NAME_CALENDAR = 'BCalendar';
var NAME_CARD = 'BCard';
var NAME_CARD_BODY = 'BCardBody';
var NAME_CARD_FOOTER = 'BCardFooter';
var NAME_CARD_GROUP = 'BCardGroup';
var NAME_CARD_HEADER = 'BCardHeader';
var NAME_CARD_IMG = 'BCardImg';
var NAME_CARD_IMG_LAZY = 'BCardImgLazy';
var NAME_CARD_SUB_TITLE = 'BCardSubTitle';
var NAME_CARD_TEXT = 'BCardText';
var NAME_CARD_TITLE = 'BCardTitle';
var NAME_CAROUSEL = 'BCarousel';
var NAME_CAROUSEL_SLIDE = 'BCarouselSlide';
var NAME_COL = 'BCol';
var NAME_COLLAPSE = 'BCollapse';
var NAME_COLLAPSE_HELPER = 'BVCollapse';
var NAME_CONTAINER = 'BContainer';
var NAME_DROPDOWN = 'BDropdown';
var NAME_DROPDOWN_DIVIDER = 'BDropdownDivider';
var NAME_DROPDOWN_FORM = 'BDropdownForm';
var NAME_DROPDOWN_GROUP = 'BDropdownGroup';
var NAME_DROPDOWN_HEADER = 'BDropdownHeader';
var NAME_DROPDOWN_ITEM = 'BDropdownItem';
var NAME_DROPDOWN_ITEM_BUTTON = 'BDropdownItemButton';
var NAME_DROPDOWN_TEXT = 'BDropdownText';
var NAME_EMBED = 'BEmbed';
var NAME_FORM = 'BForm';
var NAME_FORM_BUTTON_LABEL_CONTROL = 'BVFormBtnLabelControl';
var NAME_FORM_CHECKBOX = 'BFormCheckbox';
var NAME_FORM_CHECKBOX_GROUP = 'BFormCheckboxGroup';
var NAME_FORM_DATALIST = 'BFormDatalist';
var NAME_FORM_DATEPICKER = 'BFormDatepicker';
var NAME_FORM_FILE = 'BFormFile';
var NAME_FORM_GROUP = 'BFormGroup';
var NAME_FORM_INPUT = 'BFormInput';
var NAME_FORM_INVALID_FEEDBACK = 'BFormInvalidFeedback';
var NAME_FORM_RADIO = 'BFormRadio';
var NAME_FORM_RADIO_GROUP = 'BFormRadioGroup';
var NAME_FORM_RATING = 'BFormRating';
var NAME_FORM_RATING_STAR = 'BVFormRatingStar';
var NAME_FORM_ROW = 'BFormRow';
var NAME_FORM_SELECT = 'BFormSelect';
var NAME_FORM_SELECT_OPTION = 'BFormSelectOption';
var NAME_FORM_SELECT_OPTION_GROUP = 'BFormSelectOptionGroup';
var NAME_FORM_SPINBUTTON = 'BFormSpinbutton';
var NAME_FORM_TAG = 'BFormTag';
var NAME_FORM_TAGS = 'BFormTags';
var NAME_FORM_TEXT = 'BFormText';
var NAME_FORM_TEXTAREA = 'BFormTextarea';
var NAME_FORM_TIMEPICKER = 'BFormTimepicker';
var NAME_FORM_VALID_FEEDBACK = 'BFormValidFeedback';
var NAME_ICON = 'BIcon';
var NAME_ICONSTACK = 'BIconstack';
var NAME_ICON_BASE = 'BIconBase';
var NAME_IMG = 'BImg';
var NAME_IMG_LAZY = 'BImgLazy';
var NAME_INPUT_GROUP = 'BInputGroup';
var NAME_INPUT_GROUP_ADDON = 'BInputGroupAddon';
var NAME_INPUT_GROUP_APPEND = 'BInputGroupAppend';
var NAME_INPUT_GROUP_PREPEND = 'BInputGroupPrepend';
var NAME_INPUT_GROUP_TEXT = 'BInputGroupText';
var NAME_JUMBOTRON = 'BJumbotron';
var NAME_LINK = 'BLink';
var NAME_LIST_GROUP = 'BListGroup';
var NAME_LIST_GROUP_ITEM = 'BListGroupItem';
var NAME_MEDIA = 'BMedia';
var NAME_MEDIA_ASIDE = 'BMediaAside';
var NAME_MEDIA_BODY = 'BMediaBody';
var NAME_MODAL = 'BModal';
var NAME_MSG_BOX = 'BMsgBox';
var NAME_NAV = 'BNav';
var NAME_NAVBAR = 'BNavbar';
var NAME_NAVBAR_BRAND = 'BNavbarBrand';
var NAME_NAVBAR_NAV = 'BNavbarNav';
var NAME_NAVBAR_TOGGLE = 'BNavbarToggle';
var NAME_NAV_FORM = 'BNavForm';
var NAME_NAV_ITEM = 'BNavItem';
var NAME_NAV_ITEM_DROPDOWN = 'BNavItemDropdown';
var NAME_NAV_TEXT = 'BNavText';
var NAME_OVERLAY = 'BOverlay';
var NAME_PAGINATION = 'BPagination';
var NAME_PAGINATION_NAV = 'BPaginationNav';
var NAME_POPOVER = 'BPopover';
var NAME_POPOVER_HELPER = 'BVPopover';
var NAME_POPOVER_TEMPLATE = 'BVPopoverTemplate';
var NAME_POPPER = 'BVPopper';
var NAME_PROGRESS = 'BProgress';
var NAME_PROGRESS_BAR = 'BProgressBar';
var NAME_ROW = 'BRow';
var NAME_SIDEBAR = 'BSidebar';
var NAME_SKELETON = 'BSkeleton';
var NAME_SKELETON_ICON = 'BSkeletonIcon';
var NAME_SKELETON_IMG = 'BSkeletonImg';
var NAME_SKELETON_TABLE = 'BSkeletonTable';
var NAME_SKELETON_WRAPPER = 'BSkeletonWrapper';
var NAME_SPINNER = 'BSpinner';
var NAME_TAB = 'BTab';
var NAME_TABLE = 'BTable';
var NAME_TABLE_CELL = 'BTableCell';
var NAME_TABLE_LITE = 'BTableLite';
var NAME_TABLE_SIMPLE = 'BTableSimple';
var NAME_TABS = 'BTabs';
var NAME_TAB_BUTTON_HELPER = 'BVTabButton';
var NAME_TBODY = 'BTbody';
var NAME_TFOOT = 'BTfoot';
var NAME_TH = 'BTh';
var NAME_THEAD = 'BThead';
var NAME_TIME = 'BTime';
var NAME_TOAST = 'BToast';
var NAME_TOASTER = 'BToaster';
var NAME_TOAST_POP = 'BVToastPop';
var NAME_TOOLTIP = 'BTooltip';
var NAME_TOOLTIP_HELPER = 'BVTooltip';
var NAME_TOOLTIP_TEMPLATE = 'BVTooltipTemplate';
var NAME_TR = 'BTr';
var NAME_TRANSITION = 'BVTransition';
var NAME_TRANSPORTER_SINGLE = 'BTransporterSingle';
var NAME_TRANSPORTER_TARGET_SINGLE = 'BTransporterTargetSingle';
var _deepFreeze;
// NOTES
//
// The global config SHALL NOT be used to set defaults for Boolean props, as the props
// would loose their semantic meaning, and force people writing 3rd party components to
// explicitly set a true or false value using the v-bind syntax on boolean props
//
// Supported config values (depending on the prop's supported type(s)):
// `String`, `Array`, `Object`, `null` or `undefined`
// BREAKPOINT DEFINITIONS
//
// Some components (`<b-col>` and `<b-form-group>`) 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' props async (lazy evaluation)
// The component definition is only called/executed when the first access to the
// component is used (and cached on subsequent uses)
// PROP DEFAULTS
//
// For default values on props, we use the default value factory function approach so
// that the default values are pulled in at each component instantiation
//
// props: {
// variant: {
// type: String,
// default: () => getConfigComponent('BAlert', 'variant')
// }
// }
//
// We also provide a cached getter for breakpoints, which are "frozen" on first access
// prettier-ignore
var DEFAULTS = deepFreeze((_deepFreeze = {
// Breakpoints
breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],
// Form controls
formControls: {
size: undefined
}
}, _defineProperty(_deepFreeze, NAME_ALERT, {
dismissLabel: 'Close',
variant: 'info'
}), _defineProperty(_deepFreeze, NAME_AVATAR, {
variant: 'secondary',
badgeVariant: 'primary'
}), _defineProperty(_deepFreeze, NAME_BADGE, {
variant: 'secondary'
}), _defineProperty(_deepFreeze, NAME_BUTTON, {
size: undefined,
variant: 'secondary'
}), _defineProperty(_deepFreeze, NAME_BUTTON_CLOSE, {
content: '×',
// `textVariant` is `undefined` to inherit the current text color
textVariant: undefined,
ariaLabel: 'Close'
}), _defineProperty(_deepFreeze, NAME_CALENDAR, {
selectedVariant: 'primary',
// Defaults to `selectedVariant`
todayVariant: undefined,
navButtonVariant: 'secondary',
// BFormDate will choose these first if not provided in BFormDate section
labelPrevDecade: 'Previous decade',
labelPrevYear: 'Previous year',
labelPrevMonth: 'Previous month',
labelCurrentMonth: 'Current month',
labelNextMonth: 'Next month',
labelNextYear: 'Next year',
labelNextDecade: 'Next decade',
labelToday: 'Today',
labelSelected: 'Selected date',
labelNoDateSelected: 'No date selected',
labelCalendar: 'Calendar',
labelNav: 'Calendar navigation',
labelHelp: 'Use cursor keys to navigate calendar dates'
}), _defineProperty(_deepFreeze, NAME_CARD_SUB_TITLE, {
// `<b-card>` and `<b-card-body>` also inherit this prop
subTitleTextVariant: 'muted'
}), _defineProperty(_deepFreeze, NAME_CAROUSEL, {
labelPrev: 'Previous Slide',
labelNext: 'Next Slide',
labelGotoSlide: 'Goto Slide',
labelIndicators: 'Select a slide to display'
}), _defineProperty(_deepFreeze, NAME_DROPDOWN, {
toggleText: 'Toggle Dropdown',
size: undefined,
variant: 'secondary',
splitVariant: undefined
}), _defineProperty(_deepFreeze, NAME_FORM_DATEPICKER, {
// BFormDatepicker will choose from BCalendar first if not provided here
selectedVariant: undefined,
todayVariant: undefined,
navButtonVariant: undefined,
labelPrevDecade: undefined,
labelPrevYear: undefined,
labelPrevMonth: undefined,
labelCurrentMonth: undefined,
labelNextMonth: undefined,
labelNextYear: undefined,
labelNextDecade: undefined,
labelToday: undefined,
labelSelected: undefined,
labelNoDateSelected: undefined,
labelCalendar: undefined,
labelNav: undefined,
labelHelp: undefined,
// These props are specific to BFormDatepicker
labelTodayButton: 'Select today',
labelResetButton: 'Reset',
labelCloseButton: 'Close'
}), _defineProperty(_deepFreeze, NAME_FORM_FILE, {
browseText: 'Browse',
// Chrome default file prompt
placeholder: 'No file chosen',
dropPlaceholder: 'Drop files here',
noDropPlaceholder: 'Not allowed'
}), _defineProperty(_deepFreeze, NAME_FORM_RATING, {
variant: null,
color: null
}), _defineProperty(_deepFreeze, NAME_FORM_TAG, {
removeLabel: 'Remove tag',
variant: 'secondary'
}), _defineProperty(_deepFreeze, NAME_FORM_TAGS, {
addButtonText: 'Add',
addButtonVariant: 'outline-secondary',
duplicateTagText: 'Duplicate tag(s)',
invalidTagText: 'Invalid tag(s)',
limitTagsText: 'Tag limit reached',
placeholder: 'Add tag...',
tagRemoveLabel: 'Remove tag',
tagRemovedLabel: 'Tag removed',
tagVariant: 'secondary'
}), _defineProperty(_deepFreeze, NAME_FORM_TEXT, {
textVariant: 'muted'
}), _defineProperty(_deepFreeze, NAME_FORM_TIMEPICKER, {
// Fallback to BTime
labelNoTimeSelected: undefined,
labelSelected: undefined,
labelHours: undefined,
labelMinutes: undefined,
labelSeconds: undefined,
labelAmpm: undefined,
labelAm: undefined,
labelPm: undefined,
// Fallback to BTime then BFormSpinbutton
labelDecrement: undefined,
labelIncrement: undefined,
// These props are specific to BFormTimepicker
labelNowButton: 'Select now',
labelResetButton: 'Reset',
labelCloseButton: 'Close'
}), _defineProperty(_deepFreeze, NAME_FORM_SPINBUTTON, {
labelDecrement: 'Decrement',
labelIncrement: 'Increment'
}), _defineProperty(_deepFreeze, NAME_IMG, {
blankColor: 'transparent'
}), _defineProperty(_deepFreeze, NAME_IMG_LAZY, {
blankColor: 'transparent'
}), _defineProperty(_deepFreeze, NAME_INPUT_GROUP, {
size: undefined
}), _defineProperty(_deepFreeze, NAME_JUMBOTRON, {
bgVariant: undefined,
borderVariant: undefined,
textVariant: undefined
}), _defineProperty(_deepFreeze, NAME_LINK, {
routerComponentName: undefined
}), _defineProperty(_deepFreeze, NAME_LIST_GROUP_ITEM, {
variant: undefined
}), _defineProperty(_deepFreeze, NAME_MODAL, {
titleTag: 'h5',
size: 'md',
headerBgVariant: undefined,
headerBorderVariant: undefined,
headerTextVariant: undefined,
headerCloseVariant: undefined,
bodyBgVariant: undefined,
bodyTextVariant: undefined,
footerBgVariant: undefined,
footerBorderVariant: undefined,
footerTextVariant: undefined,
cancelTitle: 'Cancel',
cancelVariant: 'secondary',
okTitle: 'OK',
okVariant: 'primary',
headerCloseContent: '×',
headerCloseLabel: 'Close'
}), _defineProperty(_deepFreeze, NAME_NAVBAR, {
variant: null
}), _defineProperty(_deepFreeze, NAME_NAVBAR_TOGGLE, {
label: 'Toggle navigation'
}), _defineProperty(_deepFreeze, NAME_PAGINATION, {
size: undefined
}), _defineProperty(_deepFreeze, NAME_PAGINATION_NAV, {
size: undefined
}), _defineProperty(_deepFreeze, NAME_POPOVER, {
boundary: 'scrollParent',
boundaryPadding: 5,
customClass: undefined,
delay: 50,
variant: undefined
}), _defineProperty(_deepFreeze, NAME_PROGRESS, {
variant: undefined
}), _defineProperty(_deepFreeze, NAME_PROGRESS_BAR, {
variant: undefined
}), _defineProperty(_deepFreeze, NAME_SPINNER, {
variant: undefined
}), _defineProperty(_deepFreeze, NAME_SKELETON, {
animation: 'wave'
}), _defineProperty(_deepFreeze, NAME_SKELETON_ICON, {
animation: 'wave'
}), _defineProperty(_deepFreeze, NAME_SIDEBAR, {
bgVariant: 'light',
textVariant: 'dark',
shadow: false,
width: undefined,
tag: 'div',
backdropVariant: 'dark'
}), _defineProperty(_deepFreeze, NAME_TABLE, {
selectedVariant: 'active',
headVariant: undefined,
footVariant: undefined
}), _defineProperty(_deepFreeze, NAME_TIME, {
labelNoTimeSelected: 'No time selected',
labelSelected: 'Selected time',
labelHours: 'Hours',
labelMinutes: 'Minutes',
labelSeconds: 'Seconds',
labelAmpm: 'AM/PM',
// It would be nice to be able to get these from Intl.DateTimeFormat somehow
labelAm: 'AM',
labelPm: 'PM',
// The following inherit from BFormSpinbutton if not provided
labelIncrement: undefined,
labelDecrement: undefined
}), _defineProperty(_deepFreeze, NAME_TOAST, {
toaster: 'b-toaster-top-right',
autoHideDelay: 5000,
variant: undefined,
toastClass: undefined,
headerClass: undefined,
bodyClass: undefined
}), _defineProperty(_deepFreeze, NAME_TOASTER, {
ariaLive: undefined,
ariaAtomic: undefined,
role: undefined
}), _defineProperty(_deepFreeze, NAME_TOOLTIP, {
boundary: 'scrollParent',
boundaryPadding: 5,
customClass: undefined,
delay: 50,
variant: undefined
}), _deepFreeze));
var NAME = 'BvConfig';
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;
}
/* istanbul ignore next */
_createClass(BvConfig, [{
key: "getDefaults",
// Returns the defaults
/* istanbul ignore next */
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("Unknown config property \"".concat(cmpName, "\""), NAME);
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('"breakpoints" must be an array of at least 2 breakpoint names', NAME);
} 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("Unknown config property \"".concat(cmpName, ".").concat(prop, "\""), NAME);
} 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(getRaw(this.$_config, key, getRaw(DEFAULTS, key)));
}
}, {
key: "defaults",
/* istanbul ignore next */
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.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 install factory function (no plugin config option).
* @param {object} { components, directives }
* @returns {function} plugin install function
*/
var installFactoryNoConfig = function installFactoryNoConfig() {
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
components = _ref2.components,
directives = _ref2.directives,
plugins = _ref2.plugins;
var install = function install(Vue) {
if (install.installed) {
/* istanbul ignore next */
return;
}
install.installed = true;
checkMultipleVue(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 options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var extend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _objectSpread2(_objectSpread2({}, extend), {}, {
install: installFactory(options)
});
};
/**
* Plugin object factory function (no config option).
* @param {object} { components, directives, plugins }
* @returns {object} plugin install object
*/
var pluginFactoryNoConfig = function pluginFactoryNoConfig() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var extend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _objectSpread2(_objectSpread2({}, extend), {}, {
install: installFactoryNoConfig(options)
});
};
/**
* 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]);
}
};
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(getRaw(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
// --- Static ---
var from = function from() {
return Array.from.apply(Array, arguments);
}; // --- 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);
}; // --- Utilities ---
var createAndFillArray = function createAndFillArray(size, value) {
return Array(size).fill(value);
};
var flatten = function flatten(array) {
return array.reduce(function (result, item) {
return result.concat(item);
}, []);
};
var flattenDeep = function flattenDeep(array) {
return array.reduce(function (result, item) {
return result.concat(Array.isArray(item) ? flattenDeep(item) : item);
}, []);
};
// Number utilities
// Converts a value (string, number, etc.) to an integer number
// Assumes radix base 10
var toInteger = function toInteger(value) {
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
var integer = parseInt(value, 10);
return isNaN(integer) ? defaultValue : integer;
}; // Converts a value (string, number, etc.) to a number
var toFloat = function toFloat(value) {
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : NaN;
var float = parseFloat(value);
return isNaN(float) ?