UNPKG

bk-vue-cec

Version:

一个为运维业务场景而生,好看易用的Vue2原创组件库,由T-inside Design进行托管社区化运作

1,677 lines (1,548 loc) 438 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('bk-magic-vue/lib/locale')) : typeof define === 'function' && define.amd ? define(['exports', 'vue', 'bk-magic-vue/lib/locale'], factory) : (global = global || self, factory(global.library = {}, global.Vue, global.locale)); }(this, function (exports, Vue, locale) { 'use strict'; Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue; locale = locale && locale.hasOwnProperty('default') ? locale['default'] : locale; function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } 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 _core = createCommonjsModule(function (module) { var core = module.exports = { version: '2.6.12' }; if (typeof __e == 'number') __e = core; }); var _core_1 = _core.version; 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 hasOwnProperty = {}.hasOwnProperty; var _has = function (it, key) { return hasOwnProperty.call(it, key); }; 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 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 _defined = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return 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; }; }; var _library = true; 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 f$1 = {}.propertyIsEnumerable; var _objectPie = { f: f$1 }; var isEnum = _objectPie.f; var _objectToArray = function (isEntries) { return function (it) { var O = _toIobject(it); var keys = _objectKeys(O); var length = keys.length; var i = 0; var result = []; var key; while (length > i) { key = keys[i++]; if (!_descriptors || isEnum.call(O, key)) { result.push(isEntries ? [key, O[key]] : O[key]); } } return result; }; }; var $values = _objectToArray(false); _export(_export.S, 'Object', { values: function values(it) { return $values(it); } }); var values = _core.Object.values; var values$1 = values; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; }; } else { _typeof = function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function () {}; return { s: F, n: function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (e) { throw e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function () { it = it.call(o); }, n: function () { var step = it.next(); normalCompletion = step.done; return step; }, e: function (e) { didErr = true; err = e; }, f: function () { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } var _isArray = Array.isArray || function isArray(arg) { return _cof(arg) == 'Array'; }; _export(_export.S, 'Array', { isArray: _isArray }); var isArray = _core.Array.isArray; var isArray$1 = isArray; function throttle (delay, noTrailing, callback, debounceMode) { var timeoutID; var cancelled = false; var lastExec = 0; function clearExistingTimeout() { if (timeoutID) { clearTimeout(timeoutID); } } function cancel() { clearExistingTimeout(); cancelled = true; } if (typeof noTrailing !== 'boolean') { debounceMode = callback; callback = noTrailing; noTrailing = undefined; } function wrapper() { var self = this; var elapsed = Date.now() - lastExec; var args = arguments; if (cancelled) { return; } function exec() { lastExec = Date.now(); callback.apply(self, args); } function clear() { timeoutID = undefined; } if (debounceMode && !timeoutID) { exec(); } clearExistingTimeout(); if (debounceMode === undefined && elapsed > delay) { exec(); } else if (noTrailing !== true) { timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay); } } wrapper.cancel = cancel; return wrapper; } function debounce (delay, atBegin, callback) { return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false); } var requestFrame = function () { var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) { return window.setTimeout(fn, 20); }; return function (fn) { return raf(fn); }; }(); var cancelFrame = function () { var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.clearTimeout; return function (id) { return cancel(id); }; }(); var resetTrigger = function resetTrigger(element) { var trigger = element.__resizeTrigger__; var expand = trigger.firstElementChild; var contract = trigger.lastElementChild; var expandChild = expand.firstElementChild; contract.scrollLeft = contract.scrollWidth; contract.scrollTop = contract.scrollHeight; expandChild.style.width = expand.offsetWidth + 1 + 'px'; expandChild.style.height = expand.offsetHeight + 1 + 'px'; expand.scrollLeft = expand.scrollWidth; expand.scrollTop = expand.scrollHeight; }; var checkTriggers = function checkTriggers(element) { return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height; }; var scrollListener = function scrollListener(event) { var _this = this; resetTrigger(this); if (this.__resizeRAF__) cancelFrame(this.__resizeRAF__); this.__resizeRAF__ = requestFrame(function () { if (checkTriggers(_this)) { _this.__resizeLast__.width = _this.offsetWidth; _this.__resizeLast__.height = _this.offsetHeight; _this.__resizeListeners__.forEach(function (fn) { fn.call(_this, event); }); } }); }; var attachEvent = document.attachEvent; var DOM_PREFIXES = 'Webkit Moz O ms'.split(' '); var START_EVENTS = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(' '); var RESIZE_ANIMATION_NAME = 'resizeanim'; var animation = false; var keyFramePrefix = ''; var animationStartEvent = 'animationstart'; if (!attachEvent) { var testElement = document.createElement('fakeelement'); if (testElement.style.animationName !== undefined) { animation = true; } if (animation === false) { var prefix = ''; for (var i = 0; i < DOM_PREFIXES.length; i++) { if (testElement.style[DOM_PREFIXES[i] + 'AnimationName'] !== undefined) { prefix = DOM_PREFIXES[i]; keyFramePrefix = '-' + prefix.toLowerCase() + '-'; animationStartEvent = START_EVENTS[i]; animation = true; break; } } } } var stylesCreated = false; var createStyles = function createStyles() { if (!stylesCreated) { var animationKeyframes = "@".concat(keyFramePrefix, "keyframes ").concat(RESIZE_ANIMATION_NAME, " { from { opacity: 0; } to { opacity: 0; } } "); var animationStyle = "".concat(keyFramePrefix, "animation: 1ms ").concat(RESIZE_ANIMATION_NAME, ";"); var css = "".concat(animationKeyframes, "\n .resize-triggers { ").concat(animationStyle, " visibility: hidden; opacity: 0; }\n .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1 }\n .resize-triggers > div { background: #eee; overflow: auto; }\n .contract-trigger:before { width: 200%; height: 200%; }"); var head = document.head || document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.type = 'text/css'; if (style.styleSheet) { style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } head.appendChild(style); stylesCreated = true; } }; var addResizeListener = function addResizeListener(element, fn) { if (attachEvent) { element.attachEvent('onresize', fn); } else { if (!element.__resizeTrigger__) { if (getComputedStyle(element).position === 'static') { element.style.position = 'relative'; } createStyles(); element.__resizeLast__ = {}; element.__resizeListeners__ = []; var resizeTrigger = element.__resizeTrigger__ = document.createElement('div'); resizeTrigger.className = 'resize-triggers'; resizeTrigger.innerHTML = '<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>'; element.appendChild(resizeTrigger); resetTrigger(element); element.addEventListener('scroll', scrollListener, true); if (animationStartEvent) { resizeTrigger.addEventListener(animationStartEvent, function (event) { if (event.animationName === RESIZE_ANIMATION_NAME) { resetTrigger(element); } }); } } element.__resizeListeners__.push(fn); } }; var removeResizeListener = function removeResizeListener(element, fn) { if (!element || !element.__resizeListeners__) return; if (attachEvent) { element.detachEvent('onresize', fn); } else { element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); if (!element.__resizeListeners__.length) { element.removeEventListener('scroll', scrollListener); element.__resizeTrigger__ = !element.removeChild(element.__resizeTrigger__); } } }; var _populated = false; var _ie, _firefox, _opera, _webkit, _chrome; var _ie_real_version; var _osx, _windows, _linux, _android; var _win64; var _iphone, _ipad, _native; var _mobile; function _populate() { if (_populated) { return; } _populated = true; var uas = navigator.userAgent; var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas); var os = /(Mac OS X)|(Windows)|(Linux)/.exec(uas); _iphone = /\b(iPhone|iP[ao]d)/.exec(uas); _ipad = /\b(iP[ao]d)/.exec(uas); _android = /Android/i.exec(uas); _native = /FBAN\/\w+;/i.exec(uas); _mobile = /Mobile/i.exec(uas); _win64 = !!(/Win64/.exec(uas)); if (agent) { _ie = agent[1] ? parseFloat(agent[1]) : ( agent[5] ? parseFloat(agent[5]) : NaN); if (_ie && document && document.documentMode) { _ie = document.documentMode; } var trident = /(?:Trident\/(\d+.\d+))/.exec(uas); _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie; _firefox = agent[2] ? parseFloat(agent[2]) : NaN; _opera = agent[3] ? parseFloat(agent[3]) : NaN; _webkit = agent[4] ? parseFloat(agent[4]) : NaN; if (_webkit) { agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas); _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN; } else { _chrome = NaN; } } else { _ie = _firefox = _opera = _chrome = _webkit = NaN; } if (os) { if (os[1]) { var ver = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas); _osx = ver ? parseFloat(ver[1].replace('_', '.')) : true; } else { _osx = false; } _windows = !!os[2]; _linux = !!os[3]; } else { _osx = _windows = _linux = false; } } var UserAgent_DEPRECATED = { ie: function() { return _populate() || _ie; }, ieCompatibilityMode: function() { return _populate() || (_ie_real_version > _ie); }, ie64: function() { return UserAgent_DEPRECATED.ie() && _win64; }, firefox: function() { return _populate() || _firefox; }, opera: function() { return _populate() || _opera; }, webkit: function() { return _populate() || _webkit; }, safari: function() { return UserAgent_DEPRECATED.webkit(); }, chrome : function() { return _populate() || _chrome; }, windows: function() { return _populate() || _windows; }, osx: function() { return _populate() || _osx; }, linux: function() { return _populate() || _linux; }, iphone: function() { return _populate() || _iphone; }, mobile: function() { return _populate() || (_iphone || _ipad || _android || _mobile); }, nativeApp: function() { return _populate() || _native; }, android: function() { return _populate() || _android; }, ipad: function() { return _populate() || _ipad; } }; var UserAgent_DEPRECATED_1 = UserAgent_DEPRECATED; var canUseDOM = !!( typeof window !== 'undefined' && window.document && window.document.createElement ); var ExecutionEnvironment = { canUseDOM: canUseDOM, canUseWorkers: typeof Worker !== 'undefined', canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), canUseViewport: canUseDOM && !!window.screen, isInWorker: !canUseDOM }; var ExecutionEnvironment_1 = ExecutionEnvironment; var useHasFeature; if (ExecutionEnvironment_1.canUseDOM) { useHasFeature = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature('', '') !== true; } function isEventSupported(eventNameSuffix, capture) { if (!ExecutionEnvironment_1.canUseDOM || capture && !('addEventListener' in document)) { return false; } var eventName = 'on' + eventNameSuffix; var isSupported = eventName in document; if (!isSupported) { var element = document.createElement('div'); element.setAttribute(eventName, 'return;'); isSupported = typeof element[eventName] === 'function'; } if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); } return isSupported; } var isEventSupported_1 = isEventSupported; var PIXEL_STEP = 10; var LINE_HEIGHT = 40; var PAGE_HEIGHT = 800; function normalizeWheel( event) { var sX = 0, sY = 0, pX = 0, pY = 0; if ('detail' in event) { sY = event.detail; } if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; } if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; } if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; } if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if ('deltaY' in event) { pY = event.deltaY; } if ('deltaX' in event) { pX = event.deltaX; } if ((pX || pY) && event.deltaMode) { if (event.deltaMode == 1) { pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } if (pX && !sX) { sX = (pX < 1) ? -1 : 1; } if (pY && !sY) { sY = (pY < 1) ? -1 : 1; } return { spinX : sX, spinY : sY, pixelX : pX, pixelY : pY }; } normalizeWheel.getEventType = function() { return (UserAgent_DEPRECATED_1.firefox()) ? 'DOMMouseScroll' : (isEventSupported_1('wheel')) ? 'wheel' : 'mousewheel'; }; var normalizeWheel_1 = normalizeWheel; var normalizeWheel$1 = normalizeWheel_1; var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1; var mousewheel = function mousewheel(element, callback) { if (element && element.addEventListener) { element.addEventListener(isFirefox ? 'DOMMouseScroll' : 'mousewheel', function (event) { var normalized = normalizeWheel$1(event); callback && callback.apply(this, [event, normalized]); }); } }; var Mousewheel = { bind: function bind(el, binding) { mousewheel(el, binding.value); } }; _export(_export.S, 'Number', { isNaN: function isNaN(number) { return number != number; } }); var isNan = _core.Number.isNaN; var isNan$1 = isNan; _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperty: _objectDp.f }); var $Object = _core.Object; var defineProperty = function defineProperty(it, key, desc) { return $Object.defineProperty(it, key, desc); }; var defineProperty$1 = defineProperty; var hasInitZIndex = false; var zIndex; (function () { if (!window['__bk_zIndex_manager']) { var zIndexManager = { nextZIndex: function nextZIndex() { var zIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default'; return zIndex === 'default' ? zIndexManager.zIndex++ : zIndex; }, nextTickIndex: function nextTickIndex() { var tick = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; var zIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default'; if (zIndex === 'default') { zIndexManager.zIndex += tick; return zIndexManager.zIndex; } return zIndex; } }; defineProperty$1(zIndexManager, 'zIndex', { configurable: true, get: function get() { if (!hasInitZIndex) { zIndex = zIndex || (Vue.prototype.$BK_EL || {}).zIndex || 2000; hasInitZIndex = true; } return zIndex; }, set: function set(value) { zIndex = value; } }); window['__bk_zIndex_manager'] = zIndexManager; } })(); var zIndexManager = window['__bk_zIndex_manager']; var script = { name: 'bk-loading', props: { isLoading: { type: Boolean, default: false }, title: { type: [String, Object], default: '' }, mode: { type: String, default: 'normal' }, size: { type: String, default: 'large' }, theme: { type: String, default: 'colorful' }, delay: { type: Number, default: 0 }, immediate: { type: Boolean, default: false }, opacity: { type: Number, default: 0.9 }, color: { type: String, default: '#ffffff' }, zIndex: { type: Number }, afterLeave: { type: Function }, extCls: { type: String, default: '' }, type: { type: String, default: 'default' } }, data: function data() { return { timer: 0, hide: false, duration: 500, isShow: false }; }, computed: { isSpin: function isSpin() { return this.mode === 'spin'; }, bgColor: function bgColor() { var color = this.color.replace(/\s/gm, ''); if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(color)) { var colors = color.substring(1).split(''); if (colors.length === 3) { colors = [colors[0], colors[0], colors[1], colors[1], colors[2], colors[2]]; } colors = '0x' + colors.join(''); return 'rgba(' + [colors >> 16 & 255, colors >> 8 & 255, colors & 255].join(',') + ",".concat(this.opacity, ")"); } else if (/^rgba?\(([^\)]+)\)/.test(color)) { return color.replace(/^rgb\(([^\)]+)\)/, "rgba($1,".concat(this.opacity, ")")); } return this.color; }, computedClass: function computedClass() { return this.isSpin ? "bk-spin-loading bk-spin-loading-".concat(this.size, " bk-spin-loading-").concat(this.theme) : "bk-loading1 bk-".concat(this.theme, " bk-size-").concat(this.size); }, hasZIndexOption: function hasZIndexOption() { if (this.type === 'fixed') { return; } return typeof this.zIndex === 'number' && !isNan$1(this.zIndex); } }, watch: { hide: function hide(newVal) { var _this = this; if (newVal) { var delay = isNaN(this.delay) ? 0 : Number(this.delay); clearTimeout(this.timer); if (delay > 0) { this.timer = setTimeout(function () { _this.hideLoading(); }, delay); } else { this.hideLoading(); } } }, isShow: function isShow(newVal) { if (newVal && !this.hasZIndexOption) { this.zIndex = zIndexManager.nextZIndex(); } }, isLoading: { handler: function handler(newVal) { if (this.type === 'default') { if (newVal) { this.isShow = newVal; } else { this.hide = true; } } }, immediate: true } }, mounted: function mounted() { this.hide = false; }, methods: { hideLoading: function hideLoading() { this.isShow = false; this.$el.addEventListener('transitionend', this.destroyEl); }, destroyEl: function destroyEl() { this.$el.removeEventListener('transitionend', this.destroyEl); this.$destroy(); this.$el.parentNode.removeChild(this.$el); }, animationFinish: function animationFinish() { if (this.afterLeave && typeof this.afterLeave === 'function') { this.afterLeave(); } } } }; 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 _vm.type === 'default' ? _c('div', { staticClass: "bk-loading bk-default-loading", class: _vm.extCls, style: { position: 'relative' } }, [_c('div', { staticClass: "bk-loading-body" }, [_vm._t("default")], 2), _c('transition', { attrs: { "name": "fade", "duration": { enter: _vm.duration } }, on: { "after-leave": _vm.animationFinish } }, [_c('div', { directives: [{ name: "show", rawName: "v-show", value: _vm.isShow, expression: "isShow" }], staticClass: "bk-loading-wrapper", style: { zIndex: _vm.zIndex, backgroundColor: _vm.bgColor } }, [_c('div', { class: _vm.computedClass }, [_vm.isSpin ? [_c('div', { staticClass: "rotate rotate1" }), _c('div', { staticClass: "rotate rotate2" }), _c('div', { staticClass: "rotate rotate3" }), _c('div', { staticClass: "rotate rotate4" }), _c('div', { staticClass: "rotate rotate5" }), _c('div', { staticClass: "rotate rotate6" }), _c('div', { staticClass: "rotate rotate7" }), _c('div', { staticClass: "rotate rotate8" })] : [_c('div', { staticClass: "point point1" }), _c('div', { staticClass: "point point2" }), _c('div', { staticClass: "point point3" }), _c('div', { staticClass: "point point4" })]], 2), _c('div', { staticClass: "bk-loading-title" }, [_vm._t("title", [_vm._v(_vm._s(_vm.title))])], 2)])])], 1) : _c('transition', { attrs: { "name": "fade", "duration": { enter: _vm.duration } }, on: { "after-leave": _vm.animationFinish } }, [_c('div', { directives: [{ name: "show", rawName: "v-show", value: _vm.isShow, expression: "isShow" }], staticClass: "bk-loading", class: _vm.extCls, style: { position: _vm.type, zIndex: _vm.zIndex, backgroundColor: _vm.bgColor } }, [_c('div', { staticClass: "bk-loading-wrapper" }, [_c('div', { class: _vm.computedClass }, [_vm.isSpin ? [_c('div', { staticClass: "rotate rotate1" }), _c('div', { staticClass: "rotate rotate2" }), _c('div', { staticClass: "rotate rotate3" }), _c('div', { staticClass: "rotate rotate4" }), _c('div', { staticClass: "rotate rotate5" }), _c('div', { staticClass: "rotate rotate6" }), _c('div', { staticClass: "rotate rotate7" }), _c('div', { staticClass: "rotate rotate8" })] : [_c('div', { staticClass: "point point1" }), _c('div', { staticClass: "point point2" }), _c('div', { staticClass: "point point3" }), _c('div', { staticClass: "point point4" })]], 2), _c('div', { staticClass: "bk-loading-title" }, [_vm._t("title", [_vm._v(_vm._s(_vm.title))])], 2)])])]); }; 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 Model = Vue.extend(__vue_component__); function show(el, options) { if (!el.$vm) { el.$vm = el.viewmodel.$mount(); el.appendChild(el.$vm.$el); } el.$vm.duration = 0; Vue.nextTick(function () { el.$vm.isShow = true; }); } function toggle(el, options) { if (!el.$vm) { el.$vm = el.viewmodel.$mount(); el.appendChild(el.$vm.$el); } clearTimeout(el.$vm.timer); if (options.isLoading) { Vue.nextTick(function () { el.$vm.isShow = true; }); } else { var delay = isNaN(options.delay) ? 0 : Number(options.delay); if (delay > 0) { el.$vm.timer = setTimeout(function () { el.$vm.isShow = false; }, delay); } else { el.$vm.isShow = false; } } if (options.title) { el.$vm.title = options.title; } } var bkLoading = { inserted: function inserted(el, binding) { var value = binding.value; var position = getComputedStyle(el).position; var options = {}; if (!position || position !== 'relative' || position !== 'absolute') { el.style.position = 'relative'; } for (var key in value) { if (key !== 'isLoading') { options[key] = value[key]; } } options.delay = 3000; options.type = 'absolute'; options.opacity = options.opacity || 0.9; options.color = options.color || '#ffffff'; el.viewmodel = new Model({ propsData: options }); if (options.immediate) { show(el, binding.value); } else { toggle(el, binding.value); } }, update: function update(el, binding) { toggle(el, binding.value); } }; var _toObject = function (it) { return Object(_defined(it)); }; 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; var _redefine = _hide; var _meta = createCommonjsModule(function (module) { var META = _uid('meta'); var setDesc = _objectDp.f; var id = 0; var isExtensible = Object.isExtensible || function () { return true; }; var FREEZE = !_fails(function () { return isExtensible(Object.preventExtensions({})); }); var setMeta = function (it) { setDesc(it, META, { value: { i: 'O' + ++id, w: {} } }); }; var fastKey = function (it, create) { if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!_has(it, META)) { if (!isExtensible(it)) return 'F'; if (!create) return 'E'; setMeta(it); } return it[META].i; }; var getWeak = function (it, create) { if (!_has(it, META)) { if (!isExtensible(it)) return true; if (!create) return false; setMeta(it); } return it[META].w; }; var onFreeze = function (it) { if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it); return it; }; var meta = module.exports = { KEY: META, NEED: false, fastKey: fastKey, getWeak: getWeak, onFreeze: onFreeze }; }); var _meta_1 = _meta.KEY; var _meta_2 = _meta.NEED; var _meta_3 = _meta.fastKey; var _meta_4 = _meta.getWeak; var _meta_5 = _meta.onFreeze; var _wks = createCommonjsModule(function (module) { var store = _shared('wks'); var Symbol = _global.Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name)); }; $exports.store = store; }); var def = _objectDp.f; var TAG = _wks('toStringTag'); var _setToStringTag = function (it, tag, stat) { if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); }; var f$2 = _wks; var _wksExt = { f: f$2 }; var defineProperty$2 = _objectDp.f; var _wksDefine = function (name) { var $Symbol = _core.Symbol || (_core.Symbol = {} ); if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty$2($Symbol, name, { value: _wksExt.f(name) }); }; var f$3 = Object.getOwnPropertySymbols; var _objectGops = { f: f$3 }; var _enumKeys = function (it) { var result = _objectKeys(it); var getSymbols = _objectGops.f; if (getSymbols) { var symbols = getSymbols(it); var isEnum = _objectPie.f; var i = 0; var key; while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); } return result; }; var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) { _anObject(O); var keys = _objectKeys(Properties); var length = keys.length; var i = 0; var P; while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]); return O; }; var document$2 = _global.document; var _html = document$2 && document$2.documentElement; var IE_PROTO$1 = _sharedKey('IE_PROTO'); var Empty = function () { }; var PROTOTYPE$1 = 'prototype'; var createDict = function () { var iframe = _domCreate('iframe'); var i = _enumBugKeys.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; _html.appendChild(iframe); iframe.src = 'javascript:'; iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]]; return createDict(); }; var _objectCreate = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty[PROTOTYPE$1] = _anObject(O); result = new Empty(); Empty[PROTOTYPE$1] = null; result[IE_PROTO$1] = O; } else result = createDict(); return Properties === undefined ? result : _objectDps(result, Properties); }; var hiddenKeys = _enumBugKeys.concat('length', 'prototype'); var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return _objectKeysInternal(O, hiddenKeys); }; var _objectGopn = { f: f$4 }; var gOPN = _objectGopn.f; var toString$1 = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return gOPN(it); } catch (e) { return windowNames.slice(); } }; var f$5 = function getOwnPropertyNames(it) { return windowNames && toString$1.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it)); }; var _objectGopnExt = { f: f$5 }; var gOPD = Object.getOwnPropertyDescriptor; var f$6 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) { O = _toIobject(O); P = _toPrimitive(P, true); if (_ie8DomDefine) try { return gOPD(O, P); } catch (e) { } if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]); }; var _objectGopd = { f: f$6 }; var META = _meta.KEY; var gOPD$1 = _objectGopd.f; var dP$1 = _objectDp.f; var gOPN$1 = _objectGopnExt.f; var $Symbol = _global.Symbol; var $JSON = _global.JSON; var _stringify = $JSON && $JSON.stringify; var PROTOTYPE$2 = 'prototype'; var HIDDEN = _wks('_hidden'); var TO_PRIMITIVE = _wks('toPrimitive'); var isEnum$1 = {}.propertyIsEnumerable; var SymbolRegistry = _shared('symbol-registry'); var AllSymbols = _shared('symbols'); var OPSymbols = _shared('op-symbols'); var ObjectProto = Object[PROTOTYPE$2]; var USE_NATIVE = typeof $Symbol == 'function' && !!_objectGops.f; var QObject = _global.QObject; var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild; var setSymbolDesc = _descriptors && _fails(function () { return _objectCreate(dP$1({}, 'a', { get: function () { return dP$1(this, 'a', { value: 7 }).a; } })).a != 7; }) ? function (it, key, D) { var protoDesc = gOPD$1(ObjectProto, key); if (protoDesc) delete ObjectProto[key]; dP$1(it, key, D); if (protoDesc && it !== ObjectProto) dP$1(ObjectProto, key, protoDesc); } : dP$1; var wrap = function (tag) { var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]); sym._k = tag; return sym; }; var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { return typeof it == 'symbol'; } : function (it) { return it instanceof $Symbol; }; var $defineProperty = function defineProperty(it, key, D) { if (it === ObjectProto) $defineProperty(OPSymbols, key, D); _anObject(it); key = _toPrimitive(key, true); _anObject(D); if (_has(AllSymbols, key)) { if (!D.enumerable) { if (!_has(it, HIDDEN)) dP$1(it, HIDDEN, _propertyDesc(1, {})); it[HIDDEN][key] = true; } else { if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; D = _objectCreate(D, { enumerable: _propertyDesc(0, false) }); } return setSymbolDesc(it, key, D); } return dP$1(it, key, D); }; var $defineProperties = function defineProperties(it, P) { _anObject(it); var keys = _enumKeys(P = _toIobject(P)); var i = 0; var l = keys.length; var key; while (l > i) $defineProperty(it, key = keys[i++], P[key]); return it; }; var $create = function create(it, P) { return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P); }; var $propertyIsEnumerable = function propertyIsEnumerable(key) { var E = isEnum$1.call(this, key = _toPrimitive(key, true)); if (this === ObjectProto && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false; return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { it = _toIobject(it); key = _toPrimitive(key, true); if (it === ObjectProto && _has(AllSymbols, key) && !_has(OPSymbols, key)) return; var D = gOPD$1(it, key); if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; return D; }; var $getOwnPropertyNames = function getOwnPropertyNames(it) { var names = gOPN$1(_toIobject(it)); var result = []; var i = 0; var key; while (names.length > i) { if (!_has(AllSymbols, key = names[i++]) && key != HI