bk-magic-vue
Version:
基于蓝鲸 Magicbox 和 Vue 的前端组件库
1,462 lines (1,389 loc) • 58.7 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('bk-magic-vue/lib/locale')) :
typeof define === 'function' && define.amd ? define(['exports', 'bk-magic-vue/lib/locale'], factory) :
(global = global || self, factory(global.library = {}, global.locale));
}(this, function (exports, locale) { 'use strict';
locale = locale && locale.hasOwnProperty('default') ? locale['default'] : locale;
function _regeneratorRuntime() {
_regeneratorRuntime = function () {
return exports;
};
var exports = {},
Op = Object.prototype,
hasOwn = Op.hasOwnProperty,
defineProperty = Object.defineProperty || function (obj, key, desc) {
obj[key] = desc.value;
},
$Symbol = "function" == typeof Symbol ? Symbol : {},
iteratorSymbol = $Symbol.iterator || "@@iterator",
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}), obj[key];
}
try {
define({}, "");
} catch (err) {
define = function (obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
generator = Object.create(protoGenerator.prototype),
context = new Context(tryLocsList || []);
return defineProperty(generator, "_invoke", {
value: makeInvokeMethod(innerFn, self, context)
}), generator;
}
function tryCatch(fn, obj, arg) {
try {
return {
type: "normal",
arg: fn.call(obj, arg)
};
} catch (err) {
return {
type: "throw",
arg: err
};
}
}
exports.wrap = wrap;
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
define(IteratorPrototype, iteratorSymbol, function () {
return this;
});
var getProto = Object.getPrototypeOf,
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function (method) {
define(prototype, method, function (arg) {
return this._invoke(method, arg);
});
});
}
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if ("throw" !== record.type) {
var result = record.arg,
value = result.value;
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
invoke("next", value, resolve, reject);
}, function (err) {
invoke("throw", err, resolve, reject);
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
result.value = unwrapped, resolve(result);
}, function (error) {
return invoke("throw", error, resolve, reject);
});
}
reject(record.arg);
}
var previousPromise;
defineProperty(this, "_invoke", {
value: function (method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function (resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
}
});
}
function makeInvokeMethod(innerFn, self, context) {
var state = "suspendedStart";
return function (method, arg) {
if ("executing" === state) throw new Error("Generator is already running");
if ("completed" === state) {
if ("throw" === method) throw arg;
return doneResult();
}
for (context.method = method, context.arg = arg;;) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
if ("suspendedStart" === state) throw state = "completed", context.arg;
context.dispatchException(context.arg);
} else "return" === context.method && context.abrupt("return", context.arg);
state = "executing";
var record = tryCatch(innerFn, self, context);
if ("normal" === record.type) {
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
return {
value: record.arg,
done: context.done
};
}
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
}
};
}
function maybeInvokeDelegate(delegate, context) {
var methodName = context.method,
method = delegate.iterator[methodName];
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
var record = tryCatch(method, delegate.iterator, context.arg);
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
var info = record.arg;
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
}
function pushTryEntry(locs) {
var entry = {
tryLoc: locs[0]
};
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal", delete record.arg, entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{
tryLoc: "root"
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
}
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) return iteratorMethod.call(iterable);
if ("function" == typeof iterable.next) return iterable;
if (!isNaN(iterable.length)) {
var i = -1,
next = function next() {
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
return next.value = undefined, next.done = !0, next;
};
return next.next = next;
}
}
return {
next: doneResult
};
}
function doneResult() {
return {
value: undefined,
done: !0
};
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
value: GeneratorFunctionPrototype,
configurable: !0
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
value: GeneratorFunction,
configurable: !0
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
var ctor = "function" == typeof genFun && genFun.constructor;
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
}, exports.mark = function (genFun) {
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
}, exports.awrap = function (arg) {
return {
__await: arg
};
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
return this;
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
void 0 === PromiseImpl && (PromiseImpl = Promise);
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
return result.done ? result.value : iter.next();
});
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
return this;
}), define(Gp, "toString", function () {
return "[object Generator]";
}), exports.keys = function (val) {
var object = Object(val),
keys = [];
for (var key in object) keys.push(key);
return keys.reverse(), function next() {
for (; keys.length;) {
var key = keys.pop();
if (key in object) return next.value = key, next.done = !1, next;
}
return next.done = !0, next;
};
}, exports.values = values, Context.prototype = {
constructor: Context,
reset: function (skipTempReset) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
},
stop: function () {
this.done = !0;
var rootRecord = this.tryEntries[0].completion;
if ("throw" === rootRecord.type) throw rootRecord.arg;
return this.rval;
},
dispatchException: function (exception) {
if (this.done) throw exception;
var context = this;
function handle(loc, caught) {
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i],
record = entry.completion;
if ("root" === entry.tryLoc) return handle("end");
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc"),
hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
} else if (hasCatch) {
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
} else {
if (!hasFinally) throw new Error("try statement without catch or finally");
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
}
}
}
},
abrupt: function (type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
var record = finallyEntry ? finallyEntry.completion : {};
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
},
complete: function (record, afterLoc) {
if ("throw" === record.type) throw record.arg;
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
},
finish: function (finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
}
},
catch: function (tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if ("throw" === record.type) {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function (iterable, resultName, nextLoc) {
return this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
}
}, exports;
}
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 _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.");
}
var checkboxSeed = 0;
var groupSeed = 0;
function getCheckboxName() {
return "bk-checkbox_".concat(checkboxSeed++);
}
function getGroupName() {
return "bk-checkbox-group_".concat(groupSeed++);
}
var script = {
name: 'bk-checkbox-group',
provide: function provide() {
return {
handleAddItem: this.handleAddItem,
handleRemoveItem: this.handleRemoveItem
};
},
props: {
value: {
type: Array,
default: function _default() {
return [];
}
},
name: {
type: [String, Number],
default: function _default() {
return getGroupName();
}
}
},
data: function data() {
return {
checkboxItems: [],
isCheckboxGroup: true,
localValue: _toConsumableArray(this.value)
};
},
watch: {
value: function value(_value) {
this.localValue = _toConsumableArray(_value);
}
},
methods: {
handleAddItem: function handleAddItem(item) {
if (!item || this.checkboxItems.includes(item)) return;
this.checkboxItems.push(item);
},
handleRemoveItem: function handleRemoveItem(item) {
var index = this.checkboxItems.indexOf(item);
if (index > -1) {
this.checkboxItems.splice(index, 1);
}
},
handleChange: function handleChange(checked, value) {
var oldValue = _toConsumableArray(this.localValue);
var localValue = [];
this.checkboxItems.forEach(function (checkbox) {
var params = checkbox.getValue();
if (params.isChecked) {
localValue.push(params.value);
}
});
this.localValue = localValue;
this.$emit('input', this.localValue);
this.$emit('change', this.localValue, oldValue);
}
}
};
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('div', {
staticClass: "bk-form-control",
attrs: {
"name": _vm.name
}
}, [_vm._t("default")], 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 _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 = _global.document;
var is = _isObject(document) && _isObject(document.createElement);
var _domCreate = function (it) {
return is ? document.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__);
var emitter = {
methods: {
dispatch: function dispatch(componentName, eventName, params) {
var parent = this.$parent || this.$root;
var name = parent.$options.name;
while (parent && (!name || name !== componentName)) {
parent = parent.$parent;
if (parent) {
name = parent.$options.name;
}
}
if (parent) {
parent.$emit.apply(parent, [eventName].concat(params));
}
}
}
};
var script$1 = {
name: 'bk-checkbox',
mixins: [emitter],
inject: {
handleRemoveItem: {
default: null
},
handleAddItem: {
default: null
}
},
props: {
value: {
type: [String, Number, Boolean],
default: undefined
},
checked: {
type: Boolean,
default: undefined
},
trueValue: {
type: [String, Number, Boolean],
default: true
},
falseValue: {
type: [String, Number, Boolean],
default: false
},
label: {
type: [String, Number]
},
name: {
type: String,
default: function _default() {
return getCheckboxName();
}
},
disabled: Boolean,
indeterminate: Boolean,
extCls: {
type: String,
default: ''
},
beforeChange: Function
},
data: function data() {
return {
parent: null,
localValue: undefined
};
},
computed: {
selected: function selected() {
return this.localValue === this.localTrueValue;
},
parentValue: function parentValue() {
return this.parent ? this.parent.localValue : null;
},
localTrueValue: function localTrueValue() {
var localValue;
if (this.parent) {
if (this.label === undefined && this.value === undefined) {
localValue = this.trueValue;
} else if (this.value !== undefined) {
localValue = this.value;
} else {
localValue = this.label;
}
} else {
if (this.label === undefined) {
localValue = this.trueValue;
} else {
localValue = this.label;
}
}
return localValue;
}
},
watch: {
value: function value(val) {
this.setLocalValue(val);
},
checked: function checked() {
this.setLocalValue();
},
parentValue: function parentValue() {
this.setLocalValue();
}
},
created: function created() {
if (this.handleAddItem && typeof this.handleAddItem === 'function') {
this.handleAddItem(this);
}
this.init();
},
destroyed: function destroyed() {
if (this.handleRemoveItem && typeof this.handleRemoveItem === 'function') {
this.handleRemoveItem(this);
}
},
methods: {
getValue: function getValue() {
if (this.selected) {
return {
isChecked: true,
value: this.localTrueValue
};
} else {
return {
isChecked: false,
value: this.falseValue
};
}
},
init: function init() {
var parent = this.$parent;
while (parent && !parent.isCheckboxGroup && !parent.$options.name !== 'bk-checkbox-group') {
parent = parent.$parent;
}
this.parent = parent;
this.setLocalValue();
},
setLocalValue: function setLocalValue(val) {
if (val !== undefined) {
this.localValue = val;
return;
}
if (this.parent) {
var trueValue = this.localTrueValue;
var isSelected = this.parent.localValue.includes(trueValue);
this.localValue = isSelected ? trueValue : this.falseValue;
} else {
if (this.checked !== undefined) {
this.localValue = this.checked ? this.localTrueValue : this.falseValue;
} else if (this.value === undefined) {
this.localValue = this.falseValue;
} else {
this.localValue = this.value;
}
}
},
handleClick: function handleClick() {
var _this = this;
return _asyncToGenerator( _regeneratorRuntime().mark(function _callee() {
var shouldChange, oldValue, newValue, groupValue;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
if (!_this.disabled) {
_context.next = 2;
break;
}
return _context.abrupt("return", false);
case 2:
if (!(typeof _this.beforeChange === 'function')) {
_context.next = 8;
break;
}
_context.next = 5;
return _this.beforeChange();
case 5:
shouldChange = _context.sent;
if (!(shouldChange === false)) {
_context.next = 8;
break;
}
return _context.abrupt("return");
case 8:
oldValue = _this.localValue;
if (_this.indeterminate) {
newValue = _this.localTrueValue;
} else {
newValue = oldValue === _this.localTrueValue ? _this.falseValue : _this.localTrueValue;
}
_this.localValue = newValue;
_this.$emit('input', newValue, _this.localTrueValue);
_this.$emit('change', newValue, oldValue, _this.localTrueValue);
_this.dispatch('bk-form-item', 'form-change');
if (_this.parent) {
groupValue = _this.localTrueValue === undefined ? newValue : _this.localTrueValue;
_this.parent.handleChange(_this.selected, groupValue);
}
case 15:
case "end":
return _context.stop();
}
}, _callee);
}))();
}
}
};
/* script */
var __vue_script__$1 = script$1;
/* template */
var __vue_render__$1 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('label', {
staticClass: "bk-form-checkbox",
class: [{
'is-disabled': _vm.disabled,
'is-indeterminate': _vm.indeterminate,
'is-checked': _vm.selected
}, _vm.extCls],
on: {
"click": _vm.handleClick,
"keydown": function keydown($event) {
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
return null;
}
$event.preventDefault();
return _vm.handleClick.apply(null, arguments);
}
}
}, [_c('span', {
staticClass: "bk-checkbox",
attrs: {
"tabindex": _vm.disabled ? false : 0
}
}), _c('input', {
attrs: {
"type": "hidden",
"name": _vm.name
},
domProps: {
"value": _vm.label === undefined ? _vm.localValue : _vm.label
}
}), _vm.$slots.default ? _c('span', {
staticClass: "bk-checkbox-text"
}, [_vm._t("default")], 2) : _vm._e()]);
};
var __vue_staticRenderFns__$1 = [];
/* style */
var __vue_inject_styles__$1 = undefined;
/* scoped */
var __vue_scope_id__$1 = undefined;
/* module identifier */
var __vue_module_identifier__$1 = undefined;
/* functional template */
var __vue_is_functional_template__$1 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$1 = /*#__PURE__*/normalizeComponent_1({
render: __vue_render__$1,
staticRenderFns: __vue_staticRenderFns__$1
}, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
setInstaller(__vue_component__$1);
var script$2 = {
name: 'bk-spin',
props: {
theme: {
type: String,
default: 'primary',
validator: function validator(value) {
if (!['default', 'primary', 'warning', 'success', 'danger', 'info'].includes(value)) {
console.error("theme property is not valid: '".concat(value, "'"));
return false;
}
return true;
}
},
size: {
type: String,
default: 'small',
validator: function validator(value) {
if (!['large', 'normal', 'small', 'mini'].includes(value)) {
console.error("size property is not valid: '".concat(value, "'"));
return false;
}
return true;
}
},
icon: {
type: String,
default: ''
},
extCls: {
type: String,
default: ''
},
placement: {
type: String,
default: 'bottom',
validator: function validator(value) {
if (!['bottom', 'right'].includes(value)) {
console.error("placement property is not valid: '".concat(value, "'"));
return false;
}
return true;
}
},
spinning: {
type: Boolean,
default: true
}
},
data: function data() {
return {};
},
computed: {
dotClass: function dotClass() {
var dotClass = ["bk-spin-rotation", "bk-spin-rotation-".concat(this.size), "bk-spin-rotation-".concat(this.theme)];
!this.spinning && dotClass.push("bk-spin-rotation-".concat(this.theme, "-wait"));
this.placement === 'right' && dotClass.push("bk-spin-rotation-flex");
this.placement === 'bottom' && dotClass.push("bk-spin-rotation-margin");
return dotClass;
},
slotTypeClass: function slotTypeClass() {
var slotType = ["rotate"];
this.$slots.default && this.placement === 'right' && slotType.push("slots-".concat(this.placement, "-rotate"));
return slotType;
},
iconClass: function iconClass() {
var iconClass = ["bk-spin-icon", "bk-spin-icon-".concat(this.size), "bk-spin-icon-".concat(this.theme)];
!this.spinning && iconClass.push("bk-spin-icon-wait");
this.placement === 'right' && iconClass.push("bk-display-flex");
return iconClass;
},
slotClass: function slotClass() {
var slotClass = ["bk-spin-title", "bk-spin-title-".concat(this.placement)];
this.placement === 'right' && slotClass.push("bk-spin-title-".concat(this.size), "bk-display-flex");
return slotClass;
}
}
};
/* script */
var __vue_script__$2 = script$2;
/* template */
var __vue_render__$2 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('transition', {
attrs: {
"name": "fade"
}
}, [_c('div', {
class: ['bk-spin', _vm.extCls]
}, [_c('div', {
style: {
display: _vm.placement === 'right' ? 'flex' : ''
}
}, [!_vm.icon ? _c('div', {
class: [_vm.dotClass]
}, [_c('div', {
staticClass: "rotate1",
class: _vm.slotTypeClass
}), _c('div', {
staticClass: "rotate2",
class: _vm.slotTypeClass
}), _c('div', {
staticClass: "rotate3",
class: _vm.slotTypeClass
}), _c('div', {
staticClass: "rotate4",
class: _vm.slotTypeClass
}), _c('div', {
staticClass: "rotate5",
class: _vm.slotTypeClass
}), _c('div', {
staticClass: "rotate6",
class: _vm.slotTypeClass
}), _c('div', {
staticClass: "rotate7",
class: _vm.slotTypeClass
}), _c('div', {
staticClass: "rotate8",
class: _vm.slotTypeClass
})]) : _vm._e(), _vm.icon ? _c('div', {
class: [_vm.iconClass]
}, [_c('i', {
class: ['bk-icon', 'icon-' + _vm.icon]
})]) : _vm._e(), _vm.$slots.default ? _c('div', {
class: [_vm.slotClass]
}, [_vm._t("default")], 2) : _vm._e()])])]);
};
var __vue_staticRenderFns__$2 = [];
/* style */
var __vue_inject_styles__$2 = undefined;
/* scoped */
var __vue_scope_id__$2 = undefined;
/* module identifier */
var __vue_module_identifier__$2 = undefined;
/* functional template */
var __vue_is_functional_template__$2 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$2 = /*#__PURE__*/normalizeComponent_1({
render: __vue_render__$2,
staticRenderFns: __vue_staticRenderFns__$2
}, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
setInstaller(__vue_component__$2);
var script$3 = {
name: 'bk-button',
components: {
BkSpin: __vue_component__$2
},
props: {
theme: {
type: String,
default: 'default',
validator: function validator(value) {
if (['default', 'primary', 'warning', 'success', 'danger'].indexOf(value) < 0) {
console.error("theme property is not valid: '".concat(value, "'"));
return false;
}
return true;
}
},
hoverTheme: {
type: String,
default: '',
validator: function validator(value) {
if (['', 'primary', 'warning', 'success', 'danger'].indexOf(value) < 0) {
console.error("hoverTheme property is not valid: '".concat(value, "'"));
return false;
}
return true;
}
},
size: {
type: String,
default: 'normal',
validator: function validator(value) {
if (['small', 'normal', 'large'].indexOf(value) < 0) {
console.error("size property is not valid: '".concat(value, "'"));
return false;
}
return true;
}
},
title: {
type: String,
default: ''
},
icon: String,
iconRight: String,
disabled: Boolean,
loading: Boolean,
outline: Boolean,
text: Boolean,
nativeType: {
type: String,
default: 'button'
},
extCls: {
type: String,
default: ''
}
},
data: function data() {
return {
showSlot: true
};
},
computed: {
iconType: function iconType() {
var icon = this.icon || '';
if (icon) {
if (icon.indexOf('icon') === 0) {
icon = icon.replace(/^(icon-)/, '');
}
}
return icon;
},
iconRightType: function iconRightType() {
var iconRight = this.iconRight || '';
if (iconRight) {
if (iconRight.indexOf('icon') === 0) {
iconRight = iconRight.replace(/^(icon-)/, '');
}
}
return iconRight;
},
themeType: function themeType() {
if (this.text) {
if (this.theme === 'default') {
return 'primary';
}
}
return this.theme;
},
buttonCls: function buttonCls() {
return ["bk-".concat(this.themeType), "bk-button-".concat(this.size), this.hoverTheme ? "bk-button-hover bk-".concat(this.hoverTheme) : this.text ? 'bk-button-text' : 'bk-button', this.disabled ? 'is-disabled' : '', this.loading ? 'is-loading' : '', this.outline ? 'is-outline' : '', !this.showSlot ? 'no-slot' : ''];
}
},
mounted: function mounted() {
this.showSlot = this.$slots.default !== undefined;
},
methods: {
handleClick: function handleClick(e) {
if (!this.disabled && !this.loading) {
this.$emit('click', e);
this.$el.blur();
}
}
}
};
/* script */
var __vue_script__$3 = script$3;
/* template */
var __vue_render__$3 = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('button', _vm._b({
class: [_vm.buttonCls, _vm.extCls],
attrs: {
"title": _vm.title,
"disabled": _vm.disabled,
"type": _vm.nativeType
},
on: {
"click": _vm.handleClick
}
}, 'button', _vm.$attrs, false), [_vm.loading ? _c('div', {
staticClass: "bk-button-loading"
}, [!_vm.text ? [_c('div', {
staticClass: "bounce bounce1"
}), _c('div', {
staticClass: "bounce bounce2"
}), _c('div', {
staticClass: "bounce bounce3"
}), _c('div', {
staticClass: "bounce bounce4"
})] : [_c('bk-spin', {
attrs: {
"size": "mini",
"theme": _vm.theme
}
})]], 2) : _vm._e(), _c('div', {
class: _vm.loading ? 'bk-loading-wrapper' : ''
}, [_vm.iconType ? _c('i', {
staticClass: "bk-icon left-icon",
class: ['icon-' + _vm.iconType, _vm.iconType === 'loading' ? 'bk-button-icon-loading' : '']
}, [_vm.iconType === 'loading' ? [_c('span', {
staticClass: "loading"
})] : _vm._e()], 2) : _vm._e(), _c('span', [_vm._t("default")], 2), _vm.iconRightType ? _c('i', {
staticClass: "bk-icon right-icon",
class: ['icon-' + _vm.iconRightType, _vm.iconRightType === 'loading' ? 'bk-button-icon-loading' : '']
}, [_vm.iconRightType === 'loading' ? [_c('span', {
staticClass: "loading"
})] : _vm._e()], 2) : _vm._e()])]);
};
var __vue_staticRenderFns__$3 = [];
/* style */
var __vue_inject_styles__$3 = undefined;
/* scoped */
var __vue_scope_id__$3 = undefined;
/* module identifier */
var __vue_module_identifier__$3 = undefined;
/* functional template */
var __vue_is_functional_template__$3 = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__$3 = /*#__PURE__*/normalizeComponent_1({
render: __vue_render__$3,
staticRenderFns: __vue_staticRenderFns__$3
}, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
setInstaller(__vue_component__$3);
var script$4 = {
name: 'bk-table-setting-content',
components: {
bkCheckboxGroup: __vue_component__,
bkCheckbox: __vue_component__$1,
bkButton: __vue_component__$3
},
mixins: [locale.mixin],
props: {
fields: {
type: Array,
default: function _default() {
return [];
}
},
selected: {
type: Array,
default: function _default() {
return [];
}
},