bootstrap-vue
Version:
Quickly integrate Bootstrap 4 components with Vue.js
1,717 lines (1,462 loc) • 484 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global['bootstrap-vue'] = factory());
}(this, (function () { 'use strict';
/**
* Register and event to listen on specified element once.
* @param {Element} element to listen on
* @param {String} event to listen for
* @param {Function} callback when event fires
*/
// Production steps of ECMA-262, Edition 6, 22.1.2.1
// es6-ified by @alexsasharegan
if (!Array.from) {
Array.from = function () {
var toStr = Object.prototype.toString;
var isCallable = function isCallable(fn) {
return typeof fn === "function" || toStr.call(fn) === "[object Function]";
};
var toInteger = function toInteger(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function toLength(value) {
return Math.min(Math.max(toInteger(value), 0), maxSafeInteger);
};
// The length property of the from method is 1.
return function from(arrayLike /*, mapFn, thisArg */) {
// 1. Let C be the this value.
var C = this;
// 2. Let items be ToObject(arrayLike).
var items = Object(arrayLike);
// 3. ReturnIfAbrupt(items).
if (arrayLike == null) {
throw new TypeError("Array.from requires an array-like object - not null or undefined");
}
// 4. If mapfn is undefined, then let mapping be false.
var mapFn = arguments.length > 1 ? arguments[1] : void undefined;
var T = void 0;
if (typeof mapFn !== "undefined") {
// 5. else
// 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
if (!isCallable(mapFn)) {
throw new TypeError("Array.from: when provided, the second argument must be a function");
}
// 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
if (arguments.length > 2) {
T = arguments[2];
}
}
// 10. Let lenValue be Get(items, "length").
// 11. Let len be ToLength(lenValue).
var len = toLength(items.length);
// 13. If IsConstructor(C) is true, then
// 13. a. Let A be the result of calling the [[Construct]] internal method
// of C with an argument list containing the single item len.
// 14. a. Else, Let A be ArrayCreate(len).
var A = isCallable(C) ? Object(new C(len)) : new Array(len);
// 16. Let k be 0.
var k = 0;
// 17. Repeat, while k < len… (also steps a - h)
var kValue = void 0;
while (k < len) {
kValue = items[k];
if (mapFn) {
A[k] = typeof T === "undefined" ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k += 1;
}
// 18. Let putStatus be Put(A, "length", len, true).
A.length = len;
// 20. Return A.
return A;
};
}();
}
// https://tc39.github.io/ecma262/#sec-array.prototype.find
// Needed for IE support
if (!Array.prototype.find) {
Object.defineProperty(Array.prototype, 'find', {
value: function value(predicate) {
// 1. Let O be ? ToObject(this value).
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
// 2. Let len be ? ToLength(? Get(O, "length")).
var len = o.length >>> 0;
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
var thisArg = arguments[1];
// 5. Let k be 0.
var k = 0;
// 6. Repeat, while k < len
while (k < len) {
// a. Let Pk be ! ToString(k).
// b. Let kValue be ? Get(O, Pk).
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
// d. If testResult is true, return kValue.
var kValue = o[k];
if (predicate.call(thisArg, kValue, k, o)) {
return kValue;
}
// e. Increase k by 1.
k++;
}
// 7. Return undefined.
return undefined;
}
});
}
if (!Array.isArray) {
Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) === "[object Array]";
};
}
// Static
var from = Array.from;
var isArray = Array.isArray;
// Instance
var arrayIncludes = function arrayIncludes(array, value) {
return array.indexOf(value) !== -1;
};
function concat() {
return Array.prototype.concat.apply([], arguments);
}
/**
* Aliasing Object[method] allows the minifier to shorten methods to a single character variable,
* as well as giving BV a chance to inject polyfills.
* As long as we avoid
* - import * as Object from "utils/object"
* all unused exports should be removed by tree-shaking.
*/
// @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
if (typeof Object.assign != "function") {
Object.assign = function (target, varArgs) {
// .length of function is 2
if (target == null) {
// TypeError if undefined or null
throw new TypeError("Cannot convert undefined or null to object");
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) {
// Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
};
}
// @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#Polyfill
if (!Object.is) {
Object.is = function (x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
};
}
var assign = Object.assign;
var keys = Object.keys;
var defineProperties = Object.defineProperties;
var defineProperty = Object.defineProperty;
var create = Object.create;
function readonlyDescriptor() {
return { enumerable: true, configurable: false, writable: false };
}
// 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) {
return isElement(el) && document.body.contains(el) && el.getBoundingClientRect().height > 0 && el.getBoundingClientRect().width > 0;
};
// Determine if an element is disabled
var isDisabled = function isDisabled(el) {
return !isElement(el) || el.disabled || el.classList.contains('disabled') || Boolean(el.getAttribute('disabled'));
};
// Cause/wait-for an element to reflow it's content (adjusting it's height/width)
var reflow = function reflow(el) {
// requsting an elements offsetHight will trigger a reflow of the element content
return isElement(el) && el.offsetHeight;
};
// Select all elements matching selector. Returns [] if none found
var selectAll = function selectAll(selector, root) {
if (!isElement(root)) {
root = document;
}
return from(root.querySelectorAll(selector));
};
// Select a single element, returns null if not found
var select = function select(selector, root) {
if (!isElement(root)) {
root = document;
}
return root.querySelector(selector) || null;
};
// Determine if an element matches a selector
var matches = function matches(el, selector) {
if (!isElement(el)) {
return false;
}
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
// Prefer native implementations over polyfill function
var proto = Element.prototype;
var Matches = proto.matches || proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector || function (sel) {
var element = this;
var m = selectAll(sel, element.document || element.ownerDocument);
var i = m.length;
// eslint-disable-next-line no-empty
while (--i >= 0 && m.item(i) !== element) {}
return i > -1;
};
return Matches.call(el, selector);
};
// Finds closest element matching selector. Returns null if not found
var closest = function closest(selector, root) {
if (!isElement(root)) {
return null;
}
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
// Since we dont support IE < 10, we can use the "Matches" version of the polyfill for speed
// Prefer native implementation over polyfill function
var Closest = Element.prototype.closest || function (sel) {
var element = this;
if (!document.documentElement.contains(element)) {
return null;
}
do {
// Use our "patched" matches function
if (matches(element, sel)) {
return element;
}
element = element.parentElement;
} while (element !== null);
return null;
};
var el = Closest.call(root, selector);
// Emulate jQuery closest and return null if match is the passed in element (root)
return el === root ? null : el;
};
// Get an element given an ID
var getById = function getById(id) {
return document.getElementById(/^#/.test(id) ? id.slice(1) : id) || null;
};
// Add a class to an element
var addClass = function addClass(el, className) {
if (className && isElement(el)) {
el.classList.add(className);
}
};
// Remove a class from an element
var removeClass = function removeClass(el, className) {
if (className && isElement(el)) {
el.classList.remove(className);
}
};
// Test if an element has a class
var hasClass = function hasClass(el, className) {
if (className && isElement(el)) {
return el.classList.contains(className);
}
return false;
};
// Set an attribute on an element
var setAttr = function setAttr(el, attr, value) {
if (attr && isElement(el)) {
el.setAttribute(attr, value);
}
};
// 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) {
if (attr && isElement(el)) {
return el.getAttribute(attr);
}
return 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) {
if (attr && isElement(el)) {
return el.hasAttribute(attr);
}
return null;
};
// Return the Bounding Client Rec of an element. Retruns null if not an element
var getBCR = function getBCR(el) {
return isElement(el) ? el.getBoundingClientRect() : null;
};
// Get computed style object for an element
var getCS = function getCS(el) {
return isElement(el) ? window.getComputedStyle(el) : {};
};
// Return an element's offset wrt document element
// https://j11y.io/jquery/#v=git&fn=jQuery.fn.offset
var offset = function offset(el) {
if (isElement(el)) {
if (!el.getClientRects().length) {
return { top: 0, left: 0 };
}
var bcr = getBCR(el);
var win = el.ownerDocument.defaultView;
return {
top: bcr.top + win.pageYOffset,
left: bcr.left + win.pageXOffset
};
}
};
// Return an element's offset wrt to it's offsetParent
// https://j11y.io/jquery/#v=git&fn=jQuery.fn.position
var position = function position(el) {
if (!isElement(el)) {
return;
}
var parentOffset = { top: 0, left: 0 };
var offsetSelf = void 0;
var offsetParent = void 0;
if (getCS(el).position === 'fixed') {
offsetSelf = getBCR(el);
} else {
offsetSelf = offset(el);
var doc = el.ownerDocument;
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);
parentOffset.top += parseFloat(getCS(offsetParent).borderTopWidth);
parentOffset.left += parseFloat(getCS(offsetParent).borderLeftWidth);
}
}
return {
top: offsetSelf.top - parentOffset.top - parseFloat(getCS(el).marginTop),
left: offsetSelf.left - parentOffset.left - parseFloat(getCS(el).marginLeft)
};
};
// Attach an event listener to an element
var eventOn = function eventOn(el, evtName, handler) {
if (el && el.addEventListener) {
el.addEventListener(evtName, handler);
}
};
// Remove an event listener from an element
var eventOff = function eventOff(el, evtName, handler) {
if (el && el.removeEventListener) {
el.removeEventListener(evtName, handler);
}
};
function identity(x) {
return x;
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}
function AsyncGenerator(gen) {
var front, back;
function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}
function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;
if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
}
} catch (err) {
settle("throw", err);
}
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({
value: value,
done: false
});
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}
this._invoke = send;
if (typeof gen.return !== "function") {
this.return = undefined;
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};
return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
}
};
}();
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = 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);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var defineProperty$1 = function (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;
};
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
}
};
/**
* @param {[]|{}} props
* @param {Function} transformFn
*/
function copyProps(props) {
var transformFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : identity;
if (isArray(props)) {
return props.map(transformFn);
}
// Props as an object.
var copied = {};
for (var prop in props) {
if (props.hasOwnProperty(prop)) {
if ((typeof prop === "undefined" ? "undefined" : _typeof(prop)) === "object") {
copied[transformFn(prop)] = assign({}, props[prop]);
} else {
copied[transformFn(prop)] = props[prop];
}
}
}
return copied;
}
/**
* @param {string} str
*/
function lowerFirst(str) {
if (typeof str !== "string") {
str = String(str);
}
return str.charAt(0).toLowerCase() + str.slice(1);
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*/
function isObject(obj) {
return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
}
/**
* Check if two values are loosely equal - that is,
* if they are plain objects, do they have the same shape?
* Returns boolean true or false
*/
function looseEqual(a, b) {
if (a === b) return true;
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
var isArrayA = isArray(a);
var isArrayB = isArray(b);
if (isArrayA && isArrayB) {
return a.length === b.length && a.every(function (e, i) {
return looseEqual(e, b[i]);
});
} else if (!isArrayA && !isArrayB) {
var keysA = keys(a);
var keysB = keys(b);
return keysA.length === keysB.length && keysA.every(function (key) {
return looseEqual(a[key], b[key]);
});
} else {
return false;
}
} catch (e) {
return false;
}
} else if (!isObjectA && !isObjectB) {
return String(a) === String(b);
} else {
return false;
}
}
"use strict";
function concat$1() {
return Array.prototype.concat.apply([], arguments);
}function mergeData() {
for (var e = __assign({}, arguments[0]), a = 1; a < arguments.length; a++) {
for (var s = 0, t = keys$1(arguments[a]); s < t.length; s++) {
var c = t[s];if (void 0 !== e[c]) switch (c) {case "class":case "style":case "directives":
e[c] = concat$1(e[c], arguments[a][c]);break;case "staticClass":
e[c] && (e[c] = e[c].trim() + " "), e[c] += arguments[a][c].trim();break;case "on":case "nativeOn":
for (var r = 0, o = keys$1(arguments[a][c]); r < o.length; r++) {
var n = o[r];e[c][n] ? e[c][n] = concat$1(arguments[a][c][n], e[c][n]) : e[c][n] = arguments[a][c][n];
}break;case "attrs":case "props":case "domProps":case "scopedSlots":case "staticStyle":case "hook":case "transition":
e[c] = __assign({}, e[c], arguments[a][c]);break;case "slot":case "key":case "ref":case "tag":case "show":case "keepAlive":default:
e[c] = arguments[a][c];} else e[c] = arguments[a][c];
}
}return e;
}var __assign = Object.assign || function (e) {
for (var a, s = 1, t = arguments.length; s < t; s++) {
a = arguments[s];for (var c in a) {
Object.prototype.hasOwnProperty.call(a, c) && (e[c] = a[c]);
}
}return e;
};
var keys$1 = Object.keys;var lib_common = mergeData;
function memoize(fn) {
var cache = create(null);
return function memoizedFn() {
var args = JSON.stringify(arguments);
return cache[args] = cache[args] || fn.apply(null, arguments);
};
}
/**
* Observe a DOM element changes, falls back to eventListener mode
* @param {Element} el The DOM element to observe
* @param {Function} callback callback to be called on change
* @param {object} [opts={childList: true, subtree: true}] observe options
* @see http://stackoverflow.com/questions/3219758
*/
function observeDOM(el, callback, opts) {
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
var eventListenerSupported = window.addEventListener;
// Handle case where we might be passed a vue instance
el = el ? el.$el || el : null;
if (!isElement(el)) {
// We can't observe somthing that isn't an element
return null;
}
var obs = null;
if (MutationObserver) {
// Define a new observer
obs = new MutationObserver(function (mutations) {
var changed = false;
// A Mutation can contain several change records, so we loop through them to see what has changed.
// We break out of the loop early if any "significant" change has been detected
for (var i = 0; i < mutations.length && !changed; i++) {
// The muttion record
var mutation = mutations[i];
// Mutation Type
var type = mutation.type;
// DOM Node (could be any DOM Node type - HTMLElement, Text, comment, etc)
var target = mutation.target;
if (type === 'characterData' && target.nodeType === Node.TEXT_NODE) {
// We ignore nodes that are not TEXt (i.e. comments, etc) as they don't change layout
changed = true;
} else if (type === 'attributes') {
changed = true;
} else if (type === 'childList' && (mutation.addedNodes.length > 0 || mutation.removedNodes.length > 0)) {
// This includes HTMLElement and Text Nodes being added/removed/re-arranged
changed = true;
}
}
if (changed) {
// We only call the callback if a change that could affect layout/size truely happened.
callback();
}
});
// Have the observer observe foo for changes in children, etc
obs.observe(el, assign({ childList: true, subtree: true }, opts));
} else if (eventListenerSupported) {
// Legacy interface. most likely not used in modern browsers
el.addEventListener('DOMNodeInserted', callback, false);
el.addEventListener('DOMNodeRemoved', callback, false);
}
// We return a reference to the observer so that obs.disconnect() can be called if necessary
// To reduce overhead when the root element is hiiden
return obs;
}
/**
* Given an array of properties or an object of property keys,
* plucks all the values off the target object.
* @param {{}|string[]} keysToPluck
* @param {{}} objToPluck
* @param {Function} transformFn
* @return {{}}
*/
function pluckProps(keysToPluck, objToPluck) {
var transformFn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : identity;
return (isArray(keysToPluck) ? keysToPluck.slice() : keys(keysToPluck)).reduce(function (memo, prop) {
return memo[transformFn(prop)] = objToPluck[prop], memo;
}, {});
}
/**
* @param {string} str
*/
function upperFirst(str) {
if (typeof str !== "string") {
str = String(str);
}
return str.charAt(0).toUpperCase() + str.slice(1);
}
/**
* @param {string} prefix
* @param {string} value
*/
function prefixPropName(prefix, value) {
return prefix + upperFirst(value);
}
/**
* Register a component plugin as being loaded. returns true if compoent plugin already registered
* @param {object} Vue
* @param {string} Component name
* @param {object} Component definition
*/
function registerComponent(Vue, name, def) {
Vue._bootstrap_vue_components_ = Vue._bootstrap_vue_components_ || {};
var loaded = Vue._bootstrap_vue_components_[name];
if (!loaded && def && name) {
Vue._bootstrap_vue_components_[name] = true;
Vue.component(name, def);
}
return loaded;
}
/**
* Register a group of components as being loaded.
* @param {object} Vue
* @param {object} Object of component definitions
*/
function registerComponents(Vue, components) {
for (var component in components) {
registerComponent(Vue, component, components[component]);
}
}
/**
* Register a directive as being loaded. returns true if directive plugin already registered
* @param {object} Vue
* @param {string} Directive name
* @param {object} Directive definition
*/
function registerDirective(Vue, name, def) {
Vue._bootstrap_vue_directives_ = Vue._bootstrap_vue_directives_ || {};
var loaded = Vue._bootstrap_vue_directives_[name];
if (!loaded && def && name) {
Vue._bootstrap_vue_directives_[name] = true;
Vue.directive(name, def);
}
return loaded;
}
/**
* Register a group of directives as being loaded.
* @param {object} Vue
* @param {object} Object of directive definitions
*/
function registerDirectives(Vue, directives) {
for (var directive in directives) {
registerDirective(Vue, directive, directives[directive]);
}
}
/**
* Install plugin if window.Vue available
* @param {object} Plugin definition
*/
function vueUse(VuePlugin) {
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(VuePlugin);
}
}
/**
* Suffix can be a falsey value so nothing is appended to string.
* (helps when looping over props & some shouldn't change)
* Use data last parameters to allow for currying.
* @param {string} suffix
* @param {string} str
*/
function suffixPropName(suffix, str) {
return str + (suffix ? upperFirst(suffix) : "");
}
/**
* @param {string} prefix
* @param {string} value
*/
function unPrefixPropName(prefix, value) {
return lowerFirst(value.replace(prefix, ""));
}
/**
* Log a warning message to the console with bootstrap-vue formatting sugar.
* @param {string} message
*/
function warn(message) {
console.warn("[Bootstrap-Vue warn]: " + message);
}
var props = {
disabled: {
type: Boolean,
default: false
},
ariaLabel: {
type: String,
default: "Close"
},
textVariant: {
type: String,
default: null
}
};
var bBtnClose = {
functional: true,
props: props,
render: function render(h, _ref) {
var props = _ref.props,
data = _ref.data,
listeners = _ref.listeners,
children = _ref.children;
var componentData = {
staticClass: "close",
class: defineProperty$1({}, "text-" + props.textVariant, props.textVariant),
attrs: {
type: "button",
disabled: props.disabled,
"aria-label": props.ariaLabel ? String(props.ariaLabel) : null
},
on: {
click: function click(e) {
// Ensure click on button HTML content is also disabled
if (props.disabled && e instanceof Event) {
e.stopPropagation();
e.preventDefault();
}
}
}
};
// Careful not to override the slot with innerHTML
if (!children.length) {
componentData.domProps = { innerHTML: "×" };
}
return h("button", lib_common(data, componentData), children);
}
};
var bAlert$1 = { render: function render() {
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _vm.localShow ? _c('div', { class: _vm.classObject, attrs: { "role": "alert", "aria-live": "polite", "aria-atomic": "true" } }, [_vm.dismissible ? _c('b-btn-close', { attrs: { "aria-label": _vm.dismissLabel }, on: { "click": _vm.dismiss } }, [_vm._t("dismiss")], 2) : _vm._e(), _vm._v(" "), _vm._t("default")], 2) : _vm._e();
}, staticRenderFns: [],
components: { bBtnClose: bBtnClose },
model: {
prop: 'show',
event: 'input'
},
data: function data() {
return {
countDownTimerId: null,
dismissed: false
};
},
computed: {
classObject: function classObject() {
return ['alert', this.alertVariant, this.dismissible ? 'alert-dismissible' : ''];
},
alertVariant: function alertVariant() {
var variant = this.variant;
return 'alert-' + variant;
},
localShow: function localShow() {
return !this.dismissed && (this.countDownTimerId || this.show);
}
},
props: {
variant: {
type: String,
default: 'info'
},
dismissible: {
type: Boolean,
default: false
},
dismissLabel: {
type: String,
default: 'Close'
},
show: {
type: [Boolean, Number],
default: false
}
},
watch: {
show: function show() {
this.showChanged();
}
},
mounted: function mounted() {
this.showChanged();
},
destroyed: function destroyed() {
this.clearCounter();
},
methods: {
dismiss: function dismiss() {
this.clearCounter();
this.dismissed = true;
this.$emit('dismissed');
this.$emit('input', false);
if (typeof this.show === 'number') {
this.$emit('dismiss-count-down', 0);
this.$emit('input', 0);
} else {
this.$emit('input', false);
}
},
clearCounter: function clearCounter() {
if (this.countDownTimerId) {
clearInterval(this.countDownTimerId);
this.countDownTimerId = null;
}
},
showChanged: function showChanged() {
var _this = this;
// Reset counter status
this.clearCounter();
// Reset dismiss status
this.dismissed = false;
// No timer for boolean values
if (this.show === true || this.show === false || this.show === null || this.show === 0) {
return;
}
// Start counter
var dismissCountDown = this.show;
this.countDownTimerId = setInterval(function () {
if (dismissCountDown < 1) {
_this.dismiss();
return;
}
dismissCountDown--;
_this.$emit('dismiss-count-down', dismissCountDown);
_this.$emit('input', dismissCountDown);
}, 1000);
}
}
};
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
var components$1 = {
bAlert: bAlert$1
};
var VuePlugin$2 = {
install: function install(Vue) {
registerComponents(Vue, components$1);
}
};
vueUse(VuePlugin$2);
/**
* The Link component is used in many other BV components.
* As such, sharing its props makes supporting all its features easier.
* However, some components need to modify the defaults for their own purpose.
* Prefer sharing a fresh copy of the props to ensure mutations
* do not affect other component references to the props.
*
* https://github.com/vuejs/vue-router/blob/dev/src/components/link.js
* @return {{}}
*/
function propsFactory() {
return {
href: {
type: String,
default: null
},
rel: {
type: String,
default: null
},
target: {
type: String,
default: "_self"
},
active: {
type: Boolean,
default: false
},
activeClass: {
type: String,
default: "active"
},
append: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
event: {
type: [String, Array],
default: "click"
},
exact: {
type: Boolean,
default: false
},
exactActiveClass: {
type: String,
default: "active"
},
replace: {
type: Boolean,
default: false
},
routerTag: {
type: String,
default: "a"
},
to: {
type: [String, Object],
default: null
}
};
}
var props$2 = propsFactory();
function pickLinkProps(propsToPick) {
var freshLinkProps = propsFactory();
// Normalize everything to array.
propsToPick = concat(propsToPick);
return keys(freshLinkProps).reduce(function (memo, prop) {
if (arrayIncludes(propsToPick, prop)) {
memo[prop] = freshLinkProps[prop];
}
return memo;
}, {});
}
function computeTag(props, parent) {
return Boolean(parent.$router) && props.to && !props.disabled ? "router-link" : "a";
}
function computeHref(_ref, tag) {
var disabled = _ref.disabled,
href = _ref.href,
to = _ref.to;
// We've already checked the parent.$router in computeTag,
// so router-link means live router.
// When deferring to Vue Router's router-link,
// don't use the href attr at all.
// Must return undefined for router-link to populate href.
if (tag === "router-link") return void 0;
// If href explicitly provided
if (href) return href;
// Reconstruct href when `to` used, but no router
if (to) {
// Fallback to `to` prop (if `to` is a string)
if (typeof to === "string") return to;
// Fallback to `to.path` prop (if `to` is an object)
if ((typeof to === "undefined" ? "undefined" : _typeof(to)) === "object" && typeof to.path === "string") return to.path;
}
// If nothing is provided use '#'
return "#";
}
function computeRel(_ref2) {
var target = _ref2.target,
rel = _ref2.rel;
if (target === "_blank" && rel === null) {
return "noopener";
}
return rel || null;
}
function clickHandlerFactory(_ref3) {
var disabled = _ref3.disabled,
tag = _ref3.tag,
href = _ref3.href,
suppliedHandler = _ref3.suppliedHandler,
parent = _ref3.parent;
var isRouterLink = tag === "router-link";
return function onClick(e) {
if (disabled && e instanceof Event) {
// Stop event from bubbling up.
e.stopPropagation();
// Kill the event loop attached to this specific EventTarget.
e.stopImmediatePropagation();
} else {
parent.$root.$emit("clicked::link", e);
if (isRouterLink && e.target.__vue__) {
e.target.__vue__.$emit("click", e);
}
if (typeof suppliedHandler === "function") {
suppliedHandler.apply(undefined, arguments);
}
}
if (!isRouterLink && href === "#" || disabled) {
// Stop scroll-to-top behavior or navigation.
e.preventDefault();
}
};
}
var bLink = {
functional: true,
props: propsFactory(),
render: function render(h, _ref4) {
var props = _ref4.props,
data = _ref4.data,
parent = _ref4.parent,
children = _ref4.children;
var tag = computeTag(props, parent),
rel = computeRel(props),
href = computeHref(props, tag),
eventType = tag === "router-link" ? "nativeOn" : "on",
suppliedHandler = (data[eventType] || {}).click,
handlers = { click: clickHandlerFactory({ tag: tag, href: href, disabled: props.disabled, suppliedHandler: suppliedHandler, parent: parent }) };
var componentData = lib_common(data, {
class: [props.active ? props.exact ? props.exactActiveClass : props.activeClass : null, { disabled: props.disabled }],
attrs: {
rel: rel,
href: href,
target: props.target,
"aria-disabled": tag === "a" && props.disabled ? "true" : null
},
props: assign(props, { tag: props.routerTag })
});
// If href prop exists on router-link (even undefined or null) it fails working on SSR
if (!componentData.attrs.href) {
delete componentData.attrs.href;
}
// We want to overwrite any click handler since our callback
// will invoke the supplied handler if !props.disabled
componentData[eventType] = assign(componentData[eventType] || {}, handlers);
return h(tag, componentData, children);
}
};
var linkProps = propsFactory();
delete linkProps.href.default;
delete linkProps.to.default;
var props$1 = assign(linkProps, {
tag: {
type: String,
default: "span"
},
variant: {
type: String,
default: "secondary"
},
pill: {
type: Boolean,
default: false
}
});
var bBadge = {
functional: true,
props: props$1,
render: function render(h, _ref) {
var props = _ref.props,
data = _ref.data,
children = _ref.children;
var tag = !props.href && !props.to ? props.tag : bLink;
var componentData = {
staticClass: "badge",
class: [!props.variant ? "badge-secondary" : "badge-" + props.variant, {
"badge-pill": Boolean(props.pill),
active: props.active,
disabled: props.disabled
}],
props: pluckProps(linkProps, props)
};
return h(tag, lib_common(data, componentData), children);
}
};
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
var components$2 = {
bBadge: bBadge
};
var VuePlugin$4 = {
install: function install(Vue) {
registerComponents(Vue, components$2);
}
};
vueUse(VuePlugin$4);
var props$5 = assign(propsFactory(), {
text: {
type: String,
default: null
},
active: {
type: Boolean,
default: false
},
href: {
type: String,
default: "#"
},
ariaCurrent: {
type: String,
default: "location"
}
});
var BreadcrumbLink = {
functional: true,
props: props$5,
render: function render(h, _ref) {
var suppliedProps = _ref.props,
data = _ref.data,
children = _ref.children;
var tag = suppliedProps.active ? "span" : bLink;
var componentData = {
props: pluckProps(props$5, suppliedProps),
domProps: { innerHTML: suppliedProps.text }
};
if (suppliedProps.active) {
componentData.attrs = { "aria-current": suppliedProps.ariaCurrent };
} else {
componentData.attrs = { href: suppliedProps.href };
}
return h(tag, lib_common(data, componentData), children);
}
};
var props$4 = assign({}, props$5, {
text: {
type: String,
default: null
},
href: {
type: String,
default: null
}
});
var BreadcrumbItem = {
functional: true,
props: props$4,
render: function render(h, _ref) {
var props$$1 = _ref.props,
data = _ref.data,
children = _ref.children;
return h("li", lib_common(data, {
staticClass: "breadcrumb-item",
class: { active: props$$1.active },
attrs: { role: "presentation" }
}), [h(BreadcrumbLink, { props: props$$1 }, children)]);
}
};
var props$3 = {
items: {
type: Array,
default: null
}
};
var bBreadcrumb = {
functional: true,
props: props$3,
render: function render(h, _ref) {
var props = _ref.props,
data = _ref.data,
children = _ref.children;
var childNodes = children;
// Build child nodes from items if given.
if (isArray(props.items)) {
var activeDefined = false;
childNodes = props.items.map(function (item, idx) {
if ((typeof item === "undefined" ? "undefined" : _typeof(item)) !== "object") {
item = { text: item };
}
// Copy the value here so we can normalize it.
var active = item.active;
if (active) {
activeDefined = true;
}
if (!active && !activeDefined) {
// Auto-detect active by position in list.
active = idx + 1 === props.items.length;
}
return h(BreadcrumbItem, { props: assign({}, item, { active: active }) });
});
}
return h("ol", lib_common(data, { staticClass: "breadcrumb" }), childNodes);
}
};
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
var components$3 = {
bBreadcrumb: bBreadcrumb,
bBreadcrumbItem: BreadcrumbItem,
bBreadcrumbLink: BreadcrumbLink
};
var VuePlugin$6 = {
install: function install(Vue) {
registerComponents(Vue, components$3);
}
};
vueUse(VuePlugin$6);
var btnProps = {
block: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
size: {
type: String,
default: null,
validator: function validator(size) {
return arrayIncludes(["sm", "", "lg"], size);
}
},
variant: {
type: String,
default: null
},
type: {
type: String,
default: "button"
},
pressed: {
// tri-state prop: true, false or null
// => on, off, not a toggle
type: Boolean,
default: null
}
};
var linkProps$1 = propsFactory();
delete linkProps$1.href.default;
delete linkProps$1.to.default;
var linkPropKeys = keys(linkProps$1);
var props$6 = assign(linkProps$1, btnProps);
function handleFocus(evt) {
if (evt.type === "focusin") {
addClass(evt.target, "focus");
} else if (evt.type === "focusout") {
removeClass(evt.target, "focus");
}
}
var bBtn = {
functional: true,
props: props$6,
render: function render(h, _ref) {
var _ref2;
var props = _ref.props,
data = _ref.data,
listeners = _ref.listeners,
children = _ref.children;
var isLink = Boolean(props.href || props.to);
var isToggle = typeof props.pressed === "boolean";
var on = {
click: function click(e) {
if (props.disabled && e instanceof Event) {
e.stopPropagation();
e.preventDefault();
} else if (isToggle) {
// Concat will normalize the value to an array
// without double wrapping an array value in an array.
concat(listeners["update:pressed"]).forEach(function (fn) {
if (typeof fn === "function") {
fn(!props.pressed);
}
});
}
}
};
if (isToggle) {
on.focusin = handleFocus;
on.focusout = handleFocus;
}
var componentData = {
staticClass: "btn",
class: [props.variant ? "btn-" + props.variant : "btn-secondary", (_ref2 = {}, defineProperty$1(_ref2, "btn-" + props.size, Boolean(props.size)), defineProperty$1(_ref2, "btn-block", props.block), defineProperty$1(_ref2, "disabled", props.disabled), defineProperty$1(_ref2, "active", props.pressed), _ref2)],
props: isLink ? pluckProps(linkPropKeys, props) : null,
attrs: {
type: isLink ? null : props.type,
disabled: isLink ? null : props.disabled,
// Data attribute not used for js logic,
// but only for BS4 style selectors.
"data-toggle": isToggle ? "button" : null,
"aria-pressed": isToggle ? String(props.pressed) : null,
// Tab index is used when the component becomes a link.
// Links are tabable, but don't allow disabled,
// so we mimic that functionality by disabling tabbing.
tabindex: props.disabled && isLink ? "-1" : data.attrs ? data.attrs['tabindex'] : null
},
on: on
};
return h(isLink ? bLink : "button", lib_common(data, componentData), children);
}
};
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
var components$4 = {
bButton: bBtn,
bBtn: bBtn,
bButtonClose: bBtnClose,
bBtnClose: bBtnClose
};
var VuePlugin$8 = {
install: function install(Vue) {
registerComponents(Vue, components$4);
}
};
vueUse(VuePlugin$8);
var props$7 = {
vertical: {
type: Boolean,
default: false
},
size: {
type: String,
default: null,
validator: function validator(size) {
return arrayIncludes(["sm", "", "lg"], size);
}
},
tag: {
type: String,
default: "div"
},
ariaRole: {
type: String,
default: "group"
}
};
var bButtonGroup = {
functional: true,
props: props$7,
render: function render(h, _ref) {
var props = _ref.props,
data = _ref.data,
children = _ref.children;
return h(props.tag, lib_common(data, {
class: defineProperty$1({
"btn-group": !props.vertical,
"btn-group-vertical": props.vertical
}, "btn-group-" + props.size, Boolean(props.size)),
attrs: { "role": props.ariaRole }
}), children);
}
};
/* eslint-disable no-var, no-undef, guard-for-in, object-shorthand */
var components$5 = {
bButtonGroup: bButtonGroup,
bBtnGroup: bButtonGroup
};
var VuePlugin$10 = {
install: function install(Vue) {
registerComponents(Vue, components$5);
}
};
vueUse(VuePlugin$10);
var ITEM_SELECTOR = ['.btn:not(.disabled):not([disabled])', '.form-control:not(.disabled):not([disabled])', 'select:not(.disabled):not([disabled])', 'input[type="checkbox"]:not(.disabled)', 'input[type="radio"]:not(.disabled)'].join(',');
var bButtonToolbar$1 = { render: function render() {
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { class: _vm.classObject, attrs: { "role": "toolbar", "tabindex": _vm.keyNav ? '0' : null }, on: { "focu