vendor/assets/javascripts/bootstrap-table/bootstrap-table.js in bootstrap-table-rails-1.18.3 vs vendor/assets/javascripts/bootstrap-table/bootstrap-table.js in bootstrap-table-rails-1.19.0
- old
+ new
@@ -185,13 +185,14 @@
return it && it.Math == Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global_1 =
- /* global globalThis -- safe */
+ // eslint-disable-next-line es/no-global-this -- safe
check(typeof globalThis == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
+ // eslint-disable-next-line no-restricted-globals -- safe
check(typeof self == 'object' && self) ||
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
// eslint-disable-next-line no-new-func -- fallback
(function () { return this; })() || Function('return this')();
@@ -203,25 +204,27 @@
}
};
// Detect IE8's incomplete defineProperty implementation
var descriptors = !fails(function () {
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});
- var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
- var NASHORN_BUG = getOwnPropertyDescriptor$4 && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
+ var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
var f$4 = NASHORN_BUG ? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor$4(this, V);
return !!descriptor && descriptor.enumerable;
- } : nativePropertyIsEnumerable;
+ } : $propertyIsEnumerable;
var objectPropertyIsEnumerable = {
f: f$4
};
@@ -297,24 +300,26 @@
return EXISTS ? document$1.createElement(it) : {};
};
// Thank's IE8 for his funny defineProperty
var ie8DomDefine = !descriptors && !fails(function () {
+ // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
return Object.defineProperty(documentCreateElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
- var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
- var f$3 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
+ var f$3 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (ie8DomDefine) try {
- return nativeGetOwnPropertyDescriptor(O, P);
+ return $getOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has$1(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
};
var objectGetOwnPropertyDescriptor = {
@@ -325,20 +330,21 @@
if (!isObject(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
- var nativeDefineProperty = Object.defineProperty;
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
+ var $defineProperty = Object.defineProperty;
// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
- var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
+ var f$2 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (ie8DomDefine) try {
- return nativeDefineProperty(O, P, Attributes);
+ return $defineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
@@ -384,11 +390,11 @@
var shared = createCommonjsModule(function (module) {
(module.exports = function (key, value) {
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
})('versions', []).push({
- version: '3.9.1',
+ version: '3.10.1',
mode: 'global',
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
});
});
@@ -596,18 +602,20 @@
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
// `Object.getOwnPropertyNames` method
// https://tc39.es/ecma262/#sec-object.getownpropertynames
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
var f$1 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return objectKeysInternal(O, hiddenKeys);
};
var objectGetOwnPropertyNames = {
f: f$1
};
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
var f = Object.getOwnPropertySymbols;
var objectGetOwnPropertySymbols = {
f: f
};
@@ -793,11 +801,11 @@
// so we use an intermediate function.
function RE(s, f) {
return RegExp(s, f);
}
- var UNSUPPORTED_Y$2 = fails(function () {
+ var UNSUPPORTED_Y$3 = 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;
});
@@ -808,19 +816,16 @@
re.lastIndex = 2;
return re.exec('str') != null;
});
var regexpStickyHelpers = {
- UNSUPPORTED_Y: UNSUPPORTED_Y$2,
+ UNSUPPORTED_Y: UNSUPPORTED_Y$3,
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 nativeReplace = shared('native-string-replace', String.prototype.replace);
var patchedExec = nativeExec;
var UPDATES_LAST_INDEX_WRONG = (function () {
var re1 = /a/;
@@ -828,23 +833,23 @@
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;
+ var UNSUPPORTED_Y$2 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
// nonparticipating capturing group, copied from es5-shim's String#split patch.
// eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
+ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2;
if (PATCH) {
patchedExec = function exec(str) {
var re = this;
var lastIndex, reCopy, match, i;
- var sticky = UNSUPPORTED_Y$1 && re.sticky;
+ var sticky = UNSUPPORTED_Y$2 && re.sticky;
var flags = regexpFlags.call(re);
var source = re.source;
var charsAdded = 0;
var strCopy = str;
@@ -925,20 +930,23 @@
}
}
var engineV8Version = version && +version;
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
- /* global Symbol -- required for testing */
+ // eslint-disable-next-line es/no-symbol -- required for testing
return !Symbol.sham &&
// Chrome 38 Symbol has incorrect toString conversion
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
(engineIsNode ? engineV8Version === 38 : engineV8Version > 37 && engineV8Version < 41);
});
+ /* eslint-disable es/no-symbol -- required for testing */
+
+
var useSymbolAsUid = nativeSymbol
- /* global Symbol -- safe */
&& !Symbol.sham
&& typeof Symbol.iterator == 'symbol';
var WellKnownSymbolsStore = shared('wks');
var Symbol$1 = global_1.Symbol;
@@ -959,11 +967,10 @@
-
var SPECIES$5 = 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
@@ -978,10 +985,11 @@
});
// 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 () {
+ // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
return 'a'.replace(/./, '$0') === '$0';
})();
var REPLACE = wellKnownSymbol('replace');
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
@@ -1047,11 +1055,11 @@
)) ||
(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 (regexp.exec === RegExp.prototype.exec) {
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) };
@@ -1155,17 +1163,15 @@
}
return regexpExec.call(R, S);
};
+ var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y;
var arrayPush = [].push;
var min$4 = Math.min;
var MAX_UINT32 = 0xFFFFFFFF;
- // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
- var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
-
// @@split logic
fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
var internalSplit;
if (
'abbc'.split(/(b)*/)[1] == 'c' ||
@@ -1244,28 +1250,28 @@
var unicodeMatching = rx.unicode;
var flags = (rx.ignoreCase ? 'i' : '') +
(rx.multiline ? 'm' : '') +
(rx.unicode ? 'u' : '') +
- (SUPPORTS_Y ? 'y' : 'g');
+ (UNSUPPORTED_Y$1 ? 'g' : 'y');
// ^(? + rx + ) is needed, in combination with some S slicing, to
// simulate the 'y' flag.
- var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
+ var splitter = new C(UNSUPPORTED_Y$1 ? '^(?:' + rx.source + ')' : rx, flags);
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
if (lim === 0) return [];
if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
var p = 0;
var q = 0;
var A = [];
while (q < S.length) {
- splitter.lastIndex = SUPPORTS_Y ? q : 0;
- var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
+ splitter.lastIndex = UNSUPPORTED_Y$1 ? 0 : q;
+ var z = regexpExecAbstract(splitter, UNSUPPORTED_Y$1 ? S.slice(q) : S);
var e;
if (
z === null ||
- (e = min$4(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
+ (e = min$4(toLength(splitter.lastIndex + (UNSUPPORTED_Y$1 ? q : 0)), S.length)) === p
) {
q = advanceStringIndex(S, q, unicodeMatching);
} else {
A.push(S.slice(p, q));
if (A.length === lim) return A;
@@ -1278,20 +1284,62 @@
}
A.push(S.slice(p));
return A;
}
];
- }, !SUPPORTS_Y);
+ }, UNSUPPORTED_Y$1);
// `Object.keys` method
// https://tc39.es/ecma262/#sec-object.keys
+ // eslint-disable-next-line es/no-object-keys -- safe
var objectKeys = Object.keys || function keys(O) {
return objectKeysInternal(O, enumBugKeys);
};
+ var propertyIsEnumerable = objectPropertyIsEnumerable.f;
+
+ // `Object.{ entries, values }` methods implementation
+ var createMethod$1 = function (TO_ENTRIES) {
+ return function (it) {
+ var O = toIndexedObject(it);
+ var keys = objectKeys(O);
+ var length = keys.length;
+ var i = 0;
+ var result = [];
+ var key;
+ while (length > i) {
+ key = keys[i++];
+ if (!descriptors || propertyIsEnumerable.call(O, key)) {
+ result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
+ }
+ }
+ return result;
+ };
+ };
+
+ var objectToArray = {
+ // `Object.entries` method
+ // https://tc39.es/ecma262/#sec-object.entries
+ entries: createMethod$1(true),
+ // `Object.values` method
+ // https://tc39.es/ecma262/#sec-object.values
+ values: createMethod$1(false)
+ };
+
+ var $entries = objectToArray.entries;
+
+ // `Object.entries` method
+ // https://tc39.es/ecma262/#sec-object.entries
+ _export({ target: 'Object', stat: true }, {
+ entries: function entries(O) {
+ return $entries(O);
+ }
+ });
+
// `Object.defineProperties` method
// https://tc39.es/ecma262/#sec-object.defineproperties
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = objectKeys(Properties);
var length = keys.length;
var index = 0;
@@ -1404,10 +1452,11 @@
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('includes');
// `IsArray` abstract operation
// https://tc39.es/ecma262/#sec-isarray
+ // eslint-disable-next-line es/no-array-isarray -- safe
var isArray = Array.isArray || function isArray(arg) {
return classofRaw(arg) == 'Array';
};
// `ToObject` abstract operation
@@ -1528,11 +1577,11 @@
};
var push = [].push;
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
- var createMethod$1 = function (TYPE) {
+ var createMethod = function (TYPE) {
var IS_MAP = TYPE == 1;
var IS_FILTER = TYPE == 2;
var IS_SOME = TYPE == 3;
var IS_EVERY = TYPE == 4;
var IS_FIND_INDEX = TYPE == 6;
@@ -1568,32 +1617,32 @@
};
var arrayIteration = {
// `Array.prototype.forEach` method
// https://tc39.es/ecma262/#sec-array.prototype.foreach
- forEach: createMethod$1(0),
+ forEach: createMethod(0),
// `Array.prototype.map` method
// https://tc39.es/ecma262/#sec-array.prototype.map
- map: createMethod$1(1),
+ map: createMethod(1),
// `Array.prototype.filter` method
// https://tc39.es/ecma262/#sec-array.prototype.filter
- filter: createMethod$1(2),
+ filter: createMethod(2),
// `Array.prototype.some` method
// https://tc39.es/ecma262/#sec-array.prototype.some
- some: createMethod$1(3),
+ some: createMethod(3),
// `Array.prototype.every` method
// https://tc39.es/ecma262/#sec-array.prototype.every
- every: createMethod$1(4),
+ every: createMethod(4),
// `Array.prototype.find` method
// https://tc39.es/ecma262/#sec-array.prototype.find
- find: createMethod$1(5),
+ find: createMethod(5),
// `Array.prototype.findIndex` method
// https://tc39.es/ecma262/#sec-array.prototype.findIndex
- findIndex: createMethod$1(6),
+ findIndex: createMethod(6),
// `Array.prototype.filterOut` method
// https://github.com/tc39/proposal-array-filtering
- filterOut: createMethod$1(7)
+ filterOut: createMethod(7)
};
var $find = arrayIteration.find;
@@ -1686,10 +1735,11 @@
// `Array.prototype.forEach` method implementation
// https://tc39.es/ecma262/#sec-array.prototype.foreach
var arrayForEach = !STRICT_METHOD$2 ? function forEach(callbackfn /* , thisArg */) {
return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ // eslint-disable-next-line es/no-array-prototype-foreach -- safe
} : [].forEach;
for (var COLLECTION_NAME$1 in domIterables) {
var Collection$1 = global_1[COLLECTION_NAME$1];
var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
@@ -1719,50 +1769,12 @@
// https://tc39.es/ecma262/#sec-parsefloat-string
_export({ global: true, forced: parseFloat != numberParseFloat }, {
parseFloat: numberParseFloat
});
- var propertyIsEnumerable = objectPropertyIsEnumerable.f;
+ /* eslint-disable es/no-array-prototype-indexof -- required for testing */
- // `Object.{ entries, values }` methods implementation
- var createMethod = function (TO_ENTRIES) {
- return function (it) {
- var O = toIndexedObject(it);
- var keys = objectKeys(O);
- var length = keys.length;
- var i = 0;
- var result = [];
- var key;
- while (length > i) {
- key = keys[i++];
- if (!descriptors || propertyIsEnumerable.call(O, key)) {
- result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
- }
- }
- return result;
- };
- };
-
- var objectToArray = {
- // `Object.entries` method
- // https://tc39.es/ecma262/#sec-object.entries
- entries: createMethod(true),
- // `Object.values` method
- // https://tc39.es/ecma262/#sec-object.values
- values: createMethod(false)
- };
-
- var $entries = objectToArray.entries;
-
- // `Object.entries` method
- // https://tc39.es/ecma262/#sec-object.entries
- _export({ target: 'Object', stat: true }, {
- entries: function entries(O) {
- return $entries(O);
- }
- });
-
var $indexOf = arrayIncludes.indexOf;
var nativeIndexOf = [].indexOf;
@@ -1932,18 +1944,20 @@
return accumulatedResult + S.slice(nextSourcePosition);
}
];
});
- var nativeAssign = Object.assign;
+ // eslint-disable-next-line es/no-object-assign -- safe
+ var $assign = Object.assign;
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
var defineProperty$3 = Object.defineProperty;
// `Object.assign` method
// https://tc39.es/ecma262/#sec-object.assign
- var objectAssign = !nativeAssign || fails(function () {
+ var objectAssign = !$assign || fails(function () {
// should have correct order of operations (Edge bug)
- if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$3({}, 'a', {
+ if (descriptors && $assign({ b: 1 }, $assign(defineProperty$3({}, 'a', {
enumerable: true,
get: function () {
defineProperty$3(this, 'b', {
value: 3,
enumerable: false
@@ -1951,16 +1965,16 @@
}
}), { b: 2 })).b !== 1) return true;
// should work with symbols and should have deterministic property order (V8 bug)
var A = {};
var B = {};
- /* global Symbol -- required for testing */
+ // eslint-disable-next-line es/no-symbol -- safe
var symbol = Symbol();
var alphabet = 'abcdefghijklmnopqrst';
A[symbol] = 7;
alphabet.split('').forEach(function (chr) { B[chr] = chr; });
- return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
+ return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
var T = toObject(target);
var argumentsLength = arguments.length;
var index = 1;
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
@@ -1974,14 +1988,15 @@
while (length > j) {
key = keys[j++];
if (!descriptors || propertyIsEnumerable.call(S, key)) T[key] = S[key];
}
} return T;
- } : nativeAssign;
+ } : $assign;
// `Object.assign` method
// https://tc39.es/ecma262/#sec-object.assign
+ // eslint-disable-next-line es/no-object-assign -- required for testing
_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
assign: objectAssign
});
var $filter = arrayIteration.filter;
@@ -1998,10 +2013,11 @@
}
});
// `SameValue` abstract operation
// https://tc39.es/ecma262/#sec-samevalue
+ // eslint-disable-next-line es/no-object-is -- safe
var sameValue = Object.is || function is(x, y) {
// eslint-disable-next-line no-self-compare -- NaN check
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
};
@@ -2098,15 +2114,17 @@
// `Object.setPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.setprototypeof
// Works with __proto__ only. Old v8 can't work with null proto objects.
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
var CORRECT_SETTER = false;
var test = {};
var setter;
try {
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
setter.call(test, []);
CORRECT_SETTER = test instanceof Array;
} catch (error) { /* empty */ }
return function setPrototypeOf(O, proto) {
@@ -2328,18 +2346,20 @@
});
var correctPrototypeGetter = !fails(function () {
function F() { /* empty */ }
F.prototype.constructor = null;
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
return Object.getPrototypeOf(new F()) !== F.prototype;
});
var IE_PROTO = sharedKey('IE_PROTO');
var ObjectPrototype = Object.prototype;
// `Object.getPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.getprototypeof
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
O = toObject(O);
if (has$1(O, IE_PROTO)) return O[IE_PROTO];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
@@ -2353,10 +2373,11 @@
// `%IteratorPrototype%` object
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
+ /* eslint-disable es/no-array-prototype-keys -- safe */
if ([].keys) {
arrayIterator = [].keys();
// Safari 8 has buggy iterators w/o `next`
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
else {
@@ -2694,11 +2715,11 @@
}
});
/* eslint-disable no-unused-vars */
- var VERSION = '1.18.3';
+ var VERSION = '1.19.0';
var bootstrapVersion = 4;
try {
var rawVersion = $__default['default'].fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined.
// It is undefined in older versions of Bootstrap (tested with 3.1.1).
@@ -2811,23 +2832,23 @@
searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
}
},
5: {
- iconsPrefix: 'fa',
+ iconsPrefix: 'bi',
icons: {
- paginationSwitchDown: 'fa-caret-square-down',
- paginationSwitchUp: 'fa-caret-square-up',
- refresh: 'fa-sync',
- toggleOff: 'fa-toggle-off',
- toggleOn: 'fa-toggle-on',
- columns: 'fa-th-list',
- detailOpen: 'fa-plus',
- detailClose: 'fa-minus',
- fullscreen: 'fa-arrows-alt',
- search: 'fa-search',
- clearSearch: 'fa-trash'
+ paginationSwitchDown: 'bi-caret-down-square',
+ paginationSwitchUp: 'bi-caret-up-square',
+ refresh: 'bi-arrow-clockwise',
+ toggleOff: 'bi-toggle-off',
+ toggleOn: 'bi-toggle-on',
+ columns: 'bi-list-ul',
+ detailOpen: 'bi-plus',
+ detailClose: 'bi-dash',
+ fullscreen: 'bi-arrows-move',
+ search: 'bi-search',
+ clearSearch: 'bi-trash'
},
classes: {
buttonsPrefix: 'btn',
buttons: 'secondary',
buttonsGroup: 'btn-group',
@@ -2851,11 +2872,11 @@
toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
dropdownCaret: '<span class="caret"></span>',
pagination: ['<ul class="pagination%s">', '</ul>'],
paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
icon: '<i class="%s %s"></i>',
- inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
+ inputGroup: '<div class="input-group">%s%s</div>',
searchInput: '<input class="%s%s" type="text" placeholder="%s">',
searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
}
}
@@ -2936,10 +2957,11 @@
// Calculate intermediate pages for quick access
search: false,
searchHighlight: false,
searchOnEnterKey: false,
strictSearch: false,
+ regexSearch: false,
searchSelector: false,
visibleSearch: false,
showButtonIcons: true,
showButtonText: false,
showSearchButton: false,
@@ -3087,10 +3109,13 @@
onResetView: function onResetView() {
return false;
},
onScrollBody: function onScrollBody() {
return false;
+ },
+ onTogglePagination: function onTogglePagination(newState) {
+ return false;
}
};
var EN = {
formatLoadingMessage: function formatLoadingMessage() {
return 'Loading, please wait';
@@ -3227,11 +3252,13 @@
'expand-row.bs.table': 'onExpandRow',
'collapse-row.bs.table': 'onCollapseRow',
'refresh-options.bs.table': 'onRefreshOptions',
'reset-view.bs.table': 'onResetView',
'refresh.bs.table': 'onRefresh',
- 'scroll-body.bs.table': 'onScrollBody'
+ 'scroll-body.bs.table': 'onScrollBody',
+ 'toggle-pagination.bs.table': 'onTogglePagination',
+ 'virtual-scroll.bs.table': 'onVirtualScroll'
};
Object.assign(DEFAULTS, EN);
var Constants = {
VERSION: VERSION,
THEME: "bootstrap".concat(bootstrapVersion),
@@ -3254,18 +3281,56 @@
keys: function keys(it) {
return objectKeys(toObject(it));
}
});
+ // @@match logic
+ fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
+ return [
+ // `String.prototype.match` method
+ // https://tc39.es/ecma262/#sec-string.prototype.match
+ function match(regexp) {
+ var O = requireObjectCoercible(this);
+ var matcher = regexp == undefined ? undefined : regexp[MATCH];
+ return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
+ },
+ // `RegExp.prototype[@@match]` method
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
+ function (regexp) {
+ var res = maybeCallNative(nativeMatch, regexp, this);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ if (!rx.global) return regexpExecAbstract(rx, S);
+
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ var A = [];
+ var n = 0;
+ var result;
+ while ((result = regexpExecAbstract(rx, S)) !== null) {
+ var matchStr = String(result[0]);
+ A[n] = matchStr;
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ n++;
+ }
+ return n === 0 ? null : A;
+ }
+ ];
+ });
+
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
- var nativeStartsWith = ''.startsWith;
+ // eslint-disable-next-line es/no-string-prototype-startswith -- safe
+ var $startsWith = ''.startsWith;
var min$1 = Math.min;
var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('startsWith');
// https://github.com/zloirock/core-js/pull/702
var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
@@ -3279,12 +3344,12 @@
startsWith: function startsWith(searchString /* , position = 0 */) {
var that = String(requireObjectCoercible(this));
notARegexp(searchString);
var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length));
var search = String(searchString);
- return nativeStartsWith
- ? nativeStartsWith.call(that, search, index)
+ return $startsWith
+ ? $startsWith.call(that, search, index)
: that.slice(index, index + search.length) === search;
}
});
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
@@ -3292,11 +3357,12 @@
- var nativeEndsWith = ''.endsWith;
+ // eslint-disable-next-line es/no-string-prototype-endswith -- safe
+ var $endsWith = ''.endsWith;
var min = Math.min;
var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('endsWith');
// https://github.com/zloirock/core-js/pull/702
var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
@@ -3312,12 +3378,12 @@
notARegexp(searchString);
var endPosition = arguments.length > 1 ? arguments[1] : undefined;
var len = toLength(that.length);
var end = endPosition === undefined ? len : min(toLength(endPosition), len);
var search = String(searchString);
- return nativeEndsWith
- ? nativeEndsWith.call(that, search, end)
+ return $endsWith
+ ? $endsWith.call(that, search, end)
: that.slice(end - search.length, end) === search;
}
});
var Utils = {
@@ -3580,10 +3646,21 @@
}
}
return true;
},
+ regexCompare: function regexCompare(value, search) {
+ try {
+ var regexpParts = search.match(/^\/(.*?)\/([gim]*)$/);
+
+ if (value.toString().search(regexpParts ? new RegExp(regexpParts[1], regexpParts[2]) : new RegExp(search, 'gim')) !== -1) {
+ return true;
+ }
+ } catch (e) {
+ return false;
+ }
+ },
escapeHTML: function escapeHTML(text) {
if (typeof text === 'string') {
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/`/g, '`');
}
@@ -3821,11 +3898,11 @@
var onScroll = function onScroll() {
if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
_this.initDOM(_this.rows);
- _this.callback();
+ _this.callback(_this.startIndex, _this.endIndex);
}
};
this.scrollEl.addEventListener('scroll', onScroll, false);
@@ -3861,10 +3938,12 @@
if (data.bottomOffset) {
html.push(this.getExtra('bottom', data.bottomOffset));
}
+ this.startIndex = data.start;
+ this.endIndex = data.end;
this.contentEl.innerHTML = html.join('');
if (fixedScroll) {
this.contentEl.scrollTop = this.cache.scrollTop;
}
@@ -3917,10 +3996,12 @@
for (var i = start; i < end; i++) {
rows[i] && thisRows.push(rows[i]);
}
return {
+ start: start,
+ end: end,
topOffset: topOffset,
bottomOffset: bottomOffset,
rowsAbove: rowsAbove,
rows: thisRows
};
@@ -4005,17 +4086,31 @@
if (parts[1]) {
parts[1] = parts[1].toUpperCase();
}
+ var localesToExtend = {};
+
if (locales[this.options.locale]) {
- $__default['default'].extend(this.options, locales[this.options.locale]);
+ localesToExtend = locales[this.options.locale];
} else if (locales[parts.join('-')]) {
- $__default['default'].extend(this.options, locales[parts.join('-')]);
+ localesToExtend = locales[parts.join('-')];
} else if (locales[parts[0]]) {
- $__default['default'].extend(this.options, locales[parts[0]]);
+ localesToExtend = locales[parts[0]];
}
+
+ for (var _i = 0, _Object$entries = Object.entries(localesToExtend); _i < _Object$entries.length; _i++) {
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
+ formatName = _Object$entries$_i[0],
+ func = _Object$entries$_i[1];
+
+ if (this.options[formatName] !== BootstrapTable.DEFAULTS[formatName]) {
+ continue;
+ }
+
+ this.options[formatName] = func;
+ }
}
}
}, {
key: "initContainer",
value: function initContainer() {
@@ -4197,14 +4292,14 @@
var headerStyle = Utils.calculateObjectValue(null, _this2.options.headerStyle, [column]);
var csses = [];
var classes = '';
if (headerStyle && headerStyle.css) {
- for (var _i = 0, _Object$entries = Object.entries(headerStyle.css); _i < _Object$entries.length; _i++) {
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
- key = _Object$entries$_i[0],
- value = _Object$entries$_i[1];
+ for (var _i2 = 0, _Object$entries2 = Object.entries(headerStyle.css); _i2 < _Object$entries2.length; _i2++) {
+ var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
+ key = _Object$entries2$_i[0],
+ value = _Object$entries2$_i[1];
csses.push("".concat(key, ": ").concat(value));
}
}
@@ -4292,20 +4387,10 @@
if (_this2.options.sortable && $this.parent().data().sortable) {
_this2.onSort(e);
}
});
- this.$header.children().children().off('keypress').on('keypress', function (e) {
- if (_this2.options.sortable && $__default['default'](e.currentTarget).data().sortable) {
- var code = e.keyCode || e.which;
-
- if (code === 13) {
- // Enter keycode
- _this2.onSort(e);
- }
- }
- });
var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id'));
$__default['default'](window).off(resizeEvent);
if (!this.options.showHeader || this.options.cardView) {
this.$header.hide();
@@ -4580,14 +4665,14 @@
}
}
});
var buttonsHtml = {};
- for (var _i2 = 0, _Object$entries2 = Object.entries(this.buttons); _i2 < _Object$entries2.length; _i2++) {
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
- buttonName = _Object$entries2$_i[0],
- buttonConfig = _Object$entries2$_i[1];
+ for (var _i3 = 0, _Object$entries3 = Object.entries(this.buttons); _i3 < _Object$entries3.length; _i3++) {
+ var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
+ buttonName = _Object$entries3$_i[0],
+ buttonConfig = _Object$entries3$_i[1];
var buttonHtml = void 0;
if (buttonConfig.hasOwnProperty('html')) {
if (typeof buttonConfig.html === 'function') {
@@ -4597,14 +4682,14 @@
}
} else {
buttonHtml = "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"").concat(buttonName, "\"");
if (buttonConfig.hasOwnProperty('attributes')) {
- for (var _i3 = 0, _Object$entries3 = Object.entries(buttonConfig.attributes); _i3 < _Object$entries3.length; _i3++) {
- var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
- attributeName = _Object$entries3$_i[0],
- value = _Object$entries3$_i[1];
+ for (var _i4 = 0, _Object$entries4 = Object.entries(buttonConfig.attributes); _i4 < _Object$entries4.length; _i4++) {
+ var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
+ attributeName = _Object$entries4$_i[0],
+ value = _Object$entries4$_i[1];
buttonHtml += " ".concat(attributeName, "=\"").concat(value, "\"");
}
}
@@ -4657,14 +4742,14 @@
if (this.showToolbar || html.length > 2) {
this.$toolbar.append(html.join(''));
}
- for (var _i4 = 0, _Object$entries4 = Object.entries(this.buttons); _i4 < _Object$entries4.length; _i4++) {
- var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
- _buttonName = _Object$entries4$_i[0],
- _buttonConfig = _Object$entries4$_i[1];
+ for (var _i5 = 0, _Object$entries5 = Object.entries(this.buttons); _i5 < _Object$entries5.length; _i5++) {
+ var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
+ _buttonName = _Object$entries5$_i[0],
+ _buttonConfig = _Object$entries5$_i[1];
if (_buttonConfig.hasOwnProperty('event')) {
if (typeof _buttonConfig.event === 'function' || typeof _buttonConfig.event === 'string') {
var _ret = function () {
var event = typeof _buttonConfig.event === 'string' ? window[_buttonConfig.event] : _buttonConfig.event;
@@ -4678,22 +4763,22 @@
if (_ret === "continue") continue;
}
var _loop = function _loop() {
- var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
- eventType = _Object$entries5$_i[0],
- eventFunction = _Object$entries5$_i[1];
+ var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
+ eventType = _Object$entries6$_i[0],
+ eventFunction = _Object$entries6$_i[1];
var event = typeof eventFunction === 'string' ? window[eventFunction] : eventFunction;
_this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off(eventType).on(eventType, function () {
return event.call(_this4);
});
};
- for (var _i5 = 0, _Object$entries5 = Object.entries(_buttonConfig.event); _i5 < _Object$entries5.length; _i5++) {
+ for (var _i6 = 0, _Object$entries6 = Object.entries(_buttonConfig.event); _i6 < _Object$entries6.length; _i6++) {
_loop();
}
}
}
@@ -4834,11 +4919,14 @@
if (this.searchText === text) {
return;
}
- if (currentTarget === Utils.getSearchInput(this)[0] || $__default['default'](currentTarget).hasClass('search-input')) {
+ var $searchInput = Utils.getSearchInput(this);
+ var $currentTarget = currentTarget instanceof jQuery ? currentTarget : $__default['default'](currentTarget);
+
+ if ($currentTarget.is($searchInput) || $currentTarget.hasClass('search-input')) {
this.searchText = text;
this.options.searchText = text;
}
}
@@ -4874,15 +4962,16 @@
}
return;
}
- var s = this.searchText && (this.fromHtml ? Utils.escapeHTML(this.searchText) : this.searchText).toLowerCase();
+ var rawSearchText = this.searchText && (this.fromHtml ? Utils.escapeHTML(this.searchText) : this.searchText);
+ var searchText = rawSearchText ? rawSearchText.toLowerCase() : '';
var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
if (this.options.searchAccentNeutralise) {
- s = Utils.normalizeAccent(s);
+ searchText = Utils.normalizeAccent(searchText);
} // Check filter
if (typeof this.filterOptions.filterAlgorithm === 'function') {
this.data = this.options.data.filter(function (item) {
@@ -4913,11 +5002,11 @@
return true;
}) : _toConsumableArray(this.options.data);
}
var visibleFields = this.getVisibleFields();
- this.data = s ? this.data.filter(function (item, i) {
+ this.data = searchText ? this.data.filter(function (item, i) {
for (var j = 0; j < _this5.header.fields.length; j++) {
if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
continue;
}
@@ -4927,13 +5016,13 @@
if (typeof key === 'string') {
value = item;
var props = key.split('.');
- for (var _i6 = 0; _i6 < props.length; _i6++) {
- if (value[props[_i6]] !== null) {
- value = value[props[_i6]];
+ for (var _i7 = 0; _i7 < props.length; _i7++) {
+ if (value[props[_i7]] !== null) {
+ value = value[props[_i7]];
}
}
} else {
value = item[key];
}
@@ -4946,56 +5035,54 @@
if (column && column.searchFormatter) {
value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
}
if (typeof value === 'string' || typeof value === 'number') {
- if (_this5.options.strictSearch) {
- if ("".concat(value).toLowerCase() === s) {
- return true;
- }
- } else {
- var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
- var matches = largerSmallerEqualsRegex.exec(_this5.searchText);
- var comparisonCheck = false;
+ if (_this5.options.strictSearch && "".concat(value).toLowerCase() === searchText || _this5.options.regexSearch && Utils.regexCompare(value, rawSearchText)) {
+ return true;
+ }
- if (matches) {
- var operator = matches[1] || "".concat(matches[5], "l");
- var comparisonValue = matches[2] || matches[3];
- var int = parseInt(value, 10);
- var comparisonInt = parseInt(comparisonValue, 10);
+ var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
+ var matches = largerSmallerEqualsRegex.exec(_this5.searchText);
+ var comparisonCheck = false;
- switch (operator) {
- case '>':
- case '<l':
- comparisonCheck = int > comparisonInt;
- break;
+ if (matches) {
+ var operator = matches[1] || "".concat(matches[5], "l");
+ var comparisonValue = matches[2] || matches[3];
+ var int = parseInt(value, 10);
+ var comparisonInt = parseInt(comparisonValue, 10);
- case '<':
- case '>l':
- comparisonCheck = int < comparisonInt;
- break;
+ switch (operator) {
+ case '>':
+ case '<l':
+ comparisonCheck = int > comparisonInt;
+ break;
- case '<=':
- case '=<':
- case '>=l':
- case '=>l':
- comparisonCheck = int <= comparisonInt;
- break;
+ case '<':
+ case '>l':
+ comparisonCheck = int < comparisonInt;
+ break;
- case '>=':
- case '=>':
- case '<=l':
- case '=<l':
- comparisonCheck = int >= comparisonInt;
- break;
- }
- }
+ case '<=':
+ case '=<':
+ case '>=l':
+ case '=>l':
+ comparisonCheck = int <= comparisonInt;
+ break;
- if (comparisonCheck || "".concat(value).toLowerCase().includes(s)) {
- return true;
+ case '>=':
+ case '=>':
+ case '<=l':
+ case '=<l':
+ comparisonCheck = int >= comparisonInt;
+ break;
}
}
+
+ if (comparisonCheck || "".concat(value).toLowerCase().includes(searchText)) {
+ return true;
+ }
}
}
return false;
}) : this.data;
@@ -5217,11 +5304,11 @@
this.$pagination.find('div.pagination').hide();
}
if (opts.smartDisplay) {
if (pageList.length < 2 || opts.totalRows <= pageList[0]) {
- this.$pagination.find('span.page-list').hide();
+ this.$pagination.find('div.page-list').hide();
}
} // when data is empty, hide the pagination
this.$pagination[this.getData().length ? 'show' : 'hide']();
@@ -5288,10 +5375,14 @@
return false;
}
}, {
key: "onPagePre",
value: function onPagePre(event) {
+ if ($__default['default'](event.target).hasClass('disabled')) {
+ return;
+ }
+
event.preventDefault();
if (this.options.pageNumber - 1 === 0) {
this.options.pageNumber = this.options.totalPages;
} else {
@@ -5302,10 +5393,14 @@
return false;
}
}, {
key: "onPageNext",
value: function onPageNext(event) {
+ if ($__default['default'](event.target).hasClass('disabled')) {
+ return;
+ }
+
event.preventDefault();
if (this.options.pageNumber + 1 > this.options.totalPages) {
this.options.pageNumber = 1;
} else {
@@ -5346,36 +5441,36 @@
}
style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
if (style && style.css) {
- for (var _i7 = 0, _Object$entries6 = Object.entries(style.css); _i7 < _Object$entries6.length; _i7++) {
- var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i7], 2),
- key = _Object$entries6$_i[0],
- value = _Object$entries6$_i[1];
+ for (var _i8 = 0, _Object$entries7 = Object.entries(style.css); _i8 < _Object$entries7.length; _i8++) {
+ var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
+ key = _Object$entries7$_i[0],
+ value = _Object$entries7$_i[1];
csses.push("".concat(key, ": ").concat(value));
}
}
attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
if (attributes) {
- for (var _i8 = 0, _Object$entries7 = Object.entries(attributes); _i8 < _Object$entries7.length; _i8++) {
- var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
- _key2 = _Object$entries7$_i[0],
- _value = _Object$entries7$_i[1];
+ for (var _i9 = 0, _Object$entries8 = Object.entries(attributes); _i9 < _Object$entries8.length; _i9++) {
+ var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2),
+ _key2 = _Object$entries8$_i[0],
+ _value = _Object$entries8$_i[1];
htmlAttributes.push("".concat(_key2, "=\"").concat(Utils.escapeHTML(_value), "\""));
}
}
if (item._data && !Utils.isEmptyObject(item._data)) {
- for (var _i9 = 0, _Object$entries8 = Object.entries(item._data); _i9 < _Object$entries8.length; _i9++) {
- var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2),
- k = _Object$entries8$_i[0],
- v = _Object$entries8$_i[1];
+ for (var _i10 = 0, _Object$entries9 = Object.entries(item._data); _i10 < _Object$entries9.length; _i10++) {
+ var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2),
+ k = _Object$entries9$_i[0],
+ v = _Object$entries9$_i[1];
// ignore data-index
if (k === 'index') {
return;
}
@@ -5482,14 +5577,14 @@
}
if (cellStyle.css) {
var csses_ = [];
- for (var _i10 = 0, _Object$entries9 = Object.entries(cellStyle.css); _i10 < _Object$entries9.length; _i10++) {
- var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2),
- _key3 = _Object$entries9$_i[0],
- _value2 = _Object$entries9$_i[1];
+ for (var _i11 = 0, _Object$entries10 = Object.entries(cellStyle.css); _i11 < _Object$entries10.length; _i11++) {
+ var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2),
+ _key3 = _Object$entries10$_i[0],
+ _value2 = _Object$entries10$_i[1];
csses_.push("".concat(_key3, ": ").concat(_value2));
}
style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
@@ -5499,11 +5594,11 @@
if (!(column.checkbox || column.radio)) {
value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
}
- if (column.searchable && _this7.searchText && _this7.options.searchHighlight) {
+ if (column.searchable && _this7.searchText && _this7.options.searchHighlight && !(column.checkbox || column.radio)) {
var defValue = '';
var regExp = new RegExp("(".concat(_this7.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), ")"), 'gim');
var marker = '<mark>$1</mark>';
var isHTML = value && /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(value);
@@ -5519,14 +5614,14 @@
value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, _this7.searchText], defValue);
}
if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
- for (var _i11 = 0, _Object$entries10 = Object.entries(item["_".concat(field, "_data")]); _i11 < _Object$entries10.length; _i11++) {
- var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2),
- _k = _Object$entries10$_i[0],
- _v = _Object$entries10$_i[1];
+ for (var _i12 = 0, _Object$entries11 = Object.entries(item["_".concat(field, "_data")]); _i12 < _Object$entries11.length; _i12++) {
+ var _Object$entries11$_i = _slicedToArray(_Object$entries11[_i12], 2),
+ _k = _Object$entries11$_i[0],
+ _v = _Object$entries11$_i[1];
// ignore data-index
if (_k === 'index') {
return;
}
@@ -5568,11 +5663,11 @@
html.push('</tr>');
return html.join('');
}
}, {
key: "initBody",
- value: function initBody(fixedScroll) {
+ value: function initBody(fixedScroll, updatedUid) {
var _this8 = this;
var data = this.getData();
this.trigger('pre-body', data);
this.$body = this.$el.find('>tbody');
@@ -5588,18 +5683,35 @@
}
var rows = [];
var trFragments = $__default['default'](document.createDocumentFragment());
var hasTr = false;
+ var toExpand = [];
this.autoMergeCells = Utils.checkAutoMergeCells(data.slice(this.pageFrom - 1, this.pageTo));
for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
var item = data[i];
var tr = this.initRow(item, i, data, trFragments);
hasTr = hasTr || !!tr;
if (tr && typeof tr === 'string') {
+ var uniqueId = this.options.uniqueId;
+
+ if (uniqueId && item.hasOwnProperty(uniqueId)) {
+ var itemUniqueId = item[uniqueId];
+ var oldTr = this.$body.find(Utils.sprintf('> tr[data-uniqueid="%s"][data-has-detail-view]', itemUniqueId));
+ var oldTrNext = oldTr.next();
+
+ if (oldTrNext.is('tr.detail-view')) {
+ toExpand.push(i);
+
+ if (!updatedUid || itemUniqueId !== updatedUid) {
+ tr += oldTrNext[0].outerHTML;
+ }
+ }
+ }
+
if (!this.options.virtualScroll) {
trFragments.append(tr);
} else {
rows.push(tr);
}
@@ -5620,26 +5732,32 @@
rows: rows,
fixedScroll: fixedScroll,
scrollEl: this.$tableBody[0],
contentEl: this.$body[0],
itemHeight: this.options.virtualScrollItemHeight,
- callback: function callback() {
+ callback: function callback(startIndex, endIndex) {
_this8.fitHeader();
_this8.initBodyEvent();
+
+ _this8.trigger('virtual-scroll', startIndex, endIndex);
}
});
}
+ toExpand.forEach(function (index) {
+ _this8.expandRow(index);
+ });
+
if (!fixedScroll) {
this.scrollTo(0);
}
this.initBodyEvent();
- this.updateSelected();
this.initFooter();
this.resetView();
+ this.updateSelected();
if (this.options.sidePagination !== 'server') {
this.options.totalRows = data.length;
}
@@ -5789,13 +5907,13 @@
order: params.sortOrder
};
if (this.options.pagination && this.options.sidePagination === 'server') {
params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
- params.limit = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
+ params.limit = this.options.pageSize;
- if (params.limit === 0) {
+ if (params.limit === 0 || this.options.pageSize === this.options.formatAllRows()) {
delete params.limit;
}
}
}
@@ -5853,15 +5971,21 @@
if (!silent) {
_this10.hideLoading();
}
- if (_this10.options.sidePagination === 'server' && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) {
+ if (_this10.options.sidePagination === 'server' && _this10.options.pageNumber > 1 && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) {
_this10.updatePagination();
}
},
error: function error(jqXHR) {
+ // abort ajax by multiple request
+ if (jqXHR && jqXHR.status === 0 && _this10._xhrAbort) {
+ _this10._xhrAbort = false;
+ return;
+ }
+
var data = [];
if (_this10.options.sidePagination === 'server') {
data = {};
data[_this10.options.totalField] = 0;
@@ -5878,10 +6002,12 @@
if (this.options.ajax) {
Utils.calculateObjectValue(this, this.options.ajax, [request], null);
} else {
if (this._xhr && this._xhr.readyState !== 4) {
+ this._xhrAbort = true;
+
this._xhr.abort();
}
this._xhr = $__default['default'].ajax(request);
}
@@ -6118,14 +6244,14 @@
falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
valign = Utils.sprintf('vertical-align: %s; ', column.valign);
style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
if (style && style.css) {
- for (var _i12 = 0, _Object$entries11 = Object.entries(style.css); _i12 < _Object$entries11.length; _i12++) {
- var _Object$entries11$_i = _slicedToArray(_Object$entries11[_i12], 2),
- key = _Object$entries11$_i[0],
- _value3 = _Object$entries11$_i[1];
+ for (var _i13 = 0, _Object$entries12 = Object.entries(style.css); _i13 < _Object$entries12.length; _i13++) {
+ var _Object$entries12$_i = _slicedToArray(_Object$entries12[_i13], 2),
+ key = _Object$entries12$_i[0],
+ _value3 = _Object$entries12$_i[1];
csses.push("".concat(key, ": ").concat(_value3));
}
}
@@ -6323,14 +6449,14 @@
});
}
if (params && params.formatted) {
data.forEach(function (row) {
- for (var _i13 = 0, _Object$entries12 = Object.entries(row); _i13 < _Object$entries12.length; _i13++) {
- var _Object$entries12$_i = _slicedToArray(_Object$entries12[_i13], 2),
- key = _Object$entries12$_i[0],
- value = _Object$entries12$_i[1];
+ for (var _i14 = 0, _Object$entries13 = Object.entries(row); _i14 < _Object$entries13.length; _i14++) {
+ var _Object$entries13$_i = _slicedToArray(_Object$entries13[_i14], 2),
+ key = _Object$entries13$_i[0],
+ value = _Object$entries13$_i[1];
var column = _this17.columns[_this17.fieldsColumnsIndex[key]];
if (!column) {
return;
@@ -6503,11 +6629,11 @@
if (typeof rowUniqueId === 'string') {
id = id.toString();
} else if (typeof rowUniqueId === 'number') {
if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
- id = parseInt(id);
+ id = parseInt(id, 10);
} else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
id = parseFloat(id);
}
}
@@ -6521,10 +6647,11 @@
}
}, {
key: "updateByUniqueId",
value: function updateByUniqueId(params) {
var allParams = Array.isArray(params) ? params : [params];
+ var updatedUid = null;
var _iterator7 = _createForOfIteratorHelper(allParams),
_step7;
try {
@@ -6544,21 +6671,23 @@
if (_params2.hasOwnProperty('replace') && _params2.replace) {
this.options.data[rowId] = _params2.row;
} else {
$__default['default'].extend(this.options.data[rowId], _params2.row);
}
+
+ updatedUid = _params2.id;
}
} catch (err) {
_iterator7.e(err);
} finally {
_iterator7.f();
}
this.initSearch();
this.initPagination();
this.initSort();
- this.initBody(true);
+ this.initBody(true, updatedUid);
}
}, {
key: "removeByUniqueId",
value: function removeByUniqueId(id) {
var len = this.options.data.length;
@@ -6826,11 +6955,11 @@
var col = this.getVisibleFields().indexOf(options.field);
var rowspan = options.rowspan || 1;
var colspan = options.colspan || 1;
var i;
var j;
- var $tr = this.$body.find('>tr');
+ var $tr = this.$body.find('>tr[data-index]');
col += Utils.getDetailViewIndexOffset(this.options);
var $td = $tr.eq(row).find('>td').eq(col);
if (row < 0 || col < 0 || row >= this.data.length) {
return;
@@ -6969,13 +7098,14 @@
}
if (obj.values.includes(row[obj.field])) {
var $el = _this24.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
+ var onlyCurrentPage = obj.hasOwnProperty('onlyCurrentPage') ? obj.onlyCurrentPage : false;
$el = checked ? $el.not(':checked') : $el.filter(':checked');
- if (!$el.length) {
+ if (!$el.length && onlyCurrentPage) {
return;
}
$el.prop('checked', checked);
row[_this24.header.stateField] = checked;
@@ -7020,11 +7150,10 @@
if (params && params.height) {
this.options.height = params.height;
}
- this.$selectAll.prop('checked', this.$selectItem.length > 0 && this.$selectItem.length === this.$selectItem.filter(':checked').length);
this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
if (!this.options.cardView && this.options.showHeader && this.options.height) {
this.$tableHeader.show();
this.resetHeader();
@@ -7110,10 +7239,11 @@
this.options.pagination = !this.options.pagination;
var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
this.updatePagination();
+ this.trigger('toggle-pagination', this.options.pagination);
}
}, {
key: "toggleFullscreen",
value: function toggleFullscreen() {
this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
@@ -7221,15 +7351,15 @@
key: "expandRow",
value: function expandRow(index, _columnDetailFormatter) {
var row = this.data[index];
var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
- if ($tr.next().is('tr.detail-view')) {
- return;
- }
-
if (this.options.detailViewIcon) {
$tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
+ }
+
+ if ($tr.next().is('tr.detail-view')) {
+ return;
}
$tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
var $element = $tr.next().find('td');
var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;