|
|
@@ -526,33 +526,10 @@
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- var aFunction$1 = function (it) {
|
|
|
- if (typeof it != 'function') {
|
|
|
- throw TypeError(String(it) + ' is not a function');
|
|
|
- } return it;
|
|
|
- };
|
|
|
-
|
|
|
- // optional / simple context binding
|
|
|
- var bindContext = function (fn, that, length) {
|
|
|
- aFunction$1(fn);
|
|
|
- if (that === undefined) return fn;
|
|
|
- switch (length) {
|
|
|
- case 0: return function () {
|
|
|
- return fn.call(that);
|
|
|
- };
|
|
|
- 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 (/* ...args */) {
|
|
|
- return fn.apply(that, arguments);
|
|
|
- };
|
|
|
+ // `IsArray` abstract operation
|
|
|
+ // https://tc39.github.io/ecma262/#sec-isarray
|
|
|
+ var isArray = Array.isArray || function isArray(arg) {
|
|
|
+ return classofRaw(arg) == 'Array';
|
|
|
};
|
|
|
|
|
|
// `ToObject` abstract operation
|
|
|
@@ -561,10 +538,10 @@
|
|
|
return Object(requireObjectCoercible(argument));
|
|
|
};
|
|
|
|
|
|
- // `IsArray` abstract operation
|
|
|
- // https://tc39.github.io/ecma262/#sec-isarray
|
|
|
- var isArray = Array.isArray || function isArray(arg) {
|
|
|
- return classofRaw(arg) == 'Array';
|
|
|
+ var createProperty = function (object, key, value) {
|
|
|
+ var propertyKey = toPrimitive(key);
|
|
|
+ if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
|
+ else object[propertyKey] = value;
|
|
|
};
|
|
|
|
|
|
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
|
@@ -607,6 +584,119 @@
|
|
|
} return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
|
|
|
};
|
|
|
|
|
|
+ var userAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
|
+
|
|
|
+ var process = global_1.process;
|
|
|
+ var versions = process && process.versions;
|
|
|
+ var v8 = versions && versions.v8;
|
|
|
+ var match, version;
|
|
|
+
|
|
|
+ if (v8) {
|
|
|
+ match = v8.split('.');
|
|
|
+ version = match[0] + match[1];
|
|
|
+ } else if (userAgent) {
|
|
|
+ match = userAgent.match(/Edge\/(\d+)/);
|
|
|
+ if (!match || match[1] >= 74) {
|
|
|
+ match = userAgent.match(/Chrome\/(\d+)/);
|
|
|
+ if (match) version = match[1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var v8Version = version && +version;
|
|
|
+
|
|
|
+ var SPECIES$1 = wellKnownSymbol('species');
|
|
|
+
|
|
|
+ var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
|
+ // We can't use this feature detection in V8 since it causes
|
|
|
+ // deoptimization and serious performance degradation
|
|
|
+ // https://github.com/zloirock/core-js/issues/677
|
|
|
+ return v8Version >= 51 || !fails(function () {
|
|
|
+ var array = [];
|
|
|
+ var constructor = array.constructor = {};
|
|
|
+ constructor[SPECIES$1] = function () {
|
|
|
+ return { foo: 1 };
|
|
|
+ };
|
|
|
+ return array[METHOD_NAME](Boolean).foo !== 1;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
|
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
|
+ var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
|
+
|
|
|
+ // We can't use this feature detection in V8 since it causes
|
|
|
+ // deoptimization and serious performance degradation
|
|
|
+ // https://github.com/zloirock/core-js/issues/679
|
|
|
+ var IS_CONCAT_SPREADABLE_SUPPORT = v8Version >= 51 || !fails(function () {
|
|
|
+ var array = [];
|
|
|
+ array[IS_CONCAT_SPREADABLE] = false;
|
|
|
+ return array.concat()[0] !== array;
|
|
|
+ });
|
|
|
+
|
|
|
+ var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
|
+
|
|
|
+ var isConcatSpreadable = function (O) {
|
|
|
+ if (!isObject(O)) return false;
|
|
|
+ var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
|
+ return spreadable !== undefined ? !!spreadable : isArray(O);
|
|
|
+ };
|
|
|
+
|
|
|
+ var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
|
+
|
|
|
+ // `Array.prototype.concat` method
|
|
|
+ // https://tc39.github.io/ecma262/#sec-array.prototype.concat
|
|
|
+ // with adding support of @@isConcatSpreadable and @@species
|
|
|
+ _export({ target: 'Array', proto: true, forced: FORCED }, {
|
|
|
+ concat: function concat(arg) { // eslint-disable-line no-unused-vars
|
|
|
+ var O = toObject(this);
|
|
|
+ var A = arraySpeciesCreate(O, 0);
|
|
|
+ var n = 0;
|
|
|
+ var i, k, length, len, E;
|
|
|
+ for (i = -1, length = arguments.length; i < length; i++) {
|
|
|
+ E = i === -1 ? O : arguments[i];
|
|
|
+ if (isConcatSpreadable(E)) {
|
|
|
+ len = toLength(E.length);
|
|
|
+ if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
|
+ for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
|
+ } else {
|
|
|
+ if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
|
+ createProperty(A, n++, E);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ A.length = n;
|
|
|
+ return A;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ var aFunction$1 = function (it) {
|
|
|
+ if (typeof it != 'function') {
|
|
|
+ throw TypeError(String(it) + ' is not a function');
|
|
|
+ } return it;
|
|
|
+ };
|
|
|
+
|
|
|
+ // optional / simple context binding
|
|
|
+ var bindContext = function (fn, that, length) {
|
|
|
+ aFunction$1(fn);
|
|
|
+ if (that === undefined) return fn;
|
|
|
+ switch (length) {
|
|
|
+ case 0: return function () {
|
|
|
+ return fn.call(that);
|
|
|
+ };
|
|
|
+ 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 (/* ...args */) {
|
|
|
+ return fn.apply(that, arguments);
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
var push = [].push;
|
|
|
|
|
|
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
|
|
|
@@ -667,42 +757,6 @@
|
|
|
findIndex: createMethod$1(6)
|
|
|
};
|
|
|
|
|
|
- var userAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
|
-
|
|
|
- var process = global_1.process;
|
|
|
- var versions = process && process.versions;
|
|
|
- var v8 = versions && versions.v8;
|
|
|
- var match, version;
|
|
|
-
|
|
|
- if (v8) {
|
|
|
- match = v8.split('.');
|
|
|
- version = match[0] + match[1];
|
|
|
- } else if (userAgent) {
|
|
|
- match = userAgent.match(/Edge\/(\d+)/);
|
|
|
- if (!match || match[1] >= 74) {
|
|
|
- match = userAgent.match(/Chrome\/(\d+)/);
|
|
|
- if (match) version = match[1];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- var v8Version = version && +version;
|
|
|
-
|
|
|
- var SPECIES$1 = wellKnownSymbol('species');
|
|
|
-
|
|
|
- var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
|
- // We can't use this feature detection in V8 since it causes
|
|
|
- // deoptimization and serious performance degradation
|
|
|
- // https://github.com/zloirock/core-js/issues/677
|
|
|
- return v8Version >= 51 || !fails(function () {
|
|
|
- var array = [];
|
|
|
- var constructor = array.constructor = {};
|
|
|
- constructor[SPECIES$1] = function () {
|
|
|
- return { foo: 1 };
|
|
|
- };
|
|
|
- return array[METHOD_NAME](Boolean).foo !== 1;
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
var $filter = arrayIteration.filter;
|
|
|
|
|
|
|
|
|
@@ -871,12 +925,6 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- var createProperty = function (object, key, value) {
|
|
|
- var propertyKey = toPrimitive(key);
|
|
|
- if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
|
- else object[propertyKey] = value;
|
|
|
- };
|
|
|
-
|
|
|
var SPECIES$2 = wellKnownSymbol('species');
|
|
|
var nativeSlice = [].slice;
|
|
|
var max$1 = Math.max;
|
|
|
@@ -926,11 +974,11 @@
|
|
|
// Old WebKit
|
|
|
var SLOPPY_METHOD$1 = sloppyArrayMethod('sort');
|
|
|
|
|
|
- var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$1;
|
|
|
+ var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$1;
|
|
|
|
|
|
// `Array.prototype.sort` method
|
|
|
// https://tc39.github.io/ecma262/#sec-array.prototype.sort
|
|
|
- _export({ target: 'Array', proto: true, forced: FORCED }, {
|
|
|
+ _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
|
sort: function sort(comparefn) {
|
|
|
return comparefn === undefined
|
|
|
? nativeSort.call(toObject(this))
|
|
|
@@ -1010,405 +1058,6 @@
|
|
|
assign: objectAssign
|
|
|
});
|
|
|
|
|
|
- // `RegExp.prototype.flags` getter implementation
|
|
|
- // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
|
|
|
- var regexpFlags = function () {
|
|
|
- var that = anObject(this);
|
|
|
- var result = '';
|
|
|
- if (that.global) result += 'g';
|
|
|
- if (that.ignoreCase) result += 'i';
|
|
|
- if (that.multiline) result += 'm';
|
|
|
- if (that.dotAll) result += 's';
|
|
|
- if (that.unicode) result += 'u';
|
|
|
- if (that.sticky) result += 'y';
|
|
|
- return result;
|
|
|
- };
|
|
|
-
|
|
|
- // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
|
|
|
- // so we use an intermediate function.
|
|
|
- function RE(s, f) {
|
|
|
- return RegExp(s, f);
|
|
|
- }
|
|
|
-
|
|
|
- var UNSUPPORTED_Y = fails(function () {
|
|
|
- // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
|
- var re = RE('a', 'y');
|
|
|
- re.lastIndex = 2;
|
|
|
- return re.exec('abcd') != null;
|
|
|
- });
|
|
|
-
|
|
|
- var BROKEN_CARET = fails(function () {
|
|
|
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
|
- var re = RE('^r', 'gy');
|
|
|
- re.lastIndex = 2;
|
|
|
- return re.exec('str') != null;
|
|
|
- });
|
|
|
-
|
|
|
- var regexpStickyHelpers = {
|
|
|
- UNSUPPORTED_Y: UNSUPPORTED_Y,
|
|
|
- BROKEN_CARET: BROKEN_CARET
|
|
|
- };
|
|
|
-
|
|
|
- var nativeExec = RegExp.prototype.exec;
|
|
|
- // This always refers to the native implementation, because the
|
|
|
- // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
|
|
|
- // which loads this file before patching the method.
|
|
|
- var nativeReplace = String.prototype.replace;
|
|
|
-
|
|
|
- var patchedExec = nativeExec;
|
|
|
-
|
|
|
- var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
|
- var re1 = /a/;
|
|
|
- var re2 = /b*/g;
|
|
|
- nativeExec.call(re1, 'a');
|
|
|
- nativeExec.call(re2, 'a');
|
|
|
- return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
|
|
- })();
|
|
|
-
|
|
|
- var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
|
|
|
-
|
|
|
- // nonparticipating capturing group, copied from es5-shim's String#split patch.
|
|
|
- var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
|
-
|
|
|
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
|
|
|
-
|
|
|
- if (PATCH) {
|
|
|
- patchedExec = function exec(str) {
|
|
|
- var re = this;
|
|
|
- var lastIndex, reCopy, match, i;
|
|
|
- var sticky = UNSUPPORTED_Y$1 && re.sticky;
|
|
|
- var flags = regexpFlags.call(re);
|
|
|
- var source = re.source;
|
|
|
- var charsAdded = 0;
|
|
|
- var strCopy = str;
|
|
|
-
|
|
|
- if (sticky) {
|
|
|
- flags = flags.replace('y', '');
|
|
|
- if (flags.indexOf('g') === -1) {
|
|
|
- flags += 'g';
|
|
|
- }
|
|
|
-
|
|
|
- strCopy = String(str).slice(re.lastIndex);
|
|
|
- // Support anchored sticky behavior.
|
|
|
- if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
|
|
|
- source = '(?: ' + source + ')';
|
|
|
- strCopy = ' ' + strCopy;
|
|
|
- charsAdded++;
|
|
|
- }
|
|
|
- // ^(? + rx + ) is needed, in combination with some str slicing, to
|
|
|
- // simulate the 'y' flag.
|
|
|
- reCopy = new RegExp('^(?:' + source + ')', flags);
|
|
|
- }
|
|
|
-
|
|
|
- if (NPCG_INCLUDED) {
|
|
|
- reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
|
|
|
- }
|
|
|
- if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
|
|
|
-
|
|
|
- match = nativeExec.call(sticky ? reCopy : re, strCopy);
|
|
|
-
|
|
|
- if (sticky) {
|
|
|
- if (match) {
|
|
|
- match.input = match.input.slice(charsAdded);
|
|
|
- match[0] = match[0].slice(charsAdded);
|
|
|
- match.index = re.lastIndex;
|
|
|
- re.lastIndex += match[0].length;
|
|
|
- } else re.lastIndex = 0;
|
|
|
- } else if (UPDATES_LAST_INDEX_WRONG && match) {
|
|
|
- re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
|
|
|
- }
|
|
|
- if (NPCG_INCLUDED && match && match.length > 1) {
|
|
|
- // Fix browsers whose `exec` methods don't consistently return `undefined`
|
|
|
- // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
|
|
|
- nativeReplace.call(match[0], reCopy, function () {
|
|
|
- for (i = 1; i < arguments.length - 2; i++) {
|
|
|
- if (arguments[i] === undefined) match[i] = undefined;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- return match;
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- var regexpExec = patchedExec;
|
|
|
-
|
|
|
- _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
|
|
|
- exec: regexpExec
|
|
|
- });
|
|
|
-
|
|
|
- var SPECIES$3 = wellKnownSymbol('species');
|
|
|
-
|
|
|
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
|
|
|
- // #replace needs built-in support for named groups.
|
|
|
- // #match works fine because it just return the exec results, even if it has
|
|
|
- // a "grops" property.
|
|
|
- var re = /./;
|
|
|
- re.exec = function () {
|
|
|
- var result = [];
|
|
|
- result.groups = { a: '7' };
|
|
|
- return result;
|
|
|
- };
|
|
|
- return ''.replace(re, '$<a>') !== '7';
|
|
|
- });
|
|
|
-
|
|
|
- // IE <= 11 replaces $0 with the whole match, as if it was $&
|
|
|
- // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
|
|
|
- var REPLACE_KEEPS_$0 = (function () {
|
|
|
- return 'a'.replace(/./, '$0') === '$0';
|
|
|
- })();
|
|
|
-
|
|
|
- // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
|
|
|
- // Weex JS has frozen built-in prototypes, so use try / catch wrapper
|
|
|
- var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
|
|
|
- var re = /(?:)/;
|
|
|
- var originalExec = re.exec;
|
|
|
- re.exec = function () { return originalExec.apply(this, arguments); };
|
|
|
- var result = 'ab'.split(re);
|
|
|
- return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
|
|
|
- });
|
|
|
-
|
|
|
- var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
|
|
|
- var SYMBOL = wellKnownSymbol(KEY);
|
|
|
-
|
|
|
- var DELEGATES_TO_SYMBOL = !fails(function () {
|
|
|
- // String methods call symbol-named RegEp methods
|
|
|
- var O = {};
|
|
|
- O[SYMBOL] = function () { return 7; };
|
|
|
- return ''[KEY](O) != 7;
|
|
|
- });
|
|
|
-
|
|
|
- var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
|
|
|
- // Symbol-named RegExp methods call .exec
|
|
|
- var execCalled = false;
|
|
|
- var re = /a/;
|
|
|
-
|
|
|
- if (KEY === 'split') {
|
|
|
- // We can't use real regex here since it causes deoptimization
|
|
|
- // and serious performance degradation in V8
|
|
|
- // https://github.com/zloirock/core-js/issues/306
|
|
|
- re = {};
|
|
|
- // RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
|
- // a new one. We need to return the patched regex when creating the new one.
|
|
|
- re.constructor = {};
|
|
|
- re.constructor[SPECIES$3] = function () { return re; };
|
|
|
- re.flags = '';
|
|
|
- re[SYMBOL] = /./[SYMBOL];
|
|
|
- }
|
|
|
-
|
|
|
- re.exec = function () { execCalled = true; return null; };
|
|
|
-
|
|
|
- re[SYMBOL]('');
|
|
|
- return !execCalled;
|
|
|
- });
|
|
|
-
|
|
|
- if (
|
|
|
- !DELEGATES_TO_SYMBOL ||
|
|
|
- !DELEGATES_TO_EXEC ||
|
|
|
- (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) ||
|
|
|
- (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
|
|
|
- ) {
|
|
|
- var nativeRegExpMethod = /./[SYMBOL];
|
|
|
- var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
|
- if (regexp.exec === regexpExec) {
|
|
|
- if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
|
- // The native String method already delegates to @@method (this
|
|
|
- // polyfilled function), leasing to infinite recursion.
|
|
|
- // We avoid it by directly calling the native @@method method.
|
|
|
- return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
|
|
|
- }
|
|
|
- return { done: true, value: nativeMethod.call(str, regexp, arg2) };
|
|
|
- }
|
|
|
- return { done: false };
|
|
|
- }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 });
|
|
|
- var stringMethod = methods[0];
|
|
|
- var regexMethod = methods[1];
|
|
|
-
|
|
|
- redefine(String.prototype, KEY, stringMethod);
|
|
|
- redefine(RegExp.prototype, SYMBOL, length == 2
|
|
|
- // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
|
|
|
- // 21.2.5.11 RegExp.prototype[@@split](string, limit)
|
|
|
- ? function (string, arg) { return regexMethod.call(string, this, arg); }
|
|
|
- // 21.2.5.6 RegExp.prototype[@@match](string)
|
|
|
- // 21.2.5.9 RegExp.prototype[@@search](string)
|
|
|
- : function (string) { return regexMethod.call(string, this); }
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
|
|
|
- };
|
|
|
-
|
|
|
- // `String.prototype.{ codePointAt, at }` methods implementation
|
|
|
- var createMethod$2 = function (CONVERT_TO_STRING) {
|
|
|
- return function ($this, pos) {
|
|
|
- var S = String(requireObjectCoercible($this));
|
|
|
- var position = toInteger(pos);
|
|
|
- var size = S.length;
|
|
|
- var first, second;
|
|
|
- if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
|
- first = S.charCodeAt(position);
|
|
|
- return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
|
- || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
|
|
|
- ? CONVERT_TO_STRING ? S.charAt(position) : first
|
|
|
- : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
|
- };
|
|
|
- };
|
|
|
-
|
|
|
- var stringMultibyte = {
|
|
|
- // `String.prototype.codePointAt` method
|
|
|
- // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
|
|
|
- codeAt: createMethod$2(false),
|
|
|
- // `String.prototype.at` method
|
|
|
- // https://github.com/mathiasbynens/String.prototype.at
|
|
|
- charAt: createMethod$2(true)
|
|
|
- };
|
|
|
-
|
|
|
- var charAt = stringMultibyte.charAt;
|
|
|
-
|
|
|
- // `AdvanceStringIndex` abstract operation
|
|
|
- // https://tc39.github.io/ecma262/#sec-advancestringindex
|
|
|
- var advanceStringIndex = function (S, index, unicode) {
|
|
|
- return index + (unicode ? charAt(S, index).length : 1);
|
|
|
- };
|
|
|
-
|
|
|
- // `RegExpExec` abstract operation
|
|
|
- // https://tc39.github.io/ecma262/#sec-regexpexec
|
|
|
- var regexpExecAbstract = function (R, S) {
|
|
|
- var exec = R.exec;
|
|
|
- if (typeof exec === 'function') {
|
|
|
- var result = exec.call(R, S);
|
|
|
- if (typeof result !== 'object') {
|
|
|
- throw TypeError('RegExp exec method returned something other than an Object or null');
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- if (classofRaw(R) !== 'RegExp') {
|
|
|
- throw TypeError('RegExp#exec called on incompatible receiver');
|
|
|
- }
|
|
|
-
|
|
|
- return regexpExec.call(R, S);
|
|
|
- };
|
|
|
-
|
|
|
- var max$2 = Math.max;
|
|
|
- var min$2 = Math.min;
|
|
|
- var floor$1 = Math.floor;
|
|
|
- var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
|
|
|
- var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
|
|
|
-
|
|
|
- var maybeToString = function (it) {
|
|
|
- return it === undefined ? it : String(it);
|
|
|
- };
|
|
|
-
|
|
|
- // @@replace logic
|
|
|
- fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
|
|
|
- return [
|
|
|
- // `String.prototype.replace` method
|
|
|
- // https://tc39.github.io/ecma262/#sec-string.prototype.replace
|
|
|
- function replace(searchValue, replaceValue) {
|
|
|
- var O = requireObjectCoercible(this);
|
|
|
- var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
|
|
|
- return replacer !== undefined
|
|
|
- ? replacer.call(searchValue, O, replaceValue)
|
|
|
- : nativeReplace.call(String(O), searchValue, replaceValue);
|
|
|
- },
|
|
|
- // `RegExp.prototype[@@replace]` method
|
|
|
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
|
|
|
- function (regexp, replaceValue) {
|
|
|
- if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) {
|
|
|
- var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
|
|
|
- if (res.done) return res.value;
|
|
|
- }
|
|
|
-
|
|
|
- var rx = anObject(regexp);
|
|
|
- var S = String(this);
|
|
|
-
|
|
|
- var functionalReplace = typeof replaceValue === 'function';
|
|
|
- if (!functionalReplace) replaceValue = String(replaceValue);
|
|
|
-
|
|
|
- var global = rx.global;
|
|
|
- if (global) {
|
|
|
- var fullUnicode = rx.unicode;
|
|
|
- rx.lastIndex = 0;
|
|
|
- }
|
|
|
- var results = [];
|
|
|
- while (true) {
|
|
|
- var result = regexpExecAbstract(rx, S);
|
|
|
- if (result === null) break;
|
|
|
-
|
|
|
- results.push(result);
|
|
|
- if (!global) break;
|
|
|
-
|
|
|
- var matchStr = String(result[0]);
|
|
|
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
|
|
- }
|
|
|
-
|
|
|
- var accumulatedResult = '';
|
|
|
- var nextSourcePosition = 0;
|
|
|
- for (var i = 0; i < results.length; i++) {
|
|
|
- result = results[i];
|
|
|
-
|
|
|
- var matched = String(result[0]);
|
|
|
- var position = max$2(min$2(toInteger(result.index), S.length), 0);
|
|
|
- var captures = [];
|
|
|
- // NOTE: This is equivalent to
|
|
|
- // captures = result.slice(1).map(maybeToString)
|
|
|
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
|
|
|
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
|
|
|
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
|
|
|
- for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
|
|
|
- var namedCaptures = result.groups;
|
|
|
- if (functionalReplace) {
|
|
|
- var replacerArgs = [matched].concat(captures, position, S);
|
|
|
- if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
|
|
|
- var replacement = String(replaceValue.apply(undefined, replacerArgs));
|
|
|
- } else {
|
|
|
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
|
|
|
- }
|
|
|
- if (position >= nextSourcePosition) {
|
|
|
- accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
|
|
|
- nextSourcePosition = position + matched.length;
|
|
|
- }
|
|
|
- }
|
|
|
- return accumulatedResult + S.slice(nextSourcePosition);
|
|
|
- }
|
|
|
- ];
|
|
|
-
|
|
|
- // https://tc39.github.io/ecma262/#sec-getsubstitution
|
|
|
- function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
|
|
|
- var tailPos = position + matched.length;
|
|
|
- var m = captures.length;
|
|
|
- var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
|
|
- if (namedCaptures !== undefined) {
|
|
|
- namedCaptures = toObject(namedCaptures);
|
|
|
- symbols = SUBSTITUTION_SYMBOLS;
|
|
|
- }
|
|
|
- return nativeReplace.call(replacement, symbols, function (match, ch) {
|
|
|
- var capture;
|
|
|
- switch (ch.charAt(0)) {
|
|
|
- case '$': return '$';
|
|
|
- case '&': return matched;
|
|
|
- case '`': return str.slice(0, position);
|
|
|
- case "'": return str.slice(tailPos);
|
|
|
- case '<':
|
|
|
- capture = namedCaptures[ch.slice(1, -1)];
|
|
|
- break;
|
|
|
- default: // \d\d?
|
|
|
- var n = +ch;
|
|
|
- if (n === 0) return match;
|
|
|
- if (n > m) {
|
|
|
- var f = floor$1(n / 10);
|
|
|
- if (f === 0) return match;
|
|
|
- if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
|
|
|
- return match;
|
|
|
- }
|
|
|
- capture = captures[n - 1];
|
|
|
- }
|
|
|
- return capture === undefined ? '' : capture;
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
// iterable DOM collections
|
|
|
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
|
|
|
var domIterables = {
|
|
|
@@ -1583,24 +1232,7 @@
|
|
|
* @version: v1.1.0
|
|
|
*/
|
|
|
|
|
|
- var initBodyCaller; // it only does '%s', and return '' when arguments are undefined
|
|
|
-
|
|
|
- var sprintf = function sprintf(str) {
|
|
|
- var args = arguments;
|
|
|
- var flag = true;
|
|
|
- var i = 1;
|
|
|
- str = str.replace(/%s/g, function () {
|
|
|
- var arg = args[i++];
|
|
|
-
|
|
|
- if (typeof arg === 'undefined') {
|
|
|
- flag = false;
|
|
|
- return '';
|
|
|
- }
|
|
|
-
|
|
|
- return arg;
|
|
|
- });
|
|
|
- return flag ? str : '';
|
|
|
- };
|
|
|
+ var initBodyCaller;
|
|
|
|
|
|
var groupBy = function groupBy(array, f) {
|
|
|
var tmpGroups = {};
|
|
|
@@ -1612,10 +1244,23 @@
|
|
|
return tmpGroups;
|
|
|
};
|
|
|
|
|
|
+ $.extend($.fn.bootstrapTable.defaults.icons, {
|
|
|
+ collapseGroup: {
|
|
|
+ bootstrap3: 'glyphicon-chevron-up',
|
|
|
+ materialize: 'arrow_drop_down'
|
|
|
+ }[$.fn.bootstrapTable.theme] || 'fa-angle-up',
|
|
|
+ expandGroup: {
|
|
|
+ bootstrap3: 'glyphicon-chevron-down',
|
|
|
+ materialize: 'arrow_drop_up'
|
|
|
+ }[$.fn.bootstrapTable.theme] || 'fa-angle-down'
|
|
|
+ });
|
|
|
$.extend($.fn.bootstrapTable.defaults, {
|
|
|
groupBy: false,
|
|
|
groupByField: '',
|
|
|
- groupByFormatter: undefined
|
|
|
+ groupByFormatter: undefined,
|
|
|
+ groupByToggle: false,
|
|
|
+ groupByShowToggleIcon: false,
|
|
|
+ groupByCollapsedGroups: []
|
|
|
});
|
|
|
var Utils = $.fn.bootstrapTable.utils;
|
|
|
var BootstrapTable = $.fn.bootstrapTable.Constructor;
|
|
|
@@ -1680,6 +1325,10 @@
|
|
|
item._data = {};
|
|
|
}
|
|
|
|
|
|
+ if (_this.isCollapsed(key, value)) {
|
|
|
+ item._class = 'hidden';
|
|
|
+ }
|
|
|
+
|
|
|
item._data['parent-index'] = index;
|
|
|
});
|
|
|
index++;
|
|
|
@@ -1688,6 +1337,8 @@
|
|
|
};
|
|
|
|
|
|
BootstrapTable.prototype.initBody = function () {
|
|
|
+ var _this2 = this;
|
|
|
+
|
|
|
initBodyCaller = true;
|
|
|
|
|
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
|
@@ -1716,7 +1367,7 @@
|
|
|
|
|
|
this.tableGroups.forEach(function (item) {
|
|
|
var html = [];
|
|
|
- html.push(sprintf('<tr class="info groupBy expanded" data-group-index="%s">', item.id));
|
|
|
+ html.push(Utils.sprintf('<tr class="info groupBy %s" data-group-index="%s">', _this2.options.groupByToggle ? 'expanded' : '', item.id));
|
|
|
|
|
|
if (that.options.detailView && !that.options.cardView) {
|
|
|
html.push('<td class="detail"></td>');
|
|
|
@@ -1732,8 +1383,18 @@
|
|
|
formattedValue = that.options.groupByFormatter(item.name, item.id, item.data);
|
|
|
}
|
|
|
|
|
|
- html.push('<td', sprintf(' colspan="%s"', visibleColumns), '>', formattedValue, '</td>');
|
|
|
- html.push('</tr>');
|
|
|
+ html.push('<td', Utils.sprintf(' colspan="%s"', visibleColumns), '>', formattedValue);
|
|
|
+ var icon = _this2.options.icons.collapseGroup;
|
|
|
+
|
|
|
+ if (_this2.isCollapsed(item.name, item.data)) {
|
|
|
+ icon = _this2.options.icons.expandGroup;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_this2.options.groupByToggle && _this2.options.groupByShowToggleIcon) {
|
|
|
+ html.push("<span class=\"float-right ".concat(_this2.options.iconsPrefix, " ").concat(icon, "\"></span>"));
|
|
|
+ }
|
|
|
+
|
|
|
+ html.push('</td></tr>');
|
|
|
that.$body.find("tr[data-parent-index=".concat(item.id, "]:first")).before($(html.join('')));
|
|
|
});
|
|
|
this.$selectGroup = [];
|
|
|
@@ -1746,10 +1407,15 @@
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
- this.$container.off('click', '.groupBy').on('click', '.groupBy', function () {
|
|
|
- $(this).toggleClass('expanded');
|
|
|
- that.$body.find("tr[data-parent-index=".concat($(this).closest('tr').data('group-index'), "]")).toggleClass('hidden');
|
|
|
- });
|
|
|
+
|
|
|
+ if (this.options.groupByToggle) {
|
|
|
+ this.$container.off('click', '.groupBy').on('click', '.groupBy', function () {
|
|
|
+ $(this).toggleClass('expanded collapsed');
|
|
|
+ $(this).find('span').toggleClass("".concat(that.options.icons.collapseGroup, " ").concat(that.options.icons.expandGroup));
|
|
|
+ that.$body.find("tr[data-parent-index=".concat($(this).closest('tr').data('group-index'), "]")).toggleClass('hidden');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
this.$container.off('click', '[name="btSelectGroup"]').on('click', '[name="btSelectGroup"]', function (event) {
|
|
|
event.stopImmediatePropagation();
|
|
|
var self = $(this);
|
|
|
@@ -1787,6 +1453,18 @@
|
|
|
this.checkGroup_(index, false);
|
|
|
};
|
|
|
|
|
|
+ BootstrapTable.prototype.isCollapsed = function (groupKey, items) {
|
|
|
+ if (this.options.groupByCollapsedGroups) {
|
|
|
+ var collapsedGroups = Utils.calculateObjectValue(this, this.options.groupByCollapsedGroups, [groupKey, items], true);
|
|
|
+
|
|
|
+ if ($.inArray(groupKey, collapsedGroups) > -1) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ };
|
|
|
+
|
|
|
BootstrapTable.prototype.checkGroup_ = function (index, checked) {
|
|
|
var rowsBefore = this.getSelections();
|
|
|
|
|
|
@@ -1843,7 +1521,7 @@
|
|
|
|
|
|
if (options.unit === 'rows') {
|
|
|
var scrollTo = 0;
|
|
|
- this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
|
|
|
+ this.$body.find("> tr:not(.groupBy):lt(".concat(options.value, ")")).each(function (i, el) {
|
|
|
scrollTo += $(el).outerHeight(true);
|
|
|
});
|
|
|
var $targetColumn = this.$body.find("> tr:not(.groupBy):eq(".concat(options.value, ")"));
|