first commit

This commit is contained in:
DanielRamirezGe
2020-01-14 20:43:08 -06:00
parent 3557894f7f
commit 5eecfbf6cd
26326 changed files with 2434803 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
// --- Static ---
export var from = Array.from;
export var isArray = Array.isArray; // --- Instance ---
export var arrayIncludes = function arrayIncludes(array, value) {
return array.indexOf(value) !== -1;
};
export 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);
};
+76
View File
@@ -0,0 +1,76 @@
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; }
import { assign, defineProperty, defineProperties, readonlyDescriptor } from './object';
var BvEvent =
/*#__PURE__*/
function () {
function BvEvent(type) {
var eventInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, BvEvent);
// Start by emulating native Event constructor
if (!type) {
/* istanbul ignore next */
throw new TypeError("Failed to construct '".concat(this.constructor.name, "'. 1 argument required, ").concat(arguments.length, " given."));
} // Merge defaults first, the eventInit, and the type last
// so it can't be overwritten
assign(this, BvEvent.Defaults, this.constructor.Defaults, eventInit, {
type: type
}); // Freeze some props as readonly, but leave them enumerable
defineProperties(this, {
type: readonlyDescriptor(),
cancelable: readonlyDescriptor(),
nativeEvent: readonlyDescriptor(),
target: readonlyDescriptor(),
relatedTarget: readonlyDescriptor(),
vueTarget: readonlyDescriptor(),
componentId: readonlyDescriptor()
}); // Create a private variable using closure scoping
var defaultPrevented = false; // Recreate preventDefault method. One way setter
this.preventDefault = function preventDefault() {
if (this.cancelable) {
defaultPrevented = true;
}
}; // Create `defaultPrevented` publicly accessible prop that
// can only be altered by the preventDefault method
defineProperty(this, 'defaultPrevented', {
enumerable: true,
get: function get() {
return defaultPrevented;
}
});
}
_createClass(BvEvent, null, [{
key: "Defaults",
get: function get() {
return {
type: '',
cancelable: true,
nativeEvent: null,
target: null,
relatedTarget: null,
vueTarget: null,
componentId: null
};
}
}]);
return BvEvent;
}(); // Named Exports
export { BvEvent };
+91
View File
@@ -0,0 +1,91 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// Generic Bootstrap v4 fade (no-fade) transition component
//
// Assumes that `show` class is not required when
// the transition has finished the enter transition
// (show and fade classes are only applied during transition)
import Vue from './vue';
import { mergeData } from 'vue-functional-data-merge';
import { isPlainObject } from './inspect';
var NO_FADE_PROPS = {
name: '',
enterClass: '',
enterActiveClass: '',
enterToClass: 'show',
leaveClass: 'show',
leaveActiveClass: '',
leaveToClass: ''
};
var FADE_PROPS = _objectSpread({}, NO_FADE_PROPS, {
enterActiveClass: 'fade',
leaveActiveClass: 'fade'
});
export var BVTransition =
/*#__PURE__*/
Vue.extend({
name: 'BVTransition',
functional: true,
props: {
noFade: {
// Only applicable to the built in transition
// Has no effect if `trans-props` provided
type: Boolean,
default: false
},
appear: {
// Has no effect if `trans-props` provided
type: Boolean,
default: false
},
mode: {
// Can be overridden by user supplied trans-props
type: String // default: undefined
},
// For user supplied transitions (if needed)
transProps: {
type: Object,
default: null
}
},
render: function render(h, _ref) {
var children = _ref.children,
data = _ref.data,
listeners = _ref.listeners,
props = _ref.props;
var transProps = props.transProps;
if (!isPlainObject(transProps)) {
transProps = props.noFade ? NO_FADE_PROPS : FADE_PROPS;
if (props.appear) {
// Default the appear classes to equal the enter classes
transProps = _objectSpread({}, transProps, {
appear: true,
appearClass: transProps.enterClass,
appearActiveClass: transProps.enterActiveClass,
appearToClass: transProps.enterToClass
});
}
}
transProps = _objectSpread({
mode: props.mode
}, transProps, {
// We always need `css` true
css: true
});
return h('transition', // Any transition event listeners will get merged here
mergeData(data, {
props: transProps
}), children);
}
});
export default BVTransition;
+34
View File
@@ -0,0 +1,34 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
import { isArray, isPlainObject } from './inspect';
import { keys } from './object';
export 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 _objectSpread({}, result, _defineProperty({}, key, cloneDeep(obj[key], obj[key])));
}, {});
}
return defaultValue;
};
export default cloneDeep;
+172
View File
@@ -0,0 +1,172 @@
import { deepFreeze } from './object'; // --- General BootstrapVue configuration ---
// 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
// explicity 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
export default deepFreeze({
// Breakpoints
breakpoints: ['xs', 'sm', 'md', 'lg', 'xl'],
// Form controls
formControls: {
size: null
},
// Component specific defaults are keyed by the component
// name (PascalCase) and prop name (camelCase)
BAlert: {
dismissLabel: 'Close',
variant: 'info'
},
BBadge: {
variant: 'secondary'
},
BButton: {
size: null,
variant: 'secondary'
},
BButtonClose: {
// `textVariant` is `null` to inherit the current text color
textVariant: null,
ariaLabel: 'Close'
},
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: null,
variant: 'secondary',
splitVariant: null
},
BFormFile: {
browseText: 'Browse',
// Chrome default file prompt
placeholder: 'No file chosen',
dropPlaceholder: 'Drop files here'
},
BFormText: {
textVariant: 'muted'
},
BImg: {
blankColor: 'transparent'
},
BImgLazy: {
blankColor: 'transparent'
},
BInputGroup: {
size: null
},
BJumbotron: {
bgVariant: null,
borderVariant: null,
textVariant: null
},
BListGroupItem: {
variant: null
},
BModal: {
titleTag: 'h5',
size: 'md',
headerBgVariant: null,
headerBorderVariant: null,
headerTextVariant: null,
headerCloseVariant: null,
bodyBgVariant: null,
bodyTextVariant: null,
footerBgVariant: null,
footerBorderVariant: null,
footerTextVariant: null,
cancelTitle: 'Cancel',
cancelVariant: 'secondary',
okTitle: 'OK',
okVariant: 'primary',
headerCloseLabel: 'Close'
},
BNavbar: {
variant: null
},
BNavbarToggle: {
label: 'Toggle navigation'
},
BPagination: {
size: null
},
BPaginationNav: {
size: null
},
BPopover: {
boundary: 'scrollParent',
boundaryPadding: 5,
customClass: null,
delay: 50,
variant: null
},
BProgress: {
variant: null
},
BProgressBar: {
variant: null
},
BSpinner: {
variant: null
},
BTable: {
selectedVariant: 'active',
headVariant: null,
footVariant: null
},
BToast: {
toaster: 'b-toaster-top-right',
autoHideDelay: 5000,
variant: null,
toastClass: null,
headerClass: null,
bodyClass: null
},
BToaster: {
ariaLive: null,
ariaAtomic: null,
role: null
},
BTooltip: {
boundary: 'scrollParent',
boundaryPadding: 5,
customClass: null,
delay: 50,
variant: null
}
});
+144
View File
@@ -0,0 +1,144 @@
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; }
import OurVue from './vue';
import cloneDeep from './clone-deep';
import get from './get';
import warn from './warn';
import { isArray, isPlainObject, isString, isUndefined } from './inspect';
import { getOwnPropertyNames, hasOwnProperty } from './object';
import DEFAULTS from './config-defaults'; // --- Constants ---
var PROP_NAME = '$bvConfig'; // Config manager class
var BvConfig =
/*#__PURE__*/
function () {
function BvConfig() {
_classCallCheck(this, BvConfig);
// TODO: pre-populate with default config values (needs updated tests)
// this.$_config = cloneDeep(DEFAULTS)
this.$_config = {};
this.$_cachedBreakpoints = null;
}
_createClass(BvConfig, [{
key: "getDefaults",
// Returns the defaults
value: function getDefaults()
/* istanbul ignore next */
{
return this.defaults;
} // Method to merge in user config parameters
}, {
key: "setConfig",
value: function setConfig() {
var _this = this;
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (!isPlainObject(config)) {
/* istanbul ignore next */
return;
}
var configKeys = getOwnPropertyNames(config);
configKeys.forEach(function (cmpName) {
/* istanbul ignore next */
if (!hasOwnProperty(DEFAULTS, cmpName)) {
warn("config: unknown config property \"".concat(cmpName, "\""));
return;
}
var cmpConfig = config[cmpName];
if (cmpName === 'breakpoints') {
// Special case for breakpoints
var breakpoints = config.breakpoints;
/* istanbul ignore if */
if (!isArray(breakpoints) || breakpoints.length < 2 || breakpoints.some(function (b) {
return !isString(b) || b.length === 0;
})) {
warn('config: "breakpoints" must be an array of at least 2 breakpoint names');
} else {
_this.$_config.breakpoints = cloneDeep(breakpoints);
}
} else if (isPlainObject(cmpConfig)) {
// Component prop defaults
var props = getOwnPropertyNames(cmpConfig);
props.forEach(function (prop) {
/* istanbul ignore if */
if (!hasOwnProperty(DEFAULTS[cmpName], prop)) {
warn("config: unknown config property \"".concat(cmpName, ".").concat(prop, "\""));
} else {
// TODO: If we pre-populate the config with defaults, we can skip this line
_this.$_config[cmpName] = _this.$_config[cmpName] || {};
if (!isUndefined(cmpConfig[prop])) {
_this.$_config[cmpName][prop] = cloneDeep(cmpConfig[prop]);
}
}
});
}
});
} // Clear the config. For testing purposes only
}, {
key: "resetConfig",
value: function resetConfig() {
this.$_config = {};
} // Returns a deep copy of the user config
}, {
key: "getConfig",
value: function getConfig() {
return cloneDeep(this.$_config);
}
}, {
key: "getConfigValue",
value: function getConfigValue(key) {
// First we try the user config, and if key not found we fall back to default value
// NOTE: If we deep clone DEFAULTS into config, then we can skip the fallback for get
return cloneDeep(get(this.$_config, key, get(DEFAULTS, key)));
}
}, {
key: "defaults",
get: function get()
/* istanbul ignore next */
{
return DEFAULTS;
}
}], [{
key: "Defaults",
get: function get()
/* istanbul ignore next */
{
return DEFAULTS;
}
}]);
return BvConfig;
}(); // Method for applying a global config
export var setConfig = function setConfig() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var Vue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : OurVue;
// 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.prototype[PROP_NAME] = OurVue.prototype[PROP_NAME] = Vue.prototype[PROP_NAME] || OurVue.prototype[PROP_NAME] || new BvConfig(); // Apply the config values
Vue.prototype[PROP_NAME].setConfig(config);
}; // Method for resetting the user config. Exported for testing purposes only.
export var resetConfig = function resetConfig() {
if (OurVue.prototype[PROP_NAME] && OurVue.prototype[PROP_NAME].resetConfig) {
OurVue.prototype[PROP_NAME].resetConfig();
}
};
+78
View File
@@ -0,0 +1,78 @@
import Vue from './vue';
import cloneDeep from './clone-deep';
import get from './get';
import memoize from './memoize';
import DEFAULTS from './config-defaults'; // --- Constants ---
var PROP_NAME = '$bvConfig';
var VueProto = Vue.prototype; // --- Getter methods ---
// All methods return a deep clone (immutable) copy of the config
// value, to prevent mutation of the user config object.
// Get the current user config. For testing purposes only
export var getConfig = function getConfig() {
return VueProto[PROP_NAME] ? VueProto[PROP_NAME].getConfig() : {};
}; // Method to grab a config value based on a dotted/array notation key
export var getConfigValue = function getConfigValue(key) {
return VueProto[PROP_NAME] ? VueProto[PROP_NAME].getConfigValue(key) : cloneDeep(get(DEFAULTS, key));
}; // Method to grab a config value for a particular component
export 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
export 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.
export 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.
export var getBreakpointsUp = function getBreakpointsUp() {
var breakpoints = getBreakpoints();
breakpoints[0] = '';
return breakpoints;
}; // 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.
export var getBreakpointsUpCached = memoize(function () {
var breakpoints = getBreakpointsCached();
breakpoints[0] = '';
return breakpoints;
}); // Convenience method for getting breakpoints with
// the largest breakpoint set as ''.
// Useful for components that create breakpoint specific props.
export var getBreakpointsDown = function getBreakpointsDown() {
var breakpoints = getBreakpoints();
breakpoints[breakpoints.length - 1] = '';
return breakpoints;
}; // Convenience method for getting breakpoints with
// the largest breakpoint set as ''.
// Useful for components that create breakpoint specific props.
// Caches the results after first access.
/* istanbul ignore next: we don't use this method anywhere, yet */
export var getBreakpointsDownCached = function getBreakpointsDownCached()
/* istanbul ignore next */
{
var breakpoints = getBreakpointsCached();
breakpoints[breakpoints.length - 1] = '';
return breakpoints;
};
+36
View File
@@ -0,0 +1,36 @@
import identity from './identity';
import { isArray, isObject } from './inspect';
import { clone } from './object';
/**
* Copies props from one array/object to a new array/object. Prop values
* are also cloned as new references to prevent possible mutation of original
* prop object values. Optionally accepts a function to transform the prop name.
*
* @param {[]|{}} props
* @param {Function} transformFn
*/
var copyProps = 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) {
/* istanbul ignore else */
// eslint-disable-next-line no-prototype-builtins
if (props.hasOwnProperty(prop)) {
// If the prop value is an object, do a shallow clone to prevent
// potential mutations to the original object.
copied[transformFn(prop)] = isObject(props[prop]) ? clone(props[prop]) : props[prop];
}
}
return copied;
};
export default copyProps;
+281
View File
@@ -0,0 +1,281 @@
import { from as arrayFrom } from './array';
import { hasWindowSupport, hasDocumentSupport, hasPassiveEventSupport } from './env';
import { isFunction, isNull, isObject } from '../utils/inspect'; // --- Constants ---
var w = hasWindowSupport ? window : {};
var d = hasDocumentSupport ? document : {};
var elProto = typeof Element !== 'undefined' ? Element.prototype : {}; // --- Normalization utils ---
// See: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
/* istanbul ignore next */
export var matchesEl = elProto.matches || elProto.msMatchesSelector || elProto.webkitMatchesSelector; // See: https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
/* istanbul ignore next */
export 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
export var requestAF = w.requestAnimationFrame || w.webkitRequestAnimationFrame || w.mozRequestAnimationFrame || w.msRequestAnimationFrame || w.oRequestAnimationFrame || // Fallback, but not a true polyfill
// Only needed for Opera Mini
/* istanbul ignore next */
function (cb) {
return setTimeout(cb, 16);
};
export var MutationObs = w.MutationObserver || w.WebKitMutationObserver || w.MozMutationObserver || null; // --- Utils ---
// Normalize event options based on support of passive option
// Exported only for testing purposes
export var parseEventOptions = function parseEventOptions(options) {
/* istanbul ignore else: can't test in JSDOM, as it supports passive */
if (hasPassiveEventSupport) {
return isObject(options) ? options : {
useCapture: Boolean(options || false)
};
} else {
// Need to translate to actual Boolean value
return Boolean(isObject(options) ? options.useCapture : options);
}
}; // Attach an event listener to an element
export var eventOn = function eventOn(el, evtName, handler, options) {
if (el && el.addEventListener) {
el.addEventListener(evtName, handler, parseEventOptions(options));
}
}; // Remove an event listener from an element
export var eventOff = function eventOff(el, evtName, handler, options) {
if (el && el.removeEventListener) {
el.removeEventListener(evtName, handler, parseEventOptions(options));
}
}; // Determine if an element is an HTML Element
export var isElement = function isElement(el) {
return Boolean(el && el.nodeType === Node.ELEMENT_NODE);
}; // Determine if an HTML element is visible - Faster than CSS check
export var isVisible = function isVisible(el) {
if (!isElement(el) || !contains(d.body, el)) {
return false;
}
if (el.style.display === 'none') {
// We do this check to help with vue-test-utils when using v-show
/* istanbul ignore next */
return false;
} // All browsers support getBoundingClientRect(), except JSDOM as it returns all 0's for values :(
// So any tests that need isVisible will fail in JSDOM
// Except when we override the getBCR prototype in some tests
var bcr = getBCR(el);
return Boolean(bcr && bcr.height > 0 && bcr.width > 0);
}; // Determine if an element is disabled
export var isDisabled = function isDisabled(el) {
return !isElement(el) || el.disabled || Boolean(getAttr(el, 'disabled')) || hasClass(el, 'disabled');
}; // Cause/wait-for an element to reflow it's content (adjusting it's height/width)
export 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
export var selectAll = function selectAll(selector, root) {
return arrayFrom((isElement(root) ? root : d).querySelectorAll(selector));
}; // Select a single element, returns `null` if not found
export var select = function select(selector, root) {
return (isElement(root) ? root : d).querySelector(selector) || null;
}; // Determine if an element matches a selector
export var matches = function matches(el, selector) {
if (!isElement(el)) {
return false;
}
return matchesEl.call(el, selector);
}; // Finds closest element matching selector. Returns `null` if not found
export 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
export var contains = function contains(parent, child) {
if (!parent || !isFunction(parent.contains)) {
return false;
}
return parent.contains(child);
}; // Get an element given an ID
export var getById = function getById(id) {
return d.getElementById(/^#/.test(id) ? id.slice(1) : id) || null;
}; // Add a class to an element
export 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
export 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
export 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
export var setAttr = function setAttr(el, attr, val) {
if (attr && isElement(el)) {
el.setAttribute(attr, val);
}
}; // Remove an attribute from an element
export 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
export 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
export var hasAttr = function hasAttr(el, attr) {
return attr && isElement(el) ? el.hasAttribute(attr) : null;
}; // Return the Bounding Client Rect of an element
// Returns `null` if not an element
/* istanbul ignore next: getBoundingClientRect() doesn't work in JSDOM */
export var getBCR = function getBCR(el) {
return isElement(el) ? el.getBoundingClientRect() : null;
}; // Get computed style object for an element
/* istanbul ignore next: getComputedStyle() doesn't work in JSDOM */
export var getCS = function getCS(el) {
return hasWindowSupport && isElement(el) ? w.getComputedStyle(el) : {};
}; // Returns a `Selection` object representing the range of text selected
// Returns `null` if no window support is given
/* istanbul ignore next: getSelection() doesn't work in JSDOM */
export var getSel = function getSel() {
return hasWindowSupport && w.getSelection ? w.getSelection() : null;
}; // Return an element's offset with respect to document element
// https://j11y.io/jquery/#v=git&fn=jQuery.fn.offset
export var offset = function offset(el)
/* istanbul ignore next: getBoundingClientRect(), getClientRects() doesn't work in JSDOM */
{
var _offset = {
top: 0,
left: 0
};
if (!isElement(el) || el.getClientRects().length === 0) {
return _offset;
}
var bcr = getBCR(el);
if (bcr) {
var win = el.ownerDocument.defaultView;
_offset.top = bcr.top + win.pageYOffset;
_offset.left = bcr.left + win.pageXOffset;
}
return _offset;
}; // Return an element's offset with respect to to it's offsetParent
// https://j11y.io/jquery/#v=git&fn=jQuery.fn.position
export var position = function position(el)
/* istanbul ignore next: getBoundingClientRect() doesn't work in JSDOM */
{
var _offset = {
top: 0,
left: 0
};
if (!isElement(el)) {
return _offset;
}
var parentOffset = {
top: 0,
left: 0
};
var elStyles = getCS(el);
if (elStyles.position === 'fixed') {
_offset = getBCR(el) || _offset;
} else {
_offset = offset(el);
var doc = el.ownerDocument;
var offsetParent = el.offsetParent || doc.documentElement;
while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && getCS(offsetParent).position === 'static') {
offsetParent = offsetParent.parentNode;
}
if (offsetParent && offsetParent !== el && offsetParent.nodeType === Node.ELEMENT_NODE) {
parentOffset = offset(offsetParent);
var offsetParentStyles = getCS(offsetParent);
parentOffset.top += parseFloat(offsetParentStyles.borderTopWidth);
parentOffset.left += parseFloat(offsetParentStyles.borderLeftWidth);
}
}
return {
top: _offset.top - parentOffset.top - parseFloat(elStyles.marginTop),
left: _offset.left - parentOffset.left - parseFloat(elStyles.marginLeft)
};
};
+61
View File
@@ -0,0 +1,61 @@
/**
* Utilities to get information about the current environment
*/
// --- Constants ---
export var hasWindowSupport = typeof window !== 'undefined';
export var hasDocumentSupport = typeof document !== 'undefined';
export var hasNavigatorSupport = typeof navigator !== 'undefined';
export var hasPromiseSupport = typeof Promise !== 'undefined';
export var hasMutationObserverSupport = typeof MutationObserver !== 'undefined' || typeof WebKitMutationObserver !== 'undefined' || typeof MozMutationObserver !== 'undefined';
export var isBrowser = hasWindowSupport && hasDocumentSupport && hasNavigatorSupport; // Browser type sniffing
export var userAgent = isBrowser ? window.navigator.userAgent.toLowerCase() : '';
export var isJSDOM = userAgent.indexOf('jsdom') > 0;
export var isIE = /msie|trident/.test(userAgent); // Determine if the browser supports the option passive for events
export 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;
}();
export var hasTouchSupport = isBrowser && ('ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0);
export var hasPointerEventSupport = isBrowser && Boolean(window.PointerEvent || window.MSPointerEvent);
export 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 ---
export 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;
};
export var getNoWarn = function getNoWarn() {
return getEnv('BOOTSTRAP_VUE_NO_WARN');
};
+9
View File
@@ -0,0 +1,9 @@
// This method returns a component's scoped style attribute name: `data-v-xxxxxxx`
// The `_scopeId` options property is added by vue-loader when using scoped styles
// and will be `undefined` if no scoped styles are in use
var getScopeId = function getScopeId(vm) {
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
return vm ? vm.$options._scopeId || defaultValue : defaultValue;
};
export default getScopeId;
+47
View File
@@ -0,0 +1,47 @@
import { isArray, isObject } from './inspect';
/**
* Get property defined by dot/array notation in string.
*
* @link https://gist.github.com/jeneg/9767afdcca45601ea44930ea03e0febf#gistcomment-1935901
*
* @param {Object} obj
* @param {string|Array} path
* @param {*} defaultValue (optional)
* @return {*}
*/
var get = function get(obj, path) {
var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
// Handle array of path values
path = isArray(path) ? path.join('.') : path; // If no path or no object passed
if (!path || !isObject(obj)) {
return defaultValue;
} // Handle edge case where user has dot(s) in top-level item field key
// See https://github.com/bootstrap-vue/bootstrap-vue/issues/2762
// Switched to `in` operator vs `hasOwnProperty` to handle obj.prototype getters
// https://github.com/bootstrap-vue/bootstrap-vue/issues/3463
if (path in obj) {
return obj[path];
} // Handle string array notation (numeric indices only)
path = String(path).replace(/\[(\d+)]/g, '.$1');
var steps = path.split('.').filter(Boolean); // Handle case where someone passes a string of only dots
if (steps.length === 0) {
return defaultValue;
} // Traverse path in object to find result
// We use `!=` vs `!==` to test for both `null` and `undefined`
// Switched to `in` operator vs `hasOwnProperty` to handle obj.prototype getters
// https://github.com/bootstrap-vue/bootstrap-vue/issues/3463
return steps.every(function (step) {
return isObject(obj) && step in obj && (obj = obj[step]) != null;
}) ? obj : defaultValue;
};
export default get;
+14
View File
@@ -0,0 +1,14 @@
var stripTagsRegex = /(<([^>]+)>)/gi; // Removes any thing that looks like an HTML tag from the supplied string
export var stripTags = function stripTags() {
var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return String(text).replace(stripTagsRegex, '');
}; // Generate a domProps object for either innerHTML, textContent or nothing
export var htmlOrText = function htmlOrText(innerHTML, textContent) {
return innerHTML ? {
innerHTML: innerHTML
} : textContent ? {
textContent: textContent
} : {};
};
+5
View File
@@ -0,0 +1,5 @@
var identity = function identity(x) {
return x;
};
export default identity;
+56
View File
@@ -0,0 +1,56 @@
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import { isArray } from './array';
import { isObject, isPlainObject } from './object';
import { File } from './safe-types'; // --- Convenience inspection utilities ---
export var toType = function toType(val) {
return _typeof(val);
};
export var toRawType = function toRawType(val) {
return Object.prototype.toString.call(val).slice(8, -1);
};
export var toRawTypeLC = function toRawTypeLC(val) {
return toRawType(val).toLowerCase();
};
export var isUndefined = function isUndefined(val) {
return val === undefined;
};
export var isNull = function isNull(val) {
return val === null;
};
export var isUndefinedOrNull = function isUndefinedOrNull(val) {
return isUndefined(val) || isNull(val);
};
export var isFunction = function isFunction(val) {
return toType(val) === 'function';
};
export var isBoolean = function isBoolean(val) {
return toType(val) === 'boolean';
};
export var isString = function isString(val) {
return toType(val) === 'string';
};
export var isNumber = function isNumber(val) {
return toType(val) === 'number';
};
export var isPrimitive = function isPrimitive(val) {
return isBoolean(val) || isString(val) || isNumber(val);
};
export var isDate = function isDate(val) {
return val instanceof Date;
};
export var isEvent = function isEvent(val) {
return val instanceof Event;
};
export var isFile = function isFile(val) {
return val instanceof File;
};
export var isRegExp = function isRegExp(val) {
return toRawType(val) === 'RegExp';
};
export var isPromise = function isPromise(val) {
return !isUndefinedOrNull(val) && isFunction(val.then) && isFunction(val.catch);
}; // Extra convenience named re-exports
export { isArray, isObject, isPlainObject };
+27
View File
@@ -0,0 +1,27 @@
/*
* Key Codes (events)
*/
var KEY_CODES = {
SPACE: 32,
ENTER: 13,
ESC: 27,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
PAGEUP: 33,
PAGEDOWN: 34,
HOME: 36,
END: 35,
TAB: 9,
SHIFT: 16,
CTRL: 17,
BACKSPACE: 8,
ALT: 18,
PAUSE: 19,
BREAK: 19,
INSERT: 45,
INS: 45,
DELETE: 46
};
export default KEY_CODES;
+75
View File
@@ -0,0 +1,75 @@
import { keys } from './object';
import { isArray, isDate, isObject } from './inspect'; // Assumes both a and b are arrays!
// Handles when arrays are "sparse" (array.every(...) doesn't handle sparse)
var compareArrays = function compareArrays(a, b) {
if (a.length !== b.length) {
return false;
}
var equal = true;
for (var i = 0; equal && i < a.length; i++) {
equal = looseEqual(a[i], b[i]);
}
return equal;
};
/**
* 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
*/
var looseEqual = function looseEqual(a, b) {
if (a === b) {
return true;
}
var aValidType = isDate(a);
var bValidType = isDate(b);
if (aValidType || bValidType) {
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
}
aValidType = isArray(a);
bValidType = isArray(b);
if (aValidType || bValidType) {
return aValidType && bValidType ? compareArrays(a, b) : false;
}
aValidType = isObject(a);
bValidType = isObject(b);
if (aValidType || bValidType) {
/* istanbul ignore if: this if will probably never be called */
if (!aValidType || !bValidType) {
return false;
}
var aKeysCount = keys(a).length;
var bKeysCount = keys(b).length;
if (aKeysCount !== bKeysCount) {
return false;
}
for (var key in a) {
// eslint-disable-next-line no-prototype-builtins
var aHasKey = a.hasOwnProperty(key); // eslint-disable-next-line no-prototype-builtins
var bHasKey = b.hasOwnProperty(key);
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
return false;
}
}
}
return String(a) === String(b);
};
export default looseEqual;
+14
View File
@@ -0,0 +1,14 @@
import looseEqual from './loose-equal';
var looseIndexOf = function looseIndexOf(arr, val) {
// Assumes that the first argument is an array
for (var i = 0; i < arr.length; i++) {
if (looseEqual(arr[i], val)) {
return i;
}
}
return -1;
};
export default looseIndexOf;
+9
View File
@@ -0,0 +1,9 @@
/**
* @param {string} str
*/
var lowerFirst = function lowerFirst(str) {
str = String(str);
return str.charAt(0).toLowerCase() + str.slice(1);
};
export default lowerFirst;
+15
View File
@@ -0,0 +1,15 @@
import { create } from './object';
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);
};
};
export default memoize;
+3
View File
@@ -0,0 +1,3 @@
var noop = function noop() {};
export default noop;
+57
View File
@@ -0,0 +1,57 @@
import { concat } from './array';
import { isFunction } from './inspect'; // Note for functional components:
// In functional components, `slots` is a function so it must be called
// first before passing to the below methods. `scopedSlots` is always an
// object and may be undefined (for Vue < 2.6.x)
/**
* Returns true if either scoped or unscoped named slot exists
*
* @param {String, Array} name or name[]
* @param {Object} scopedSlots
* @param {Object} slots
* @returns {Array|undefined} VNodes
*/
var hasNormalizedSlot = function hasNormalizedSlot(names) {
var $scopedSlots = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var $slots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
// Ensure names is an array
names = concat(names).filter(Boolean); // Returns true if the either a $scopedSlot or $slot exists with the specified name
return names.some(function (name) {
return $scopedSlots[name] || $slots[name];
});
};
/**
* Returns VNodes for named slot either scoped or unscoped
*
* @param {String, Array} name or name[]
* @param {String} scope
* @param {Object} scopedSlots
* @param {Object} slots
* @returns {Array|undefined} VNodes
*/
var normalizeSlot = function normalizeSlot(names) {
var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var $scopedSlots = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var $slots = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
// Ensure names is an array
names = concat(names).filter(Boolean);
var slot;
for (var i = 0; i < names.length && !slot; i++) {
var name = names[i];
slot = $scopedSlots[name] || $slots[name];
} // Note: in Vue 2.6.x, all named slots are also scoped slots
return isFunction(slot) ? slot(scope) : slot;
}; // Named exports
export { hasNormalizedSlot, normalizeSlot }; // Default export (backwards compatibility)
export default normalizeSlot;
+100
View File
@@ -0,0 +1,100 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import { isArray } from './array'; // --- Static ---
export var assign = Object.assign;
export var getOwnPropertyNames = Object.getOwnPropertyNames;
export var keys = Object.keys;
export var defineProperties = Object.defineProperties;
export var defineProperty = Object.defineProperty;
export var freeze = Object.freeze;
export var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
export var getOwnPropertySymbols = Object.getOwnPropertySymbols;
export var getPrototypeOf = Object.getPrototypeOf;
export var create = Object.create;
export var isFrozen = Object.isFrozen;
export var is = Object.is; // --- "Instance" ---
export var hasOwnProperty = function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
export 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.
*/
export var isObject = function isObject(obj) {
return obj !== null && _typeof(obj) === 'object';
};
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*/
export 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
*/
export var clone = function clone(obj) {
return _objectSpread({}, obj);
};
/**
* Return a shallow copy of object with
* the specified properties omitted
* @link https://gist.github.com/bisubus/2da8af7e801ffd813fab7ac221aa7afc
*/
export var omit = function omit(obj, props) {
return keys(obj).filter(function (key) {
return props.indexOf(key) === -1;
}).reduce(function (result, key) {
return _objectSpread({}, result, _defineProperty({}, key, obj[key]));
}, {});
};
/**
* Convenience method to create a read-only descriptor
*/
export 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
*/
export 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);
};
+79
View File
@@ -0,0 +1,79 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import { MutationObs, isElement } from './dom';
import { warnNoMutationObserverSupport } from './warn';
/**
* 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
*/
var observeDom = function observeDom(el, callback, opts)
/* istanbul ignore next: difficult to test in JSDOM */
{
// Handle cases where we might be passed a Vue instance
el = el ? el.$el || el : null; // Early exit when we have no element
/* istanbul ignore next: difficult to test in JSDOM */
if (!isElement(el)) {
return null;
} // Exit and throw a warning when `MutationObserver` isn't available
if (warnNoMutationObserverSupport('observeDom')) {
return null;
} // Define a new observer
var obs = new MutationObs(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 mutation 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; // Detect whether a change happened based on type and 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;
}
} // We only call the callback if a change that could affect
// layout/size truely happened
if (changed) {
callback();
}
}); // Have the observer observe foo for changes in children, etc
obs.observe(el, _objectSpread({
childList: true,
subtree: true
}, opts)); // We return a reference to the observer so that `obs.disconnect()`
// can be called if necessary
// To reduce overhead when the root element is hidden
return obs;
};
export default observeDom;
+23
View File
@@ -0,0 +1,23 @@
import identity from './identity';
import { isArray } from './inspect';
import { keys } from './object';
/**
* Given an array of properties or an object of property keys,
* plucks all the values off the target object, returning a new object
* that has props that reference the original prop values
*
* @param {{}|string[]} keysToPluck
* @param {{}} objToPluck
* @param {Function} transformFn
* @return {{}}
*/
var pluckProps = 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) {
memo[transformFn(prop)] = objToPluck[prop];
return memo;
}, {});
};
export default pluckProps;
+155
View File
@@ -0,0 +1,155 @@
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import OurVue from './vue';
import warn from './warn';
import { setConfig } from './config-set';
import { hasWindowSupport, isJSDOM } from './env';
/**
* Checks if there are multiple instances of Vue, and warns (once) about possible issues.
* @param {object} Vue
*/
export var checkMultipleVue = function () {
var checkMultipleVueWarned = false;
var MULTIPLE_VUE_WARNING = ['Multiple instances of Vue detected!', 'You may need to set up an alias for Vue in your bundler config.', 'See: https://bootstrap-vue.js.org/docs#using-module-bundlers'].join('\n');
return function (Vue) {
/* istanbul ignore next */
if (!checkMultipleVueWarned && OurVue !== Vue && !isJSDOM) {
warn(MULTIPLE_VUE_WARNING);
}
checkMultipleVueWarned = true;
};
}();
/**
* Plugin install factory function.
* @param {object} { components, directives }
* @returns {function} plugin install function
*/
export 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
*/
export var pluginFactory = function pluginFactory() {
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var extend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return _objectSpread({}, extend, {
install: installFactory(opts)
});
};
/**
* Load a group of plugins.
* @param {object} Vue
* @param {object} Plugin definitions
*/
export 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
*/
export 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
*/
export 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
*/
export 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
*/
export 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
*/
export 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;
}
};
+11
View File
@@ -0,0 +1,11 @@
import upperFirst from './upper-first';
/**
* @param {string} prefix
* @param {string} value
*/
var prefixPropName = function prefixPropName(prefix, value) {
return prefix + upperFirst(value);
};
export default prefixPropName;
+11
View File
@@ -0,0 +1,11 @@
/**
* @param {number} length
* @return {Array}
*/
var range = function range(length) {
return Array.apply(null, {
length: length
});
};
export default range;
+142
View File
@@ -0,0 +1,142 @@
import toString from './to-string';
import { isArray, isNull, isPlainObject, isString, isUndefined } from './inspect';
import { keys } from './object';
var ANCHOR_TAG = 'a'; // Precompile RegExp
var commaRE = /%2C/g;
var encodeReserveRE = /[!'()*]/g; // Method to replace reserved chars
var encodeReserveReplacer = function encodeReserveReplacer(c) {
return '%' + c.charCodeAt(0).toString(16);
}; // Fixed encodeURIComponent which is more conformant to RFC3986:
// - escapes [!'()*]
// - preserve commas
var encode = function encode(str) {
return encodeURIComponent(toString(str)).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
};
var decode = decodeURIComponent; // Stringifies an object of query parameters
// See: https://github.com/vuejs/vue-router/blob/dev/src/util/query.js
export var stringifyQueryObj = function stringifyQueryObj(obj) {
if (!isPlainObject(obj)) {
return '';
}
var query = keys(obj).map(function (key) {
var val = obj[key];
if (isUndefined(val)) {
return '';
} else if (isNull(val)) {
return encode(key);
} else if (isArray(val)) {
return val.reduce(function (results, val2) {
if (isNull(val2)) {
results.push(encode(key));
} else if (!isUndefined(val2)) {
// Faster than string interpolation
results.push(encode(key) + '=' + encode(val2));
}
return results;
}, []).join('&');
} // Faster than string interpolation
return encode(key) + '=' + encode(val);
})
/* must check for length, as we only want to filter empty strings, not things that look falsey! */
.filter(function (x) {
return x.length > 0;
}).join('&');
return query ? "?".concat(query) : '';
};
export var parseQuery = function parseQuery(query) {
var parsed = {};
query = toString(query).trim().replace(/^(\?|#|&)/, '');
if (!query) {
return parsed;
}
query.split('&').forEach(function (param) {
var parts = param.replace(/\+/g, ' ').split('=');
var key = decode(parts.shift());
var val = parts.length > 0 ? decode(parts.join('=')) : null;
if (isUndefined(parsed[key])) {
parsed[key] = val;
} else if (isArray(parsed[key])) {
parsed[key].push(val);
} else {
parsed[key] = [parsed[key], val];
}
});
return parsed;
};
export var isRouterLink = function isRouterLink(tag) {
return toString(tag).toLowerCase() !== ANCHOR_TAG;
};
export var computeTag = function computeTag() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
to = _ref.to,
disabled = _ref.disabled;
var thisOrParent = arguments.length > 1 ? arguments[1] : undefined;
return thisOrParent.$router && to && !disabled ? thisOrParent.$nuxt ? 'nuxt-link' : 'router-link' : ANCHOR_TAG;
};
export var computeRel = function computeRel() {
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
target = _ref2.target,
rel = _ref2.rel;
if (target === '_blank' && isNull(rel)) {
return 'noopener';
}
return rel || null;
};
export var computeHref = function computeHref() {
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
href = _ref3.href,
to = _ref3.to;
var tag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ANCHOR_TAG;
var fallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '#';
var toFallback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
// We've already checked the $router in computeTag(), so isRouterLink() indicates a live router.
// When deferring to Vue Router's router-link, don't use the href attribute at all.
// We return null, and then remove href from the attributes passed to router-link
if (isRouterLink(tag)) {
return null;
} // Return `href` when 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 (isString(to)) {
return to || toFallback;
} // Fallback to `to.path + to.query + to.hash` prop (if `to` is an object)
if (isPlainObject(to) && (to.path || to.query || to.hash)) {
var path = toString(to.path);
var query = stringifyQueryObj(to.query);
var hash = toString(to.hash);
hash = !hash || hash.charAt(0) === '#' ? hash : "#".concat(hash);
return "".concat(path).concat(query).concat(hash) || toFallback;
}
} // If nothing is provided return the fallback
return fallback;
};
+79
View File
@@ -0,0 +1,79 @@
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _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 _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 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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* SSR safe types
*/
import { hasWindowSupport } from './env';
var w = hasWindowSupport ? window : {};
export var Element = hasWindowSupport ? w.Element :
/*#__PURE__*/
function (_Object) {
_inherits(Element, _Object);
function Element() {
_classCallCheck(this, Element);
return _possibleConstructorReturn(this, _getPrototypeOf(Element).apply(this, arguments));
}
return Element;
}(_wrapNativeSuper(Object));
export var HTMLElement = hasWindowSupport ? w.HTMLElement :
/*#__PURE__*/
function (_Element) {
_inherits(HTMLElement, _Element);
function HTMLElement() {
_classCallCheck(this, HTMLElement);
return _possibleConstructorReturn(this, _getPrototypeOf(HTMLElement).apply(this, arguments));
}
return HTMLElement;
}(Element);
export var SVGElement = hasWindowSupport ? w.SVGElement :
/*#__PURE__*/
function (_Element2) {
_inherits(SVGElement, _Element2);
function SVGElement() {
_classCallCheck(this, SVGElement);
return _possibleConstructorReturn(this, _getPrototypeOf(SVGElement).apply(this, arguments));
}
return SVGElement;
}(Element);
export var File = hasWindowSupport ? w.File :
/*#__PURE__*/
function (_Object2) {
_inherits(File, _Object2);
function File() {
_classCallCheck(this, File);
return _possibleConstructorReturn(this, _getPrototypeOf(File).apply(this, arguments));
}
return File;
}(_wrapNativeSuper(Object));
+32
View File
@@ -0,0 +1,32 @@
/*
* Consistent and stable sort function across JavaScript platforms
*
* Inconsistent sorts can cause SSR problems between client and server
* such as in <b-table> if sortBy is applied to the data on server side render.
* Chrome and V8 native sorts are inconsistent/unstable
*
* This function uses native sort with fallback to index compare when the a and b
* compare returns 0
*
* Algorithm based on:
* https://stackoverflow.com/questions/1427608/fast-stable-sorting-algorithm-implementation-in-javascript/45422645#45422645
*
* @param {array} array to sort
* @param {function} sort compare function
* @return {array}
*/
var stableSort = function stableSort(array, compareFn) {
// Using `.bind(compareFn)` on the wrapped anonymous function improves
// performance by avoiding the function call setup. We don't use an arrow
// function here as it binds `this` to the `stableSort` context rather than
// the `compareFn` context, which wouldn't give us the performance increase.
return array.map(function (a, index) {
return [index, a];
}).sort(function (a, b) {
return this(a[1], b[1]) || a[0] - b[0];
}.bind(compareFn)).map(function (e) {
return e[1];
});
};
export default stableSort;
+28
View File
@@ -0,0 +1,28 @@
/**
* Converts a string, including strings in camelCase or snake_case, into Start Case (a variant
* of Title Case where all words start with a capital letter), it keeps original single quote
* and hyphen in the word.
*
* Copyright (c) 2017 Compass (MIT)
* https://github.com/UrbanCompass/to-start-case
* @author Zhuoyuan Zhang <https://github.com/drawyan>
* @author Wei Wang <https://github.com/onlywei>
*
*
* 'management_companies' to 'Management Companies'
* 'managementCompanies' to 'Management Companies'
* `hell's kitchen` to `Hell's Kitchen`
* `co-op` to `Co-op`
*
* @param {String} str
* @returns {String}
*/
var startCase = function startCase(str) {
return str.replace(/_/g, ' ').replace(/([a-z])([A-Z])/g, function (str, $1, $2) {
return $1 + ' ' + $2;
}).replace(/(\s|^)(\w)/g, function (str, $1, $2) {
return $1 + $2.toUpperCase();
});
};
export default startCase;
+14
View File
@@ -0,0 +1,14 @@
import upperFirst from './upper-first';
/**
* 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
*/
var suffixPropName = function suffixPropName(suffix, str) {
return str + (suffix ? upperFirst(suffix) : '');
};
export default suffixPropName;
+61
View File
@@ -0,0 +1,61 @@
import { keys } from './object';
import { eventOn, eventOff } from './dom';
var allListenTypes = {
hover: true,
click: true,
focus: true
};
var BVBoundListeners = '__BV_boundEventListeners__';
var getTargets = function getTargets(binding) {
var targets = keys(binding.modifiers || {}).filter(function (t) {
return !allListenTypes[t];
});
if (binding.value) {
targets.push(binding.value);
}
return targets;
};
var bindTargets = function bindTargets(vnode, binding, listenTypes, fn) {
var targets = getTargets(binding);
var listener = function listener() {
fn({
targets: targets,
vnode: vnode
});
};
keys(allListenTypes).forEach(function (type) {
if (listenTypes[type] || binding.modifiers[type]) {
eventOn(vnode.elm, type, listener);
var boundListeners = vnode.elm[BVBoundListeners] || {};
boundListeners[type] = boundListeners[type] || [];
boundListeners[type].push(listener);
vnode.elm[BVBoundListeners] = boundListeners;
}
}); // Return the list of targets
return targets;
};
var unbindTargets = function unbindTargets(vnode, binding, listenTypes) {
keys(allListenTypes).forEach(function (type) {
if (listenTypes[type] || binding.modifiers[type]) {
var boundListeners = vnode.elm[BVBoundListeners] && vnode.elm[BVBoundListeners][type];
if (boundListeners) {
boundListeners.forEach(function (listener) {
return eventOff(vnode.elm, type, listener);
});
delete vnode.elm[BVBoundListeners][type];
}
}
});
};
export { bindTargets, unbindTargets, getTargets };
export default bindTargets;
+11
View File
@@ -0,0 +1,11 @@
import { isArray, isPlainObject, isUndefinedOrNull } from './inspect';
/**
* Convert a value to a string that can be rendered.
*/
var toString = function toString(val) {
var spaces = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
return isUndefinedOrNull(val) ? '' : isArray(val) || isPlainObject(val) && val.toString === Object.prototype.toString ? JSON.stringify(val, null, spaces) : String(val);
};
export default toString;
+184
View File
@@ -0,0 +1,184 @@
import Vue from './vue';
import { concat } from './array';
import { select } from './dom';
import { isBrowser } from './env';
import { isFunction, isString } from './inspect';
import { HTMLElement } from './safe-types';
import normalizeSlotMixin from '../mixins/normalize-slot'; // BTransporterSingle/BTransporterTargetSingle:
//
// Single root node portaling of content, which retains parent/child hierarchy
// Unlike Portal-Vue where portaled content is no longer a descendent of it's
// intended parent components
//
// Private components for use by Tooltips, Popovers and Modals
//
// Based on vue-simple-portal
// https://github.com/LinusBorg/vue-simple-portal
// Transporter target used by BTransporterSingle
// Supports only a single root element
// @vue/component
var BTransporterTargetSingle =
/*#__PURE__*/
Vue.extend({
// As an abstract component, it doesn't appear in the $parent chain of
// components, which means the next parent of any component rendered inside
// of this one will be the parent from which is was portal'd
abstract: true,
name: 'BTransporterTargetSingle',
props: {
nodes: {
// Even though we only support a single root element,
// VNodes are always passed as an array
type: [Array, Function] // default: undefined
}
},
data: function data(vm) {
return {
updatedNodes: vm.nodes
};
},
destroyed: function destroyed() {
var el = this.$el;
el && el.parentNode && el.parentNode.removeChild(el);
},
render: function render(h) {
var nodes = isFunction(this.updatedNodes) ? this.updatedNodes({}) : this.updatedNodes;
nodes = concat(nodes).filter(Boolean);
/* istanbul ignore else */
if (nodes && nodes.length > 0 && !nodes[0].text) {
return nodes[0];
} else {
/* istanbul ignore next */
return h();
}
}
}); // This component has no root element, so only a single VNode is allowed
// @vue/component
export var BTransporterSingle =
/*#__PURE__*/
Vue.extend({
name: 'BTransporterSingle',
mixins: [normalizeSlotMixin],
props: {
disabled: {
type: Boolean,
default: false
},
container: {
// String: CSS selector,
// HTMLElement: Element reference
// Mainly needed for tooltips/popovers inside modals
type: [String, HTMLElement],
default: 'body'
},
tag: {
// This should be set to match the root element type
type: String,
default: 'div'
}
},
watch: {
disabled: {
immediate: true,
handler: function handler(disabled) {
disabled ? this.unmountTarget() : this.$nextTick(this.mountTarget);
}
}
},
created: function created() {
this._bv_defaultFn = null;
this._bv_target = null;
},
beforeMount: function beforeMount() {
this.mountTarget();
},
updated: function updated() {
var _this = this;
// Placed in a nextTick to ensure that children have completed
// updating before rendering in the target
this.$nextTick(function () {
_this.updateTarget();
});
},
beforeDestroy: function beforeDestroy() {
this.unmountTarget();
this._bv_defaultFn = null;
},
methods: {
// Get the element which the target should be appended to
getContainer: function getContainer() {
/* istanbul ignore else */
if (isBrowser) {
var container = this.container;
return isString(container) ? select(container) : container;
} else {
return null;
}
},
// Mount the target
mountTarget: function mountTarget() {
if (!this._bv_target) {
var container = this.getContainer();
if (container) {
var el = document.createElement('div');
container.appendChild(el);
this._bv_target = new BTransporterTargetSingle({
el: el,
parent: this,
propsData: {
// Initial nodes to be rendered
nodes: concat(this.normalizeSlot('default'))
}
});
}
}
},
// Update the content of the target
updateTarget: function updateTarget() {
if (isBrowser && this._bv_target) {
var defaultFn = this.$scopedSlots.default;
if (!this.disabled) {
/* istanbul ignore else: only applicable in Vue 2.5.x */
if (defaultFn && this._bv_defaultFn !== defaultFn) {
// We only update the target component if the scoped slot
// function is a fresh one. The new slot syntax (since Vue 2.6)
// can cache unchanged slot functions and we want to respect that here
this._bv_target.updatedNodes = defaultFn;
} else if (!defaultFn) {
// We also need to be back compatible with non-scoped default slot (i.e. 2.5.x)
this._bv_target.updatedNodes = this.$slots.default;
}
} // Update the scoped slot function cache
this._bv_defaultFn = defaultFn;
}
},
// Unmount the target
unmountTarget: function unmountTarget() {
if (this._bv_target) {
this._bv_target.$destroy();
this._bv_target = null;
}
}
},
render: function render(h) {
if (this.disabled) {
var nodes = concat(this.normalizeSlot('default')).filter(Boolean);
if (nodes.length > 0 && !nodes[0].text) {
return nodes[0];
}
}
return h();
}
});
+11
View File
@@ -0,0 +1,11 @@
import lowerFirst from './lower-first';
/**
* @param {string} prefix
* @param {string} value
*/
var unprefixPropName = function unprefixPropName(prefix, value) {
return lowerFirst(value.replace(prefix, ''));
};
export default unprefixPropName;
+16
View File
@@ -0,0 +1,16 @@
import { isString } from './inspect';
/**
* Transform the first character to uppercase
* @param {string} str
*/
var upperFirst = function upperFirst(str) {
if (!isString(str)) {
str = String(str);
}
str = str.trim();
return str.charAt(0).toUpperCase() + str.slice(1);
};
export default upperFirst;
+8
View File
@@ -0,0 +1,8 @@
//
// Single point of contact for Vue
//
// TODO:
// Conditionally import Vue if no global Vue
//
import Vue from 'vue';
export default Vue;
+60
View File
@@ -0,0 +1,60 @@
import { isBrowser, hasPromiseSupport, hasMutationObserverSupport, getNoWarn } from './env';
/**
* Log a warning message to the console with BootstrapVue formatting
* @param {string} message
*/
export var warn = function warn(message)
/* istanbul ignore next */
{
if (!getNoWarn()) {
console.warn("[BootstrapVue warn]: ".concat(message));
}
};
/**
* Warn when no Promise support is given
* @param {string} source
* @returns {boolean} warned
*/
export 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
*/
export 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
*/
export var warnNoMutationObserverSupport = function warnNoMutationObserverSupport(source) {
/* istanbul ignore else */
if (hasMutationObserverSupport) {
return false;
} else {
warn("".concat(source, ": Requires MutationObserver support."));
return true;
}
}; // Default export
export default warn;