') !== '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$2(this);
var replacer = isNullOrUndefined(searchValue) ? undefined : getMethod(searchValue, REPLACE);
return replacer
? call(replacer, searchValue, O, replaceValue)
: call(nativeReplace, toString$2(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$2(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$2(replaceValue);
var global = rx.global;
var fullUnicode;
if (global) {
fullUnicode = rx.unicode;
rx.lastIndex = 0;
}
var results = [];
var result;
while (true) {
result = regExpExec(rx, S);
if (result === null) break;
push(results, result);
if (!global) break;
var matchStr = toString$2(result[0]);
if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength$1(rx.lastIndex), fullUnicode);
}
var accumulatedResult = '';
var nextSourcePosition = 0;
for (var i = 0; i < results.length; i++) {
result = results[i];
var matched = toString$2(result[0]);
var position = max(min$1(toIntegerOrInfinity(result.index), S.length), 0);
var captures = [];
var replacement;
// 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(captures, maybeToString(result[j]));
var namedCaptures = result.groups;
if (functionalReplace) {
var replacerArgs = concat([matched], captures, position, S);
if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
replacement = toString$2(apply(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 isObject = isObject$8;
var classof = classofRaw$2;
var wellKnownSymbol$1 = wellKnownSymbol$b;
var MATCH$1 = wellKnownSymbol$1('match');
// `IsRegExp` abstract operation
// https://tc39.es/ecma262/#sec-isregexp
var isRegexp = function (it) {
var isRegExp;
return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof(it) === 'RegExp');
};
var isRegExp = isRegexp;
var $TypeError = TypeError;
var notARegexp = function (it) {
if (isRegExp(it)) {
throw new $TypeError("The method doesn't accept regular expressions");
} return it;
};
var wellKnownSymbol = wellKnownSymbol$b;
var MATCH = wellKnownSymbol('match');
var correctIsRegexpLogic = function (METHOD_NAME) {
var regexp = /./;
try {
'/./'[METHOD_NAME](regexp);
} catch (error1) {
try {
regexp[MATCH] = false;
return '/./'[METHOD_NAME](regexp);
} catch (error2) { /* empty */ }
} return false;
};
var $$1 = _export;
var uncurryThis$1 = functionUncurryThisClause;
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
var toLength = toLength$4;
var toString$1 = toString$8;
var notARegExp = notARegexp;
var requireObjectCoercible$1 = requireObjectCoercible$7;
var correctIsRegExpLogic = correctIsRegexpLogic;
var stringSlice = uncurryThis$1(''.slice);
var min = Math.min;
var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
// https://github.com/zloirock/core-js/pull/702
var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
return descriptor && !descriptor.writable;
}();
// `String.prototype.startsWith` method
// https://tc39.es/ecma262/#sec-string.prototype.startswith
$$1({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
startsWith: function startsWith(searchString /* , position = 0 */) {
var that = toString$1(requireObjectCoercible$1(this));
notARegExp(searchString);
var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
var search = toString$1(searchString);
return stringSlice(that, index, index + search.length) === search;
}
});
// a string of all valid unicode whitespaces
var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
var uncurryThis = functionUncurryThis;
var requireObjectCoercible = requireObjectCoercible$7;
var toString = toString$8;
var whitespaces$1 = whitespaces$2;
var replace = uncurryThis(''.replace);
var ltrim = RegExp('^[' + whitespaces$1 + ']+');
var rtrim = RegExp('(^|[^' + whitespaces$1 + '])[' + whitespaces$1 + ']+$');
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
var createMethod = function (TYPE) {
return function ($this) {
var string = toString(requireObjectCoercible($this));
if (TYPE & 1) string = replace(string, ltrim, '');
if (TYPE & 2) string = replace(string, rtrim, '$1');
return string;
};
};
var stringTrim = {
// `String.prototype.{ trimLeft, trimStart }` methods
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
start: createMethod(1),
// `String.prototype.{ trimRight, trimEnd }` methods
// https://tc39.es/ecma262/#sec-string.prototype.trimend
end: createMethod(2),
// `String.prototype.trim` method
// https://tc39.es/ecma262/#sec-string.prototype.trim
trim: createMethod(3)
};
var PROPER_FUNCTION_NAME = functionName.PROPER;
var fails = fails$m;
var whitespaces = whitespaces$2;
var non = '\u200B\u0085\u180E';
// check that a method works with the correct list
// of whitespaces and has a correct name
var stringTrimForced = function (METHOD_NAME) {
return fails(function () {
return !!whitespaces[METHOD_NAME]()
|| non[METHOD_NAME]() !== non
|| (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
});
};
var $ = _export;
var $trim = stringTrim.trim;
var forcedStringTrimMethod = stringTrimForced;
// `String.prototype.trim` method
// https://tc39.es/ecma262/#sec-string.prototype.trim
$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
trim: function trim() {
return $trim(this);
}
});
// 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 documentCreateElement = documentCreateElement$2;
var classList = documentCreateElement('span').classList;
var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
var $forEach = arrayIteration.forEach;
var arrayMethodIsStrict = arrayMethodIsStrict$4;
var STRICT_METHOD = arrayMethodIsStrict('forEach');
// `Array.prototype.forEach` method implementation
// https://tc39.es/ecma262/#sec-array.prototype.foreach
var arrayForEach = !STRICT_METHOD ? 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 global$1 = global$e;
var DOMIterables = domIterables;
var DOMTokenListPrototype = domTokenListPrototype;
var forEach = arrayForEach;
var createNonEnumerableProperty = createNonEnumerableProperty$4;
var handlePrototype = function (CollectionPrototype) {
// some Chrome versions have non-configurable methods on DOMTokenList
if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
} catch (error) {
CollectionPrototype.forEach = forEach;
}
};
for (var COLLECTION_NAME in DOMIterables) {
if (DOMIterables[COLLECTION_NAME]) {
handlePrototype(global$1[COLLECTION_NAME] && global$1[COLLECTION_NAME].prototype);
}
}
handlePrototype(DOMTokenListPrototype);
/* eslint-disable no-use-before-define */
var Utils = $$b.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-%s', formControlClass, formControlClass, that.options.iconSize) : formControlClass;
}
function getOptionsFromSelectControl(selectControl) {
return selectControl[0].options;
}
function getControlContainer(that) {
if (that.options.filterControlContainer) {
return $$b("".concat(that.options.filterControlContainer));
}
if (that.options.height && that._initialized) {
return that.$tableContainer.find('.fixed-table-header table thead');
}
return that.$header;
}
function isKeyAllowed(keyCode) {
return $$b.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(Utils.unescapeHTML(value));
text = Utils.removeHTML(Utils.unescapeHTML(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, options) {
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, options);
});
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').split(' ').filter(function (className) {
return className.startsWith('bootstrap-table-filter-control-');
});
}
function getCursorPosition(el) {
if ($$b(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 = $$b(this);
var fieldClass = escapeID(getElementClass($field));
if (that.options.height && !that.options.filterControlContainer) {
$field = that.$el.find(".fixed-table-header .".concat(fieldClass));
} else if (that.options.filterControlContainer) {
$field = $$b("".concat(that.options.filterControlContainer, " .").concat(fieldClass));
} else {
$field = that.$el.find(".".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 = $$b(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 = $$b(element);
$$b.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) {
$$b.each(foundCookies, function (i, _cookie) {
var cookie = _cookie;
if (/./.test(cookie)) {
cookie = cookie.split('.').pop();
}
if ($$b.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;
$$b.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 === undefined || fieldValue === null) {
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);
}
if (that.options.sortSelectOptions) {
sortSelectControl(selectControl, column.filterOrderBy, that.options);
}
}
});
}
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;
$$b.each(that.columns, function (_, column) {
html = [];
if (!column.visible && !(that.options.filterControlContainer && $$b(".bootstrap-table-filter-control-".concat(escapeID(column.field))).length >= 1)) {
return;
}
if (!column.filterControl && !that.options.filterControlContainer) {
html.push('');
} else if (that.options.filterControlContainer) {
// Use a filter control container instead of th
var $filterControls = $$b(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
$$b.each($filterControls, function (_, filterControl) {
var $filterControl = $$b(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 ($$b.isEmptyObject(that.filterColumnsPartial)) {
that.filterColumnsPartial = {};
}
if (!(column.field in that.filterColumnsPartial)) {
that.filterColumnsPartial[column.field] = column.filterDefault;
}
}
$$b.each(header.find('th'), function (_, th) {
var $th = $$b(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 = $$b(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 = $$b(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 = $$b(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) {
$$b.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(escapeID(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 = that.$tableContainer.find('.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 = $$b(element);
var $field = $element.data('field');
var $fixedField = that.$tableContainer.find("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, that.options);
}
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, that.options);
}
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, that.options);
}
setValues(that);
},
url: function url(that, filterDataSource, selectControl, filterOrderBy, selected) {
$$b.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, that.options);
}
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, that.options);
}
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;
}));