') !== '7';
});
// @@replace logic
fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
return [
// `String.prototype.replace` method
// https://tc39.es/ecma262/#sec-string.prototype.replace
function replace(searchValue, replaceValue) {
var O = requireObjectCoercible(this);
var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
return replacer
? functionCall(replacer, searchValue, O, replaceValue)
: functionCall(nativeReplace, toString_1(O), searchValue, replaceValue);
},
// `RegExp.prototype[@@replace]` method
// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
function (string, replaceValue) {
var rx = anObject(this);
var S = toString_1(string);
if (
typeof replaceValue == 'string' &&
stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
stringIndexOf(replaceValue, '$<') === -1
) {
var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
if (res.done) return res.value;
}
var functionalReplace = isCallable(replaceValue);
if (!functionalReplace) replaceValue = toString_1(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;
push$1(results, result);
if (!global) break;
var matchStr = toString_1(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 = toString_1(result[0]);
var position = max(min$1(toIntegerOrInfinity(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++) push$1(captures, maybeToString(result[j]));
var namedCaptures = result.groups;
if (functionalReplace) {
var replacerArgs = concat([matched], captures, position, S);
if (namedCaptures !== undefined) push$1(replacerArgs, namedCaptures);
var replacement = toString_1(functionApply(replaceValue, undefined, replacerArgs));
} else {
replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
}
if (position >= nextSourcePosition) {
accumulatedResult += stringSlice$1(S, nextSourcePosition, position) + replacement;
nextSourcePosition = position + matched.length;
}
}
return accumulatedResult + stringSlice$1(S, nextSourcePosition);
}
];
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
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 engineV8Version >= 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';
var TypeError$2 = global_1.TypeError;
// 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 = engineV8Version >= 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.es/ecma262/#sec-array.prototype.concat
// with adding support of @@isConcatSpreadable and @@species
_export({ target: 'Array', proto: true, forced: FORCED }, {
// eslint-disable-next-line no-unused-vars -- required for `.length`
concat: function concat(arg) {
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 = lengthOfArrayLike(E);
if (n + len > MAX_SAFE_INTEGER) throw TypeError$2(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$2(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
createProperty(A, n++, E);
}
}
A.length = n;
return A;
}
});
var $filter = arrayIteration.filter;
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
// `Array.prototype.filter` method
// https://tc39.es/ecma262/#sec-array.prototype.filter
// with adding support of @@species
_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
filter: function filter(callbackfn /* , thisArg */) {
return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
// @@match logic
fixRegexpWellKnownSymbolLogic('match', 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 : getMethod(regexp, MATCH);
return matcher ? functionCall(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString_1(O));
},
// `RegExp.prototype[@@match]` method
// https://tc39.es/ecma262/#sec-regexp.prototype-@@match
function (string) {
var rx = anObject(this);
var S = toString_1(string);
var res = maybeCallNative(nativeMatch, rx, S);
if (res.done) return res.value;
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 = toString_1(result[0]);
A[n] = matchStr;
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
n++;
}
return n === 0 ? null : A;
}
];
});
var MATCH = wellKnownSymbol('match');
// `IsRegExp` abstract operation
// https://tc39.es/ecma262/#sec-isregexp
var isRegexp = function (it) {
var isRegExp;
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
};
var TypeError$1 = global_1.TypeError;
// `Assert: IsConstructor(argument) is true`
var aConstructor = function (argument) {
if (isConstructor(argument)) return argument;
throw TypeError$1(tryToString(argument) + ' is not a constructor');
};
var SPECIES = wellKnownSymbol('species');
// `SpeciesConstructor` abstract operation
// https://tc39.es/ecma262/#sec-speciesconstructor
var speciesConstructor = function (O, defaultConstructor) {
var C = anObject(O).constructor;
var S;
return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);
};
var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y;
var MAX_UINT32 = 0xFFFFFFFF;
var min = Math.min;
var $push = [].push;
var exec = functionUncurryThis(/./.exec);
var push = functionUncurryThis($push);
var stringSlice = functionUncurryThis(''.slice);
// 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 () {
// eslint-disable-next-line regexp/no-empty-group -- required for testing
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';
});
// @@split logic
fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
var internalSplit;
if (
'abbc'.split(/(b)*/)[1] == 'c' ||
// eslint-disable-next-line regexp/no-empty-group -- required for testing
'test'.split(/(?:)/, -1).length != 4 ||
'ab'.split(/(?:ab)*/).length != 2 ||
'.'.split(/(.?)(.?)/).length != 4 ||
// eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
'.'.split(/()()/).length > 1 ||
''.split(/.?/).length
) {
// based on es5-shim implementation, need to rework it
internalSplit = function (separator, limit) {
var string = toString_1(requireObjectCoercible(this));
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
if (lim === 0) return [];
if (separator === undefined) return [string];
// If `separator` is not a regex, use native split
if (!isRegexp(separator)) {
return functionCall(nativeSplit, string, separator, lim);
}
var output = [];
var flags = (separator.ignoreCase ? 'i' : '') +
(separator.multiline ? 'm' : '') +
(separator.unicode ? 'u' : '') +
(separator.sticky ? 'y' : '');
var lastLastIndex = 0;
// Make `global` and avoid `lastIndex` issues by working with a copy
var separatorCopy = new RegExp(separator.source, flags + 'g');
var match, lastIndex, lastLength;
while (match = functionCall(regexpExec, separatorCopy, string)) {
lastIndex = separatorCopy.lastIndex;
if (lastIndex > lastLastIndex) {
push(output, stringSlice(string, lastLastIndex, match.index));
if (match.length > 1 && match.index < string.length) functionApply($push, output, arraySliceSimple(match, 1));
lastLength = match[0].length;
lastLastIndex = lastIndex;
if (output.length >= lim) break;
}
if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
}
if (lastLastIndex === string.length) {
if (lastLength || !exec(separatorCopy, '')) push(output, '');
} else push(output, stringSlice(string, lastLastIndex));
return output.length > lim ? arraySliceSimple(output, 0, lim) : output;
};
// Chakra, V8
} else if ('0'.split(undefined, 0).length) {
internalSplit = function (separator, limit) {
return separator === undefined && limit === 0 ? [] : functionCall(nativeSplit, this, separator, limit);
};
} else internalSplit = nativeSplit;
return [
// `String.prototype.split` method
// https://tc39.es/ecma262/#sec-string.prototype.split
function split(separator, limit) {
var O = requireObjectCoercible(this);
var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT);
return splitter
? functionCall(splitter, separator, O, limit)
: functionCall(internalSplit, toString_1(O), separator, limit);
},
// `RegExp.prototype[@@split]` method
// https://tc39.es/ecma262/#sec-regexp.prototype-@@split
//
// NOTE: This cannot be properly polyfilled in engines that don't support
// the 'y' flag.
function (string, limit) {
var rx = anObject(this);
var S = toString_1(string);
var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
if (res.done) return res.value;
var C = speciesConstructor(rx, RegExp);
var unicodeMatching = rx.unicode;
var flags = (rx.ignoreCase ? 'i' : '') +
(rx.multiline ? 'm' : '') +
(rx.unicode ? 'u' : '') +
(UNSUPPORTED_Y ? 'g' : 'y');
// ^(? + rx + ) is needed, in combination with some S slicing, to
// simulate the 'y' flag.
var splitter = new C(UNSUPPORTED_Y ? '^(?:' + 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 = UNSUPPORTED_Y ? 0 : q;
var z = regexpExecAbstract(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S);
var e;
if (
z === null ||
(e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
) {
q = advanceStringIndex(S, q, unicodeMatching);
} else {
push(A, stringSlice(S, p, q));
if (A.length === lim) return A;
for (var i = 1; i <= z.length - 1; i++) {
push(A, z[i]);
if (A.length === lim) return A;
}
q = p = e;
}
}
push(A, stringSlice(S, p));
return A;
}
];
}, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
var $includes = arrayIncludes.includes;
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
_export({ target: 'Array', proto: true }, {
includes: function includes(el /* , fromIndex = 0 */) {
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
}
});
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables('includes');
// iterable DOM collections
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
var domIterables = {
CSSRuleList: 0,
CSSStyleDeclaration: 0,
CSSValueList: 0,
ClientRectList: 0,
DOMRectList: 0,
DOMStringList: 0,
DOMTokenList: 1,
DataTransferItemList: 0,
FileList: 0,
HTMLAllCollection: 0,
HTMLCollection: 0,
HTMLFormElement: 0,
HTMLSelectElement: 0,
MediaList: 0,
MimeTypeArray: 0,
NamedNodeMap: 0,
NodeList: 1,
PaintRequestList: 0,
Plugin: 0,
PluginArray: 0,
SVGLengthList: 0,
SVGNumberList: 0,
SVGPathSegList: 0,
SVGPointList: 0,
SVGStringList: 0,
SVGTransformList: 0,
SourceBufferList: 0,
StyleSheetList: 0,
TextTrackCueList: 0,
TextTrackList: 0,
TouchList: 0
};
// in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
var classList = documentCreateElement('span').classList;
var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
var domTokenListPrototype = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
var $forEach = arrayIteration.forEach;
var STRICT_METHOD$2 = arrayMethodIsStrict('forEach');
// `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;
var handlePrototype = function (CollectionPrototype) {
// some Chrome versions have non-configurable methods on DOMTokenList
if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
} catch (error) {
CollectionPrototype.forEach = arrayForEach;
}
};
for (var COLLECTION_NAME in domIterables) {
if (domIterables[COLLECTION_NAME]) {
handlePrototype(global_1[COLLECTION_NAME] && global_1[COLLECTION_NAME].prototype);
}
}
handlePrototype(domTokenListPrototype);
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
// `Object.keys` method
// https://tc39.es/ecma262/#sec-object.keys
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
keys: function keys(it) {
return objectKeys(toObject(it));
}
});
var un$Join = functionUncurryThis([].join);
var ES3_STRINGS = indexedObject != Object;
var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
// `Array.prototype.join` method
// https://tc39.es/ecma262/#sec-array.prototype.join
_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
join: function join(separator) {
return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
}
});
/* eslint-disable es/no-array-prototype-indexof -- required for testing */
var $IndexOf = arrayIncludes.indexOf;
var un$IndexOf = functionUncurryThis([].indexOf);
var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
var STRICT_METHOD = arrayMethodIsStrict('indexOf');
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
_export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
return NEGATIVE_ZERO
// convert -0 to +0
? un$IndexOf(this, searchElement, fromIndex) || 0
: $IndexOf(this, searchElement, fromIndex);
}
});
/* eslint-disable no-use-before-define */
var Utils = $__default["default"].fn.bootstrapTable.utils;
var searchControls = 'select, input:not([type="checkbox"]):not([type="radio"])';
function getInputClass(that) {
var isSelect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var formControlClass = isSelect ? that.constants.classes.select : that.constants.classes.input;
return that.options.iconSize ? Utils.sprintf('%s-%s', formControlClass, that.options.iconSize) : formControlClass;
}
function getOptionsFromSelectControl(selectControl) {
return selectControl[0].options;
}
function getControlContainer(that) {
if (that.options.filterControlContainer) {
return $__default["default"]("".concat(that.options.filterControlContainer));
}
if (that.options.height && that._initialized) {
return $__default["default"]('.fixed-table-header table thead');
}
return that.$header;
}
function isKeyAllowed(keyCode) {
return $__default["default"].inArray(keyCode, [37, 38, 39, 40]) > -1;
}
function getSearchControls(that) {
return getControlContainer(that).find(searchControls);
}
function hideUnusedSelectOptions(selectControl, uniqueValues) {
var options = getOptionsFromSelectControl(selectControl);
for (var i = 0; i < options.length; i++) {
if (options[i].value !== '') {
if (!uniqueValues.hasOwnProperty(options[i].value)) {
selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
} else {
selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
}
}
}
}
function existOptionInSelectControl(selectControl, value) {
var options = getOptionsFromSelectControl(selectControl);
for (var i = 0; i < options.length; i++) {
if (options[i].value === Utils.unescapeHTML(value)) {
// The value is not valid to add
return true;
}
} // If we get here, the value is valid to add
return false;
}
function addOptionToSelectControl(selectControl, _value, text, selected, shouldCompareText) {
var value = _value === undefined || _value === null ? '' : _value.toString().trim();
value = Utils.removeHTML(value);
text = Utils.removeHTML(text);
if (existOptionInSelectControl(selectControl, value)) {
return;
}
var isSelected = shouldCompareText ? value === selected || text === selected : value === selected;
var option = new Option(text, value, false, isSelected);
selectControl.get(0).add(option);
}
function sortSelectControl(selectControl, orderBy) {
var $selectControl = selectControl.get(0);
if (orderBy === 'server') {
return;
}
var tmpAry = new Array();
for (var i = 0; i < $selectControl.options.length; i++) {
tmpAry[i] = new Array();
tmpAry[i][0] = $selectControl.options[i].text;
tmpAry[i][1] = $selectControl.options[i].value;
tmpAry[i][2] = $selectControl.options[i].selected;
}
tmpAry.sort(function (a, b) {
return Utils.sort(a[0], b[0], orderBy === 'desc' ? -1 : 1);
});
while ($selectControl.options.length > 0) {
$selectControl.options[0] = null;
}
for (var _i = 0; _i < tmpAry.length; _i++) {
var op = new Option(tmpAry[_i][0], tmpAry[_i][1], false, tmpAry[_i][2]);
$selectControl.add(op);
}
}
function fixHeaderCSS(_ref) {
var $tableHeader = _ref.$tableHeader;
$tableHeader.css('height', $tableHeader.find('table').outerHeight(true));
}
function getElementClass($element) {
return $element.attr('class').replace('form-control', '').replace('focus-temp', '').replace('search-input', '').trim();
}
function getCursorPosition(el) {
if ($__default["default"](el).is('input[type=search]')) {
var pos = 0;
if ('selectionStart' in el) {
pos = el.selectionStart;
} else if ('selection' in document) {
el.focus();
var Sel = document.selection.createRange();
var SelLength = document.selection.createRange().text.length;
Sel.moveStart('character', -el.value.length);
pos = Sel.text.length - SelLength;
}
return pos;
}
return -1;
}
function cacheValues(that) {
var searchControls = getSearchControls(that);
that._valuesFilterControl = [];
searchControls.each(function () {
var $field = $__default["default"](this);
var fieldClass = getElementClass($field);
if (that.options.height && !that.options.filterControlContainer) {
$field = $__default["default"](".fixed-table-header .".concat(fieldClass));
} else if (that.options.filterControlContainer) {
$field = $__default["default"]("".concat(that.options.filterControlContainer, " .").concat(fieldClass));
} else {
$field = $__default["default"](".".concat(fieldClass));
}
that._valuesFilterControl.push({
field: $field.closest('[data-field]').data('field'),
value: $field.val(),
position: getCursorPosition($field.get(0)),
hasFocus: $field.is(':focus')
});
});
}
function setCaretPosition(elem, caretPos) {
try {
if (elem) {
if (elem.createTextRange) {
var range = elem.createTextRange();
range.move('character', caretPos);
range.select();
} else {
elem.setSelectionRange(caretPos, caretPos);
}
}
} catch (ex) {// ignored
}
}
function setValues(that) {
var field = null;
var result = [];
var searchControls = getSearchControls(that);
if (that._valuesFilterControl.length > 0) {
// Callback to apply after settings fields values
var callbacks = [];
searchControls.each(function (i, el) {
var $this = $__default["default"](el);
field = $this.closest('[data-field]').data('field');
result = that._valuesFilterControl.filter(function (valueObj) {
return valueObj.field === field;
});
if (result.length > 0) {
if (result[0].hasFocus || result[0].value) {
var fieldToFocusCallback = function (element, cacheElementInfo) {
// Closure here to capture the field information
var closedCallback = function closedCallback() {
if (cacheElementInfo.hasFocus) {
element.focus();
}
if (Array.isArray(cacheElementInfo.value)) {
var $element = $__default["default"](element);
$__default["default"].each(cacheElementInfo.value, function (i, e) {
$element.find(Utils.sprintf('option[value=\'%s\']', e)).prop('selected', true);
});
} else {
element.value = cacheElementInfo.value;
}
setCaretPosition(element, cacheElementInfo.position);
};
return closedCallback;
}($this.get(0), result[0]);
callbacks.push(fieldToFocusCallback);
}
}
}); // Callback call.
if (callbacks.length > 0) {
callbacks.forEach(function (callback) {
return callback();
});
}
}
}
function collectBootstrapTableFilterCookies() {
var cookies = [];
var foundCookies = document.cookie.match(/bs\.table\.(filterControl|searchText)/g);
var foundLocalStorage = localStorage;
if (foundCookies) {
$__default["default"].each(foundCookies, function (i, _cookie) {
var cookie = _cookie;
if (/./.test(cookie)) {
cookie = cookie.split('.').pop();
}
if ($__default["default"].inArray(cookie, cookies) === -1) {
cookies.push(cookie);
}
});
}
if (foundLocalStorage) {
for (var i = 0; i < foundLocalStorage.length; i++) {
var cookie = foundLocalStorage.key(i);
if (/./.test(cookie)) {
cookie = cookie.split('.').pop();
}
if (!cookies.includes(cookie)) {
cookies.push(cookie);
}
}
}
return cookies;
}
function escapeID(id) {
// eslint-disable-next-line no-useless-escape
return String(id).replace(/([:.\[\],])/g, '\\$1');
}
function isColumnSearchableViaSelect(_ref2) {
var filterControl = _ref2.filterControl,
searchable = _ref2.searchable;
return filterControl && filterControl.toLowerCase() === 'select' && searchable;
}
function isFilterDataNotGiven(_ref3) {
var filterData = _ref3.filterData;
return filterData === undefined || filterData.toLowerCase() === 'column';
}
function hasSelectControlElement(selectControl) {
return selectControl && selectControl.length > 0;
}
function initFilterSelectControls(that) {
var data = that.options.data;
$__default["default"].each(that.header.fields, function (j, field) {
var column = that.columns[that.fieldsColumnsIndex[field]];
var selectControl = getControlContainer(that).find("select.bootstrap-table-filter-control-".concat(escapeID(column.field)));
if (isColumnSearchableViaSelect(column) && isFilterDataNotGiven(column) && hasSelectControlElement(selectControl)) {
if (!selectControl[0].multiple && selectControl.get(selectControl.length - 1).options.length === 0) {
// Added the default option, must use a non-breaking space( ) to pass the W3C validator
addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder || ' ', column.filterDefault);
}
var uniqueValues = {};
for (var i = 0; i < data.length; i++) {
// Added a new value
var fieldValue = Utils.getItemField(data[i], field, false);
var formatter = that.options.editable && column.editable ? column._formatter : that.header.formatters[j];
var formattedValue = Utils.calculateObjectValue(that.header, formatter, [fieldValue, data[i], i], fieldValue);
if (!fieldValue) {
fieldValue = formattedValue;
column._forceFormatter = true;
}
if (column.filterDataCollector) {
formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
}
if (column.searchFormatter) {
fieldValue = formattedValue;
}
uniqueValues[formattedValue] = fieldValue;
if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
formattedValue.forEach(function (value) {
addOptionToSelectControl(selectControl, value, value, column.filterDefault);
});
continue;
}
} // eslint-disable-next-line guard-for-in
for (var key in uniqueValues) {
addOptionToSelectControl(selectControl, uniqueValues[key], key, column.filterDefault);
}
}
});
}
function getFilterDataMethod(objFilterDataMethod, searchTerm) {
var keys = Object.keys(objFilterDataMethod);
for (var i = 0; i < keys.length; i++) {
if (keys[i] === searchTerm) {
return objFilterDataMethod[searchTerm];
}
}
return null;
}
function createControls(that, header) {
var addedFilterControl = false;
var html;
$__default["default"].each(that.columns, function (_, column) {
html = [];
if (!column.visible) {
return;
}
if (!column.filterControl && !that.options.filterControlContainer) {
html.push('');
} else if (that.options.filterControlContainer) {
// Use a filter control container instead of th
var $filterControls = $__default["default"](".bootstrap-table-filter-control-".concat(column.field));
$__default["default"].each($filterControls, function (_, filterControl) {
var $filterControl = $__default["default"](filterControl);
if (!$filterControl.is('[type=radio]')) {
var placeholder = column.filterControlPlaceholder || '';
$filterControl.attr('placeholder', placeholder).val(column.filterDefault);
}
$filterControl.attr('data-field', column.field);
});
addedFilterControl = true;
} else {
// Create the control based on the html defined in the filterTemplate array.
var nameControl = column.filterControl.toLowerCase();
html.push('');
addedFilterControl = true;
if (column.searchable && that.options.filterTemplate[nameControl]) {
html.push(that.options.filterTemplate[nameControl](that, column, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
}
} // Filtering by default when it is set.
if (column.filterControl && '' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
if ($__default["default"].isEmptyObject(that.filterColumnsPartial)) {
that.filterColumnsPartial = {};
}
that.filterColumnsPartial[column.field] = column.filterDefault;
}
$__default["default"].each(header.find('th'), function (_, th) {
var $th = $__default["default"](th);
if ($th.data('field') === column.field) {
$th.find('.filter-control').remove();
$th.find('.fht-cell').html(html.join(''));
return false;
}
});
if (column.filterData && column.filterData.toLowerCase() !== 'column') {
var filterDataType = getFilterDataMethod(filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
var filterDataSource;
var selectControl;
if (filterDataType) {
filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
selectControl = header.find(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault, true);
filterDataType(that, filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault);
} else {
throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, obj, json, url, func.' + ' Use like this: var: {key: "value"}');
}
}
});
if (addedFilterControl) {
header.off('keyup', 'input').on('keyup', 'input', function (_ref4, obj) {
var currentTarget = _ref4.currentTarget,
keyCode = _ref4.keyCode;
keyCode = obj ? obj.keyCode : keyCode;
if (that.options.searchOnEnterKey && keyCode !== 13) {
return;
}
if (isKeyAllowed(keyCode)) {
return;
}
var $currentTarget = $__default["default"](currentTarget);
if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
return;
}
clearTimeout(currentTarget.timeoutId || 0);
currentTarget.timeoutId = setTimeout(function () {
that.onColumnSearch({
currentTarget: currentTarget,
keyCode: keyCode
});
}, that.options.searchTimeOut);
});
header.off('change', 'select', '.fc-multipleselect').on('change', 'select', '.fc-multipleselect', function (_ref5) {
var currentTarget = _ref5.currentTarget,
keyCode = _ref5.keyCode;
var $selectControl = $__default["default"](currentTarget);
var value = $selectControl.val();
if (Array.isArray(value)) {
for (var i = 0; i < value.length; i++) {
if (value[i] && value[i].length > 0 && value[i].trim()) {
$selectControl.find("option[value=\"".concat(value[i], "\"]")).attr('selected', true);
}
}
} else if (value && value.length > 0 && value.trim()) {
$selectControl.find('option[selected]').removeAttr('selected');
$selectControl.find("option[value=\"".concat(value, "\"]")).attr('selected', true);
} else {
$selectControl.find('option[selected]').removeAttr('selected');
}
clearTimeout(currentTarget.timeoutId || 0);
currentTarget.timeoutId = setTimeout(function () {
that.onColumnSearch({
currentTarget: currentTarget,
keyCode: keyCode
});
}, that.options.searchTimeOut);
});
header.off('mouseup', 'input:not([type=radio])').on('mouseup', 'input:not([type=radio])', function (_ref6) {
var currentTarget = _ref6.currentTarget,
keyCode = _ref6.keyCode;
var $input = $__default["default"](currentTarget);
var oldValue = $input.val();
if (oldValue === '') {
return;
}
setTimeout(function () {
var newValue = $input.val();
if (newValue === '') {
clearTimeout(currentTarget.timeoutId || 0);
currentTarget.timeoutId = setTimeout(function () {
that.onColumnSearch({
currentTarget: currentTarget,
keyCode: keyCode
});
}, that.options.searchTimeOut);
}
}, 1);
});
header.off('change', 'input[type=radio]').on('change', 'input[type=radio]', function (_ref7) {
var currentTarget = _ref7.currentTarget,
keyCode = _ref7.keyCode;
clearTimeout(currentTarget.timeoutId || 0);
currentTarget.timeoutId = setTimeout(function () {
that.onColumnSearch({
currentTarget: currentTarget,
keyCode: keyCode
});
}, that.options.searchTimeOut);
}); // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date
if (header.find('.date-filter-control').length > 0) {
$__default["default"].each(that.columns, function (i, _ref8) {
var filterDefault = _ref8.filterDefault,
filterControl = _ref8.filterControl,
field = _ref8.field,
filterDatepickerOptions = _ref8.filterDatepickerOptions;
if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
var $datepicker = header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field));
if (filterDefault) {
$datepicker.value(filterDefault);
}
if (filterDatepickerOptions.min) {
$datepicker.attr('min', filterDatepickerOptions.min);
}
if (filterDatepickerOptions.max) {
$datepicker.attr('max', filterDatepickerOptions.max);
}
if (filterDatepickerOptions.step) {
$datepicker.attr('step', filterDatepickerOptions.step);
}
if (filterDatepickerOptions.pattern) {
$datepicker.attr('pattern', filterDatepickerOptions.pattern);
}
$datepicker.on('change', function (_ref9) {
var currentTarget = _ref9.currentTarget;
clearTimeout(currentTarget.timeoutId || 0);
currentTarget.timeoutId = setTimeout(function () {
that.onColumnSearch({
currentTarget: currentTarget
});
}, that.options.searchTimeOut);
});
}
});
}
if (that.options.sidePagination !== 'server') {
that.triggerSearch();
}
if (!that.options.filterControlVisible) {
header.find('.filter-control, .no-filter-control').hide();
}
} else {
header.find('.filter-control, .no-filter-control').hide();
}
that.trigger('created-controls');
}
function getDirectionOfSelectOptions(_alignment) {
var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
switch (alignment) {
case 'left':
return 'ltr';
case 'right':
return 'rtl';
case 'auto':
return 'auto';
default:
return 'ltr';
}
}
function syncHeaders(that) {
if (!that.options.height) {
return;
}
var fixedHeader = $__default["default"]('.fixed-table-header table thead');
if (fixedHeader.length === 0) {
return;
}
that.$header.children().find('th[data-field]').each(function (_, element) {
if (element.classList[0] !== 'bs-checkbox') {
var $element = $__default["default"](element);
var $field = $element.data('field');
var $fixedField = $__default["default"]("th[data-field='".concat($field, "']")).not($element);
var input = $element.find('input');
var fixedInput = $fixedField.find('input');
if (input.length > 0 && fixedInput.length > 0) {
if (input.val() !== fixedInput.val()) {
input.val(fixedInput.val());
}
}
}
});
}
var filterDataMethods = {
func: function func(that, filterDataSource, selectControl, filterOrderBy, selected) {
var variableValues = window[filterDataSource].apply(); // eslint-disable-next-line guard-for-in
for (var key in variableValues) {
addOptionToSelectControl(selectControl, key, variableValues[key], selected);
}
if (that.options.sortSelectOptions) {
sortSelectControl(selectControl, filterOrderBy);
}
setValues(that);
},
obj: function obj(that, filterDataSource, selectControl, filterOrderBy, selected) {
var objectKeys = filterDataSource.split('.');
var variableName = objectKeys.shift();
var variableValues = window[variableName];
if (objectKeys.length > 0) {
objectKeys.forEach(function (key) {
variableValues = variableValues[key];
});
} // eslint-disable-next-line guard-for-in
for (var key in variableValues) {
addOptionToSelectControl(selectControl, key, variableValues[key], selected);
}
if (that.options.sortSelectOptions) {
sortSelectControl(selectControl, filterOrderBy);
}
setValues(that);
},
var: function _var(that, filterDataSource, selectControl, filterOrderBy, selected) {
var variableValues = window[filterDataSource];
var isArray = Array.isArray(variableValues);
for (var key in variableValues) {
if (isArray) {
addOptionToSelectControl(selectControl, variableValues[key], variableValues[key], selected, true);
} else {
addOptionToSelectControl(selectControl, key, variableValues[key], selected, true);
}
}
if (that.options.sortSelectOptions) {
sortSelectControl(selectControl, filterOrderBy);
}
setValues(that);
},
url: function url(that, filterDataSource, selectControl, filterOrderBy, selected) {
$__default["default"].ajax({
url: filterDataSource,
dataType: 'json',
success: function success(data) {
// eslint-disable-next-line guard-for-in
for (var key in data) {
addOptionToSelectControl(selectControl, key, data[key], selected);
}
if (that.options.sortSelectOptions) {
sortSelectControl(selectControl, filterOrderBy);
}
setValues(that);
}
});
},
json: function json(that, filterDataSource, selectControl, filterOrderBy, selected) {
var variableValues = JSON.parse(filterDataSource); // eslint-disable-next-line guard-for-in
for (var key in variableValues) {
addOptionToSelectControl(selectControl, key, variableValues[key], selected);
}
if (that.options.sortSelectOptions) {
sortSelectControl(selectControl, filterOrderBy);
}
setValues(that);
}
};
exports.addOptionToSelectControl = addOptionToSelectControl;
exports.cacheValues = cacheValues;
exports.collectBootstrapTableFilterCookies = collectBootstrapTableFilterCookies;
exports.createControls = createControls;
exports.escapeID = escapeID;
exports.existOptionInSelectControl = existOptionInSelectControl;
exports.fixHeaderCSS = fixHeaderCSS;
exports.getControlContainer = getControlContainer;
exports.getCursorPosition = getCursorPosition;
exports.getDirectionOfSelectOptions = getDirectionOfSelectOptions;
exports.getElementClass = getElementClass;
exports.getFilterDataMethod = getFilterDataMethod;
exports.getInputClass = getInputClass;
exports.getOptionsFromSelectControl = getOptionsFromSelectControl;
exports.getSearchControls = getSearchControls;
exports.hasSelectControlElement = hasSelectControlElement;
exports.hideUnusedSelectOptions = hideUnusedSelectOptions;
exports.initFilterSelectControls = initFilterSelectControls;
exports.isColumnSearchableViaSelect = isColumnSearchableViaSelect;
exports.isFilterDataNotGiven = isFilterDataNotGiven;
exports.isKeyAllowed = isKeyAllowed;
exports.setCaretPosition = setCaretPosition;
exports.setValues = setValues;
exports.sortSelectControl = sortSelectControl;
exports.syncHeaders = syncHeaders;
Object.defineProperty(exports, '__esModule', { value: true });
}));