UNPKG

vue-tables-2

Version:
21 lines (15 loc) 1.14 kB
"use strict"; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var merge = require('merge'); module.exports = function () { var _data; var additionalData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var keys = this.opts.requestKeys; var data = (_data = {}, _defineProperty(_data, keys.query, this.filteredQuery), _defineProperty(_data, keys.limit, this.limit), _defineProperty(_data, keys.ascending, this.orderBy.ascending ? 1 : 0), _defineProperty(_data, keys.page, parseInt(this.page)), _defineProperty(_data, keys.byColumn, this.opts.filterByColumn ? 1 : 0), _data); if (this.orderBy.hasOwnProperty('column') && this.orderBy.column) data[keys.orderBy] = this.orderBy.column; data = merge(data, this.opts.params, this.customQueries, additionalData); if (this.hasMultiSort && this.orderBy.column && this.userMultiSorting[this.orderBy.column]) { data.multiSort = this.userMultiSorting[this.orderBy.column]; } return data; };