*/
var Utils = $$b.fn.bootstrapTable.utils;
var theme = {
bootstrap3: {
icons: {
advancedSearchIcon: 'glyphicon-chevron-down'
},
classes: {},
html: {
modal: "\n \n "
}
},
bootstrap4: {
icons: {
advancedSearchIcon: 'fa-chevron-down'
},
classes: {},
html: {
modal: "\n \n "
}
},
bootstrap5: {
icons: {
advancedSearchIcon: 'bi-chevron-down'
},
classes: {
formGroup: 'mb-3'
},
html: {
modal: "\n \n "
}
},
bulma: {
icons: {
advancedSearchIcon: 'fa-chevron-down'
},
classes: {},
html: {
modal: "\n \n "
}
},
foundation: {
icons: {
advancedSearchIcon: 'fa-chevron-down'
},
classes: {},
html: {
modal: "\n \n "
}
},
materialize: {
icons: {
advancedSearchIcon: 'expand_more'
},
classes: {},
html: {
modal: "\n \n "
}
},
semantic: {
icons: {
advancedSearchIcon: 'fa-chevron-down'
},
classes: {},
html: {
modal: "\n \n "
}
}
}[$$b.fn.bootstrapTable.theme];
Object.assign($$b.fn.bootstrapTable.defaults, {
advancedSearch: false,
idForm: 'advancedSearch',
actionForm: '',
idTable: undefined,
// eslint-disable-next-line no-unused-vars
onColumnAdvancedSearch: function onColumnAdvancedSearch(field, text) {
return false;
}
});
Object.assign($$b.fn.bootstrapTable.defaults.icons, {
advancedSearchIcon: theme.icons.advancedSearchIcon
});
Object.assign($$b.fn.bootstrapTable.events, {
'column-advanced-search.bs.table': 'onColumnAdvancedSearch'
});
Object.assign($$b.fn.bootstrapTable.locales, {
formatAdvancedSearch: function formatAdvancedSearch() {
return 'Advanced search';
},
formatAdvancedCloseButton: function formatAdvancedCloseButton() {
return 'Close';
}
});
Object.assign($$b.fn.bootstrapTable.defaults, $$b.fn.bootstrapTable.locales);
$$b.BootstrapTable = /*#__PURE__*/function (_$$BootstrapTable) {
function _class() {
_classCallCheck(this, _class);
return _callSuper(this, _class, arguments);
}
_inherits(_class, _$$BootstrapTable);
return _createClass(_class, [{
key: "initToolbar",
value: function initToolbar() {
this.showToolbar = this.showToolbar || this.options.search && this.options.advancedSearch && this.options.idTable;
if (this.showToolbar) {
this.buttons = Object.assign(this.buttons, {
advancedSearch: {
text: this.options.formatAdvancedSearch(),
icon: this.options.icons.advancedSearchIcon,
event: this.showAdvancedSearch,
attributes: {
'aria-label': this.options.formatAdvancedSearch(),
title: this.options.formatAdvancedSearch()
}
}
});
if (Utils.isEmptyObject(this.filterColumnsPartial)) {
this.filterColumnsPartial = {};
}
}
_superPropGet(_class, "initToolbar", this)([]);
}
}, {
key: "showAdvancedSearch",
value: function showAdvancedSearch() {
var _this = this;
this.$toolbarModal = $$b("#avdSearchModal_".concat(this.options.idTable));
if (this.$toolbarModal.length <= 0) {
$$b('body').append(Utils.sprintf(theme.html.modal, this.options.idTable, this.options.buttonsClass));
this.$toolbarModal = $$b("#avdSearchModal_".concat(this.options.idTable));
this.$toolbarModal.find('.toolbar-modal-close').off('click').on('click', function () {
return _this.hideToolbarModal();
});
}
this.initToolbarModalBody();
this.showToolbarModal();
}
}, {
key: "initToolbarModalBody",
value: function initToolbarModalBody() {
var _this2 = this;
this.$toolbarModal.find('.toolbar-modal-title').html(this.options.formatAdvancedSearch());
this.$toolbarModal.find('.toolbar-modal-footer .toolbar-modal-close').html(this.options.formatAdvancedCloseButton());
this.$toolbarModal.find('.toolbar-modal-body').html(this.createToolbarForm()).off('keyup blur', 'input').on('keyup blur', 'input', function (e) {
_this2.onColumnAdvancedSearch(e);
});
}
}, {
key: "showToolbarModal",
value: function showToolbarModal() {
var theme = $$b.fn.bootstrapTable.theme;
if (['bootstrap3', 'bootstrap4'].includes(theme)) {
this.$toolbarModal.modal();
} else if (theme === 'bootstrap5') {
if (!this.toolbarModal) {
this.toolbarModal = new window.bootstrap.Modal(this.$toolbarModal[0], {});
}
this.toolbarModal.show();
} else if (theme === 'bulma') {
this.$toolbarModal.toggleClass('is-active');
} else if (theme === 'foundation') {
if (!this.toolbarModal) {
this.toolbarModal = new window.Foundation.Reveal(this.$toolbarModal);
}
this.toolbarModal.open();
} else if (theme === 'materialize') {
this.$toolbarModal.modal().modal('open');
} else if (theme === 'semantic') {
this.$toolbarModal.modal('show');
}
}
}, {
key: "hideToolbarModal",
value: function hideToolbarModal() {
var theme = $$b.fn.bootstrapTable.theme;
if (['bootstrap3', 'bootstrap4'].includes(theme)) {
this.$toolbarModal.modal('hide');
} else if (theme === 'bootstrap5') {
this.toolbarModal.hide();
} else if (theme === 'bulma') {
$$b('html').toggleClass('is-clipped');
this.$toolbarModal.toggleClass('is-active');
} else if (theme === 'foundation') {
this.toolbarModal.close();
} else if (theme === 'materialize') {
this.$toolbarModal.modal('open');
} else if (theme === 'semantic') {
this.$toolbarModal.modal('close');
}
if (this.options.sidePagination === 'server') {
this.options.pageNumber = 1;
this.updatePagination();
this.trigger('column-advanced-search', this.filterColumnsPartial);
}
}
}, {
key: "createToolbarForm",
value: function createToolbarForm() {
var html = ["');
return html.join('');
}
}, {
key: "initSearch",
value: function initSearch() {
var _this3 = this;
_superPropGet(_class, "initSearch", this)([]);
if (!this.options.advancedSearch || this.options.sidePagination === 'server') {
return;
}
var fp = Utils.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
this.data = fp ? this.data.filter(function (item, i) {
for (var _i = 0, _Object$entries = Object.entries(fp); _i < _Object$entries.length; _i++) {
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
key = _Object$entries$_i[0],
v = _Object$entries$_i[1];
var val = v.toLowerCase();
var value = item[key];
var index = _this3.header.fields.indexOf(key);
value = Utils.calculateObjectValue(_this3.header, _this3.header.formatters[index], [value, item, i], value);
if (_this3.header.formatters[index]) {
// search innerText
value = $$b('').html(value).text();
}
if (!(index !== -1 && (typeof value === 'string' || typeof value === 'number') && "".concat(value).toLowerCase().includes(val))) {
return false;
}
}
return true;
}) : this.data;
this.unsortedData = _toConsumableArray(this.data);
}
}, {
key: "onColumnAdvancedSearch",
value: function onColumnAdvancedSearch(e) {
var text = $$b(e.currentTarget).val().trim();
var field = $$b(e.currentTarget).attr('name');
if (text) {
this.filterColumnsPartial[field] = text;
} else {
delete this.filterColumnsPartial[field];
}
if (this.options.sidePagination !== 'server') {
this.options.pageNumber = 1;
this.initSearch();
this.updatePagination();
this.trigger('column-advanced-search', field, text);
}
}
}]);
}($$b.BootstrapTable);
}));