@cw-devops/bk-magic-vue
Version:
基于蓝鲸 Magicbox 和 Vue 的前端组件库
849 lines (800 loc) • 30.9 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.library = {}));
}(this, function (exports) { 'use strict';
var script = {
name: 'bk-virtual-scroll',
props: {
itemHeight: {
type: Number,
default: 16
},
showIndex: {
type: Boolean,
default: false
},
list: {
type: Array,
default: function _default() {
return [];
}
},
extCls: {
type: String,
default: ''
}
},
data: function data() {
return {
ulHeight: 0,
allListData: [],
offscreenCanvas: '',
indexList: [],
listData: [],
worker: {},
mainWidth: 0,
mainLeft: 0,
totalHeight: 0,
itemNumber: 0,
totalNumber: 0,
visHeight: 0,
visWidth: 0,
totalScrollHeight: 0,
startMinMapMove: false,
tempVal: 0,
minMapTop: 0,
minNavTop: 0,
navHeight: 0,
mapHeight: 0,
moveRate: 0,
bottomScrollWidth: Infinity,
bottomScrollDis: 0,
itemWidth: 0,
isScrolling: false,
isBottomMove: false,
downPreDefault: false,
upPreDefault: false,
indexWidth: 0,
observer: {}
};
},
watch: {
list: {
handler: function handler(list) {
this.setListData(list);
},
deep: true
}
},
mounted: function mounted() {
this.initStatus();
this.initEvent();
if (this.list.length > 0) this.setListData(this.list);
},
beforeDestroy: function beforeDestroy() {
document.removeEventListener('mousemove', this.minNavMove);
document.removeEventListener('mouseup', this.moveEnd);
window.removeEventListener('resize', this.resize);
if (MutationObserver) this.observer.disconnect();
this.observer = {};
},
methods: {
initStatus: function initStatus() {
var mainEle = this.$refs.scrollHome;
var scrollEle = this.$refs.scrollMain;
this.visHeight = mainEle.offsetHeight || 300;
this.visWidth = mainEle.offsetWidth || 300;
var scrollWidth = scrollEle.scrollWidth || 0;
this.itemWidth = scrollWidth;
this.bottomScrollWidth = this.visWidth * this.visWidth / scrollWidth < 20 ? 20 : this.visWidth * this.visWidth / scrollWidth;
var dpr = window.devicePixelRatio || 1;
this.$refs.minNav.width = 8 * dpr;
this.$refs.minNav.height = this.visHeight * dpr;
this.$refs.minNav.getContext('2d').setTransform(dpr, 0, 0, dpr, 0, 0);
},
initEvent: function initEvent() {
document.addEventListener('mousemove', this.minNavMove);
document.addEventListener('mouseup', this.moveEnd);
window.addEventListener('resize', this.resize);
if (MutationObserver) {
this.observer = new MutationObserver(this.resize);
this.observer.observe(this.$el, {
attributes: true,
attributeFilter: ['style']
});
}
},
resize: function resize(event) {
var _this = this;
this.slowExec(function () {
var lastHeight = _this.visHeight;
_this.initStatus();
_this.setStatus();
_this.minMapTop = _this.visHeight / lastHeight * _this.minMapTop;
_this.minNavTop = _this.minMapTop * (_this.visHeight - _this.navHeight) / (_this.mapHeight - _this.visHeight / 8);
_this.totalScrollHeight = _this.mapHeight === _this.canvasHeight / 8 ? 0 : _this.minMapTop / (_this.mapHeight - _this.visHeight / 8) * (_this.totalHeight - _this.visHeight);
_this.getListData(_this.totalScrollHeight, true);
});
},
handleWheel: function handleWheel(event) {
var isVerticalScroll = event.wheelDeltaX !== undefined ? Math.abs(event.wheelDeltaY) > Math.abs(event.wheelDeltaX) : event.axis === 2;
if (isVerticalScroll) this.handleVerticalScroll(event);else this.handleHorizontalScroll(event);
},
handleHorizontalScroll: function handleHorizontalScroll(event) {
event.preventDefault();
if (this.bottomScrollWidth >= this.mainWidth) return;
var deltaX = -Math.max(-1, Math.min(1, event.wheelDeltaX || -event.detail));
var bottomScrollLeft = this.bottomScrollDis + deltaX * 4;
if (bottomScrollLeft <= 0) bottomScrollLeft = 0;
if (bottomScrollLeft + this.bottomScrollWidth >= this.mainWidth) bottomScrollLeft = this.mainWidth - this.bottomScrollWidth;
this.bottomScrollDis = bottomScrollLeft;
this.$emit('horizontal-scroll', this.indexWidth + bottomScrollLeft);
},
handleVerticalScroll: function handleVerticalScroll(event) {
var deltaY = Math.max(-1, Math.min(1, event.wheelDeltaY || -event.detail));
var shouldPreDefault = deltaY < 0 ? this.downPreDefault : this.upPreDefault;
if (shouldPreDefault) event.preventDefault();
if (this.isScrolling || this.itemHeight * this.totalNumber <= this.visHeight) return;
var dis = 0;
if (event.wheelDelta) dis = -1 / 5 * event.wheelDelta;
if (event.detail) dis = event.detail;
var tickGap = deltaY * -2;
if (deltaY === 0) {
dis = 0;
tickGap = 0;
}
var scrollHeight = this.minMapTop + (dis + tickGap) * (this.mapHeight - this.visHeight / 8) / (this.totalHeight - this.itemHeight * this.itemNumber);
var totalScrollHeight = 0;
var minMapTop = 0;
var minNavTop = 0;
if (scrollHeight < 0) {
totalScrollHeight = 0;
minMapTop = 0;
minNavTop = 0;
} else if (scrollHeight >= 0 && scrollHeight <= this.mapHeight - this.visHeight / 8) {
minMapTop = scrollHeight;
minNavTop = this.minNavTop + (dis + tickGap) * (this.visHeight - this.navHeight) / (this.totalHeight - this.itemHeight * this.itemNumber);
totalScrollHeight = scrollHeight * (this.totalHeight - this.itemHeight * this.itemNumber) / (this.mapHeight - this.visHeight / 8);
} else {
totalScrollHeight = this.totalHeight - this.visHeight;
minMapTop = this.mapHeight - this.visHeight / 8;
minNavTop = this.visHeight - this.navHeight;
}
this.minMapTop = minMapTop;
this.minNavTop = minNavTop;
this.isScrolling = true;
this.getListData(totalScrollHeight);
},
scrollPageByIndex: function scrollPageByIndex(index) {
var height = this.itemHeight * index;
if (height <= 0) height = 0;else if (height >= this.totalHeight - this.visHeight) height = this.totalHeight - this.visHeight;
if (this.totalHeight <= this.visHeight) height = 0;
var heightDiff = this.totalHeight - this.visHeight || 1;
this.minMapTop = height / heightDiff * (this.mapHeight - this.visHeight / 8);
this.minNavTop = height / heightDiff * (this.visHeight - this.navHeight);
this.getListData(height);
},
getListData: function getListData() {
var totalScrollHeight = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var isResize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var postData = {
type: 'wheelGetData',
totalScrollHeight: totalScrollHeight,
isResize: isResize,
totalHeight: this.totalHeight,
itemHeight: this.itemHeight,
itemNumber: this.itemNumber,
canvasHeight: this.visHeight,
minMapTop: this.minMapTop,
mapHeight: this.mapHeight
};
this.calcList(postData);
},
calcList: function calcList(_ref) {
var totalScrollHeight = _ref.totalScrollHeight,
itemHeight = _ref.itemHeight,
itemNumber = _ref.itemNumber,
canvasHeight = _ref.canvasHeight,
minMapTop = _ref.minMapTop,
totalHeight = _ref.totalHeight,
mapHeight = _ref.mapHeight,
isResize = _ref.isResize;
var realHeight = mapHeight === canvasHeight / 8 ? 0 : minMapTop / (mapHeight - canvasHeight / 8) * (totalHeight - canvasHeight);
var startIndex = Math.floor(realHeight / itemHeight);
var endIndex = startIndex + itemNumber;
startIndex = startIndex > 0 ? startIndex - 1 : 0;
var listData = [];
var indexList = [];
var nums = Math.floor(startIndex * itemHeight / 500000);
for (var i = startIndex; i <= endIndex; i++) {
var top = i * itemHeight - nums * 500000;
var value = this.allListData[i];
if (value) {
indexList.push({
top: top,
value: i + 1
});
listData.push({
top: top,
value: value
});
}
}
totalScrollHeight = totalScrollHeight - nums * 500000;
this.indexList = indexList;
this.listData = listData;
this.totalScrollHeight = totalScrollHeight;
var firstIndexObj = this.indexList[0] || {};
var lastIndexObj = this.indexList[this.indexList.length - 1] || {};
this.downPreDefault = lastIndexObj.value + 1 < this.totalNumber;
this.upPreDefault = firstIndexObj.value > 1;
this.isScrolling = false;
this.$emit('change', listData.map(function (x) {
return x.value;
}));
},
addListData: function addListData(list) {
this.allListData = this.allListData.concat(list);
var number = this.totalNumber + list.length;
var lastIndexData = this.indexList[this.indexList.length - 1] || {
value: 0
};
if (this.totalNumber - lastIndexData.value <= 3) {
this.freshDataScrollBottom(number);
} else {
this.freshDataNoScroll(number);
}
this.resize();
},
setListData: function setListData(list) {
this.allListData = list;
this.freshDataNoScroll(list.length);
this.resize();
},
freshDataScrollBottom: function freshDataScrollBottom(number) {
this.totalNumber = number;
this.indexWidth = this.showIndex ? (Math.log10(this.totalNumber) + 1) * 7 : 0;
this.setStatus();
this.scrollPageByIndex(this.totalNumber - this.itemNumber + 1);
},
freshDataNoScroll: function freshDataNoScroll(number) {
var oldNumber = this.totalNumber;
var oldItemNumber = this.itemNumber;
var oldMapHeight = this.mapHeight;
var oldVisHeight = this.visHeight;
this.totalNumber = number;
this.indexWidth = this.showIndex ? (Math.log10(this.totalNumber) + 1) * 7 : 0;
this.setStatus();
this.getNumberChangeList({
oldNumber: oldNumber,
oldItemNumber: oldItemNumber,
oldMapHeight: oldMapHeight,
oldVisHeight: oldVisHeight
});
},
getNumberChangeList: function getNumberChangeList(_ref2) {
var oldNumber = _ref2.oldNumber,
oldItemNumber = _ref2.oldItemNumber,
oldMapHeight = _ref2.oldMapHeight,
oldVisHeight = _ref2.oldVisHeight;
var minMapTop = this.minMapTop * (oldNumber - oldItemNumber) / (this.totalNumber - this.itemNumber || 1) * ((this.mapHeight - this.visHeight / 8) / (oldMapHeight - oldVisHeight / 8 || 1));
var totalScrollHeight = minMapTop / (this.mapHeight - this.visHeight / 8 || 1) * (this.totalHeight - this.visHeight);
if (minMapTop <= 0 || this.navHeight >= this.visHeight) {
minMapTop = 0;
totalScrollHeight = 0;
} else if (minMapTop > this.mapHeight - this.visHeight / 8) {
minMapTop = this.mapHeight - this.visHeight / 8;
totalScrollHeight = this.totalHeight - this.visHeight;
}
this.minMapTop = minMapTop;
this.minNavTop = this.minMapTop / (this.mapHeight - this.visHeight / 8 || 1) * (this.visHeight - this.navHeight);
this.getListData(totalScrollHeight);
},
setStatus: function setStatus() {
this.totalHeight = this.totalNumber * this.itemHeight;
this.itemNumber = this.totalHeight > this.visHeight ? Math.ceil(this.visHeight / this.itemHeight) : this.totalNumber;
this.ulHeight = this.totalHeight > 400000 ? 1000000 : this.totalHeight;
var heightRate = this.visHeight / this.totalHeight;
var minNavHeight = heightRate * this.visHeight;
this.navHeight = heightRate > 1 ? this.visHeight : minNavHeight < 20 ? 20 : minNavHeight;
var moveMaxHeight = this.totalNumber * this.itemHeight / 8;
this.mapHeight = moveMaxHeight < this.visHeight ? moveMaxHeight : this.visHeight;
this.mainWidth = this.visWidth;
if (this.$refs.scrollNav) this.mainWidth -= this.$refs.scrollNav.offsetWidth;
if (this.showIndex) {
this.mainWidth -= (Math.log10(this.totalNumber) + 1) * 7;
this.mainLeft = (Math.log10(this.totalNumber) + 1) * 7;
}
},
startBottomMove: function startBottomMove(event) {
this.tempVal = event.screenX;
this.startMinMapMove = true;
this.isBottomMove = true;
},
startNavMove: function startNavMove(rate) {
this.moveRate = rate;
this.tempVal = event.screenY;
this.startMinMapMove = true;
this.$emit('virtual-scroll-scroll-bar-mouse', 'down');
document.addEventListener('click', this.docClickHandler);
},
docClickHandler: function docClickHandler() {
var _this2 = this;
document.removeEventListener('click', this.docClickHandler);
setTimeout(function () {
_this2.$emit('virtual-scroll-scroll-bar-mouse', 'up');
}, 0);
},
minNavMove: function minNavMove() {
var _this3 = this;
if (!this.startMinMapMove) return;
if (this.isBottomMove) {
var moveDis = event.screenX - this.tempVal;
var bottomScrollLeft = this.bottomScrollDis + moveDis;
if (bottomScrollLeft <= 0) bottomScrollLeft = 0;
if (bottomScrollLeft + this.bottomScrollWidth >= this.mainWidth) bottomScrollLeft = this.mainWidth - this.bottomScrollWidth;
this.bottomScrollDis = bottomScrollLeft;
this.tempVal = event.screenX;
this.$emit('horizontal-scroll', this.indexWidth + bottomScrollLeft);
} else {
var _moveDis = event.screenY - this.tempVal;
var minMapTop = this.minMapTop + _moveDis / this.moveRate * (this.mapHeight - this.visHeight / 8);
if (minMapTop <= 0) minMapTop = 0;
if (minMapTop >= this.mapHeight - this.visHeight / 8) minMapTop = this.mapHeight - this.visHeight / 8;
var totalScrollHeight = minMapTop / (this.mapHeight - this.visHeight / 8) * (this.totalHeight - this.visHeight);
this.tempVal = event.screenY;
this.minMapTop = minMapTop;
this.minNavTop = minMapTop * (this.visHeight - this.navHeight) / (this.mapHeight - this.visHeight / 8);
this.slowExec(function () {
_this3.getListData(totalScrollHeight);
});
}
},
slowExec: function slowExec(callBack) {
var now = +new Date();
if (now - (this.slowExec.lastTime || 0) >= 100) {
this.slowExec.lastTime = now;
callBack();
}
window.clearTimeout(this.slowExec.timeId);
this.slowExec.timeId = window.setTimeout(function () {
callBack();
}, 50);
},
moveEnd: function moveEnd(event) {
event.preventDefault();
this.startMinMapMove = false;
this.isBottomMove = false;
}
}
};
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
if (typeof shadowMode !== 'boolean') {
createInjectorSSR = createInjector;
createInjector = shadowMode;
shadowMode = false;
}
var options = typeof script === 'function' ? script.options : script;
if (template && template.render) {
options.render = template.render;
options.staticRenderFns = template.staticRenderFns;
options._compiled = true;
if (isFunctionalTemplate) {
options.functional = true;
}
}
if (scopeId) {
options._scopeId = scopeId;
}
var hook;
if (moduleIdentifier) {
hook = function hook(context) {
context = context ||
this.$vnode && this.$vnode.ssrContext ||
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__;
}
if (style) {
style.call(this, createInjectorSSR(context));
}
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier);
}
};
options._ssrRegister = hook;
} else if (style) {
hook = shadowMode ? function () {
style.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
} : function (context) {
style.call(this, createInjector(context));
};
}
if (hook) {
if (options.functional) {
var originalRender = options.render;
options.render = function renderWithStyleInjection(h, context) {
hook.call(context);
return originalRender(h, context);
};
} else {
var existing = options.beforeCreate;
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
}
}
return script;
}
var normalizeComponent_1 = normalizeComponent;
/* script */
var __vue_script__ = script;
/* template */
var __vue_render__ = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('section', {
ref: "scrollHome",
staticClass: "bk-scroll-home",
class: _vm.extCls,
on: {
"mousewheel": _vm.handleWheel,
"DOMMouseScroll": _vm.handleWheel
}
}, [_c('main', {
staticClass: "bk-scroll-main"
}, [_vm.showIndex ? _c('ul', {
staticClass: "bk-scroll-index bk-scroll",
style: {
height: _vm.ulHeight + "px",
top: -_vm.totalScrollHeight + "px",
width: _vm.indexWidth + "px"
}
}, _vm._l(_vm.indexList, function (item, index) {
return _c('li', {
key: index,
staticClass: "bk-scroll-item",
style: {
height: _vm.itemHeight + "px",
top: item.top + "px"
}
}, [_vm._t("index", [_vm._v("\n " + _vm._s(item.value) + "\n ")], {
data: item.value
})], 2);
}), 0) : _vm._e(), _c('ul', {
ref: "scrollMain",
staticClass: "bk-scroll",
style: {
height: _vm.ulHeight + "px",
top: -_vm.totalScrollHeight + "px",
width: _vm.mainWidth + "px",
left: _vm.mainLeft + "px"
}
}, _vm._l(_vm.listData, function (item) {
return _c('li', {
key: item.top,
staticClass: "bk-scroll-item",
style: {
height: _vm.itemHeight + "px",
top: item.top + "px",
left: -_vm.bottomScrollDis * (_vm.itemWidth - _vm.mainWidth) / (_vm.mainWidth - _vm.bottomScrollWidth) + "px"
}
}, [_vm._t("default", null, {
data: item.value
})], 2);
}), 0)]), _c('canvas', {
ref: "minNav",
staticClass: "bk-min-nav",
style: "height: " + _vm.visHeight + "px;"
}), _vm.navHeight < _vm.visHeight ? _c('span', {
ref: "scrollNav",
staticClass: "bk-min-nav-slide bk-nav-show",
style: {
height: _vm.navHeight + "px",
top: _vm.minNavTop + "px"
},
on: {
"mousedown": function mousedown($event) {
_vm.startNavMove(_vm.visHeight - _vm.navHeight);
}
}
}) : _vm._e(), _vm.bottomScrollWidth < _vm.mainWidth ? _c('span', {
staticClass: "bk-min-nav-slide bk-bottom-scroll",
style: {
left: _vm.indexWidth + _vm.bottomScrollDis + "px",
width: _vm.bottomScrollWidth + "px"
},
on: {
"mousedown": _vm.startBottomMove
}
}) : _vm._e()]);
};
var __vue_staticRenderFns__ = [];
/* style */
var __vue_inject_styles__ = undefined;
/* scoped */
var __vue_scope_id__ = undefined;
/* module identifier */
var __vue_module_identifier__ = undefined;
/* functional template */
var __vue_is_functional_template__ = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__ = /*#__PURE__*/normalizeComponent_1({
render: __vue_render__,
staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
var _defined = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
var _toObject = function (it) {
return Object(_defined(it));
};
var hasOwnProperty = {}.hasOwnProperty;
var _has = function (it, key) {
return hasOwnProperty.call(it, key);
};
var toString = {}.toString;
var _cof = function (it) {
return toString.call(it).slice(8, -1);
};
var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
return _cof(it) == 'String' ? it.split('') : Object(it);
};
var _toIobject = function (it) {
return _iobject(_defined(it));
};
var ceil = Math.ceil;
var floor = Math.floor;
var _toInteger = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
var min = Math.min;
var _toLength = function (it) {
return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0;
};
var max = Math.max;
var min$1 = Math.min;
var _toAbsoluteIndex = function (index, length) {
index = _toInteger(index);
return index < 0 ? max(index + length, 0) : min$1(index, length);
};
var _arrayIncludes = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = _toIobject($this);
var length = _toLength(O.length);
var index = _toAbsoluteIndex(fromIndex, length);
var value;
if (IS_INCLUDES && el != el) while (length > index) {
value = O[index++];
if (value != value) return true;
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
if (O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var _core = createCommonjsModule(function (module) {
var core = module.exports = { version: '2.6.12' };
if (typeof __e == 'number') __e = core;
});
var _core_1 = _core.version;
var _global = createCommonjsModule(function (module) {
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
: Function('return this')();
if (typeof __g == 'number') __g = global;
});
var _shared = createCommonjsModule(function (module) {
var SHARED = '__core-js_shared__';
var store = _global[SHARED] || (_global[SHARED] = {});
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: _core.version,
mode: 'pure' ,
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
});
});
var id = 0;
var px = Math.random();
var _uid = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
var shared = _shared('keys');
var _sharedKey = function (key) {
return shared[key] || (shared[key] = _uid(key));
};
var arrayIndexOf = _arrayIncludes(false);
var IE_PROTO = _sharedKey('IE_PROTO');
var _objectKeysInternal = function (object, names) {
var O = _toIobject(object);
var i = 0;
var result = [];
var key;
for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
while (names.length > i) if (_has(O, key = names[i++])) {
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
var _enumBugKeys = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
var _objectKeys = Object.keys || function keys(O) {
return _objectKeysInternal(O, _enumBugKeys);
};
var _aFunction = function (it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
};
var _ctx = function (fn, that, length) {
_aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
var _isObject = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
var _anObject = function (it) {
if (!_isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
var _fails = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
var _descriptors = !_fails(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
var document$1 = _global.document;
var is = _isObject(document$1) && _isObject(document$1.createElement);
var _domCreate = function (it) {
return is ? document$1.createElement(it) : {};
};
var _ie8DomDefine = !_descriptors && !_fails(function () {
return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
});
var _toPrimitive = function (it, S) {
if (!_isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
var dP = Object.defineProperty;
var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
_anObject(O);
P = _toPrimitive(P, true);
_anObject(Attributes);
if (_ie8DomDefine) try {
return dP(O, P, Attributes);
} catch (e) { }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var _objectDp = {
f: f
};
var _propertyDesc = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var _hide = _descriptors ? function (object, key, value) {
return _objectDp.f(object, key, _propertyDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var IS_WRAP = type & $export.W;
var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
var expProto = exports[PROTOTYPE];
var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE];
var key, own, out;
if (IS_GLOBAL) source = name;
for (key in source) {
own = !IS_FORCED && target && target[key] !== undefined;
if (own && _has(exports, key)) continue;
out = own ? target[key] : source[key];
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
: IS_BIND && own ? _ctx(out, _global)
: IS_WRAP && target[key] == out ? (function (C) {
var F = function (a, b, c) {
if (this instanceof C) {
switch (arguments.length) {
case 0: return new C();
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
})(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
if (IS_PROTO) {
(exports.virtual || (exports.virtual = {}))[key] = out;
if (type & $export.R && expProto && !expProto[key]) _hide(expProto, key, out);
}
}
};
$export.F = 1;
$export.G = 2;
$export.S = 4;
$export.P = 8;
$export.B = 16;
$export.W = 32;
$export.U = 64;
$export.R = 128;
var _export = $export;
var _objectSap = function (KEY, exec) {
var fn = (_core.Object || {})[KEY] || Object[KEY];
var exp = {};
exp[KEY] = exec(fn);
_export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
};
_objectSap('keys', function () {
return function keys(it) {
return _objectKeys(_toObject(it));
};
});
var keys = _core.Object.keys;
var keys$1 = keys;
function setInstaller (component, afterInstall) {
component.install = function (Vue) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var props = component.props || {};
keys$1(options).forEach(function (key) {
if (props.hasOwnProperty(key)) {
if (typeof props[key] === 'function' || props[key] instanceof Array) {
props[key] = {
type: props[key],
default: options[key]
};
} else {
props[key].default = options[key];
}
}
});
component.name = options.namespace ? component.name.replace('bk', options.namespace) : component.name;
Vue.component(component.name, component);
typeof afterInstall === 'function' && afterInstall(Vue, options);
};
}
setInstaller(__vue_component__);
exports.default = __vue_component__;
Object.defineProperty(exports, '__esModule', { value: true });
}));