UNPKG

yapsr-vue2-bootstrap-table2

Version:

A sortable and searchable vue table, as a Vue component, using bootstrap styling.

1,518 lines (1,332 loc) 328 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["VueBootstrapTable"] = factory(); else root["VueBootstrapTable"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _VueBootstrapTable = __webpack_require__(1); var _VueBootstrapTable2 = _interopRequireDefault(_VueBootstrapTable); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } module.exports = _VueBootstrapTable2.default; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { var __vue_script__, __vue_template__ var __vue_styles__ = {} __vue_script__ = __webpack_require__(2) if (Object.keys(__vue_script__).some(function (key) { return key !== "default" && key !== "__esModule" })) { console.warn("[vue-loader] src\\VueBootstrapTable.vue: named exports in *.vue files are ignored.")} __vue_template__ = __webpack_require__(114) module.exports = __vue_script__ || {} if (module.exports.__esModule) module.exports = module.exports.default var __vue_options__ = typeof module.exports === "function" ? (module.exports.options || (module.exports.options = {})) : module.exports if (__vue_template__) { __vue_options__.template = __vue_template__ } if (!__vue_options__.computed) __vue_options__.computed = {} Object.keys(__vue_styles__).forEach(function (key) { var module = __vue_styles__[key] __vue_options__.computed[key] = function () { return module } }) if (false) {(function () { module.hot.accept() var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), false) if (!hotAPI.compatible) return var id = "_v-bae9a0b0/VueBootstrapTable.vue" if (!module.hot.data) { hotAPI.createRecord(id, module.exports) } else { hotAPI.update(id, module.exports, __vue_template__) } })()} /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _stringify = __webpack_require__(3); var _stringify2 = _interopRequireDefault(_stringify); var _axios = __webpack_require__(6); var _axios2 = _interopRequireDefault(_axios); var _qs = __webpack_require__(33); var _qs2 = _interopRequireDefault(_qs); var _lodash = __webpack_require__(38); var _lodash2 = _interopRequireDefault(_lodash); var _lodash3 = __webpack_require__(40); var _lodash4 = _interopRequireDefault(_lodash3); var _lodash5 = __webpack_require__(41); var _lodash6 = _interopRequireDefault(_lodash5); var _VueBootstrapCell = __webpack_require__(42); var _VueBootstrapCell2 = _interopRequireDefault(_VueBootstrapCell); var _VueBootstrapFooterCell = __webpack_require__(111); var _VueBootstrapFooterCell2 = _interopRequireDefault(_VueBootstrapFooterCell); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { name: "VueBootstrapTable", components: { 'vue-bootstrap-cell': _VueBootstrapCell2.default, 'vue-bootstrap-footer-cell': _VueBootstrapFooterCell2.default }, props: { /** * The column titles, required */ columns: { type: Array, required: true }, /** * The rows, an Array of objects */ values: { type: Array, required: false }, /** * Enable/disable table sorting, optional, default true */ sortable: { type: Boolean, required: false, default: true }, /** * Enable/disable table multicolumn sorting, optional, default false. * Also sortable must be enabled for this function to work. */ multiColumnSortable: { type: Boolean, required: false, default: false }, /** * Array of sort keys to start with * * Example: ['votes'] or ['votes', 'id'] * */ defaultSortKeys: { type: Array, required: false, default: function _default() { return []; } }, /** * Array of sort orders to start with, corresponding with defaultSortKeys * * Example: ['asc'] or ['desc', 'asc'] * */ defaultSortOrders: { type: Array, required: false, default: function _default() { return []; } }, /** * Enable/disable input filter, optional, default false */ showFilter: { type: Boolean, required: false, default: false }, /** * Default filter key value */ defaultFilterKey: { type: String, required: false, default: "" }, /** * Define if Filter search field is to work in a case Sensitive way. Default: true */ filterCaseSensitive: { type: Boolean, required: false, default: true }, /** * Enable/disable column picker to show/hide table columns, optional, default false */ showColumnPicker: { type: Boolean, required: false, default: false }, /** * Enable/disable pagination for the table, optional, default false */ paginated: { type: Boolean, required: false, default: false }, /** * If pagination is enabled defining the page size, optional, default 10 */ pageSize: { type: Number, required: false, default: 10 }, /** * If loading of table is to be done through ajax, then this object must be set */ ajax: { type: Object, required: false, default: function _default() { return { enabled: false, url: "", method: "GET", delegate: false, axiosConfig: {} }; } }, extendedMethods: { type: Object, required: false, default: function _default() { return {}; } }, messages: { type: Array, required: false, default: function _default() { return []; } }, table: { type: String, required: false, default: function _default() { return ''; } }, tableClasses: { type: String, required: false, default: function _default() { return ''; } } }, data: function data() { return { filterKey: "", sortKeys: [], sortOrders: [], columnMenuOpen: false, displayCols: [], filteredValues: [], page: 1, echo: 0, loading: false }; }, mounted: function mounted() { console.log('table.mounted'); this.loading = true; this.setComputedValues(); this.setSorting(); this.setColumns(); this.setValueTypes(); this.filterKey = this.defaultFilterKey; this.loading = false; }, created: function created() { console.log('table.created'); }, beforeDestroy: function beforeDestroy() {}, watch: { filteredValues: function filteredValues() { console.log('watch: filteredValues'); }, values: function values() { console.log('watch: values'); this.processFilter(); }, columns: function columns() { console.log('watch: columns'); this.setColumns(); }, showFilter: function showFilter() { // this.filterKey = ""; }, showColumnPicker: function showColumnPicker() { console.log('watch: showColumnPicker'); this.columnMenuOpen = false; this.displayCols.forEach(function (column) { column.visible = true; }); }, filterKey: function filterKey() { console.log('watch: filterKey'); // filter was updated, so resetting to page 1 this.page = 1; this.processFilter(); this.fireFilterKeyModifiedEvent(this.filterKey); }, sortKeys: function sortKeys() { console.log('watch: sortKeys'); this.processFilter(); }, sortOrders: function sortOrders() { console.log('watch: sortOrders'); this.processFilter(); }, page: function page() { console.log('watch: page'); this.processFilter(); }, paginated: function paginated() { console.log('watch: paginated'); this.processFilter(); }, loading: function loading() { console.log('watch: loading'); }, extendedMethods: function extendedMethods() { console.log('watch: extendedMethods'); } }, computed: { config: function config() { return this.getConfig(); }, filteredValuesSorted: function filteredValuesSorted() { return this.sortFilteredValues(); }, displayColsVisible: function displayColsVisible() { var displayColsVisible = []; for (var a in this.displayCols) { if (this.displayCols[a].visible) displayColsVisible.push(this.displayCols[a]); } return displayColsVisible; }, validPageNumbers: function validPageNumbers() { // 5 page max var result = []; var start = 1; if (this.page > 3) start = this.page - 2; for (var i = 0; start <= this.maxPage && i < 5; start++) { result.push(start); i++; } return result; }, maxPage: function maxPage() { return Math.ceil(this.filteredSize / this.pageSize); }, showPaginationEtc: function showPaginationEtc() { var temp = 1; if (this.page > 3) temp = this.page - 2; return temp + 4 < this.maxPage; }, filteredSize: function filteredSize() { return this.values.length; }, hasDefaultSorting: function hasDefaultSorting() { return this.defaultSortKeys.length > 0; } }, methods: { getConfig: function getConfig() { return {}; }, getExtendedMethod: function getExtendedMethod(value) { var result = false; if (typeof value === 'undefined') { result = false; } else if (typeof this.extendedMethods[value] === 'function') { result = this.extendedMethods[value]; } else if (typeof value === 'function') { result = value; } else if (typeof value === 'string') { result = Function([], value); } return result; }, getCellReference: function getCellReference(col, row) { return col + ':' + row; }, enableCell: function enableCell(ref, index) { if (typeof index === 'undefined') { index = 0; } this.$refs[ref][index].enable(); }, onDown: function onDown(col, row) { var ref = this.getCellReference(col, row + 1); this.enableCell(ref); }, onUp: function onUp(col, row) { var ref = this.getCellReference(col, row - 1); this.enableCell(ref); }, onLeft: function onLeft(col, row) { var ref = this.getCellReference(col - 1, row); this.enableCell(ref); }, onRight: function onRight(col, row) { var ref = this.getCellReference(col + 1, row); this.enableCell(ref); }, onCellDataModified: function onCellDataModified(column, entry, input) { console.log('onCellDataModified', column, entry, input); this.saveInternal(column, entry, input); // this.saveExternal(column, entry, input); }, saveInternal: function saveInternal(column, entry, input) { console.log('table.saveInternal', arguments); var obj = this.values; var key = this.getKeyByValue(this.values, 'id', entry.id); if (key === false) { console.log('WARNING: table.update: Adding new entry, because id was not found in values.'); } var val = entry; this.$set(obj, key, val); this.fireCellDataModifiedEvent(column, entry, input); this.setComputedValues(); this.processFilter(); }, // saveExternal: function(column, entry, input){ // console.log('table.saveExternal', arguments); // let fn = {}; // if (fn = this.getExtendedMethod('store')) { // return fn(column, entry, input); // } // return false; // }, getKeyByValue: function getKeyByValue(array, key, value) { if (typeof value === 'undefined') { return false; } for (var i = 0, count = array.length; i < count; i++) { if (array[i][key] === value) { return i; } } return false; }, sortFilteredValues: function sortFilteredValues() { return (0, _lodash2.default)(this.filteredValues, this.sortKeys, this.sortOrders); }, castToType: function castToType(value, type) { var result = null; if (type === 'decimal') { result = parseFloat(parseFloat(String(value).replace(',', '.')).toFixed(9)); if (isNaN(result)) { result = 0; } } else if (type === 'money') { result = parseFloat(parseFloat(String(value).replace(',', '.')).toFixed(2)); if (isNaN(result)) { result = 0; } } else if (type === 'integer') { result = parseInt(value); if (isNaN(result)) { result = 0; } } else { // Treat as string result = value; } if (typeof result === 'undefined') { result = '?'; } // console.log('castToType', value, type, result); return result; }, setValueTypes: function setValueTypes() { for (var i in this.columns) { var column = this.columns[i]; if (column.type) { for (var j in this.values) { var entry = this.values[j]; this.castToType(entry[column.name], column.type); } } } }, /** * Set all extended computed column values dynamically * */ setComputedValues: function setComputedValues() { var fn = {}; for (var i in this.columns) { var column = this.columns[i]; if (fn = this.getExtendedMethod(column.computed)) { for (var j in this.values) { var obj = this.values; var prop = j; var value = this.values[j]; var params = { caller: this, column: this.columns[i], entry: value }; var name = this.columns[i].name; value[name] = fn(params); this.$set(obj, prop, value); } } } }, processFilter: function processFilter() { var self = this; if (this.loading) { return; } if (this.ajax.enabled && this.ajax.delegate) { this.fetchData(function (data) { self.values = data.values; self.filteredValues = data.filteredValues; self.loading = false; }); } else { var q = self.filterKey + ""; if (q) { console.log('Filtering on ', q); this.filteredValues = this.values.filter(function (entry) { var i = 0; var haystack = ""; var column = []; if (!self.filterCaseSensitive) { q = q.toLowerCase(); } for (var _i in self.displayColsVisible) { column = self.displayColsVisible[_i]; haystack = entry[column.name] || ""; if (!self.filterCaseSensitive && typeof haystack === 'string') { haystack = haystack.toLowerCase(); } // console.log('lodashincludes', haystack, q); if ((0, _lodash4.default)(haystack, q)) { return true; } } return false; }); } else { console.log('No filtering'); this.filteredValues = this.values; } // Pagination if (this.paginated) { console.log('Paginating...'); var startIndex = (this.page - 1) * this.pageSize; var index = 0; var result = []; while (index < this.pageSize) { if (typeof this.filteredValues[startIndex + index] !== "undefined") { result.push(this.filteredValues[startIndex + index]); } index++; } this.filteredValues = result; } this.loading = false; } }, fetchData: function fetchData(dataCallBackFunction) { var _this = this; var self = this; var ajaxParameters = { params: {} }; this.echo++; if (this.ajax.enabled && this.ajax.delegate) { if (this.ajax.method === "GET") { //COPY ajaxParameters = JSON.parse((0, _stringify2.default)(this.ajax.axiosConfig)); ajaxParameters.params = {}; ajaxParameters.params.sortcol = this.sortKeys; ajaxParameters.params.sortdir = this.sortOrders; ajaxParameters.params.filter = this.filterKey; if (self.paginated) { ajaxParameters.params.page = this.page; ajaxParameters.params.pagesize = this.pageSize; } else { ajaxParameters.params.page = 1; ajaxParameters.params.pagesize = null; } ajaxParameters.params.echo = this.echo; } if (this.ajax.method === "POST") { ajaxParameters.sortcol = this.sortKeys; ajaxParameters.sortdir = this.sortOrders; ajaxParameters.filter = this.filterKey; if (self.paginated) { ajaxParameters.page = this.page; ajaxParameters.pagesize = this.pageSize; } else { ajaxParameters.page = 1; ajaxParameters.pagesize = null; } ajaxParameters.echo = this.echo; } } if (this.ajax.enabled && !this.ajax.delegate) { if (this.ajax.method === "GET") { //COPY ajaxParameters = JSON.parse((0, _stringify2.default)(this.ajax.axiosConfig)); ajaxParameters.params = {}; } if (this.ajax.method === "POST") { // Do nothing at this point ! } } if (this.ajax.enabled && this.ajax.method === "GET") { _axios2.default.get(self.ajax.url, ajaxParameters).then(function (response) { if (_this.ajax.delegate) { if (response.data.echo !== self.echo) { return; } } dataCallBackFunction(response.data); _this.$emit('ajaxLoaded', response.data); }).catch(function (e) { _this.$emit('ajaxLoadingError', e); }); } if (this.ajax.enabled && this.ajax.method === "POST") { _axios2.default.post(self.ajax.url, _qs2.default.stringify(ajaxParameters), this.ajax.axiosConfig).then(function (response) { if (_this.ajax.delegate) { if (response.data.echo !== self.echo) { return; } } dataCallBackFunction(response.data); _this.$emit('ajaxLoaded', response.data); }).catch(function (e) { _this.$emit('ajaxLoadingError', e); }); } }, buildColumnObject: function buildColumnObject(column) { var obj = {}; obj.title = column.title; if (typeof column.name !== "undefined") obj.name = column.name;else obj.name = column.title; if (typeof column.description !== "undefined") obj.description = column.description;else obj.description = ''; if (typeof column.visible !== "undefined") obj.visible = column.visible;else obj.visible = true; if (typeof column.editable !== "undefined") obj.editable = column.editable;else obj.editable = false; if (typeof column.render !== "undefined") obj.render = column.render;else obj.render = false; if (typeof column.computed !== "undefined") obj.computed = column.computed;else obj.computed = false; if (typeof column.validate !== "undefined") obj.validate = column.validate;else obj.validate = false; if (typeof column.type !== "undefined") obj.type = column.type;else obj.type = 'string'; if (typeof column.footer !== "undefined") obj.footer = column.footer;else obj.footer = false; if (typeof column.columnClasses !== "undefined") obj.columnClasses = column.columnClasses;else obj.columnClasses = ""; if (typeof column.cellClasses !== "undefined") obj.cellClasses = column.cellClasses;else obj.cellClasses = ""; if (typeof column.step !== "undefined") obj.step = column.step;else obj.step = null; return obj; }, setColumns: function setColumns() { var self = this; this.displayCols = []; this.columns.forEach(function (column) { var obj = self.buildColumnObject(column); self.displayCols.push(obj); }); }, setSorting: function setSorting() { if (this.hasDefaultSorting) { this.setDefaultSorting(); } else { this.sortKeys = []; this.sortOrders = []; } }, /** * Example: { "votes":"desc", "id":"asc" } * * Sets * this.sortKeys = ['votes', 'id'] * this.sortOrders = ['desc', 'asc'] */ setDefaultSorting: function setDefaultSorting() { this.sortKeys = this.defaultSortKeys; this.sortOrders = this.defaultSortOrders; }, resetSortOrders: function resetSortOrders() { this.sortOrders = []; }, sortBy: function sortBy(event, key) { if (this.sortable) { var pos = 0; if (!this.multiColumnSortable || this.multiColumnSortable && !event.shiftKey) { this.sortKeys = [key]; // this.columns.forEach(function (column) { // if (column.name !== key) { // self.sortOrders[column.name] = ""; // } // }); } else { if ((0, _lodash6.default)(this.sortKeys, function (o) { return o === key; }) === -1) { this.sortKeys.push(key); } pos = this.sortKeys.indexOf(key); } if (pos > this.sortKeys.length - 1) { this.sortKeys[pos] = "asc"; } else if (this.sortOrders[pos] === "asc") { this.sortOrders[pos] = "desc"; } else { this.sortOrders[pos] = "asc"; } this.fireSortModifiedEvent(this.sortKeys, this.sortOrders); } }, getTableClasses: function getTableClasses() { return this.tableClasses; }, getColumnClasses: function getColumnClasses(column) { var classes = [column.columnClasses]; var key = column.name; if (this.sortable) { classes.push("arrow"); /*if (this.sortKeys === key) { classes.push("active"); }*/ if ((0, _lodash6.default)(this.sortKeys, function (o) { return o === key; }) !== -1) { classes.push("active"); } var pos = this.sortKeys.indexOf(key); if (this.sortOrders[[pos]] === "asc") { classes.push("asc"); } else if (this.sortOrders[pos] === "desc") { classes.push("desc"); } } return classes; }, getCellClasses: function getCellClasses(column, entry) { var result = column.cellClasses; if (column.editable) { result = result + " editable"; } return result; }, getFooterCellClasses: function getFooterCellClasses(column) { return column.cellClasses; }, toggleColumn: function toggleColumn(column) { column.visible = !column.visible; this.fireColumnToggledEvent(column); }, closeDropdown: function closeDropdown() { this.columnMenuOpen = false; }, fireCellDataModifiedEvent: function fireCellDataModifiedEvent(column, entry, input) { this.$emit('cell-data-modified', this.table, column, entry, input); }, fireColumnToggledEvent: function fireColumnToggledEvent(column) { this.$emit('column-toggled', this.table, column, this.displayColsVisible); }, fireFilterKeyModifiedEvent: function fireFilterKeyModifiedEvent(filterKey) { this.$emit('filter-key-modified', this.table, filterKey); }, fireSortModifiedEvent: function fireSortModifiedEvent(sortKeys, sortOrders) { this.$emit('sort-modified', this.table, sortKeys, sortOrders); }, fireRowClickedEvent: function fireRowClickedEvent(entry) { this.$emit('row-clicked', this.table, entry); }, fireCellClickedEvent: function fireCellClickedEvent(column, entry) { this.$emit('cell-clicked', this.table, column, entry); }, fireFooterCellClickedEvent: function fireFooterCellClickedEvent(column) { this.$emit('footer-cell-clicked', this.table, column); }, hasDescription: function hasDescription(column) { if (typeof column.description !== 'undefined') { if (column.description) { return true; } } return false; } }, events: {} // </script> /* generated by vue-loader */ }; // <template> // <div class="vue-bootstrap-table" @click="closeDropdown" @keyup.esc="closeDropdown"> // <div class="container-fluid"> // <div class="row"> // <div class="col-sm-12"> // <div v-for="message in messages" :class="message.class" v-html="message.render()"></div> // </div> // </div> // <div class="row"> // <div class="col-sm-6"> // <div v-if="showFilter" class="filterButton"> // <div class="input-group"> // <input type="text" class="form-control" placeholder="Filter" v-model="filterKey"> // <div class="input-group-append"> // <button type="button" class="btn"> // <i class="fa fa-search"></i> // </button> // </div> // </div> // </div> // </div> // <div class="col-sm-6"> // <div v-if="showColumnPicker" class="columnPickerButton"> // <div class="dropdown" :class="{'show' : columnMenuOpen}"> // <button class="btn btn-default dropdown-toggle" // type="button" // data-toggle="dropdown" // aria-haspopup="true" // aria-expanded="false" // >Columns</button> // <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> // <a v-for="(column, index) in displayCols" class="dropdown-item" @click.stop.prevent="toggleColumn(column)" href="javascript:" :title="column.description"> // <i v-if="column.visible" class="fas fa-check"></i> {{column.title}} // </a> // </div> // </div> // </div> // </div> // </div> // </div> // <div class="col-sm-12"> // <div :class="{'vue-table-loading': this.loading , 'vue-table-loading-hidden': !this.loading}"> // <div class="spinner"></div> // </div> // <table v-bind:class="getTableClasses()"> // <thead> // <tr> // <th v-for="(column, index) in displayColsVisible" @click="sortBy($event, column.name)" // :class="getColumnClasses(column)" // :title="column.description"><span class="title">{{ column.title }}</span></th> // </tr> // </thead> // <tbody> // <tr v-for="(entry, row) in filteredValuesSorted" track-by="entry.id" // @click="fireRowClickedEvent(entry)"> // <td v-for="(column, col) in displayColsVisible" // v-show="column.visible" // :class="getCellClasses(column, entry)" // @click="fireCellClickedEvent(column, entry)" // > // <vue-bootstrap-cell // :column="column" // :entry="entry" // :ref="getCellReference(col, row)" // @cell-data-modified="onCellDataModified" // @down="onDown(col, row, ...arguments)" // @up="onUp(col, row, ...arguments)" // @right="onRight(col, row, ...arguments)" // @left="onLeft(col, row, ...arguments)" // ></vue-bootstrap-cell> // </td> // </tr> // <tr class="footer"> // <td v-for="(column, index) in displayColsVisible" v-show="column.visible" // :class="getFooterCellClasses(column)" @click="fireFooterCellClickedEvent(column)"> // <vue-bootstrap-footer-cell :column="column" // :values="filteredValuesSorted"></vue-bootstrap-footer-cell> // </td> // </tr> // </tbody> // </table> // </div> // <div v-if="paginated" class="col-sm-12"> // <div class="btn-toolbar" role="toolbar" aria-label="pagination bar"> // <div class="btn-group" role="group" aria-label="first page"> // <button type="button" class="btn btn-default" @click="page=1">&laquo;</button> // </div> // <div class="btn-group" role="group" aria-label="pages"> // <button v-for="(pageNumber, index) in validPageNumbers" // type="button" class="btn btn-default" // :class="{ active: page===pageNumber }" // @click="page=pageNumber"> // {{index}} // </button> // </div> // <div class="btn-group" v-if="showPaginationEtc">...</div> // <div class="btn-group" role="group" aria-label="last page"> // <button type="button" class="btn btn-default" @click="page=maxPage">&raquo;</button> // </div> // </div> // </div> // </div> // </template> // // <script> /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { module.exports = { "default": __webpack_require__(4), __esModule: true }; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { var core = __webpack_require__(5); var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify }); module.exports = function stringify(it) { // eslint-disable-line no-unused-vars return $JSON.stringify.apply($JSON, arguments); }; /***/ }), /* 5 */ /***/ (function(module, exports) { var core = module.exports = { version: '2.5.3' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(7); /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var utils = __webpack_require__(8); var bind = __webpack_require__(9); var Axios = __webpack_require__(11); var defaults = __webpack_require__(12); /** * Create an instance of Axios * * @param {Object} defaultConfig The default config for the instance * @return {Axios} A new instance of Axios */ function createInstance(defaultConfig) { var context = new Axios(defaultConfig); var instance = bind(Axios.prototype.request, context); // Copy axios.prototype to instance utils.extend(instance, Axios.prototype, context); // Copy context to instance utils.extend(instance, context); return instance; } // Create the default instance to be exported var axios = createInstance(defaults); // Expose Axios class to allow class inheritance axios.Axios = Axios; // Factory for creating new instances axios.create = function create(instanceConfig) { return createInstance(utils.merge(defaults, instanceConfig)); }; // Expose Cancel & CancelToken axios.Cancel = __webpack_require__(30); axios.CancelToken = __webpack_require__(31); axios.isCancel = __webpack_require__(27); // Expose all/spread axios.all = function all(promises) { return Promise.all(promises); }; axios.spread = __webpack_require__(32); module.exports = axios; // Allow use of default import syntax in TypeScript module.exports.default = axios; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var bind = __webpack_require__(9); var isBuffer = __webpack_require__(10); /*global toString:true*/ // utils is a library of generic helper functions non-specific to axios var toString = Object.prototype.toString; /** * Determine if a value is an Array * * @param {Object} val The value to test * @returns {boolean} True if value is an Array, otherwise false */ function isArray(val) { return toString.call(val) === '[object Array]'; } /** * Determine if a value is an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is an ArrayBuffer, otherwise false */ function isArrayBuffer(val) { return toString.call(val) === '[object ArrayBuffer]'; } /** * Determine if a value is a FormData * * @param {Object} val The value to test * @returns {boolean} True if value is an FormData, otherwise false */ function isFormData(val) { return (typeof FormData !== 'undefined') && (val instanceof FormData); } /** * Determine if a value is a view on an ArrayBuffer * * @param {Object} val The value to test * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false */ function isArrayBufferView(val) { var result; if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { result = ArrayBuffer.isView(val); } else { result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); } return result; } /** * Determine if a value is a String * * @param {Object} val The value to test * @returns {boolean} True if value is a String, otherwise false */ function isString(val) { return typeof val === 'string'; } /** * Determine if a value is a Number * * @param {Object} val The value to test * @returns {boolean} True if value is a Number, otherwise false */ function isNumber(val) { return typeof val === 'number'; } /** * Determine if a value is undefined * * @param {Object} val The value to test * @returns {boolean} True if the value is undefined, otherwise false */ function isUndefined(val) { return typeof val === 'undefined'; } /** * Determine if a value is an Object * * @param {Object} val The value to test * @returns {boolean} True if value is an Object, otherwise false */ function isObject(val) { return val !== null && typeof val === 'object'; } /** * Determine if a value is a Date * * @param {Object} val The value to test * @returns {boolean} True if value is a Date, otherwise false */ function isDate(val) { return toString.call(val) === '[object Date]'; } /** * Determine if a value is a File * * @param {Object} val The value to test * @returns {boolean} True if value is a File, otherwise false */ function isFile(val) { return toString.call(val) === '[object File]'; } /** * Determine if a value is a Blob * * @param {Object} val The value to test * @returns {boolean} True if value is a Blob, otherwise false */ function isBlob(val) { return toString.call(val) === '[object Blob]'; } /** * Determine if a value is a Function * * @param {Object} val The value to test * @returns {boolean} True if value is a Function, otherwise false */ function isFunction(val) { return toString.call(val) === '[object Function]'; } /** * Determine if a value is a Stream * * @param {Object} val The value to test * @returns {boolean} True if value is a Stream, otherwise false */ function isStream(val) { return isObject(val) && isFunction(val.pipe); } /** * Determine if a value is a URLSearchParams object * * @param {Object} val The value to test * @returns {boolean} True if value is a URLSearchParams object, otherwise false */ function isURLSearchParams(val) { return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; } /** * Trim excess whitespace off the beginning and end of a string * * @param {String} str The String to trim * @returns {String} The String freed of excess whitespace */ function trim(str) { return str.replace(/^\s*/, '').replace(/\s*$/, ''); } /** * Determine if we're running in a standard browser environment * * This allows axios to run in a web worker, and react-native. * Both environments support XMLHttpRequest, but not fully standard globals. * * web workers: * typeof window -> undefined * typeof document -> undefined * * react-native: * navigator.product -> 'ReactNative' */ function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { return false; } return ( typeof window !== 'undefined' && typeof document !== 'undefined' ); } /** * Iterate over an Array or an Object invoking a function for each item. * * If `obj` is an Array callback will be called passing * the value, index, and complete array for each item. * * If 'obj' is an Object callback will be called passing * the value, key, and complete object for each property. * * @param {Object|Array} obj The object to iterate * @param {Function} fn The callback to invoke for each item */ function forEach(obj, fn) { // Don't bother if no value provided if (obj === null || typeof obj === 'undefined') { return; } // Force an array if not already something iterable if (typeof obj !== 'object' && !isArray(obj)) { /*eslint no-param-reassign:0*/ obj = [obj]; } if (isArray(obj)) { // Iterate over array values for (var i = 0, l = obj.length; i < l; i++) { fn.call(null, obj[i], i, obj); } } else { // Iterate over object keys for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { fn.call(null, obj[key], key, obj); } } } } /** * Accepts varargs expecting each argument to be an object, then * immutably merges the properties of each object and returns result. * * When multiple objects contain the same key the later object in * the arguments list will take precedence. * * Example: * * ```js * var result = merge({foo: 123}, {foo: 456}); * console.log(result.foo); // outputs 456 * ``` * * @param {Object} obj1 Object to merge * @returns {Object} Result of all merge properties */ function merge(/* obj1, obj2, obj3, ... */) { var result = {}; function assignValue(val, key) { if (typeof result[key] === 'object' && typeof val === 'object') { result[key] = merge(result[key], val); } else { result[key] = val; } } for (var i = 0, l = arguments.length; i < l; i++) { forEach(arguments[i], assignValue); } return result; } /** * Extends object a by mutably adding to it the properties of object b. * * @param {Object} a The object to be extended * @param {Object} b The object to copy properties from * @param {Object} thisArg The object to bind function to * @return {Object} The resulting value of object a */ function extend(a, b, thisArg) { forEach(b, function assignValue(val, key) { if (thisArg && typeof val === 'function') { a[key] = bind(val, thisArg); } else { a[key] = val; } }); return a; } module.exports = { isArray: isArray, isArrayBuffer: isArrayBuffer, isBuffer: isBuffer, isFormData: isFormData, isArrayBufferView: isArrayBufferView, isString: isString, isNumber: isNumber, isObject: isObject, isUndefined: isUndefined, isDate: isDate, isFile: isFile, isBlob: isBlob, isFunction: isFunction, isStream: isStream, isURLSearchParams: isURLSearchParams, isStandardBrowserEnv: isStandardBrowserEnv, forEach: forEach, merge: merge, extend: extend, trim: trim }; /***/ }), /* 9 */ /***/ (function(module, exports) { 'use strict'; module.exports = function bind(fn, thisArg) { return function wrap() { var args = new Array(arguments.length); for (var i = 0; i < args.length; i++) { args[i] = arguments[i]; } return fn.apply(thisArg, args); }; }; /***/ }), /* 10 */ /***/ (function(module, exports) { /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ // The _isBuffer check is for Safari 5-7 support, because it's missing // Object.prototype.constructor. Remove this eventually module.exports = function (obj) { return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) } function isBuffer (obj) { return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) } // For Node v0.10 support. Remove this eventually. function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var defaults = __webpack_require__(12); var utils = __webpack_require__(8); var InterceptorManager = __webpack_require__(24); var dispatchRequest = __webpack_require__(25); var isAbsoluteURL = __webpack_require__(28); var combineURLs = __webpack_require__(29); /** * Create a new instance of Axios * * @param {Object} instanceConfig The default config for the instance */ function Axios(instanceConfig) { this.defaults = instanceConfig; this.interceptors = { request: new InterceptorManager(), response: new InterceptorManager() }; } /** * Dispatch a request * * @param {Object} config The config specific for this request (merged with this.defaults) */ Axios.prototype.request = function request(config) { /*eslint no-param-reassign:0*/ // Allow for axios('example/url'[, config]) a la fetch API if (typeof config === 'string') { config = utils.merge({ url: a