bootstrap-vue
Version:
BootstrapVue, with more than 85 custom components, over 45 plugins, several custom directives, and over 300 icons, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated W
1,564 lines (1,338 loc) • 1.04 MB
JavaScript
/*!
* BootstrapVue 2.13.1
*
* @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
*/
(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 && Object.prototype.hasOwnProperty.call(Vue, 'default') ? Vue['default'] : 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 () {
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.");
}
// --- Static ---
var from = function from() {
return Array.from.apply(Array, arguments);
};
var isArray = function isArray(val) {
return Array.isArray(val);
}; // --- 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 = 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 ---
/**
* 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]';
};
/**
* 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]));
}, {});
};
/**
* 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.
* 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);
};
/**
* 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');
};
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';
};
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);
}; // 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(_objectSpread2({}, result), {}, _defineProperty({}, key, cloneDeep(obj[key], obj[key])));
}, {});
}
return defaultValue;
};
var identity = function identity(x) {
return x;
};
var RX_ARRAY_NOTATION = /\[(\d+)]/g;
/**
* 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;
}
};
// 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({
// Breakpoints
breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],
// Form controls
formControls: {
size: undefined
},
// Component specific defaults are keyed by the component
// name (PascalCase) and prop name (camelCase)
BAlert: {
dismissLabel: 'Close',
variant: 'info'
},
BAvatar: {
variant: 'secondary',
badgeVariant: 'primary'
},
BBadge: {
variant: 'secondary'
},
BButton: {
size: undefined,
variant: 'secondary'
},
BButtonClose: {
content: '×',
// `textVariant` is `null` to inherit the current text color
textVariant: undefined,
ariaLabel: 'Close'
},
BCalendar: {
// 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'
},
BCardSubTitle: {
// `<b-card>` and `<b-card-body>` 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',
size: undefined,
variant: 'secondary',
splitVariant: undefined
},
BFormDatepicker: {
// BFormDatepicker will choose from BCalendar first if not provided here
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'
},
BFormFile: {
browseText: 'Browse',
// Chrome default file prompt
placeholder: 'No file chosen',
dropPlaceholder: 'Drop files here'
},
BFormRating: {
variant: null,
color: null
},
BFormTag: {
removeLabel: 'Remove tag',
variant: 'secondary'
},
BFormTags: {
addButtonText: 'Add',
addButtonVariant: 'outline-secondary',
duplicateTagText: 'Duplicate tag(s)',
invalidTagText: 'Invalid tag(s)',
placeholder: 'Add tag...',
tagRemoveLabel: 'Remove tag',
tagRemovedLabel: 'Tag removed',
tagVariant: 'secondary'
},
BFormText: {
textVariant: 'muted'
},
BFormTimepicker: {
// 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'
},
BFormSpinbutton: {
labelDecrement: 'Decrement',
labelIncrement: 'Increment'
},
BImg: {
blankColor: 'transparent'
},
BImgLazy: {
blankColor: 'transparent'
},
BInputGroup: {
size: undefined
},
BJumbotron: {
bgVariant: undefined,
borderVariant: undefined,
textVariant: undefined
},
BListGroupItem: {
variant: undefined
},
BModal: {
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'
},
BNavbar: {
variant: null
},
BNavbarToggle: {
label: 'Toggle navigation'
},
BPagination: {
size: undefined
},
BPaginationNav: {
size: undefined
},
BPopover: {
boundary: 'scrollParent',
boundaryPadding: 5,
customClass: undefined,
delay: 50,
variant: undefined
},
BProgress: {
variant: undefined
},
BProgressBar: {
variant: undefined
},
BSpinner: {
variant: undefined
},
BSidebar: {
bgVariant: 'light',
textVariant: 'dark',
shadow: false,
width: undefined,
tag: 'div'
},
BTable: {
selectedVariant: 'active',
headVariant: undefined,
footVariant: undefined
},
BTime: {
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
},
BToast: {
toaster: 'b-toaster-top-right',
autoHideDelay: 5000,
variant: undefined,
toastClass: undefined,
headerClass: undefined,
bodyClass: undefined
},
BToaster: {
ariaLive: undefined,
ariaAtomic: undefined,
role: undefined
},
BTooltip: {
boundary: 'scrollParent',
boundaryPadding: 5,
customClass: undefined,
delay: 50,
variant: undefined
}
});
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 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)
});
};
/**
* 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);
}
/* istanbul ignore next */
if (hasWindowSupport && VuePlugin.NAME) {
window[VuePlugin.NAME] = 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(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
// 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) ? defaultValue : float;
}; // Converts a value (string, number, etc) to a string
// representation with `precision` digits after the decimal
// Returns the string 'NaN' if the value cannot be converted
var toFixed = function toFixed(val, precision) {
return toFloat(val).toFixed(toInteger(precision, 0));
};
var TABABLE_SELECTOR = ['button', '[href]:not(.disabled)', 'input', 'select', 'textarea', '[tabindex]', '[contenteditable]'].map(function (s) {
return "".concat(s, ":not(:disabled):not([disabled])");
}).join(', ');
var w$1 = 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
/* istanbul ignore next: JSDOM always returns the first option */
var requestAF = w$1.requestAnimationFrame || w$1.webkitRequestAnimationFrame || w$1.mozRequestAnimationFrame || w$1.msRequestAnimationFrame || w$1.oRequestAnimationFrame || // Fallback, but not a true polyfill
// Only needed for Opera Mini
/* istanbul ignore next */
function (cb) {
return setTimeout(cb, 16);
};
var MutationObs = w$1.MutationObserver || w$1.WebKitMutationObserver || w$1.MozMutationObserver || null; // --- Utils ---
// Remove a node from DOM
var removeNode = function removeNode(el) {
return el && el.parentNode && el.parentNode.removeChild(el);
}; // Determine if an element is an HTML element
var isElement = function isElement(el) {
return !!(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) || !el.parentNode || !contains(d.body, el)) {
// Note this can fail for shadow dom elements since they
// are not a direct descendant of document.body
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 !!(bcr && bcr.height > 0 && bcr.width > 0);
}; // Determine if an element is disabled
var isDisabled = function isDisabled(el) {
return !isElement(el) || el.disabled || hasAttr(el, 'disabled') || hasClass(el, 'disabled');
}; // Cause/wait-for an element to reflow its content (adjusting its 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) {
return isElement(el) ? matchesEl.call(el, selector) : false;
}; // Finds closest element matching selector. Returns `null` if not found
var closest = function closest(selector, root) {
var includeRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (!isElement(root)) {
return null;
}
var el = closestEl.call(root, selector); // Native closest behaviour when `includeRoot` is truthy,
// else emulate jQuery closest and return `null` if match is
// the passed in root element when `includeRoot` is falsey
return includeRoot ? el : el === root ? null : el;
}; // Returns true if the parent element contains the child element
var contains = function contains(parent, child) {
return parent && isFunction(parent.contains) ? parent.contains(child) : false;
}; // 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