vue-tables-2
Version:
Vue.js 2 grid components
39 lines (31 loc) • 1.7 kB
JavaScript
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
module.exports = function (query) {
var el;
if (this.opts.filterByColumn) {
for (var column in query) {
var columnName = this._getColumnName(column);
if (this.isDateFilter(column)) {
if (query[column] && _typeof(query[column]) === 'object') {
var start = typeof query[column].start === 'string' ? moment(query[column].start, 'YYYY-MM-DD') : query[column].start;
var end = typeof query[column].end === 'string' ? moment(query[column].end, 'YYYY-MM-DD') : query[column].end;
this._setDatepickerText(column, start, end);
} else {
$(this.$el).find("#VueTables__" + $.escapeSelector(column) + "-filter").html("<span class='VueTables__filter-placeholder'>" + this.display('filterBy', {
column: this.getHeading(column)
}) + "</span>");
}
continue;
}
el = this.$el.querySelector("[name='".concat(columnName.replace("'", "\\'"), "']"));
if (el) {
el.value = query[column];
} else if (this.columns.indexOf(column) === -1) {
console.error("vue-tables-2: Error in setting filter value. Column '".concat(column, "' does not exist."));
}
}
} else {
var el = this.$el.querySelector('.VueTables__search__input');
if (el) el.value = query;
}
};
;