├── .circleci └── config.yml ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── deploy.sh ├── dist ├── VueTable.common.js ├── VueTable.common.js.map ├── VueTable.umd.js ├── VueTable.umd.js.map ├── VueTable.umd.min.js └── VueTable.umd.min.js.map ├── docs ├── .vuepress │ ├── config.js │ ├── override.styl │ └── public │ │ ├── icons │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon-120x120.png │ │ ├── apple-touch-icon-152x152.png │ │ ├── apple-touch-icon-180x180.png │ │ ├── apple-touch-icon-60x60.png │ │ ├── apple-touch-icon-76x76.png │ │ ├── apple-touch-icon.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── msapplication-icon-144x144.png │ │ ├── mstile-150x150.png │ │ └── safari-pinned-tab.svg │ │ ├── logo.png │ │ └── manifest.json ├── README.md ├── api-references │ └── README.md ├── examples │ ├── README.md │ └── case-study.md └── getting-started │ ├── README.md │ └── credits.md ├── package.json ├── src ├── VueTable.vue ├── VueTablePagination.vue ├── main.js └── mixins │ ├── vueTableMixin.js │ └── vueTablePaginationMixin.js ├── tests └── unit │ ├── VueTable.spec.js │ ├── VueTablePagination.spec.js │ └── utils │ └── console │ ├── index.js │ └── matchers.js └── yarn.lock /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Javascript Node CircleCI 2.0 configuration file 2 | # 3 | # Check https://circleci.com/docs/2.0/language-javascript/ for more details 4 | # 5 | version: 2 6 | jobs: 7 | build: 8 | docker: 9 | # specify the version you desire here 10 | - image: circleci/node:10.2.0-stretch 11 | 12 | # Specify service dependencies here if necessary 13 | # CircleCI maintains a library of pre-built images 14 | # documented at https://circleci.com/docs/2.0/circleci-images/ 15 | # - image: circleci/mongo:3.4.4 16 | 17 | working_directory: ~/repo 18 | 19 | steps: 20 | - checkout 21 | 22 | # Download and cache dependencies 23 | - restore_cache: 24 | keys: 25 | - v1-dependencies-{{ checksum "package.json" }} 26 | # fallback to using the latest cache if no exact match is found 27 | - v1-dependencies- 28 | 29 | - run: yarn install 30 | 31 | - save_cache: 32 | paths: 33 | - node_modules 34 | key: v1-dependencies-{{ checksum "package.json" }} 35 | 36 | # run tests! 37 | - run: yarn test 38 | 39 | 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | 4 | # Log files 5 | npm-debug.log* 6 | yarn-debug.log* 7 | yarn-error.log* 8 | 9 | # Editor directories and files 10 | .idea 11 | .vscode 12 | *.suo 13 | *.ntvs* 14 | *.njsproj 15 | *.sln 16 | *.sw* 17 | 18 | # generated demo code 19 | dist/demo.html 20 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .temp 3 | .idea 4 | .circleci 5 | TODOs.md 6 | tests 7 | docs 8 | yarn.lock 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Stéphane Boulard 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VueTable [![CircleCI](https://circleci.com/gh/lossendae/vue-table.svg?style=shield&circle-token=2aa1824b780715141aeaed61168e185a1c1ceb67)](https://circleci.com/gh/lossendae/vue-table) 2 | 3 | Simple table component for Vue.js 2.x with pagination and sortable columns 4 | 5 | Documentation is available here: https://lossendae.github.io/vue-table 6 | 7 | ## Installation 8 | 9 | ``` 10 | npm install --save @lossendae/vue-table 11 | ``` 12 | 13 | Then in your component 14 | 15 | ```js 16 | import Vue from 'vue' 17 | import VueTable from '@lossendae/vue-table' 18 | 19 | // install globally... 20 | Vue.use('vue-table', Vuetable) 21 | 22 | // Or in your Vue component 23 | 24 | export default { 25 | components: { Vuetable }, 26 | ... 27 | } 28 | ``` 29 | 30 | ## License 31 | 32 | [MIT](https://github.com/lossendae/vue-table/blob/master/LICENSE) 33 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # abort on errors 4 | set -e 5 | 6 | # build 7 | npm run docs:build 8 | 9 | # navigate into the build output directory 10 | cd docs/.vuepress/dist 11 | 12 | # if you are deploying to a custom domain 13 | # echo 'www.example.com' > CNAME 14 | 15 | git init 16 | git add -A 17 | git commit -m 'deploy' 18 | 19 | # if you are deploying to https://.github.io 20 | # git push -f git@github.com:/.github.io.git master 21 | 22 | # if you are deploying to https://.github.io/ 23 | git push -f git@github.com:lossendae/vue-table.git master:gh-pages 24 | 25 | cd - 26 | -------------------------------------------------------------------------------- /dist/VueTable.common.js: -------------------------------------------------------------------------------- 1 | module.exports = 2 | /******/ (function(modules) { // webpackBootstrap 3 | /******/ // The module cache 4 | /******/ var installedModules = {}; 5 | /******/ 6 | /******/ // The require function 7 | /******/ function __webpack_require__(moduleId) { 8 | /******/ 9 | /******/ // Check if module is in cache 10 | /******/ if(installedModules[moduleId]) { 11 | /******/ return installedModules[moduleId].exports; 12 | /******/ } 13 | /******/ // Create a new module (and put it into the cache) 14 | /******/ var module = installedModules[moduleId] = { 15 | /******/ i: moduleId, 16 | /******/ l: false, 17 | /******/ exports: {} 18 | /******/ }; 19 | /******/ 20 | /******/ // Execute the module function 21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 | /******/ 23 | /******/ // Flag the module as loaded 24 | /******/ module.l = true; 25 | /******/ 26 | /******/ // Return the exports of the module 27 | /******/ return module.exports; 28 | /******/ } 29 | /******/ 30 | /******/ 31 | /******/ // expose the modules object (__webpack_modules__) 32 | /******/ __webpack_require__.m = modules; 33 | /******/ 34 | /******/ // expose the module cache 35 | /******/ __webpack_require__.c = installedModules; 36 | /******/ 37 | /******/ // define getter function for harmony exports 38 | /******/ __webpack_require__.d = function(exports, name, getter) { 39 | /******/ if(!__webpack_require__.o(exports, name)) { 40 | /******/ Object.defineProperty(exports, name, { 41 | /******/ configurable: false, 42 | /******/ enumerable: true, 43 | /******/ get: getter 44 | /******/ }); 45 | /******/ } 46 | /******/ }; 47 | /******/ 48 | /******/ // define __esModule on exports 49 | /******/ __webpack_require__.r = function(exports) { 50 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 51 | /******/ }; 52 | /******/ 53 | /******/ // getDefaultExport function for compatibility with non-harmony modules 54 | /******/ __webpack_require__.n = function(module) { 55 | /******/ var getter = module && module.__esModule ? 56 | /******/ function getDefault() { return module['default']; } : 57 | /******/ function getModuleExports() { return module; }; 58 | /******/ __webpack_require__.d(getter, 'a', getter); 59 | /******/ return getter; 60 | /******/ }; 61 | /******/ 62 | /******/ // Object.prototype.hasOwnProperty.call 63 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 64 | /******/ 65 | /******/ // __webpack_public_path__ 66 | /******/ __webpack_require__.p = ""; 67 | /******/ 68 | /******/ 69 | /******/ // Load entry module and return exports 70 | /******/ return __webpack_require__(__webpack_require__.s = "+xUi"); 71 | /******/ }) 72 | /************************************************************************/ 73 | /******/ ({ 74 | 75 | /***/ "+rLv": 76 | /***/ (function(module, exports, __webpack_require__) { 77 | 78 | var document = __webpack_require__("dyZX").document; 79 | module.exports = document && document.documentElement; 80 | 81 | 82 | /***/ }), 83 | 84 | /***/ "+xUi": 85 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 86 | 87 | "use strict"; 88 | __webpack_require__.r(__webpack_exports__); 89 | 90 | // EXTERNAL MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js 91 | var setPublicPath = __webpack_require__("HrLf"); 92 | 93 | // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"/home/styx/Projets/vue-table/node_modules/.cache/vue-loader","cacheIdentifier":"b3fca2dc-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueTable.vue?vue&type=template&id=29b122a0 94 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('table',{staticClass:"table table-hover"},[_c('thead',[_c('tr',_vm._l((_vm.columns),function(column,index){return _c('th',{key:(column + "_" + index)},[_vm._t(("header__" + (column.name)),[((column.sortable || false) && _vm.rows.length > 0)?_c('a',{staticClass:"d-flex align-items-center sortable-link",attrs:{"href":""},on:{"click":function($event){$event.preventDefault();_vm.sort(column)}}},[_vm._v("\n "+_vm._s(column.title || column.name)+"\n "),(_vm.isSorted(column))?_c('i',{staticClass:"fa ml-2",class:{'fa-caret-up': _vm.sortDirection === 'asc', 'fa-caret-down': _vm.sortDirection === 'desc'}}):_vm._e()]):[_vm._v(_vm._s(column.title || column.name))]],{column:column})],2)}))]),_c('tbody',[_vm._l((_vm.rows),function(row){return _c('tr',_vm._l((_vm.column_names),function(name,index){return _c('td',{key:((row[name]) + "_" + index)},[(_vm.fieldExistsInRow(row, name))?[_vm._t(name,[_vm._v(_vm._s(row[name]))],{row:row})]:[_vm._t(name,[_vm._v("[slot: "+_vm._s(name)+"]")],{row:row})]],2)}))}),(_vm.rows.length === 0)?_c('tr',[_vm._t("no_result",[_c('td',{staticClass:"text-center pt-4 p-3",attrs:{"colspan":_vm.columns.length}},[_vm._t("empty",[_vm._v("No results found")])],2)],{columns:_vm.columns})],2):_vm._e()],2)])} 95 | var staticRenderFns = [] 96 | 97 | 98 | // CONCATENATED MODULE: ./src/VueTable.vue?vue&type=template&id=29b122a0 99 | 100 | // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.function.name.js 101 | var es6_function_name = __webpack_require__("f3/d"); 102 | 103 | // EXTERNAL MODULE: ./node_modules/core-js/modules/es7.array.includes.js 104 | var es7_array_includes = __webpack_require__("Z2Ku"); 105 | 106 | // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js 107 | var es6_string_includes = __webpack_require__("L9s1"); 108 | 109 | // CONCATENATED MODULE: ./src/mixins/vueTableMixin.js 110 | 111 | 112 | 113 | /* harmony default export */ var vueTableMixin = ({ 114 | props: { 115 | columns: { 116 | type: Array, 117 | required: true 118 | }, 119 | rows: { 120 | type: Array, 121 | required: true 122 | }, 123 | sortBy: { 124 | type: String 125 | }, 126 | sortDirection: { 127 | type: String, 128 | default: function _default() { 129 | return 'asc'; 130 | }, 131 | validator: function validator(value) { 132 | // The value must match one of these strings 133 | return ['asc', 'desc'].includes(value); 134 | } 135 | } 136 | }, 137 | data: function data() { 138 | return { 139 | column_names: [] 140 | }; 141 | }, 142 | methods: { 143 | fieldExistsInRow: function fieldExistsInRow(row, name) { 144 | return row.hasOwnProperty(name); 145 | }, 146 | getSortKey: function getSortKey(column) { 147 | return typeof column.sortable === 'string' ? column.sortable : column.name; 148 | }, 149 | isSorted: function isSorted(column) { 150 | // If a column is marked as sortable, sortBy props should be defined 151 | // If not the user should be warned as it might have forgotten to set the prop 152 | if (typeof this.sortBy === 'undefined') { 153 | console.warn("\"sortBy\" prop was not defined, but column \"%s\" is marked as sortable", column.name); 154 | } 155 | 156 | return this.getSortKey(column) === this.sortBy; 157 | }, 158 | sort: function sort(column) { 159 | // emit event to parent to change the sort parameters 160 | this.$emit('column:sort', { 161 | sortBy: this.getSortKey(column), 162 | sortDirection: this.sortDirection === 'asc' ? 'desc' : 'asc' 163 | }); 164 | } 165 | }, 166 | mounted: function mounted() { 167 | // map column names 168 | this.column_names = this.columns.map(function (f) { 169 | return f.name; 170 | }); 171 | } 172 | }); 173 | // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/VueTable.vue?vue&type=script&lang=js 174 | // 175 | // 176 | // 177 | // 178 | // 179 | // 180 | // 181 | // 182 | // 183 | // 184 | // 185 | // 186 | // 187 | // 188 | // 189 | // 190 | // 191 | // 192 | // 193 | // 194 | // 195 | // 196 | // 197 | // 198 | // 199 | // 200 | // 201 | // 202 | // 203 | // 204 | // 205 | // 206 | // 207 | // 208 | // 209 | // 210 | // 211 | // 212 | // 213 | // 214 | // 215 | 216 | /* harmony default export */ var VueTablevue_type_script_lang_js = ({ 217 | name: 'vue-table', 218 | mixins: [vueTableMixin] 219 | }); 220 | // CONCATENATED MODULE: ./src/VueTable.vue?vue&type=script&lang=js 221 | /* harmony default export */ var src_VueTablevue_type_script_lang_js = (VueTablevue_type_script_lang_js); 222 | // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js 223 | /* globals __VUE_SSR_CONTEXT__ */ 224 | 225 | // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). 226 | // This module is a runtime utility for cleaner component module output and will 227 | // be included in the final webpack user bundle. 228 | 229 | function normalizeComponent ( 230 | scriptExports, 231 | render, 232 | staticRenderFns, 233 | functionalTemplate, 234 | injectStyles, 235 | scopeId, 236 | moduleIdentifier, /* server only */ 237 | shadowMode /* vue-cli only */ 238 | ) { 239 | // Vue.extend constructor export interop 240 | var options = typeof scriptExports === 'function' 241 | ? scriptExports.options 242 | : scriptExports 243 | 244 | // render functions 245 | if (render) { 246 | options.render = render 247 | options.staticRenderFns = staticRenderFns 248 | options._compiled = true 249 | } 250 | 251 | // functional template 252 | if (functionalTemplate) { 253 | options.functional = true 254 | } 255 | 256 | // scopedId 257 | if (scopeId) { 258 | options._scopeId = 'data-v-' + scopeId 259 | } 260 | 261 | var hook 262 | if (moduleIdentifier) { // server build 263 | hook = function (context) { 264 | // 2.3 injection 265 | context = 266 | context || // cached call 267 | (this.$vnode && this.$vnode.ssrContext) || // stateful 268 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional 269 | // 2.2 with runInNewContext: true 270 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { 271 | context = __VUE_SSR_CONTEXT__ 272 | } 273 | // inject component styles 274 | if (injectStyles) { 275 | injectStyles.call(this, context) 276 | } 277 | // register component module identifier for async chunk inferrence 278 | if (context && context._registeredComponents) { 279 | context._registeredComponents.add(moduleIdentifier) 280 | } 281 | } 282 | // used by ssr in case component is cached and beforeCreate 283 | // never gets called 284 | options._ssrRegister = hook 285 | } else if (injectStyles) { 286 | hook = shadowMode 287 | ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) } 288 | : injectStyles 289 | } 290 | 291 | if (hook) { 292 | if (options.functional) { 293 | // for template-only hot-reload because in that case the render fn doesn't 294 | // go through the normalizer 295 | options._injectStyles = hook 296 | // register for functioal component in vue file 297 | var originalRender = options.render 298 | options.render = function renderWithStyleInjection (h, context) { 299 | hook.call(context) 300 | return originalRender(h, context) 301 | } 302 | } else { 303 | // inject component registration as beforeCreate hook 304 | var existing = options.beforeCreate 305 | options.beforeCreate = existing 306 | ? [].concat(existing, hook) 307 | : [hook] 308 | } 309 | } 310 | 311 | return { 312 | exports: scriptExports, 313 | options: options 314 | } 315 | } 316 | 317 | // CONCATENATED MODULE: ./src/VueTable.vue 318 | 319 | 320 | 321 | 322 | 323 | /* normalize component */ 324 | 325 | var component = normalizeComponent( 326 | src_VueTablevue_type_script_lang_js, 327 | render, 328 | staticRenderFns, 329 | false, 330 | null, 331 | null, 332 | null 333 | 334 | ) 335 | 336 | /* harmony default export */ var VueTable = (component.exports); 337 | // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"/home/styx/Projets/vue-table/node_modules/.cache/vue-loader","cacheIdentifier":"b3fca2dc-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueTablePagination.vue?vue&type=template&id=4dc728dc 338 | var VueTablePaginationvue_type_template_id_4dc728dc_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"d-flex bg-light p-2 align-items-center"},[_c('div',[_vm._t("info",[(_vm.totalItems > 0)?[_vm._v("\n From "+_vm._s(_vm.from)+" to "+_vm._s(_vm.to)+" on "+_vm._s(_vm.totalItems)+" result(s)\n ")]:[_vm._v("\n No results\n ")]],{from:_vm.from,to:_vm.to,totalItems:_vm.totalItems})],2),_c('div',{staticClass:"ml-auto d-flex"},[(_vm.showRefreshButton)?[_c('button',{staticClass:"btn btn-sm btn-outline-secondary mr-2",on:{"click":function($event){$event.preventDefault();_vm.selectPage(_vm.currentPage)}}},[_c('i',{staticClass:"fa fa-refresh pl-1 pr-1"})])]:_vm._e(),(_vm.total_pages > 1)?_c('ul',{staticClass:"pagination"},[(_vm.useFirstLastLinks)?_c('li',{staticClass:"page-item",class:{ disabled: _vm.is_first_page }},[_c('a',{staticClass:"page-link",attrs:{"href":""},domProps:{"innerHTML":_vm._s(_vm.firstText)},on:{"click":function($event){$event.preventDefault();_vm.selectPage(1)}}})]):_vm._e(),(_vm.useNextPrevLinks)?_c('li',{staticClass:"page-item",class:{ disabled: _vm.is_first_page }},[_c('a',{staticClass:"page-link",attrs:{"href":""},domProps:{"innerHTML":_vm._s(_vm.previousText)},on:{"click":function($event){$event.preventDefault();_vm.selectPage(_vm.currentPage - 1)}}})]):_vm._e(),_vm._l((_vm.pages),function(page,index){return _c('li',{key:index,staticClass:"page-item",class:{ active: page.active }},[_c('a',{staticClass:"page-link",attrs:{"disabled":!page.active,"href":""},on:{"click":function($event){$event.preventDefault();_vm.selectPage(page.number)}}},[_vm._v(_vm._s(page.label))])])}),(_vm.useNextPrevLinks)?_c('li',{staticClass:"page-item",class:{ disabled: _vm.is_last_page }},[_c('a',{staticClass:"page-link",attrs:{"href":""},domProps:{"innerHTML":_vm._s(_vm.nextText)},on:{"click":function($event){$event.preventDefault();_vm.selectPage(_vm.currentPage + 1)}}})]):_vm._e(),(_vm.useFirstLastLinks)?_c('li',{staticClass:"page-item",class:{ disabled: _vm.is_last_page }},[_c('a',{staticClass:"page-link",attrs:{"href":""},domProps:{"innerHTML":_vm._s(_vm.lastText )},on:{"click":function($event){$event.preventDefault();_vm.selectPage(_vm.total_pages)}}})]):_vm._e()],2):_vm._e()],2)])} 339 | var VueTablePaginationvue_type_template_id_4dc728dc_staticRenderFns = [] 340 | 341 | 342 | // CONCATENATED MODULE: ./src/VueTablePagination.vue?vue&type=template&id=4dc728dc 343 | 344 | // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.number.constructor.js 345 | var es6_number_constructor = __webpack_require__("xfY5"); 346 | 347 | // CONCATENATED MODULE: ./src/mixins/vueTablePaginationMixin.js 348 | 349 | /* harmony default export */ var vueTablePaginationMixin = ({ 350 | props: { 351 | showRefreshButton: { 352 | type: Boolean, 353 | default: true 354 | }, 355 | useFirstLastLinks: { 356 | type: Boolean, 357 | default: true 358 | }, 359 | useBoundariesNumbersLinks: { 360 | type: Boolean, 361 | default: false 362 | }, 363 | useNextPrevLinks: { 364 | type: Boolean, 365 | default: false 366 | }, 367 | firstText: { 368 | type: String, 369 | default: "«" 370 | }, 371 | lastText: { 372 | type: String, 373 | default: "»" 374 | }, 375 | nextText: { 376 | type: String, 377 | default: "<" 378 | }, 379 | previousText: { 380 | type: String, 381 | default: ">" 382 | }, 383 | useEllipses: { 384 | type: Boolean, 385 | default: true 386 | }, 387 | rotate: { 388 | type: Boolean, 389 | default: true 390 | }, 391 | maxPageItems: { 392 | type: Number, 393 | default: 5 394 | }, 395 | itemsPerPage: { 396 | type: Number, 397 | default: 15 398 | }, 399 | totalItems: { 400 | type: Number, 401 | required: true 402 | }, 403 | currentPage: { 404 | type: Number, 405 | required: true 406 | } 407 | }, 408 | computed: { 409 | is_last_page: function is_last_page() { 410 | return this.currentPage === this.total_pages; 411 | }, 412 | is_first_page: function is_first_page() { 413 | return this.currentPage === 1; 414 | }, 415 | total_pages: function total_pages() { 416 | var total_pages = this.itemsPerPage < 1 ? 1 : Math.ceil(this.totalItems / this.itemsPerPage); 417 | return Math.max(total_pages || 0, 1); 418 | }, 419 | from: function from() { 420 | return this.is_first_page ? 1 : this.itemsPerPage * (this.currentPage - 1) + 1; 421 | }, 422 | to: function to() { 423 | return this.is_last_page ? this.totalItems : this.itemsPerPage * this.currentPage; 424 | }, 425 | pages: function pages() { 426 | var pages = []; 427 | 428 | if (this.currentPage <= 0 || this.currentPage > this.total_pages) { 429 | return pages; 430 | } // Default page limits 431 | 432 | 433 | var start_page = 1; 434 | var end_page = this.total_pages; 435 | var limit_page_items = this.isDefined(this.maxPageItems) && this.maxPageItems < this.total_pages; // recompute if maxPageItems 436 | 437 | if (limit_page_items) { 438 | if (this.rotate) { 439 | // Current page is displayed in the middle of the visible ones 440 | start_page = Math.max(this.currentPage - Math.floor(this.maxPageItems / 2), 1); 441 | end_page = start_page + this.maxPageItems - 1; // Adjust if limit is exceeded 442 | 443 | if (end_page > this.total_pages) { 444 | end_page = this.total_pages; 445 | start_page = end_page - this.maxPageItems + 1; 446 | } 447 | } else { 448 | // Visible pages are paginated with maxPageItems 449 | start_page = (Math.ceil(this.currentPage / this.maxPageItems) - 1) * this.maxPageItems + 1; // Adjust last page if limit is exceeded 450 | 451 | end_page = Math.min(start_page + this.maxPageItems - 1, this.total_pages); 452 | } 453 | } // Add page number links 454 | 455 | 456 | for (var number = start_page; number <= end_page; number++) { 457 | var page = this.makePage(number, number, number === this.currentPage); 458 | pages.push(page); 459 | } // Add links to move between page sets 460 | 461 | 462 | if (limit_page_items && this.maxPageItems > 0 && (!this.rotate || this.useEllipses || this.useBoundariesNumbersLinks)) { 463 | if (start_page > 1) { 464 | if (!this.useBoundariesNumbersLinks || start_page > 3) { 465 | //need ellipsis for all options unless range is too close to beginning 466 | var previous_ellipsis_page_item = this.makePage(start_page - 1, '...', false); 467 | pages.unshift(previous_ellipsis_page_item); 468 | } 469 | 470 | if (this.useBoundariesNumbersLinks) { 471 | if (start_page === 3) { 472 | //need to replace ellipsis when the buttons would be sequential 473 | var second_page_item = this.makePage(2, '2', false); 474 | pages.unshift(second_page_item); 475 | } //add the first page 476 | 477 | 478 | var first_page_item = this.makePage(1, '1', false); 479 | pages.unshift(first_page_item); 480 | } 481 | } 482 | 483 | if (end_page < this.total_pages) { 484 | if (!this.useBoundariesNumbersLinks || end_page < this.total_pages - 2) { 485 | //need ellipsis for all options unless range is too close to end 486 | var next_ellipsis_page_item = this.makePage(end_page + 1, '...', false); 487 | pages.push(next_ellipsis_page_item); 488 | } 489 | 490 | if (this.useBoundariesNumbersLinks) { 491 | if (end_page === this.total_pages - 2) { 492 | //need to replace ellipsis when the buttons would be sequential 493 | var second_to_last_page_item = this.makePage(this.total_pages - 1, this.total_pages - 1, false); 494 | pages.push(second_to_last_page_item); 495 | } //add the last page 496 | 497 | 498 | var last_page_item = this.makePage(this.total_pages, this.total_pages, false); 499 | pages.push(last_page_item); 500 | } 501 | } 502 | } 503 | 504 | return pages; 505 | } 506 | }, 507 | methods: { 508 | selectPage: function selectPage(page) { 509 | this.$emit('pagination:change', page); 510 | }, 511 | isDefined: function isDefined(value) { 512 | return typeof value !== "undefined"; 513 | }, 514 | makePage: function makePage(number, label, active) { 515 | return { 516 | number: number, 517 | label: label, 518 | active: active 519 | }; 520 | } 521 | } 522 | }); 523 | // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/VueTablePagination.vue?vue&type=script&lang=js 524 | // 525 | // 526 | // 527 | // 528 | // 529 | // 530 | // 531 | // 532 | // 533 | // 534 | // 535 | // 536 | // 537 | // 538 | // 539 | // 540 | // 541 | // 542 | // 543 | // 544 | // 545 | // 546 | // 547 | // 548 | // 549 | // 550 | // 551 | // 552 | // 553 | // 554 | // 555 | // 556 | // 557 | // 558 | // 559 | // 560 | // 561 | // 562 | // 563 | // 564 | // 565 | 566 | /* harmony default export */ var VueTablePaginationvue_type_script_lang_js = ({ 567 | mixins: [vueTablePaginationMixin] 568 | }); 569 | // CONCATENATED MODULE: ./src/VueTablePagination.vue?vue&type=script&lang=js 570 | /* harmony default export */ var src_VueTablePaginationvue_type_script_lang_js = (VueTablePaginationvue_type_script_lang_js); 571 | // CONCATENATED MODULE: ./src/VueTablePagination.vue 572 | 573 | 574 | 575 | 576 | 577 | /* normalize component */ 578 | 579 | var VueTablePagination_component = normalizeComponent( 580 | src_VueTablePaginationvue_type_script_lang_js, 581 | VueTablePaginationvue_type_template_id_4dc728dc_render, 582 | VueTablePaginationvue_type_template_id_4dc728dc_staticRenderFns, 583 | false, 584 | null, 585 | null, 586 | null 587 | 588 | ) 589 | 590 | /* harmony default export */ var VueTablePagination = (VueTablePagination_component.exports); 591 | // CONCATENATED MODULE: ./src/main.js 592 | 593 | 594 | 595 | 596 | /* harmony default export */ var main = (VueTable); 597 | 598 | // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js 599 | /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "VueTable", function() { return VueTable; }); 600 | /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "vueTableMixin", function() { return vueTableMixin; }); 601 | /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "VueTablePagination", function() { return VueTablePagination; }); 602 | /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "vueTablePaginationMixin", function() { return vueTablePaginationMixin; }); 603 | 604 | 605 | /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (main); 606 | 607 | 608 | 609 | /***/ }), 610 | 611 | /***/ "/e88": 612 | /***/ (function(module, exports) { 613 | 614 | module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + 615 | '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; 616 | 617 | 618 | /***/ }), 619 | 620 | /***/ "0/R4": 621 | /***/ (function(module, exports) { 622 | 623 | module.exports = function (it) { 624 | return typeof it === 'object' ? it !== null : typeof it === 'function'; 625 | }; 626 | 627 | 628 | /***/ }), 629 | 630 | /***/ "0sh+": 631 | /***/ (function(module, exports, __webpack_require__) { 632 | 633 | // helper for String#{startsWith, endsWith, includes} 634 | var isRegExp = __webpack_require__("quPj"); 635 | var defined = __webpack_require__("vhPU"); 636 | 637 | module.exports = function (that, searchString, NAME) { 638 | if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); 639 | return String(defined(that)); 640 | }; 641 | 642 | 643 | /***/ }), 644 | 645 | /***/ "2OiF": 646 | /***/ (function(module, exports) { 647 | 648 | module.exports = function (it) { 649 | if (typeof it != 'function') throw TypeError(it + ' is not a function!'); 650 | return it; 651 | }; 652 | 653 | 654 | /***/ }), 655 | 656 | /***/ "4R4u": 657 | /***/ (function(module, exports) { 658 | 659 | // IE 8- don't enum bug keys 660 | module.exports = ( 661 | 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' 662 | ).split(','); 663 | 664 | 665 | /***/ }), 666 | 667 | /***/ "DVgA": 668 | /***/ (function(module, exports, __webpack_require__) { 669 | 670 | // 19.1.2.14 / 15.2.3.14 Object.keys(O) 671 | var $keys = __webpack_require__("zhAb"); 672 | var enumBugKeys = __webpack_require__("4R4u"); 673 | 674 | module.exports = Object.keys || function keys(O) { 675 | return $keys(O, enumBugKeys); 676 | }; 677 | 678 | 679 | /***/ }), 680 | 681 | /***/ "EemH": 682 | /***/ (function(module, exports, __webpack_require__) { 683 | 684 | var pIE = __webpack_require__("UqcF"); 685 | var createDesc = __webpack_require__("RjD/"); 686 | var toIObject = __webpack_require__("aCFj"); 687 | var toPrimitive = __webpack_require__("apmT"); 688 | var has = __webpack_require__("aagx"); 689 | var IE8_DOM_DEFINE = __webpack_require__("xpql"); 690 | var gOPD = Object.getOwnPropertyDescriptor; 691 | 692 | exports.f = __webpack_require__("nh4g") ? gOPD : function getOwnPropertyDescriptor(O, P) { 693 | O = toIObject(O); 694 | P = toPrimitive(P, true); 695 | if (IE8_DOM_DEFINE) try { 696 | return gOPD(O, P); 697 | } catch (e) { /* empty */ } 698 | if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); 699 | }; 700 | 701 | 702 | /***/ }), 703 | 704 | /***/ "FJW5": 705 | /***/ (function(module, exports, __webpack_require__) { 706 | 707 | var dP = __webpack_require__("hswa"); 708 | var anObject = __webpack_require__("y3w9"); 709 | var getKeys = __webpack_require__("DVgA"); 710 | 711 | module.exports = __webpack_require__("nh4g") ? Object.defineProperties : function defineProperties(O, Properties) { 712 | anObject(O); 713 | var keys = getKeys(Properties); 714 | var length = keys.length; 715 | var i = 0; 716 | var P; 717 | while (length > i) dP.f(O, P = keys[i++], Properties[P]); 718 | return O; 719 | }; 720 | 721 | 722 | /***/ }), 723 | 724 | /***/ "HrLf": 725 | /***/ (function(module, exports, __webpack_require__) { 726 | 727 | // This file is imported into lib/wc client bundles. 728 | 729 | if (typeof window !== 'undefined') { 730 | let i 731 | if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js$/))) { 732 | __webpack_require__.p = i[1] // eslint-disable-line 733 | } 734 | } 735 | 736 | 737 | /***/ }), 738 | 739 | /***/ "Iw71": 740 | /***/ (function(module, exports, __webpack_require__) { 741 | 742 | var isObject = __webpack_require__("0/R4"); 743 | var document = __webpack_require__("dyZX").document; 744 | // typeof document.createElement is 'object' in old IE 745 | var is = isObject(document) && isObject(document.createElement); 746 | module.exports = function (it) { 747 | return is ? document.createElement(it) : {}; 748 | }; 749 | 750 | 751 | /***/ }), 752 | 753 | /***/ "K0xU": 754 | /***/ (function(module, exports, __webpack_require__) { 755 | 756 | var store = __webpack_require__("VTer")('wks'); 757 | var uid = __webpack_require__("ylqs"); 758 | var Symbol = __webpack_require__("dyZX").Symbol; 759 | var USE_SYMBOL = typeof Symbol == 'function'; 760 | 761 | var $exports = module.exports = function (name) { 762 | return store[name] || (store[name] = 763 | USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); 764 | }; 765 | 766 | $exports.store = store; 767 | 768 | 769 | /***/ }), 770 | 771 | /***/ "KroJ": 772 | /***/ (function(module, exports, __webpack_require__) { 773 | 774 | var global = __webpack_require__("dyZX"); 775 | var hide = __webpack_require__("Mukb"); 776 | var has = __webpack_require__("aagx"); 777 | var SRC = __webpack_require__("ylqs")('src'); 778 | var TO_STRING = 'toString'; 779 | var $toString = Function[TO_STRING]; 780 | var TPL = ('' + $toString).split(TO_STRING); 781 | 782 | __webpack_require__("g3g5").inspectSource = function (it) { 783 | return $toString.call(it); 784 | }; 785 | 786 | (module.exports = function (O, key, val, safe) { 787 | var isFunction = typeof val == 'function'; 788 | if (isFunction) has(val, 'name') || hide(val, 'name', key); 789 | if (O[key] === val) return; 790 | if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); 791 | if (O === global) { 792 | O[key] = val; 793 | } else if (!safe) { 794 | delete O[key]; 795 | hide(O, key, val); 796 | } else if (O[key]) { 797 | O[key] = val; 798 | } else { 799 | hide(O, key, val); 800 | } 801 | // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative 802 | })(Function.prototype, TO_STRING, function toString() { 803 | return typeof this == 'function' && this[SRC] || $toString.call(this); 804 | }); 805 | 806 | 807 | /***/ }), 808 | 809 | /***/ "Kuth": 810 | /***/ (function(module, exports, __webpack_require__) { 811 | 812 | // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) 813 | var anObject = __webpack_require__("y3w9"); 814 | var dPs = __webpack_require__("FJW5"); 815 | var enumBugKeys = __webpack_require__("4R4u"); 816 | var IE_PROTO = __webpack_require__("YTvA")('IE_PROTO'); 817 | var Empty = function () { /* empty */ }; 818 | var PROTOTYPE = 'prototype'; 819 | 820 | // Create object with fake `null` prototype: use iframe Object with cleared prototype 821 | var createDict = function () { 822 | // Thrash, waste and sodomy: IE GC bug 823 | var iframe = __webpack_require__("Iw71")('iframe'); 824 | var i = enumBugKeys.length; 825 | var lt = '<'; 826 | var gt = '>'; 827 | var iframeDocument; 828 | iframe.style.display = 'none'; 829 | __webpack_require__("+rLv").appendChild(iframe); 830 | iframe.src = 'javascript:'; // eslint-disable-line no-script-url 831 | // createDict = iframe.contentWindow.Object; 832 | // html.removeChild(iframe); 833 | iframeDocument = iframe.contentWindow.document; 834 | iframeDocument.open(); 835 | iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); 836 | iframeDocument.close(); 837 | createDict = iframeDocument.F; 838 | while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; 839 | return createDict(); 840 | }; 841 | 842 | module.exports = Object.create || function create(O, Properties) { 843 | var result; 844 | if (O !== null) { 845 | Empty[PROTOTYPE] = anObject(O); 846 | result = new Empty(); 847 | Empty[PROTOTYPE] = null; 848 | // add "__proto__" for Object.getPrototypeOf polyfill 849 | result[IE_PROTO] = O; 850 | } else result = createDict(); 851 | return Properties === undefined ? result : dPs(result, Properties); 852 | }; 853 | 854 | 855 | /***/ }), 856 | 857 | /***/ "L9s1": 858 | /***/ (function(module, exports, __webpack_require__) { 859 | 860 | "use strict"; 861 | // 21.1.3.7 String.prototype.includes(searchString, position = 0) 862 | 863 | var $export = __webpack_require__("XKFU"); 864 | var context = __webpack_require__("0sh+"); 865 | var INCLUDES = 'includes'; 866 | 867 | $export($export.P + $export.F * __webpack_require__("UUeW")(INCLUDES), 'String', { 868 | includes: function includes(searchString /* , position = 0 */) { 869 | return !!~context(this, searchString, INCLUDES) 870 | .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); 871 | } 872 | }); 873 | 874 | 875 | /***/ }), 876 | 877 | /***/ "LQAc": 878 | /***/ (function(module, exports) { 879 | 880 | module.exports = false; 881 | 882 | 883 | /***/ }), 884 | 885 | /***/ "LZWt": 886 | /***/ (function(module, exports) { 887 | 888 | var toString = {}.toString; 889 | 890 | module.exports = function (it) { 891 | return toString.call(it).slice(8, -1); 892 | }; 893 | 894 | 895 | /***/ }), 896 | 897 | /***/ "Mukb": 898 | /***/ (function(module, exports, __webpack_require__) { 899 | 900 | var dP = __webpack_require__("hswa"); 901 | var createDesc = __webpack_require__("RjD/"); 902 | module.exports = __webpack_require__("nh4g") ? function (object, key, value) { 903 | return dP.f(object, key, createDesc(1, value)); 904 | } : function (object, key, value) { 905 | object[key] = value; 906 | return object; 907 | }; 908 | 909 | 910 | /***/ }), 911 | 912 | /***/ "RYi7": 913 | /***/ (function(module, exports) { 914 | 915 | // 7.1.4 ToInteger 916 | var ceil = Math.ceil; 917 | var floor = Math.floor; 918 | module.exports = function (it) { 919 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); 920 | }; 921 | 922 | 923 | /***/ }), 924 | 925 | /***/ "RjD/": 926 | /***/ (function(module, exports) { 927 | 928 | module.exports = function (bitmap, value) { 929 | return { 930 | enumerable: !(bitmap & 1), 931 | configurable: !(bitmap & 2), 932 | writable: !(bitmap & 4), 933 | value: value 934 | }; 935 | }; 936 | 937 | 938 | /***/ }), 939 | 940 | /***/ "UUeW": 941 | /***/ (function(module, exports, __webpack_require__) { 942 | 943 | var MATCH = __webpack_require__("K0xU")('match'); 944 | module.exports = function (KEY) { 945 | var re = /./; 946 | try { 947 | '/./'[KEY](re); 948 | } catch (e) { 949 | try { 950 | re[MATCH] = false; 951 | return !'/./'[KEY](re); 952 | } catch (f) { /* empty */ } 953 | } return true; 954 | }; 955 | 956 | 957 | /***/ }), 958 | 959 | /***/ "UqcF": 960 | /***/ (function(module, exports) { 961 | 962 | exports.f = {}.propertyIsEnumerable; 963 | 964 | 965 | /***/ }), 966 | 967 | /***/ "VTer": 968 | /***/ (function(module, exports, __webpack_require__) { 969 | 970 | var core = __webpack_require__("g3g5"); 971 | var global = __webpack_require__("dyZX"); 972 | var SHARED = '__core-js_shared__'; 973 | var store = global[SHARED] || (global[SHARED] = {}); 974 | 975 | (module.exports = function (key, value) { 976 | return store[key] || (store[key] = value !== undefined ? value : {}); 977 | })('versions', []).push({ 978 | version: core.version, 979 | mode: __webpack_require__("LQAc") ? 'pure' : 'global', 980 | copyright: '© 2018 Denis Pushkarev (zloirock.ru)' 981 | }); 982 | 983 | 984 | /***/ }), 985 | 986 | /***/ "XKFU": 987 | /***/ (function(module, exports, __webpack_require__) { 988 | 989 | var global = __webpack_require__("dyZX"); 990 | var core = __webpack_require__("g3g5"); 991 | var hide = __webpack_require__("Mukb"); 992 | var redefine = __webpack_require__("KroJ"); 993 | var ctx = __webpack_require__("m0Pp"); 994 | var PROTOTYPE = 'prototype'; 995 | 996 | var $export = function (type, name, source) { 997 | var IS_FORCED = type & $export.F; 998 | var IS_GLOBAL = type & $export.G; 999 | var IS_STATIC = type & $export.S; 1000 | var IS_PROTO = type & $export.P; 1001 | var IS_BIND = type & $export.B; 1002 | var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; 1003 | var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); 1004 | var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); 1005 | var key, own, out, exp; 1006 | if (IS_GLOBAL) source = name; 1007 | for (key in source) { 1008 | // contains in native 1009 | own = !IS_FORCED && target && target[key] !== undefined; 1010 | // export native or passed 1011 | out = (own ? target : source)[key]; 1012 | // bind timers to global for call from export context 1013 | exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; 1014 | // extend global 1015 | if (target) redefine(target, key, out, type & $export.U); 1016 | // export 1017 | if (exports[key] != out) hide(exports, key, exp); 1018 | if (IS_PROTO && expProto[key] != out) expProto[key] = out; 1019 | } 1020 | }; 1021 | global.core = core; 1022 | // type bitmap 1023 | $export.F = 1; // forced 1024 | $export.G = 2; // global 1025 | $export.S = 4; // static 1026 | $export.P = 8; // proto 1027 | $export.B = 16; // bind 1028 | $export.W = 32; // wrap 1029 | $export.U = 64; // safe 1030 | $export.R = 128; // real proto method for `library` 1031 | module.exports = $export; 1032 | 1033 | 1034 | /***/ }), 1035 | 1036 | /***/ "Xbzi": 1037 | /***/ (function(module, exports, __webpack_require__) { 1038 | 1039 | var isObject = __webpack_require__("0/R4"); 1040 | var setPrototypeOf = __webpack_require__("i5dc").set; 1041 | module.exports = function (that, target, C) { 1042 | var S = target.constructor; 1043 | var P; 1044 | if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { 1045 | setPrototypeOf(that, P); 1046 | } return that; 1047 | }; 1048 | 1049 | 1050 | /***/ }), 1051 | 1052 | /***/ "YTvA": 1053 | /***/ (function(module, exports, __webpack_require__) { 1054 | 1055 | var shared = __webpack_require__("VTer")('keys'); 1056 | var uid = __webpack_require__("ylqs"); 1057 | module.exports = function (key) { 1058 | return shared[key] || (shared[key] = uid(key)); 1059 | }; 1060 | 1061 | 1062 | /***/ }), 1063 | 1064 | /***/ "Ymqv": 1065 | /***/ (function(module, exports, __webpack_require__) { 1066 | 1067 | // fallback for non-array-like ES3 and non-enumerable old V8 strings 1068 | var cof = __webpack_require__("LZWt"); 1069 | // eslint-disable-next-line no-prototype-builtins 1070 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { 1071 | return cof(it) == 'String' ? it.split('') : Object(it); 1072 | }; 1073 | 1074 | 1075 | /***/ }), 1076 | 1077 | /***/ "Z2Ku": 1078 | /***/ (function(module, exports, __webpack_require__) { 1079 | 1080 | "use strict"; 1081 | 1082 | // https://github.com/tc39/Array.prototype.includes 1083 | var $export = __webpack_require__("XKFU"); 1084 | var $includes = __webpack_require__("w2a5")(true); 1085 | 1086 | $export($export.P, 'Array', { 1087 | includes: function includes(el /* , fromIndex = 0 */) { 1088 | return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); 1089 | } 1090 | }); 1091 | 1092 | __webpack_require__("nGyu")('includes'); 1093 | 1094 | 1095 | /***/ }), 1096 | 1097 | /***/ "aCFj": 1098 | /***/ (function(module, exports, __webpack_require__) { 1099 | 1100 | // to indexed object, toObject with fallback for non-array-like ES3 strings 1101 | var IObject = __webpack_require__("Ymqv"); 1102 | var defined = __webpack_require__("vhPU"); 1103 | module.exports = function (it) { 1104 | return IObject(defined(it)); 1105 | }; 1106 | 1107 | 1108 | /***/ }), 1109 | 1110 | /***/ "aagx": 1111 | /***/ (function(module, exports) { 1112 | 1113 | var hasOwnProperty = {}.hasOwnProperty; 1114 | module.exports = function (it, key) { 1115 | return hasOwnProperty.call(it, key); 1116 | }; 1117 | 1118 | 1119 | /***/ }), 1120 | 1121 | /***/ "apmT": 1122 | /***/ (function(module, exports, __webpack_require__) { 1123 | 1124 | // 7.1.1 ToPrimitive(input [, PreferredType]) 1125 | var isObject = __webpack_require__("0/R4"); 1126 | // instead of the ES6 spec version, we didn't implement @@toPrimitive case 1127 | // and the second argument - flag - preferred type is a string 1128 | module.exports = function (it, S) { 1129 | if (!isObject(it)) return it; 1130 | var fn, val; 1131 | if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; 1132 | if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; 1133 | if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; 1134 | throw TypeError("Can't convert object to primitive value"); 1135 | }; 1136 | 1137 | 1138 | /***/ }), 1139 | 1140 | /***/ "d/Gc": 1141 | /***/ (function(module, exports, __webpack_require__) { 1142 | 1143 | var toInteger = __webpack_require__("RYi7"); 1144 | var max = Math.max; 1145 | var min = Math.min; 1146 | module.exports = function (index, length) { 1147 | index = toInteger(index); 1148 | return index < 0 ? max(index + length, 0) : min(index, length); 1149 | }; 1150 | 1151 | 1152 | /***/ }), 1153 | 1154 | /***/ "dyZX": 1155 | /***/ (function(module, exports) { 1156 | 1157 | // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 1158 | var global = module.exports = typeof window != 'undefined' && window.Math == Math 1159 | ? window : typeof self != 'undefined' && self.Math == Math ? self 1160 | // eslint-disable-next-line no-new-func 1161 | : Function('return this')(); 1162 | if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef 1163 | 1164 | 1165 | /***/ }), 1166 | 1167 | /***/ "eeVq": 1168 | /***/ (function(module, exports) { 1169 | 1170 | module.exports = function (exec) { 1171 | try { 1172 | return !!exec(); 1173 | } catch (e) { 1174 | return true; 1175 | } 1176 | }; 1177 | 1178 | 1179 | /***/ }), 1180 | 1181 | /***/ "f3/d": 1182 | /***/ (function(module, exports, __webpack_require__) { 1183 | 1184 | var dP = __webpack_require__("hswa").f; 1185 | var FProto = Function.prototype; 1186 | var nameRE = /^\s*function ([^ (]*)/; 1187 | var NAME = 'name'; 1188 | 1189 | // 19.2.4.2 name 1190 | NAME in FProto || __webpack_require__("nh4g") && dP(FProto, NAME, { 1191 | configurable: true, 1192 | get: function () { 1193 | try { 1194 | return ('' + this).match(nameRE)[1]; 1195 | } catch (e) { 1196 | return ''; 1197 | } 1198 | } 1199 | }); 1200 | 1201 | 1202 | /***/ }), 1203 | 1204 | /***/ "g3g5": 1205 | /***/ (function(module, exports) { 1206 | 1207 | var core = module.exports = { version: '2.5.7' }; 1208 | if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef 1209 | 1210 | 1211 | /***/ }), 1212 | 1213 | /***/ "hswa": 1214 | /***/ (function(module, exports, __webpack_require__) { 1215 | 1216 | var anObject = __webpack_require__("y3w9"); 1217 | var IE8_DOM_DEFINE = __webpack_require__("xpql"); 1218 | var toPrimitive = __webpack_require__("apmT"); 1219 | var dP = Object.defineProperty; 1220 | 1221 | exports.f = __webpack_require__("nh4g") ? Object.defineProperty : function defineProperty(O, P, Attributes) { 1222 | anObject(O); 1223 | P = toPrimitive(P, true); 1224 | anObject(Attributes); 1225 | if (IE8_DOM_DEFINE) try { 1226 | return dP(O, P, Attributes); 1227 | } catch (e) { /* empty */ } 1228 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); 1229 | if ('value' in Attributes) O[P] = Attributes.value; 1230 | return O; 1231 | }; 1232 | 1233 | 1234 | /***/ }), 1235 | 1236 | /***/ "i5dc": 1237 | /***/ (function(module, exports, __webpack_require__) { 1238 | 1239 | // Works with __proto__ only. Old v8 can't work with null proto objects. 1240 | /* eslint-disable no-proto */ 1241 | var isObject = __webpack_require__("0/R4"); 1242 | var anObject = __webpack_require__("y3w9"); 1243 | var check = function (O, proto) { 1244 | anObject(O); 1245 | if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); 1246 | }; 1247 | module.exports = { 1248 | set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line 1249 | function (test, buggy, set) { 1250 | try { 1251 | set = __webpack_require__("m0Pp")(Function.call, __webpack_require__("EemH").f(Object.prototype, '__proto__').set, 2); 1252 | set(test, []); 1253 | buggy = !(test instanceof Array); 1254 | } catch (e) { buggy = true; } 1255 | return function setPrototypeOf(O, proto) { 1256 | check(O, proto); 1257 | if (buggy) O.__proto__ = proto; 1258 | else set(O, proto); 1259 | return O; 1260 | }; 1261 | }({}, false) : undefined), 1262 | check: check 1263 | }; 1264 | 1265 | 1266 | /***/ }), 1267 | 1268 | /***/ "kJMx": 1269 | /***/ (function(module, exports, __webpack_require__) { 1270 | 1271 | // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) 1272 | var $keys = __webpack_require__("zhAb"); 1273 | var hiddenKeys = __webpack_require__("4R4u").concat('length', 'prototype'); 1274 | 1275 | exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { 1276 | return $keys(O, hiddenKeys); 1277 | }; 1278 | 1279 | 1280 | /***/ }), 1281 | 1282 | /***/ "m0Pp": 1283 | /***/ (function(module, exports, __webpack_require__) { 1284 | 1285 | // optional / simple context binding 1286 | var aFunction = __webpack_require__("2OiF"); 1287 | module.exports = function (fn, that, length) { 1288 | aFunction(fn); 1289 | if (that === undefined) return fn; 1290 | switch (length) { 1291 | case 1: return function (a) { 1292 | return fn.call(that, a); 1293 | }; 1294 | case 2: return function (a, b) { 1295 | return fn.call(that, a, b); 1296 | }; 1297 | case 3: return function (a, b, c) { 1298 | return fn.call(that, a, b, c); 1299 | }; 1300 | } 1301 | return function (/* ...args */) { 1302 | return fn.apply(that, arguments); 1303 | }; 1304 | }; 1305 | 1306 | 1307 | /***/ }), 1308 | 1309 | /***/ "nGyu": 1310 | /***/ (function(module, exports, __webpack_require__) { 1311 | 1312 | // 22.1.3.31 Array.prototype[@@unscopables] 1313 | var UNSCOPABLES = __webpack_require__("K0xU")('unscopables'); 1314 | var ArrayProto = Array.prototype; 1315 | if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__("Mukb")(ArrayProto, UNSCOPABLES, {}); 1316 | module.exports = function (key) { 1317 | ArrayProto[UNSCOPABLES][key] = true; 1318 | }; 1319 | 1320 | 1321 | /***/ }), 1322 | 1323 | /***/ "ne8i": 1324 | /***/ (function(module, exports, __webpack_require__) { 1325 | 1326 | // 7.1.15 ToLength 1327 | var toInteger = __webpack_require__("RYi7"); 1328 | var min = Math.min; 1329 | module.exports = function (it) { 1330 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 1331 | }; 1332 | 1333 | 1334 | /***/ }), 1335 | 1336 | /***/ "nh4g": 1337 | /***/ (function(module, exports, __webpack_require__) { 1338 | 1339 | // Thank's IE8 for his funny defineProperty 1340 | module.exports = !__webpack_require__("eeVq")(function () { 1341 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; 1342 | }); 1343 | 1344 | 1345 | /***/ }), 1346 | 1347 | /***/ "qncB": 1348 | /***/ (function(module, exports, __webpack_require__) { 1349 | 1350 | var $export = __webpack_require__("XKFU"); 1351 | var defined = __webpack_require__("vhPU"); 1352 | var fails = __webpack_require__("eeVq"); 1353 | var spaces = __webpack_require__("/e88"); 1354 | var space = '[' + spaces + ']'; 1355 | var non = '\u200b\u0085'; 1356 | var ltrim = RegExp('^' + space + space + '*'); 1357 | var rtrim = RegExp(space + space + '*$'); 1358 | 1359 | var exporter = function (KEY, exec, ALIAS) { 1360 | var exp = {}; 1361 | var FORCE = fails(function () { 1362 | return !!spaces[KEY]() || non[KEY]() != non; 1363 | }); 1364 | var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; 1365 | if (ALIAS) exp[ALIAS] = fn; 1366 | $export($export.P + $export.F * FORCE, 'String', exp); 1367 | }; 1368 | 1369 | // 1 -> String#trimLeft 1370 | // 2 -> String#trimRight 1371 | // 3 -> String#trim 1372 | var trim = exporter.trim = function (string, TYPE) { 1373 | string = String(defined(string)); 1374 | if (TYPE & 1) string = string.replace(ltrim, ''); 1375 | if (TYPE & 2) string = string.replace(rtrim, ''); 1376 | return string; 1377 | }; 1378 | 1379 | module.exports = exporter; 1380 | 1381 | 1382 | /***/ }), 1383 | 1384 | /***/ "quPj": 1385 | /***/ (function(module, exports, __webpack_require__) { 1386 | 1387 | // 7.2.8 IsRegExp(argument) 1388 | var isObject = __webpack_require__("0/R4"); 1389 | var cof = __webpack_require__("LZWt"); 1390 | var MATCH = __webpack_require__("K0xU")('match'); 1391 | module.exports = function (it) { 1392 | var isRegExp; 1393 | return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); 1394 | }; 1395 | 1396 | 1397 | /***/ }), 1398 | 1399 | /***/ "vhPU": 1400 | /***/ (function(module, exports) { 1401 | 1402 | // 7.2.1 RequireObjectCoercible(argument) 1403 | module.exports = function (it) { 1404 | if (it == undefined) throw TypeError("Can't call method on " + it); 1405 | return it; 1406 | }; 1407 | 1408 | 1409 | /***/ }), 1410 | 1411 | /***/ "w2a5": 1412 | /***/ (function(module, exports, __webpack_require__) { 1413 | 1414 | // false -> Array#indexOf 1415 | // true -> Array#includes 1416 | var toIObject = __webpack_require__("aCFj"); 1417 | var toLength = __webpack_require__("ne8i"); 1418 | var toAbsoluteIndex = __webpack_require__("d/Gc"); 1419 | module.exports = function (IS_INCLUDES) { 1420 | return function ($this, el, fromIndex) { 1421 | var O = toIObject($this); 1422 | var length = toLength(O.length); 1423 | var index = toAbsoluteIndex(fromIndex, length); 1424 | var value; 1425 | // Array#includes uses SameValueZero equality algorithm 1426 | // eslint-disable-next-line no-self-compare 1427 | if (IS_INCLUDES && el != el) while (length > index) { 1428 | value = O[index++]; 1429 | // eslint-disable-next-line no-self-compare 1430 | if (value != value) return true; 1431 | // Array#indexOf ignores holes, Array#includes - not 1432 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) { 1433 | if (O[index] === el) return IS_INCLUDES || index || 0; 1434 | } return !IS_INCLUDES && -1; 1435 | }; 1436 | }; 1437 | 1438 | 1439 | /***/ }), 1440 | 1441 | /***/ "xfY5": 1442 | /***/ (function(module, exports, __webpack_require__) { 1443 | 1444 | "use strict"; 1445 | 1446 | var global = __webpack_require__("dyZX"); 1447 | var has = __webpack_require__("aagx"); 1448 | var cof = __webpack_require__("LZWt"); 1449 | var inheritIfRequired = __webpack_require__("Xbzi"); 1450 | var toPrimitive = __webpack_require__("apmT"); 1451 | var fails = __webpack_require__("eeVq"); 1452 | var gOPN = __webpack_require__("kJMx").f; 1453 | var gOPD = __webpack_require__("EemH").f; 1454 | var dP = __webpack_require__("hswa").f; 1455 | var $trim = __webpack_require__("qncB").trim; 1456 | var NUMBER = 'Number'; 1457 | var $Number = global[NUMBER]; 1458 | var Base = $Number; 1459 | var proto = $Number.prototype; 1460 | // Opera ~12 has broken Object#toString 1461 | var BROKEN_COF = cof(__webpack_require__("Kuth")(proto)) == NUMBER; 1462 | var TRIM = 'trim' in String.prototype; 1463 | 1464 | // 7.1.3 ToNumber(argument) 1465 | var toNumber = function (argument) { 1466 | var it = toPrimitive(argument, false); 1467 | if (typeof it == 'string' && it.length > 2) { 1468 | it = TRIM ? it.trim() : $trim(it, 3); 1469 | var first = it.charCodeAt(0); 1470 | var third, radix, maxCode; 1471 | if (first === 43 || first === 45) { 1472 | third = it.charCodeAt(2); 1473 | if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix 1474 | } else if (first === 48) { 1475 | switch (it.charCodeAt(1)) { 1476 | case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i 1477 | case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i 1478 | default: return +it; 1479 | } 1480 | for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { 1481 | code = digits.charCodeAt(i); 1482 | // parseInt parses a string to a first unavailable symbol 1483 | // but ToNumber should return NaN if a string contains unavailable symbols 1484 | if (code < 48 || code > maxCode) return NaN; 1485 | } return parseInt(digits, radix); 1486 | } 1487 | } return +it; 1488 | }; 1489 | 1490 | if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { 1491 | $Number = function Number(value) { 1492 | var it = arguments.length < 1 ? 0 : value; 1493 | var that = this; 1494 | return that instanceof $Number 1495 | // check on 1..constructor(foo) case 1496 | && (BROKEN_COF ? fails(function () { proto.valueOf.call(that); }) : cof(that) != NUMBER) 1497 | ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); 1498 | }; 1499 | for (var keys = __webpack_require__("nh4g") ? gOPN(Base) : ( 1500 | // ES3: 1501 | 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + 1502 | // ES6 (in case, if modules with ES6 Number statics required before): 1503 | 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 1504 | 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' 1505 | ).split(','), j = 0, key; keys.length > j; j++) { 1506 | if (has(Base, key = keys[j]) && !has($Number, key)) { 1507 | dP($Number, key, gOPD(Base, key)); 1508 | } 1509 | } 1510 | $Number.prototype = proto; 1511 | proto.constructor = $Number; 1512 | __webpack_require__("KroJ")(global, NUMBER, $Number); 1513 | } 1514 | 1515 | 1516 | /***/ }), 1517 | 1518 | /***/ "xpql": 1519 | /***/ (function(module, exports, __webpack_require__) { 1520 | 1521 | module.exports = !__webpack_require__("nh4g") && !__webpack_require__("eeVq")(function () { 1522 | return Object.defineProperty(__webpack_require__("Iw71")('div'), 'a', { get: function () { return 7; } }).a != 7; 1523 | }); 1524 | 1525 | 1526 | /***/ }), 1527 | 1528 | /***/ "y3w9": 1529 | /***/ (function(module, exports, __webpack_require__) { 1530 | 1531 | var isObject = __webpack_require__("0/R4"); 1532 | module.exports = function (it) { 1533 | if (!isObject(it)) throw TypeError(it + ' is not an object!'); 1534 | return it; 1535 | }; 1536 | 1537 | 1538 | /***/ }), 1539 | 1540 | /***/ "ylqs": 1541 | /***/ (function(module, exports) { 1542 | 1543 | var id = 0; 1544 | var px = Math.random(); 1545 | module.exports = function (key) { 1546 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); 1547 | }; 1548 | 1549 | 1550 | /***/ }), 1551 | 1552 | /***/ "zhAb": 1553 | /***/ (function(module, exports, __webpack_require__) { 1554 | 1555 | var has = __webpack_require__("aagx"); 1556 | var toIObject = __webpack_require__("aCFj"); 1557 | var arrayIndexOf = __webpack_require__("w2a5")(false); 1558 | var IE_PROTO = __webpack_require__("YTvA")('IE_PROTO'); 1559 | 1560 | module.exports = function (object, names) { 1561 | var O = toIObject(object); 1562 | var i = 0; 1563 | var result = []; 1564 | var key; 1565 | for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); 1566 | // Don't enum bug & hidden keys 1567 | while (names.length > i) if (has(O, key = names[i++])) { 1568 | ~arrayIndexOf(result, key) || result.push(key); 1569 | } 1570 | return result; 1571 | }; 1572 | 1573 | 1574 | /***/ }) 1575 | 1576 | /******/ }); 1577 | //# sourceMappingURL=VueTable.common.js.map -------------------------------------------------------------------------------- /dist/VueTable.umd.js: -------------------------------------------------------------------------------- 1 | (function webpackUniversalModuleDefinition(root, factory) { 2 | if(typeof exports === 'object' && typeof module === 'object') 3 | module.exports = factory(); 4 | else if(typeof define === 'function' && define.amd) 5 | define([], factory); 6 | else if(typeof exports === 'object') 7 | exports["VueTable"] = factory(); 8 | else 9 | root["VueTable"] = factory(); 10 | })(typeof self !== 'undefined' ? self : this, function() { 11 | return /******/ (function(modules) { // webpackBootstrap 12 | /******/ // The module cache 13 | /******/ var installedModules = {}; 14 | /******/ 15 | /******/ // The require function 16 | /******/ function __webpack_require__(moduleId) { 17 | /******/ 18 | /******/ // Check if module is in cache 19 | /******/ if(installedModules[moduleId]) { 20 | /******/ return installedModules[moduleId].exports; 21 | /******/ } 22 | /******/ // Create a new module (and put it into the cache) 23 | /******/ var module = installedModules[moduleId] = { 24 | /******/ i: moduleId, 25 | /******/ l: false, 26 | /******/ exports: {} 27 | /******/ }; 28 | /******/ 29 | /******/ // Execute the module function 30 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 31 | /******/ 32 | /******/ // Flag the module as loaded 33 | /******/ module.l = true; 34 | /******/ 35 | /******/ // Return the exports of the module 36 | /******/ return module.exports; 37 | /******/ } 38 | /******/ 39 | /******/ 40 | /******/ // expose the modules object (__webpack_modules__) 41 | /******/ __webpack_require__.m = modules; 42 | /******/ 43 | /******/ // expose the module cache 44 | /******/ __webpack_require__.c = installedModules; 45 | /******/ 46 | /******/ // define getter function for harmony exports 47 | /******/ __webpack_require__.d = function(exports, name, getter) { 48 | /******/ if(!__webpack_require__.o(exports, name)) { 49 | /******/ Object.defineProperty(exports, name, { 50 | /******/ configurable: false, 51 | /******/ enumerable: true, 52 | /******/ get: getter 53 | /******/ }); 54 | /******/ } 55 | /******/ }; 56 | /******/ 57 | /******/ // define __esModule on exports 58 | /******/ __webpack_require__.r = function(exports) { 59 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 60 | /******/ }; 61 | /******/ 62 | /******/ // getDefaultExport function for compatibility with non-harmony modules 63 | /******/ __webpack_require__.n = function(module) { 64 | /******/ var getter = module && module.__esModule ? 65 | /******/ function getDefault() { return module['default']; } : 66 | /******/ function getModuleExports() { return module; }; 67 | /******/ __webpack_require__.d(getter, 'a', getter); 68 | /******/ return getter; 69 | /******/ }; 70 | /******/ 71 | /******/ // Object.prototype.hasOwnProperty.call 72 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 73 | /******/ 74 | /******/ // __webpack_public_path__ 75 | /******/ __webpack_require__.p = ""; 76 | /******/ 77 | /******/ 78 | /******/ // Load entry module and return exports 79 | /******/ return __webpack_require__(__webpack_require__.s = "+xUi"); 80 | /******/ }) 81 | /************************************************************************/ 82 | /******/ ({ 83 | 84 | /***/ "+rLv": 85 | /***/ (function(module, exports, __webpack_require__) { 86 | 87 | var document = __webpack_require__("dyZX").document; 88 | module.exports = document && document.documentElement; 89 | 90 | 91 | /***/ }), 92 | 93 | /***/ "+xUi": 94 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 95 | 96 | "use strict"; 97 | __webpack_require__.r(__webpack_exports__); 98 | 99 | // EXTERNAL MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js 100 | var setPublicPath = __webpack_require__("HrLf"); 101 | 102 | // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"/home/styx/Projets/vue-table/node_modules/.cache/vue-loader","cacheIdentifier":"b3fca2dc-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueTable.vue?vue&type=template&id=29b122a0 103 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('table',{staticClass:"table table-hover"},[_c('thead',[_c('tr',_vm._l((_vm.columns),function(column,index){return _c('th',{key:(column + "_" + index)},[_vm._t(("header__" + (column.name)),[((column.sortable || false) && _vm.rows.length > 0)?_c('a',{staticClass:"d-flex align-items-center sortable-link",attrs:{"href":""},on:{"click":function($event){$event.preventDefault();_vm.sort(column)}}},[_vm._v("\n "+_vm._s(column.title || column.name)+"\n "),(_vm.isSorted(column))?_c('i',{staticClass:"fa ml-2",class:{'fa-caret-up': _vm.sortDirection === 'asc', 'fa-caret-down': _vm.sortDirection === 'desc'}}):_vm._e()]):[_vm._v(_vm._s(column.title || column.name))]],{column:column})],2)}))]),_c('tbody',[_vm._l((_vm.rows),function(row){return _c('tr',_vm._l((_vm.column_names),function(name,index){return _c('td',{key:((row[name]) + "_" + index)},[(_vm.fieldExistsInRow(row, name))?[_vm._t(name,[_vm._v(_vm._s(row[name]))],{row:row})]:[_vm._t(name,[_vm._v("[slot: "+_vm._s(name)+"]")],{row:row})]],2)}))}),(_vm.rows.length === 0)?_c('tr',[_vm._t("no_result",[_c('td',{staticClass:"text-center pt-4 p-3",attrs:{"colspan":_vm.columns.length}},[_vm._t("empty",[_vm._v("No results found")])],2)],{columns:_vm.columns})],2):_vm._e()],2)])} 104 | var staticRenderFns = [] 105 | 106 | 107 | // CONCATENATED MODULE: ./src/VueTable.vue?vue&type=template&id=29b122a0 108 | 109 | // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.function.name.js 110 | var es6_function_name = __webpack_require__("f3/d"); 111 | 112 | // EXTERNAL MODULE: ./node_modules/core-js/modules/es7.array.includes.js 113 | var es7_array_includes = __webpack_require__("Z2Ku"); 114 | 115 | // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js 116 | var es6_string_includes = __webpack_require__("L9s1"); 117 | 118 | // CONCATENATED MODULE: ./src/mixins/vueTableMixin.js 119 | 120 | 121 | 122 | /* harmony default export */ var vueTableMixin = ({ 123 | props: { 124 | columns: { 125 | type: Array, 126 | required: true 127 | }, 128 | rows: { 129 | type: Array, 130 | required: true 131 | }, 132 | sortBy: { 133 | type: String 134 | }, 135 | sortDirection: { 136 | type: String, 137 | default: function _default() { 138 | return 'asc'; 139 | }, 140 | validator: function validator(value) { 141 | // The value must match one of these strings 142 | return ['asc', 'desc'].includes(value); 143 | } 144 | } 145 | }, 146 | data: function data() { 147 | return { 148 | column_names: [] 149 | }; 150 | }, 151 | methods: { 152 | fieldExistsInRow: function fieldExistsInRow(row, name) { 153 | return row.hasOwnProperty(name); 154 | }, 155 | getSortKey: function getSortKey(column) { 156 | return typeof column.sortable === 'string' ? column.sortable : column.name; 157 | }, 158 | isSorted: function isSorted(column) { 159 | // If a column is marked as sortable, sortBy props should be defined 160 | // If not the user should be warned as it might have forgotten to set the prop 161 | if (typeof this.sortBy === 'undefined') { 162 | console.warn("\"sortBy\" prop was not defined, but column \"%s\" is marked as sortable", column.name); 163 | } 164 | 165 | return this.getSortKey(column) === this.sortBy; 166 | }, 167 | sort: function sort(column) { 168 | // emit event to parent to change the sort parameters 169 | this.$emit('column:sort', { 170 | sortBy: this.getSortKey(column), 171 | sortDirection: this.sortDirection === 'asc' ? 'desc' : 'asc' 172 | }); 173 | } 174 | }, 175 | mounted: function mounted() { 176 | // map column names 177 | this.column_names = this.columns.map(function (f) { 178 | return f.name; 179 | }); 180 | } 181 | }); 182 | // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/VueTable.vue?vue&type=script&lang=js 183 | // 184 | // 185 | // 186 | // 187 | // 188 | // 189 | // 190 | // 191 | // 192 | // 193 | // 194 | // 195 | // 196 | // 197 | // 198 | // 199 | // 200 | // 201 | // 202 | // 203 | // 204 | // 205 | // 206 | // 207 | // 208 | // 209 | // 210 | // 211 | // 212 | // 213 | // 214 | // 215 | // 216 | // 217 | // 218 | // 219 | // 220 | // 221 | // 222 | // 223 | // 224 | 225 | /* harmony default export */ var VueTablevue_type_script_lang_js = ({ 226 | name: 'vue-table', 227 | mixins: [vueTableMixin] 228 | }); 229 | // CONCATENATED MODULE: ./src/VueTable.vue?vue&type=script&lang=js 230 | /* harmony default export */ var src_VueTablevue_type_script_lang_js = (VueTablevue_type_script_lang_js); 231 | // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js 232 | /* globals __VUE_SSR_CONTEXT__ */ 233 | 234 | // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). 235 | // This module is a runtime utility for cleaner component module output and will 236 | // be included in the final webpack user bundle. 237 | 238 | function normalizeComponent ( 239 | scriptExports, 240 | render, 241 | staticRenderFns, 242 | functionalTemplate, 243 | injectStyles, 244 | scopeId, 245 | moduleIdentifier, /* server only */ 246 | shadowMode /* vue-cli only */ 247 | ) { 248 | // Vue.extend constructor export interop 249 | var options = typeof scriptExports === 'function' 250 | ? scriptExports.options 251 | : scriptExports 252 | 253 | // render functions 254 | if (render) { 255 | options.render = render 256 | options.staticRenderFns = staticRenderFns 257 | options._compiled = true 258 | } 259 | 260 | // functional template 261 | if (functionalTemplate) { 262 | options.functional = true 263 | } 264 | 265 | // scopedId 266 | if (scopeId) { 267 | options._scopeId = 'data-v-' + scopeId 268 | } 269 | 270 | var hook 271 | if (moduleIdentifier) { // server build 272 | hook = function (context) { 273 | // 2.3 injection 274 | context = 275 | context || // cached call 276 | (this.$vnode && this.$vnode.ssrContext) || // stateful 277 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional 278 | // 2.2 with runInNewContext: true 279 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { 280 | context = __VUE_SSR_CONTEXT__ 281 | } 282 | // inject component styles 283 | if (injectStyles) { 284 | injectStyles.call(this, context) 285 | } 286 | // register component module identifier for async chunk inferrence 287 | if (context && context._registeredComponents) { 288 | context._registeredComponents.add(moduleIdentifier) 289 | } 290 | } 291 | // used by ssr in case component is cached and beforeCreate 292 | // never gets called 293 | options._ssrRegister = hook 294 | } else if (injectStyles) { 295 | hook = shadowMode 296 | ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) } 297 | : injectStyles 298 | } 299 | 300 | if (hook) { 301 | if (options.functional) { 302 | // for template-only hot-reload because in that case the render fn doesn't 303 | // go through the normalizer 304 | options._injectStyles = hook 305 | // register for functioal component in vue file 306 | var originalRender = options.render 307 | options.render = function renderWithStyleInjection (h, context) { 308 | hook.call(context) 309 | return originalRender(h, context) 310 | } 311 | } else { 312 | // inject component registration as beforeCreate hook 313 | var existing = options.beforeCreate 314 | options.beforeCreate = existing 315 | ? [].concat(existing, hook) 316 | : [hook] 317 | } 318 | } 319 | 320 | return { 321 | exports: scriptExports, 322 | options: options 323 | } 324 | } 325 | 326 | // CONCATENATED MODULE: ./src/VueTable.vue 327 | 328 | 329 | 330 | 331 | 332 | /* normalize component */ 333 | 334 | var component = normalizeComponent( 335 | src_VueTablevue_type_script_lang_js, 336 | render, 337 | staticRenderFns, 338 | false, 339 | null, 340 | null, 341 | null 342 | 343 | ) 344 | 345 | /* harmony default export */ var VueTable = (component.exports); 346 | // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"/home/styx/Projets/vue-table/node_modules/.cache/vue-loader","cacheIdentifier":"b3fca2dc-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/VueTablePagination.vue?vue&type=template&id=4dc728dc 347 | var VueTablePaginationvue_type_template_id_4dc728dc_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"d-flex bg-light p-2 align-items-center"},[_c('div',[_vm._t("info",[(_vm.totalItems > 0)?[_vm._v("\n From "+_vm._s(_vm.from)+" to "+_vm._s(_vm.to)+" on "+_vm._s(_vm.totalItems)+" result(s)\n ")]:[_vm._v("\n No results\n ")]],{from:_vm.from,to:_vm.to,totalItems:_vm.totalItems})],2),_c('div',{staticClass:"ml-auto d-flex"},[(_vm.showRefreshButton)?[_c('button',{staticClass:"btn btn-sm btn-outline-secondary mr-2",on:{"click":function($event){$event.preventDefault();_vm.selectPage(_vm.currentPage)}}},[_c('i',{staticClass:"fa fa-refresh pl-1 pr-1"})])]:_vm._e(),(_vm.total_pages > 1)?_c('ul',{staticClass:"pagination"},[(_vm.useFirstLastLinks)?_c('li',{staticClass:"page-item",class:{ disabled: _vm.is_first_page }},[_c('a',{staticClass:"page-link",attrs:{"href":""},domProps:{"innerHTML":_vm._s(_vm.firstText)},on:{"click":function($event){$event.preventDefault();_vm.selectPage(1)}}})]):_vm._e(),(_vm.useNextPrevLinks)?_c('li',{staticClass:"page-item",class:{ disabled: _vm.is_first_page }},[_c('a',{staticClass:"page-link",attrs:{"href":""},domProps:{"innerHTML":_vm._s(_vm.previousText)},on:{"click":function($event){$event.preventDefault();_vm.selectPage(_vm.currentPage - 1)}}})]):_vm._e(),_vm._l((_vm.pages),function(page,index){return _c('li',{key:index,staticClass:"page-item",class:{ active: page.active }},[_c('a',{staticClass:"page-link",attrs:{"disabled":!page.active,"href":""},on:{"click":function($event){$event.preventDefault();_vm.selectPage(page.number)}}},[_vm._v(_vm._s(page.label))])])}),(_vm.useNextPrevLinks)?_c('li',{staticClass:"page-item",class:{ disabled: _vm.is_last_page }},[_c('a',{staticClass:"page-link",attrs:{"href":""},domProps:{"innerHTML":_vm._s(_vm.nextText)},on:{"click":function($event){$event.preventDefault();_vm.selectPage(_vm.currentPage + 1)}}})]):_vm._e(),(_vm.useFirstLastLinks)?_c('li',{staticClass:"page-item",class:{ disabled: _vm.is_last_page }},[_c('a',{staticClass:"page-link",attrs:{"href":""},domProps:{"innerHTML":_vm._s(_vm.lastText )},on:{"click":function($event){$event.preventDefault();_vm.selectPage(_vm.total_pages)}}})]):_vm._e()],2):_vm._e()],2)])} 348 | var VueTablePaginationvue_type_template_id_4dc728dc_staticRenderFns = [] 349 | 350 | 351 | // CONCATENATED MODULE: ./src/VueTablePagination.vue?vue&type=template&id=4dc728dc 352 | 353 | // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.number.constructor.js 354 | var es6_number_constructor = __webpack_require__("xfY5"); 355 | 356 | // CONCATENATED MODULE: ./src/mixins/vueTablePaginationMixin.js 357 | 358 | /* harmony default export */ var vueTablePaginationMixin = ({ 359 | props: { 360 | showRefreshButton: { 361 | type: Boolean, 362 | default: true 363 | }, 364 | useFirstLastLinks: { 365 | type: Boolean, 366 | default: true 367 | }, 368 | useBoundariesNumbersLinks: { 369 | type: Boolean, 370 | default: false 371 | }, 372 | useNextPrevLinks: { 373 | type: Boolean, 374 | default: false 375 | }, 376 | firstText: { 377 | type: String, 378 | default: "«" 379 | }, 380 | lastText: { 381 | type: String, 382 | default: "»" 383 | }, 384 | nextText: { 385 | type: String, 386 | default: "<" 387 | }, 388 | previousText: { 389 | type: String, 390 | default: ">" 391 | }, 392 | useEllipses: { 393 | type: Boolean, 394 | default: true 395 | }, 396 | rotate: { 397 | type: Boolean, 398 | default: true 399 | }, 400 | maxPageItems: { 401 | type: Number, 402 | default: 5 403 | }, 404 | itemsPerPage: { 405 | type: Number, 406 | default: 15 407 | }, 408 | totalItems: { 409 | type: Number, 410 | required: true 411 | }, 412 | currentPage: { 413 | type: Number, 414 | required: true 415 | } 416 | }, 417 | computed: { 418 | is_last_page: function is_last_page() { 419 | return this.currentPage === this.total_pages; 420 | }, 421 | is_first_page: function is_first_page() { 422 | return this.currentPage === 1; 423 | }, 424 | total_pages: function total_pages() { 425 | var total_pages = this.itemsPerPage < 1 ? 1 : Math.ceil(this.totalItems / this.itemsPerPage); 426 | return Math.max(total_pages || 0, 1); 427 | }, 428 | from: function from() { 429 | return this.is_first_page ? 1 : this.itemsPerPage * (this.currentPage - 1) + 1; 430 | }, 431 | to: function to() { 432 | return this.is_last_page ? this.totalItems : this.itemsPerPage * this.currentPage; 433 | }, 434 | pages: function pages() { 435 | var pages = []; 436 | 437 | if (this.currentPage <= 0 || this.currentPage > this.total_pages) { 438 | return pages; 439 | } // Default page limits 440 | 441 | 442 | var start_page = 1; 443 | var end_page = this.total_pages; 444 | var limit_page_items = this.isDefined(this.maxPageItems) && this.maxPageItems < this.total_pages; // recompute if maxPageItems 445 | 446 | if (limit_page_items) { 447 | if (this.rotate) { 448 | // Current page is displayed in the middle of the visible ones 449 | start_page = Math.max(this.currentPage - Math.floor(this.maxPageItems / 2), 1); 450 | end_page = start_page + this.maxPageItems - 1; // Adjust if limit is exceeded 451 | 452 | if (end_page > this.total_pages) { 453 | end_page = this.total_pages; 454 | start_page = end_page - this.maxPageItems + 1; 455 | } 456 | } else { 457 | // Visible pages are paginated with maxPageItems 458 | start_page = (Math.ceil(this.currentPage / this.maxPageItems) - 1) * this.maxPageItems + 1; // Adjust last page if limit is exceeded 459 | 460 | end_page = Math.min(start_page + this.maxPageItems - 1, this.total_pages); 461 | } 462 | } // Add page number links 463 | 464 | 465 | for (var number = start_page; number <= end_page; number++) { 466 | var page = this.makePage(number, number, number === this.currentPage); 467 | pages.push(page); 468 | } // Add links to move between page sets 469 | 470 | 471 | if (limit_page_items && this.maxPageItems > 0 && (!this.rotate || this.useEllipses || this.useBoundariesNumbersLinks)) { 472 | if (start_page > 1) { 473 | if (!this.useBoundariesNumbersLinks || start_page > 3) { 474 | //need ellipsis for all options unless range is too close to beginning 475 | var previous_ellipsis_page_item = this.makePage(start_page - 1, '...', false); 476 | pages.unshift(previous_ellipsis_page_item); 477 | } 478 | 479 | if (this.useBoundariesNumbersLinks) { 480 | if (start_page === 3) { 481 | //need to replace ellipsis when the buttons would be sequential 482 | var second_page_item = this.makePage(2, '2', false); 483 | pages.unshift(second_page_item); 484 | } //add the first page 485 | 486 | 487 | var first_page_item = this.makePage(1, '1', false); 488 | pages.unshift(first_page_item); 489 | } 490 | } 491 | 492 | if (end_page < this.total_pages) { 493 | if (!this.useBoundariesNumbersLinks || end_page < this.total_pages - 2) { 494 | //need ellipsis for all options unless range is too close to end 495 | var next_ellipsis_page_item = this.makePage(end_page + 1, '...', false); 496 | pages.push(next_ellipsis_page_item); 497 | } 498 | 499 | if (this.useBoundariesNumbersLinks) { 500 | if (end_page === this.total_pages - 2) { 501 | //need to replace ellipsis when the buttons would be sequential 502 | var second_to_last_page_item = this.makePage(this.total_pages - 1, this.total_pages - 1, false); 503 | pages.push(second_to_last_page_item); 504 | } //add the last page 505 | 506 | 507 | var last_page_item = this.makePage(this.total_pages, this.total_pages, false); 508 | pages.push(last_page_item); 509 | } 510 | } 511 | } 512 | 513 | return pages; 514 | } 515 | }, 516 | methods: { 517 | selectPage: function selectPage(page) { 518 | this.$emit('pagination:change', page); 519 | }, 520 | isDefined: function isDefined(value) { 521 | return typeof value !== "undefined"; 522 | }, 523 | makePage: function makePage(number, label, active) { 524 | return { 525 | number: number, 526 | label: label, 527 | active: active 528 | }; 529 | } 530 | } 531 | }); 532 | // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/VueTablePagination.vue?vue&type=script&lang=js 533 | // 534 | // 535 | // 536 | // 537 | // 538 | // 539 | // 540 | // 541 | // 542 | // 543 | // 544 | // 545 | // 546 | // 547 | // 548 | // 549 | // 550 | // 551 | // 552 | // 553 | // 554 | // 555 | // 556 | // 557 | // 558 | // 559 | // 560 | // 561 | // 562 | // 563 | // 564 | // 565 | // 566 | // 567 | // 568 | // 569 | // 570 | // 571 | // 572 | // 573 | // 574 | 575 | /* harmony default export */ var VueTablePaginationvue_type_script_lang_js = ({ 576 | mixins: [vueTablePaginationMixin] 577 | }); 578 | // CONCATENATED MODULE: ./src/VueTablePagination.vue?vue&type=script&lang=js 579 | /* harmony default export */ var src_VueTablePaginationvue_type_script_lang_js = (VueTablePaginationvue_type_script_lang_js); 580 | // CONCATENATED MODULE: ./src/VueTablePagination.vue 581 | 582 | 583 | 584 | 585 | 586 | /* normalize component */ 587 | 588 | var VueTablePagination_component = normalizeComponent( 589 | src_VueTablePaginationvue_type_script_lang_js, 590 | VueTablePaginationvue_type_template_id_4dc728dc_render, 591 | VueTablePaginationvue_type_template_id_4dc728dc_staticRenderFns, 592 | false, 593 | null, 594 | null, 595 | null 596 | 597 | ) 598 | 599 | /* harmony default export */ var VueTablePagination = (VueTablePagination_component.exports); 600 | // CONCATENATED MODULE: ./src/main.js 601 | 602 | 603 | 604 | 605 | /* harmony default export */ var main = (VueTable); 606 | 607 | // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js 608 | /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "VueTable", function() { return VueTable; }); 609 | /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "vueTableMixin", function() { return vueTableMixin; }); 610 | /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "VueTablePagination", function() { return VueTablePagination; }); 611 | /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "vueTablePaginationMixin", function() { return vueTablePaginationMixin; }); 612 | 613 | 614 | /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (main); 615 | 616 | 617 | 618 | /***/ }), 619 | 620 | /***/ "/e88": 621 | /***/ (function(module, exports) { 622 | 623 | module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + 624 | '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; 625 | 626 | 627 | /***/ }), 628 | 629 | /***/ "0/R4": 630 | /***/ (function(module, exports) { 631 | 632 | module.exports = function (it) { 633 | return typeof it === 'object' ? it !== null : typeof it === 'function'; 634 | }; 635 | 636 | 637 | /***/ }), 638 | 639 | /***/ "0sh+": 640 | /***/ (function(module, exports, __webpack_require__) { 641 | 642 | // helper for String#{startsWith, endsWith, includes} 643 | var isRegExp = __webpack_require__("quPj"); 644 | var defined = __webpack_require__("vhPU"); 645 | 646 | module.exports = function (that, searchString, NAME) { 647 | if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); 648 | return String(defined(that)); 649 | }; 650 | 651 | 652 | /***/ }), 653 | 654 | /***/ "2OiF": 655 | /***/ (function(module, exports) { 656 | 657 | module.exports = function (it) { 658 | if (typeof it != 'function') throw TypeError(it + ' is not a function!'); 659 | return it; 660 | }; 661 | 662 | 663 | /***/ }), 664 | 665 | /***/ "4R4u": 666 | /***/ (function(module, exports) { 667 | 668 | // IE 8- don't enum bug keys 669 | module.exports = ( 670 | 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' 671 | ).split(','); 672 | 673 | 674 | /***/ }), 675 | 676 | /***/ "DVgA": 677 | /***/ (function(module, exports, __webpack_require__) { 678 | 679 | // 19.1.2.14 / 15.2.3.14 Object.keys(O) 680 | var $keys = __webpack_require__("zhAb"); 681 | var enumBugKeys = __webpack_require__("4R4u"); 682 | 683 | module.exports = Object.keys || function keys(O) { 684 | return $keys(O, enumBugKeys); 685 | }; 686 | 687 | 688 | /***/ }), 689 | 690 | /***/ "EemH": 691 | /***/ (function(module, exports, __webpack_require__) { 692 | 693 | var pIE = __webpack_require__("UqcF"); 694 | var createDesc = __webpack_require__("RjD/"); 695 | var toIObject = __webpack_require__("aCFj"); 696 | var toPrimitive = __webpack_require__("apmT"); 697 | var has = __webpack_require__("aagx"); 698 | var IE8_DOM_DEFINE = __webpack_require__("xpql"); 699 | var gOPD = Object.getOwnPropertyDescriptor; 700 | 701 | exports.f = __webpack_require__("nh4g") ? gOPD : function getOwnPropertyDescriptor(O, P) { 702 | O = toIObject(O); 703 | P = toPrimitive(P, true); 704 | if (IE8_DOM_DEFINE) try { 705 | return gOPD(O, P); 706 | } catch (e) { /* empty */ } 707 | if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); 708 | }; 709 | 710 | 711 | /***/ }), 712 | 713 | /***/ "FJW5": 714 | /***/ (function(module, exports, __webpack_require__) { 715 | 716 | var dP = __webpack_require__("hswa"); 717 | var anObject = __webpack_require__("y3w9"); 718 | var getKeys = __webpack_require__("DVgA"); 719 | 720 | module.exports = __webpack_require__("nh4g") ? Object.defineProperties : function defineProperties(O, Properties) { 721 | anObject(O); 722 | var keys = getKeys(Properties); 723 | var length = keys.length; 724 | var i = 0; 725 | var P; 726 | while (length > i) dP.f(O, P = keys[i++], Properties[P]); 727 | return O; 728 | }; 729 | 730 | 731 | /***/ }), 732 | 733 | /***/ "HrLf": 734 | /***/ (function(module, exports, __webpack_require__) { 735 | 736 | // This file is imported into lib/wc client bundles. 737 | 738 | if (typeof window !== 'undefined') { 739 | let i 740 | if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js$/))) { 741 | __webpack_require__.p = i[1] // eslint-disable-line 742 | } 743 | } 744 | 745 | 746 | /***/ }), 747 | 748 | /***/ "Iw71": 749 | /***/ (function(module, exports, __webpack_require__) { 750 | 751 | var isObject = __webpack_require__("0/R4"); 752 | var document = __webpack_require__("dyZX").document; 753 | // typeof document.createElement is 'object' in old IE 754 | var is = isObject(document) && isObject(document.createElement); 755 | module.exports = function (it) { 756 | return is ? document.createElement(it) : {}; 757 | }; 758 | 759 | 760 | /***/ }), 761 | 762 | /***/ "K0xU": 763 | /***/ (function(module, exports, __webpack_require__) { 764 | 765 | var store = __webpack_require__("VTer")('wks'); 766 | var uid = __webpack_require__("ylqs"); 767 | var Symbol = __webpack_require__("dyZX").Symbol; 768 | var USE_SYMBOL = typeof Symbol == 'function'; 769 | 770 | var $exports = module.exports = function (name) { 771 | return store[name] || (store[name] = 772 | USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); 773 | }; 774 | 775 | $exports.store = store; 776 | 777 | 778 | /***/ }), 779 | 780 | /***/ "KroJ": 781 | /***/ (function(module, exports, __webpack_require__) { 782 | 783 | var global = __webpack_require__("dyZX"); 784 | var hide = __webpack_require__("Mukb"); 785 | var has = __webpack_require__("aagx"); 786 | var SRC = __webpack_require__("ylqs")('src'); 787 | var TO_STRING = 'toString'; 788 | var $toString = Function[TO_STRING]; 789 | var TPL = ('' + $toString).split(TO_STRING); 790 | 791 | __webpack_require__("g3g5").inspectSource = function (it) { 792 | return $toString.call(it); 793 | }; 794 | 795 | (module.exports = function (O, key, val, safe) { 796 | var isFunction = typeof val == 'function'; 797 | if (isFunction) has(val, 'name') || hide(val, 'name', key); 798 | if (O[key] === val) return; 799 | if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); 800 | if (O === global) { 801 | O[key] = val; 802 | } else if (!safe) { 803 | delete O[key]; 804 | hide(O, key, val); 805 | } else if (O[key]) { 806 | O[key] = val; 807 | } else { 808 | hide(O, key, val); 809 | } 810 | // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative 811 | })(Function.prototype, TO_STRING, function toString() { 812 | return typeof this == 'function' && this[SRC] || $toString.call(this); 813 | }); 814 | 815 | 816 | /***/ }), 817 | 818 | /***/ "Kuth": 819 | /***/ (function(module, exports, __webpack_require__) { 820 | 821 | // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) 822 | var anObject = __webpack_require__("y3w9"); 823 | var dPs = __webpack_require__("FJW5"); 824 | var enumBugKeys = __webpack_require__("4R4u"); 825 | var IE_PROTO = __webpack_require__("YTvA")('IE_PROTO'); 826 | var Empty = function () { /* empty */ }; 827 | var PROTOTYPE = 'prototype'; 828 | 829 | // Create object with fake `null` prototype: use iframe Object with cleared prototype 830 | var createDict = function () { 831 | // Thrash, waste and sodomy: IE GC bug 832 | var iframe = __webpack_require__("Iw71")('iframe'); 833 | var i = enumBugKeys.length; 834 | var lt = '<'; 835 | var gt = '>'; 836 | var iframeDocument; 837 | iframe.style.display = 'none'; 838 | __webpack_require__("+rLv").appendChild(iframe); 839 | iframe.src = 'javascript:'; // eslint-disable-line no-script-url 840 | // createDict = iframe.contentWindow.Object; 841 | // html.removeChild(iframe); 842 | iframeDocument = iframe.contentWindow.document; 843 | iframeDocument.open(); 844 | iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); 845 | iframeDocument.close(); 846 | createDict = iframeDocument.F; 847 | while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; 848 | return createDict(); 849 | }; 850 | 851 | module.exports = Object.create || function create(O, Properties) { 852 | var result; 853 | if (O !== null) { 854 | Empty[PROTOTYPE] = anObject(O); 855 | result = new Empty(); 856 | Empty[PROTOTYPE] = null; 857 | // add "__proto__" for Object.getPrototypeOf polyfill 858 | result[IE_PROTO] = O; 859 | } else result = createDict(); 860 | return Properties === undefined ? result : dPs(result, Properties); 861 | }; 862 | 863 | 864 | /***/ }), 865 | 866 | /***/ "L9s1": 867 | /***/ (function(module, exports, __webpack_require__) { 868 | 869 | "use strict"; 870 | // 21.1.3.7 String.prototype.includes(searchString, position = 0) 871 | 872 | var $export = __webpack_require__("XKFU"); 873 | var context = __webpack_require__("0sh+"); 874 | var INCLUDES = 'includes'; 875 | 876 | $export($export.P + $export.F * __webpack_require__("UUeW")(INCLUDES), 'String', { 877 | includes: function includes(searchString /* , position = 0 */) { 878 | return !!~context(this, searchString, INCLUDES) 879 | .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); 880 | } 881 | }); 882 | 883 | 884 | /***/ }), 885 | 886 | /***/ "LQAc": 887 | /***/ (function(module, exports) { 888 | 889 | module.exports = false; 890 | 891 | 892 | /***/ }), 893 | 894 | /***/ "LZWt": 895 | /***/ (function(module, exports) { 896 | 897 | var toString = {}.toString; 898 | 899 | module.exports = function (it) { 900 | return toString.call(it).slice(8, -1); 901 | }; 902 | 903 | 904 | /***/ }), 905 | 906 | /***/ "Mukb": 907 | /***/ (function(module, exports, __webpack_require__) { 908 | 909 | var dP = __webpack_require__("hswa"); 910 | var createDesc = __webpack_require__("RjD/"); 911 | module.exports = __webpack_require__("nh4g") ? function (object, key, value) { 912 | return dP.f(object, key, createDesc(1, value)); 913 | } : function (object, key, value) { 914 | object[key] = value; 915 | return object; 916 | }; 917 | 918 | 919 | /***/ }), 920 | 921 | /***/ "RYi7": 922 | /***/ (function(module, exports) { 923 | 924 | // 7.1.4 ToInteger 925 | var ceil = Math.ceil; 926 | var floor = Math.floor; 927 | module.exports = function (it) { 928 | return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); 929 | }; 930 | 931 | 932 | /***/ }), 933 | 934 | /***/ "RjD/": 935 | /***/ (function(module, exports) { 936 | 937 | module.exports = function (bitmap, value) { 938 | return { 939 | enumerable: !(bitmap & 1), 940 | configurable: !(bitmap & 2), 941 | writable: !(bitmap & 4), 942 | value: value 943 | }; 944 | }; 945 | 946 | 947 | /***/ }), 948 | 949 | /***/ "UUeW": 950 | /***/ (function(module, exports, __webpack_require__) { 951 | 952 | var MATCH = __webpack_require__("K0xU")('match'); 953 | module.exports = function (KEY) { 954 | var re = /./; 955 | try { 956 | '/./'[KEY](re); 957 | } catch (e) { 958 | try { 959 | re[MATCH] = false; 960 | return !'/./'[KEY](re); 961 | } catch (f) { /* empty */ } 962 | } return true; 963 | }; 964 | 965 | 966 | /***/ }), 967 | 968 | /***/ "UqcF": 969 | /***/ (function(module, exports) { 970 | 971 | exports.f = {}.propertyIsEnumerable; 972 | 973 | 974 | /***/ }), 975 | 976 | /***/ "VTer": 977 | /***/ (function(module, exports, __webpack_require__) { 978 | 979 | var core = __webpack_require__("g3g5"); 980 | var global = __webpack_require__("dyZX"); 981 | var SHARED = '__core-js_shared__'; 982 | var store = global[SHARED] || (global[SHARED] = {}); 983 | 984 | (module.exports = function (key, value) { 985 | return store[key] || (store[key] = value !== undefined ? value : {}); 986 | })('versions', []).push({ 987 | version: core.version, 988 | mode: __webpack_require__("LQAc") ? 'pure' : 'global', 989 | copyright: '© 2018 Denis Pushkarev (zloirock.ru)' 990 | }); 991 | 992 | 993 | /***/ }), 994 | 995 | /***/ "XKFU": 996 | /***/ (function(module, exports, __webpack_require__) { 997 | 998 | var global = __webpack_require__("dyZX"); 999 | var core = __webpack_require__("g3g5"); 1000 | var hide = __webpack_require__("Mukb"); 1001 | var redefine = __webpack_require__("KroJ"); 1002 | var ctx = __webpack_require__("m0Pp"); 1003 | var PROTOTYPE = 'prototype'; 1004 | 1005 | var $export = function (type, name, source) { 1006 | var IS_FORCED = type & $export.F; 1007 | var IS_GLOBAL = type & $export.G; 1008 | var IS_STATIC = type & $export.S; 1009 | var IS_PROTO = type & $export.P; 1010 | var IS_BIND = type & $export.B; 1011 | var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; 1012 | var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); 1013 | var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); 1014 | var key, own, out, exp; 1015 | if (IS_GLOBAL) source = name; 1016 | for (key in source) { 1017 | // contains in native 1018 | own = !IS_FORCED && target && target[key] !== undefined; 1019 | // export native or passed 1020 | out = (own ? target : source)[key]; 1021 | // bind timers to global for call from export context 1022 | exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; 1023 | // extend global 1024 | if (target) redefine(target, key, out, type & $export.U); 1025 | // export 1026 | if (exports[key] != out) hide(exports, key, exp); 1027 | if (IS_PROTO && expProto[key] != out) expProto[key] = out; 1028 | } 1029 | }; 1030 | global.core = core; 1031 | // type bitmap 1032 | $export.F = 1; // forced 1033 | $export.G = 2; // global 1034 | $export.S = 4; // static 1035 | $export.P = 8; // proto 1036 | $export.B = 16; // bind 1037 | $export.W = 32; // wrap 1038 | $export.U = 64; // safe 1039 | $export.R = 128; // real proto method for `library` 1040 | module.exports = $export; 1041 | 1042 | 1043 | /***/ }), 1044 | 1045 | /***/ "Xbzi": 1046 | /***/ (function(module, exports, __webpack_require__) { 1047 | 1048 | var isObject = __webpack_require__("0/R4"); 1049 | var setPrototypeOf = __webpack_require__("i5dc").set; 1050 | module.exports = function (that, target, C) { 1051 | var S = target.constructor; 1052 | var P; 1053 | if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { 1054 | setPrototypeOf(that, P); 1055 | } return that; 1056 | }; 1057 | 1058 | 1059 | /***/ }), 1060 | 1061 | /***/ "YTvA": 1062 | /***/ (function(module, exports, __webpack_require__) { 1063 | 1064 | var shared = __webpack_require__("VTer")('keys'); 1065 | var uid = __webpack_require__("ylqs"); 1066 | module.exports = function (key) { 1067 | return shared[key] || (shared[key] = uid(key)); 1068 | }; 1069 | 1070 | 1071 | /***/ }), 1072 | 1073 | /***/ "Ymqv": 1074 | /***/ (function(module, exports, __webpack_require__) { 1075 | 1076 | // fallback for non-array-like ES3 and non-enumerable old V8 strings 1077 | var cof = __webpack_require__("LZWt"); 1078 | // eslint-disable-next-line no-prototype-builtins 1079 | module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { 1080 | return cof(it) == 'String' ? it.split('') : Object(it); 1081 | }; 1082 | 1083 | 1084 | /***/ }), 1085 | 1086 | /***/ "Z2Ku": 1087 | /***/ (function(module, exports, __webpack_require__) { 1088 | 1089 | "use strict"; 1090 | 1091 | // https://github.com/tc39/Array.prototype.includes 1092 | var $export = __webpack_require__("XKFU"); 1093 | var $includes = __webpack_require__("w2a5")(true); 1094 | 1095 | $export($export.P, 'Array', { 1096 | includes: function includes(el /* , fromIndex = 0 */) { 1097 | return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); 1098 | } 1099 | }); 1100 | 1101 | __webpack_require__("nGyu")('includes'); 1102 | 1103 | 1104 | /***/ }), 1105 | 1106 | /***/ "aCFj": 1107 | /***/ (function(module, exports, __webpack_require__) { 1108 | 1109 | // to indexed object, toObject with fallback for non-array-like ES3 strings 1110 | var IObject = __webpack_require__("Ymqv"); 1111 | var defined = __webpack_require__("vhPU"); 1112 | module.exports = function (it) { 1113 | return IObject(defined(it)); 1114 | }; 1115 | 1116 | 1117 | /***/ }), 1118 | 1119 | /***/ "aagx": 1120 | /***/ (function(module, exports) { 1121 | 1122 | var hasOwnProperty = {}.hasOwnProperty; 1123 | module.exports = function (it, key) { 1124 | return hasOwnProperty.call(it, key); 1125 | }; 1126 | 1127 | 1128 | /***/ }), 1129 | 1130 | /***/ "apmT": 1131 | /***/ (function(module, exports, __webpack_require__) { 1132 | 1133 | // 7.1.1 ToPrimitive(input [, PreferredType]) 1134 | var isObject = __webpack_require__("0/R4"); 1135 | // instead of the ES6 spec version, we didn't implement @@toPrimitive case 1136 | // and the second argument - flag - preferred type is a string 1137 | module.exports = function (it, S) { 1138 | if (!isObject(it)) return it; 1139 | var fn, val; 1140 | if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; 1141 | if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; 1142 | if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; 1143 | throw TypeError("Can't convert object to primitive value"); 1144 | }; 1145 | 1146 | 1147 | /***/ }), 1148 | 1149 | /***/ "d/Gc": 1150 | /***/ (function(module, exports, __webpack_require__) { 1151 | 1152 | var toInteger = __webpack_require__("RYi7"); 1153 | var max = Math.max; 1154 | var min = Math.min; 1155 | module.exports = function (index, length) { 1156 | index = toInteger(index); 1157 | return index < 0 ? max(index + length, 0) : min(index, length); 1158 | }; 1159 | 1160 | 1161 | /***/ }), 1162 | 1163 | /***/ "dyZX": 1164 | /***/ (function(module, exports) { 1165 | 1166 | // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 1167 | var global = module.exports = typeof window != 'undefined' && window.Math == Math 1168 | ? window : typeof self != 'undefined' && self.Math == Math ? self 1169 | // eslint-disable-next-line no-new-func 1170 | : Function('return this')(); 1171 | if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef 1172 | 1173 | 1174 | /***/ }), 1175 | 1176 | /***/ "eeVq": 1177 | /***/ (function(module, exports) { 1178 | 1179 | module.exports = function (exec) { 1180 | try { 1181 | return !!exec(); 1182 | } catch (e) { 1183 | return true; 1184 | } 1185 | }; 1186 | 1187 | 1188 | /***/ }), 1189 | 1190 | /***/ "f3/d": 1191 | /***/ (function(module, exports, __webpack_require__) { 1192 | 1193 | var dP = __webpack_require__("hswa").f; 1194 | var FProto = Function.prototype; 1195 | var nameRE = /^\s*function ([^ (]*)/; 1196 | var NAME = 'name'; 1197 | 1198 | // 19.2.4.2 name 1199 | NAME in FProto || __webpack_require__("nh4g") && dP(FProto, NAME, { 1200 | configurable: true, 1201 | get: function () { 1202 | try { 1203 | return ('' + this).match(nameRE)[1]; 1204 | } catch (e) { 1205 | return ''; 1206 | } 1207 | } 1208 | }); 1209 | 1210 | 1211 | /***/ }), 1212 | 1213 | /***/ "g3g5": 1214 | /***/ (function(module, exports) { 1215 | 1216 | var core = module.exports = { version: '2.5.7' }; 1217 | if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef 1218 | 1219 | 1220 | /***/ }), 1221 | 1222 | /***/ "hswa": 1223 | /***/ (function(module, exports, __webpack_require__) { 1224 | 1225 | var anObject = __webpack_require__("y3w9"); 1226 | var IE8_DOM_DEFINE = __webpack_require__("xpql"); 1227 | var toPrimitive = __webpack_require__("apmT"); 1228 | var dP = Object.defineProperty; 1229 | 1230 | exports.f = __webpack_require__("nh4g") ? Object.defineProperty : function defineProperty(O, P, Attributes) { 1231 | anObject(O); 1232 | P = toPrimitive(P, true); 1233 | anObject(Attributes); 1234 | if (IE8_DOM_DEFINE) try { 1235 | return dP(O, P, Attributes); 1236 | } catch (e) { /* empty */ } 1237 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); 1238 | if ('value' in Attributes) O[P] = Attributes.value; 1239 | return O; 1240 | }; 1241 | 1242 | 1243 | /***/ }), 1244 | 1245 | /***/ "i5dc": 1246 | /***/ (function(module, exports, __webpack_require__) { 1247 | 1248 | // Works with __proto__ only. Old v8 can't work with null proto objects. 1249 | /* eslint-disable no-proto */ 1250 | var isObject = __webpack_require__("0/R4"); 1251 | var anObject = __webpack_require__("y3w9"); 1252 | var check = function (O, proto) { 1253 | anObject(O); 1254 | if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); 1255 | }; 1256 | module.exports = { 1257 | set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line 1258 | function (test, buggy, set) { 1259 | try { 1260 | set = __webpack_require__("m0Pp")(Function.call, __webpack_require__("EemH").f(Object.prototype, '__proto__').set, 2); 1261 | set(test, []); 1262 | buggy = !(test instanceof Array); 1263 | } catch (e) { buggy = true; } 1264 | return function setPrototypeOf(O, proto) { 1265 | check(O, proto); 1266 | if (buggy) O.__proto__ = proto; 1267 | else set(O, proto); 1268 | return O; 1269 | }; 1270 | }({}, false) : undefined), 1271 | check: check 1272 | }; 1273 | 1274 | 1275 | /***/ }), 1276 | 1277 | /***/ "kJMx": 1278 | /***/ (function(module, exports, __webpack_require__) { 1279 | 1280 | // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) 1281 | var $keys = __webpack_require__("zhAb"); 1282 | var hiddenKeys = __webpack_require__("4R4u").concat('length', 'prototype'); 1283 | 1284 | exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { 1285 | return $keys(O, hiddenKeys); 1286 | }; 1287 | 1288 | 1289 | /***/ }), 1290 | 1291 | /***/ "m0Pp": 1292 | /***/ (function(module, exports, __webpack_require__) { 1293 | 1294 | // optional / simple context binding 1295 | var aFunction = __webpack_require__("2OiF"); 1296 | module.exports = function (fn, that, length) { 1297 | aFunction(fn); 1298 | if (that === undefined) return fn; 1299 | switch (length) { 1300 | case 1: return function (a) { 1301 | return fn.call(that, a); 1302 | }; 1303 | case 2: return function (a, b) { 1304 | return fn.call(that, a, b); 1305 | }; 1306 | case 3: return function (a, b, c) { 1307 | return fn.call(that, a, b, c); 1308 | }; 1309 | } 1310 | return function (/* ...args */) { 1311 | return fn.apply(that, arguments); 1312 | }; 1313 | }; 1314 | 1315 | 1316 | /***/ }), 1317 | 1318 | /***/ "nGyu": 1319 | /***/ (function(module, exports, __webpack_require__) { 1320 | 1321 | // 22.1.3.31 Array.prototype[@@unscopables] 1322 | var UNSCOPABLES = __webpack_require__("K0xU")('unscopables'); 1323 | var ArrayProto = Array.prototype; 1324 | if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__("Mukb")(ArrayProto, UNSCOPABLES, {}); 1325 | module.exports = function (key) { 1326 | ArrayProto[UNSCOPABLES][key] = true; 1327 | }; 1328 | 1329 | 1330 | /***/ }), 1331 | 1332 | /***/ "ne8i": 1333 | /***/ (function(module, exports, __webpack_require__) { 1334 | 1335 | // 7.1.15 ToLength 1336 | var toInteger = __webpack_require__("RYi7"); 1337 | var min = Math.min; 1338 | module.exports = function (it) { 1339 | return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 1340 | }; 1341 | 1342 | 1343 | /***/ }), 1344 | 1345 | /***/ "nh4g": 1346 | /***/ (function(module, exports, __webpack_require__) { 1347 | 1348 | // Thank's IE8 for his funny defineProperty 1349 | module.exports = !__webpack_require__("eeVq")(function () { 1350 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; 1351 | }); 1352 | 1353 | 1354 | /***/ }), 1355 | 1356 | /***/ "qncB": 1357 | /***/ (function(module, exports, __webpack_require__) { 1358 | 1359 | var $export = __webpack_require__("XKFU"); 1360 | var defined = __webpack_require__("vhPU"); 1361 | var fails = __webpack_require__("eeVq"); 1362 | var spaces = __webpack_require__("/e88"); 1363 | var space = '[' + spaces + ']'; 1364 | var non = '\u200b\u0085'; 1365 | var ltrim = RegExp('^' + space + space + '*'); 1366 | var rtrim = RegExp(space + space + '*$'); 1367 | 1368 | var exporter = function (KEY, exec, ALIAS) { 1369 | var exp = {}; 1370 | var FORCE = fails(function () { 1371 | return !!spaces[KEY]() || non[KEY]() != non; 1372 | }); 1373 | var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; 1374 | if (ALIAS) exp[ALIAS] = fn; 1375 | $export($export.P + $export.F * FORCE, 'String', exp); 1376 | }; 1377 | 1378 | // 1 -> String#trimLeft 1379 | // 2 -> String#trimRight 1380 | // 3 -> String#trim 1381 | var trim = exporter.trim = function (string, TYPE) { 1382 | string = String(defined(string)); 1383 | if (TYPE & 1) string = string.replace(ltrim, ''); 1384 | if (TYPE & 2) string = string.replace(rtrim, ''); 1385 | return string; 1386 | }; 1387 | 1388 | module.exports = exporter; 1389 | 1390 | 1391 | /***/ }), 1392 | 1393 | /***/ "quPj": 1394 | /***/ (function(module, exports, __webpack_require__) { 1395 | 1396 | // 7.2.8 IsRegExp(argument) 1397 | var isObject = __webpack_require__("0/R4"); 1398 | var cof = __webpack_require__("LZWt"); 1399 | var MATCH = __webpack_require__("K0xU")('match'); 1400 | module.exports = function (it) { 1401 | var isRegExp; 1402 | return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); 1403 | }; 1404 | 1405 | 1406 | /***/ }), 1407 | 1408 | /***/ "vhPU": 1409 | /***/ (function(module, exports) { 1410 | 1411 | // 7.2.1 RequireObjectCoercible(argument) 1412 | module.exports = function (it) { 1413 | if (it == undefined) throw TypeError("Can't call method on " + it); 1414 | return it; 1415 | }; 1416 | 1417 | 1418 | /***/ }), 1419 | 1420 | /***/ "w2a5": 1421 | /***/ (function(module, exports, __webpack_require__) { 1422 | 1423 | // false -> Array#indexOf 1424 | // true -> Array#includes 1425 | var toIObject = __webpack_require__("aCFj"); 1426 | var toLength = __webpack_require__("ne8i"); 1427 | var toAbsoluteIndex = __webpack_require__("d/Gc"); 1428 | module.exports = function (IS_INCLUDES) { 1429 | return function ($this, el, fromIndex) { 1430 | var O = toIObject($this); 1431 | var length = toLength(O.length); 1432 | var index = toAbsoluteIndex(fromIndex, length); 1433 | var value; 1434 | // Array#includes uses SameValueZero equality algorithm 1435 | // eslint-disable-next-line no-self-compare 1436 | if (IS_INCLUDES && el != el) while (length > index) { 1437 | value = O[index++]; 1438 | // eslint-disable-next-line no-self-compare 1439 | if (value != value) return true; 1440 | // Array#indexOf ignores holes, Array#includes - not 1441 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) { 1442 | if (O[index] === el) return IS_INCLUDES || index || 0; 1443 | } return !IS_INCLUDES && -1; 1444 | }; 1445 | }; 1446 | 1447 | 1448 | /***/ }), 1449 | 1450 | /***/ "xfY5": 1451 | /***/ (function(module, exports, __webpack_require__) { 1452 | 1453 | "use strict"; 1454 | 1455 | var global = __webpack_require__("dyZX"); 1456 | var has = __webpack_require__("aagx"); 1457 | var cof = __webpack_require__("LZWt"); 1458 | var inheritIfRequired = __webpack_require__("Xbzi"); 1459 | var toPrimitive = __webpack_require__("apmT"); 1460 | var fails = __webpack_require__("eeVq"); 1461 | var gOPN = __webpack_require__("kJMx").f; 1462 | var gOPD = __webpack_require__("EemH").f; 1463 | var dP = __webpack_require__("hswa").f; 1464 | var $trim = __webpack_require__("qncB").trim; 1465 | var NUMBER = 'Number'; 1466 | var $Number = global[NUMBER]; 1467 | var Base = $Number; 1468 | var proto = $Number.prototype; 1469 | // Opera ~12 has broken Object#toString 1470 | var BROKEN_COF = cof(__webpack_require__("Kuth")(proto)) == NUMBER; 1471 | var TRIM = 'trim' in String.prototype; 1472 | 1473 | // 7.1.3 ToNumber(argument) 1474 | var toNumber = function (argument) { 1475 | var it = toPrimitive(argument, false); 1476 | if (typeof it == 'string' && it.length > 2) { 1477 | it = TRIM ? it.trim() : $trim(it, 3); 1478 | var first = it.charCodeAt(0); 1479 | var third, radix, maxCode; 1480 | if (first === 43 || first === 45) { 1481 | third = it.charCodeAt(2); 1482 | if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix 1483 | } else if (first === 48) { 1484 | switch (it.charCodeAt(1)) { 1485 | case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i 1486 | case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i 1487 | default: return +it; 1488 | } 1489 | for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { 1490 | code = digits.charCodeAt(i); 1491 | // parseInt parses a string to a first unavailable symbol 1492 | // but ToNumber should return NaN if a string contains unavailable symbols 1493 | if (code < 48 || code > maxCode) return NaN; 1494 | } return parseInt(digits, radix); 1495 | } 1496 | } return +it; 1497 | }; 1498 | 1499 | if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { 1500 | $Number = function Number(value) { 1501 | var it = arguments.length < 1 ? 0 : value; 1502 | var that = this; 1503 | return that instanceof $Number 1504 | // check on 1..constructor(foo) case 1505 | && (BROKEN_COF ? fails(function () { proto.valueOf.call(that); }) : cof(that) != NUMBER) 1506 | ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); 1507 | }; 1508 | for (var keys = __webpack_require__("nh4g") ? gOPN(Base) : ( 1509 | // ES3: 1510 | 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + 1511 | // ES6 (in case, if modules with ES6 Number statics required before): 1512 | 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 1513 | 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' 1514 | ).split(','), j = 0, key; keys.length > j; j++) { 1515 | if (has(Base, key = keys[j]) && !has($Number, key)) { 1516 | dP($Number, key, gOPD(Base, key)); 1517 | } 1518 | } 1519 | $Number.prototype = proto; 1520 | proto.constructor = $Number; 1521 | __webpack_require__("KroJ")(global, NUMBER, $Number); 1522 | } 1523 | 1524 | 1525 | /***/ }), 1526 | 1527 | /***/ "xpql": 1528 | /***/ (function(module, exports, __webpack_require__) { 1529 | 1530 | module.exports = !__webpack_require__("nh4g") && !__webpack_require__("eeVq")(function () { 1531 | return Object.defineProperty(__webpack_require__("Iw71")('div'), 'a', { get: function () { return 7; } }).a != 7; 1532 | }); 1533 | 1534 | 1535 | /***/ }), 1536 | 1537 | /***/ "y3w9": 1538 | /***/ (function(module, exports, __webpack_require__) { 1539 | 1540 | var isObject = __webpack_require__("0/R4"); 1541 | module.exports = function (it) { 1542 | if (!isObject(it)) throw TypeError(it + ' is not an object!'); 1543 | return it; 1544 | }; 1545 | 1546 | 1547 | /***/ }), 1548 | 1549 | /***/ "ylqs": 1550 | /***/ (function(module, exports) { 1551 | 1552 | var id = 0; 1553 | var px = Math.random(); 1554 | module.exports = function (key) { 1555 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); 1556 | }; 1557 | 1558 | 1559 | /***/ }), 1560 | 1561 | /***/ "zhAb": 1562 | /***/ (function(module, exports, __webpack_require__) { 1563 | 1564 | var has = __webpack_require__("aagx"); 1565 | var toIObject = __webpack_require__("aCFj"); 1566 | var arrayIndexOf = __webpack_require__("w2a5")(false); 1567 | var IE_PROTO = __webpack_require__("YTvA")('IE_PROTO'); 1568 | 1569 | module.exports = function (object, names) { 1570 | var O = toIObject(object); 1571 | var i = 0; 1572 | var result = []; 1573 | var key; 1574 | for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); 1575 | // Don't enum bug & hidden keys 1576 | while (names.length > i) if (has(O, key = names[i++])) { 1577 | ~arrayIndexOf(result, key) || result.push(key); 1578 | } 1579 | return result; 1580 | }; 1581 | 1582 | 1583 | /***/ }) 1584 | 1585 | /******/ }); 1586 | }); 1587 | //# sourceMappingURL=VueTable.umd.js.map -------------------------------------------------------------------------------- /dist/VueTable.umd.min.js: -------------------------------------------------------------------------------- 1 | (function t(e,n){"object"===typeof exports&&"object"===typeof module?module.exports=n():"function"===typeof define&&define.amd?define([],n):"object"===typeof exports?exports["VueTable"]=n():e["VueTable"]=n()})("undefined"!==typeof self?self:this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function e(){return t["default"]}:function e(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="+xUi")}({"+rLv":function(t,e,n){var r=n("dyZX").document;t.exports=r&&r.documentElement},"+xUi":function(t,e,n){"use strict";n.r(e);var r=n("HrLf"),i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("table",{staticClass:"table table-hover"},[n("thead",[n("tr",t._l(t.columns,function(e,r){return n("th",{key:e+"_"+r},[t._t("header__"+e.name,[e.sortable&&t.rows.length>0?n("a",{staticClass:"d-flex align-items-center sortable-link",attrs:{href:""},on:{click:function(n){n.preventDefault(),t.sort(e)}}},[t._v("\n "+t._s(e.title||e.name)+"\n "),t.isSorted(e)?n("i",{staticClass:"fa ml-2",class:{"fa-caret-up":"asc"===t.sortDirection,"fa-caret-down":"desc"===t.sortDirection}}):t._e()]):[t._v(t._s(e.title||e.name))]],{column:e})],2)}))]),n("tbody",[t._l(t.rows,function(e){return n("tr",t._l(t.column_names,function(r,i){return n("td",{key:e[r]+"_"+i},[t.fieldExistsInRow(e,r)?[t._t(r,[t._v(t._s(e[r]))],{row:e})]:[t._t(r,[t._v("[slot: "+t._s(r)+"]")],{row:e})]],2)}))}),0===t.rows.length?n("tr",[t._t("no_result",[n("td",{staticClass:"text-center pt-4 p-3",attrs:{colspan:t.columns.length}},[t._t("empty",[t._v("No results found")])],2)],{columns:t.columns})],2):t._e()],2)])},o=[],s=n("f3/d"),a=n("Z2Ku"),u=n("L9s1"),c={props:{columns:{type:Array,required:!0},rows:{type:Array,required:!0},sortBy:{type:String},sortDirection:{type:String,default:function t(){return"asc"},validator:function t(e){return["asc","desc"].includes(e)}}},data:function t(){return{column_names:[]}},methods:{fieldExistsInRow:function t(e,n){return e.hasOwnProperty(n)},getSortKey:function t(e){return"string"===typeof e.sortable?e.sortable:e.name},isSorted:function t(e){return"undefined"===typeof this.sortBy&&console.warn('"sortBy" prop was not defined, but column "%s" is marked as sortable',e.name),this.getSortKey(e)===this.sortBy},sort:function t(e){this.$emit("column:sort",{sortBy:this.getSortKey(e),sortDirection:"asc"===this.sortDirection?"desc":"asc"})}},mounted:function t(){this.column_names=this.columns.map(function(t){return t.name})}},f={name:"vue-table",mixins:[c]},l=f;function p(t,e,n,r,i,o,s,a){var u="function"===typeof t?t.options:t,c;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=c):i&&(c=a?function(){i.call(this,this.$root.$options.shadowRoot)}:i),c)if(u.functional){u._injectStyles=c;var f=u.render;u.render=function t(e,n){return c.call(n),f(e,n)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:t,options:u}}var h=p(l,i,o,!1,null,null,null),d=h.exports,g=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"d-flex bg-light p-2 align-items-center"},[n("div",[t._t("info",[t.totalItems>0?[t._v("\n From "+t._s(t.from)+" to "+t._s(t.to)+" on "+t._s(t.totalItems)+" result(s)\n ")]:[t._v("\n No results\n ")]],{from:t.from,to:t.to,totalItems:t.totalItems})],2),n("div",{staticClass:"ml-auto d-flex"},[t.showRefreshButton?[n("button",{staticClass:"btn btn-sm btn-outline-secondary mr-2",on:{click:function(e){e.preventDefault(),t.selectPage(t.currentPage)}}},[n("i",{staticClass:"fa fa-refresh pl-1 pr-1"})])]:t._e(),t.total_pages>1?n("ul",{staticClass:"pagination"},[t.useFirstLastLinks?n("li",{staticClass:"page-item",class:{disabled:t.is_first_page}},[n("a",{staticClass:"page-link",attrs:{href:""},domProps:{innerHTML:t._s(t.firstText)},on:{click:function(e){e.preventDefault(),t.selectPage(1)}}})]):t._e(),t.useNextPrevLinks?n("li",{staticClass:"page-item",class:{disabled:t.is_first_page}},[n("a",{staticClass:"page-link",attrs:{href:""},domProps:{innerHTML:t._s(t.previousText)},on:{click:function(e){e.preventDefault(),t.selectPage(t.currentPage-1)}}})]):t._e(),t._l(t.pages,function(e,r){return n("li",{key:r,staticClass:"page-item",class:{active:e.active}},[n("a",{staticClass:"page-link",attrs:{disabled:!e.active,href:""},on:{click:function(n){n.preventDefault(),t.selectPage(e.number)}}},[t._v(t._s(e.label))])])}),t.useNextPrevLinks?n("li",{staticClass:"page-item",class:{disabled:t.is_last_page}},[n("a",{staticClass:"page-link",attrs:{href:""},domProps:{innerHTML:t._s(t.nextText)},on:{click:function(e){e.preventDefault(),t.selectPage(t.currentPage+1)}}})]):t._e(),t.useFirstLastLinks?n("li",{staticClass:"page-item",class:{disabled:t.is_last_page}},[n("a",{staticClass:"page-link",attrs:{href:""},domProps:{innerHTML:t._s(t.lastText)},on:{click:function(e){e.preventDefault(),t.selectPage(t.total_pages)}}})]):t._e()],2):t._e()],2)])},m=[],v=n("xfY5"),_={props:{showRefreshButton:{type:Boolean,default:!0},useFirstLastLinks:{type:Boolean,default:!0},useBoundariesNumbersLinks:{type:Boolean,default:!1},useNextPrevLinks:{type:Boolean,default:!1},firstText:{type:String,default:"«"},lastText:{type:String,default:"»"},nextText:{type:String,default:"<"},previousText:{type:String,default:">"},useEllipses:{type:Boolean,default:!0},rotate:{type:Boolean,default:!0},maxPageItems:{type:Number,default:5},itemsPerPage:{type:Number,default:15},totalItems:{type:Number,required:!0},currentPage:{type:Number,required:!0}},computed:{is_last_page:function t(){return this.currentPage===this.total_pages},is_first_page:function t(){return 1===this.currentPage},total_pages:function t(){var t=this.itemsPerPage<1?1:Math.ceil(this.totalItems/this.itemsPerPage);return Math.max(t||0,1)},from:function t(){return this.is_first_page?1:this.itemsPerPage*(this.currentPage-1)+1},to:function t(){return this.is_last_page?this.totalItems:this.itemsPerPage*this.currentPage},pages:function t(){var t=[];if(this.currentPage<=0||this.currentPage>this.total_pages)return t;var e=1,n=this.total_pages,r=this.isDefined(this.maxPageItems)&&this.maxPageItemsthis.total_pages&&(n=this.total_pages,e=n-this.maxPageItems+1)):(e=(Math.ceil(this.currentPage/this.maxPageItems)-1)*this.maxPageItems+1,n=Math.min(e+this.maxPageItems-1,this.total_pages)));for(var i=e;i<=n;i++){var o=this.makePage(i,i,i===this.currentPage);t.push(o)}if(r&&this.maxPageItems>0&&(!this.rotate||this.useEllipses||this.useBoundariesNumbersLinks)){if(e>1){if(!this.useBoundariesNumbersLinks||e>3){var s=this.makePage(e-1,"...",!1);t.unshift(s)}if(this.useBoundariesNumbersLinks){if(3===e){var a=this.makePage(2,"2",!1);t.unshift(a)}var u=this.makePage(1,"1",!1);t.unshift(u)}}if(nu)r.f(e,c=s[u++],n[c]);return e}},HrLf:function(t,e,n){if("undefined"!==typeof window){let t;(t=window.document.currentScript)&&(t=t.src.match(/(.+\/)[^/]+\.js$/))&&(n.p=t[1])}},Iw71:function(t,e,n){var r=n("0/R4"),i=n("dyZX").document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},K0xU:function(t,e,n){var r=n("VTer")("wks"),i=n("ylqs"),o=n("dyZX").Symbol,s="function"==typeof o,a=t.exports=function(t){return r[t]||(r[t]=s&&o[t]||(s?o:i)("Symbol."+t))};a.store=r},KroJ:function(t,e,n){var r=n("dyZX"),i=n("Mukb"),o=n("aagx"),s=n("ylqs")("src"),a="toString",u=Function[a],c=(""+u).split(a);n("g3g5").inspectSource=function(t){return u.call(t)},(t.exports=function(t,e,n,a){var u="function"==typeof n;u&&(o(n,"name")||i(n,"name",e)),t[e]!==n&&(u&&(o(n,s)||i(n,s,t[e]?""+t[e]:c.join(String(e)))),t===r?t[e]=n:a?t[e]?t[e]=n:i(t,e,n):(delete t[e],i(t,e,n)))})(Function.prototype,a,function t(){return"function"==typeof this&&this[s]||u.call(this)})},Kuth:function(t,e,n){var r=n("y3w9"),i=n("FJW5"),o=n("4R4u"),s=n("YTvA")("IE_PROTO"),a=function(){},u="prototype",c=function(){var t=n("Iw71")("iframe"),e=o.length,r="<",i=">",s;t.style.display="none",n("+rLv").appendChild(t),t.src="javascript:",s=t.contentWindow.document,s.open(),s.write(r+"script"+i+"document.F=Object"+r+"/script"+i),s.close(),c=s.F;while(e--)delete c[u][o[e]];return c()};t.exports=Object.create||function t(e,n){var o;return null!==e?(a[u]=r(e),o=new a,a[u]=null,o[s]=e):o=c(),void 0===n?o:i(o,n)}},L9s1:function(t,e,n){"use strict";var r=n("XKFU"),i=n("0sh+"),o="includes";r(r.P+r.F*n("UUeW")(o),"String",{includes:function t(e){return!!~i(this,e,o).indexOf(e,arguments.length>1?arguments[1]:void 0)}})},LQAc:function(t,e){t.exports=!1},LZWt:function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},Mukb:function(t,e,n){var r=n("hswa"),i=n("RjD/");t.exports=n("nh4g")?function(t,e,n){return r.f(t,e,i(1,n))}:function(t,e,n){return t[e]=n,t}},RYi7:function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},"RjD/":function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},UUeW:function(t,e,n){var r=n("K0xU")("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[r]=!1,!"/./"[t](e)}catch(t){}}return!0}},UqcF:function(t,e){e.f={}.propertyIsEnumerable},VTer:function(t,e,n){var r=n("g3g5"),i=n("dyZX"),o="__core-js_shared__",s=i[o]||(i[o]={});(t.exports=function(t,e){return s[t]||(s[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n("LQAc")?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},XKFU:function(t,e,n){var r=n("dyZX"),i=n("g3g5"),o=n("Mukb"),s=n("KroJ"),a=n("m0Pp"),u="prototype",c=function(t,e,n){var f=t&c.F,l=t&c.G,p=t&c.S,h=t&c.P,d=t&c.B,g=l?r:p?r[e]||(r[e]={}):(r[e]||{})[u],m=l?i:i[e]||(i[e]={}),v=m[u]||(m[u]={}),_,y,x,b;for(_ in l&&(n=e),n)y=!f&&g&&void 0!==g[_],x=(y?g:n)[_],b=d&&y?a(x,r):h&&"function"==typeof x?a(Function.call,x):x,g&&s(g,_,x,t&c.U),m[_]!=x&&o(m,_,b),h&&v[_]!=x&&(v[_]=x)};r.core=i,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},Xbzi:function(t,e,n){var r=n("0/R4"),i=n("i5dc").set;t.exports=function(t,e,n){var o=e.constructor,s;return o!==n&&"function"==typeof o&&(s=o.prototype)!==n.prototype&&r(s)&&i&&i(t,s),t}},YTvA:function(t,e,n){var r=n("VTer")("keys"),i=n("ylqs");t.exports=function(t){return r[t]||(r[t]=i(t))}},Ymqv:function(t,e,n){var r=n("LZWt");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},Z2Ku:function(t,e,n){"use strict";var r=n("XKFU"),i=n("w2a5")(!0);r(r.P,"Array",{includes:function t(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),n("nGyu")("includes")},aCFj:function(t,e,n){var r=n("Ymqv"),i=n("vhPU");t.exports=function(t){return r(i(t))}},aagx:function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},apmT:function(t,e,n){var r=n("0/R4");t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},"d/Gc":function(t,e,n){var r=n("RYi7"),i=Math.max,o=Math.min;t.exports=function(t,e){return t=r(t),t<0?i(t+e,0):o(t,e)}},dyZX:function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},eeVq:function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},"f3/d":function(t,e,n){var r=n("hswa").f,i=Function.prototype,o=/^\s*function ([^ (]*)/,s="name";s in i||n("nh4g")&&r(i,s,{configurable:!0,get:function(){try{return(""+this).match(o)[1]}catch(t){return""}}})},g3g5:function(t,e){var n=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},hswa:function(t,e,n){var r=n("y3w9"),i=n("xpql"),o=n("apmT"),s=Object.defineProperty;e.f=n("nh4g")?Object.defineProperty:function t(e,n,a){if(r(e),n=o(n,!0),r(a),i)try{return s(e,n,a)}catch(t){}if("get"in a||"set"in a)throw TypeError("Accessors not supported!");return"value"in a&&(e[n]=a.value),e}},i5dc:function(t,e,n){var r=n("0/R4"),i=n("y3w9"),o=function(t,e){if(i(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{r=n("m0Pp")(Function.call,n("EemH").f(Object.prototype,"__proto__").set,2),r(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function t(n,i){return o(n,i),e?n.__proto__=i:r(n,i),n}}({},!1):void 0),check:o}},kJMx:function(t,e,n){var r=n("zhAb"),i=n("4R4u").concat("length","prototype");e.f=Object.getOwnPropertyNames||function t(e){return r(e,i)}},m0Pp:function(t,e,n){var r=n("2OiF");t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},nGyu:function(t,e,n){var r=n("K0xU")("unscopables"),i=Array.prototype;void 0==i[r]&&n("Mukb")(i,r,{}),t.exports=function(t){i[r][t]=!0}},ne8i:function(t,e,n){var r=n("RYi7"),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},nh4g:function(t,e,n){t.exports=!n("eeVq")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},qncB:function(t,e,n){var r=n("XKFU"),i=n("vhPU"),o=n("eeVq"),s=n("/e88"),a="["+s+"]",u="​…",c=RegExp("^"+a+a+"*"),f=RegExp(a+a+"*$"),l=function(t,e,n){var i={},a=o(function(){return!!s[t]()||u[t]()!=u}),c=i[t]=a?e(p):s[t];n&&(i[n]=c),r(r.P+r.F*a,"String",i)},p=l.trim=function(t,e){return t=String(i(t)),1&e&&(t=t.replace(c,"")),2&e&&(t=t.replace(f,"")),t};t.exports=l},quPj:function(t,e,n){var r=n("0/R4"),i=n("LZWt"),o=n("K0xU")("match");t.exports=function(t){var e;return r(t)&&(void 0!==(e=t[o])?!!e:"RegExp"==i(t))}},vhPU:function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},w2a5:function(t,e,n){var r=n("aCFj"),i=n("ne8i"),o=n("d/Gc");t.exports=function(t){return function(e,n,s){var a=r(e),u=i(a.length),c=o(s,u),f;if(t&&n!=n){while(u>c)if(f=a[c++],f!=f)return!0}else for(;u>c;c++)if((t||c in a)&&a[c]===n)return t||c||0;return!t&&-1}}},xfY5:function(t,e,n){"use strict";var r=n("dyZX"),i=n("aagx"),o=n("LZWt"),s=n("Xbzi"),a=n("apmT"),u=n("eeVq"),c=n("kJMx").f,f=n("EemH").f,l=n("hswa").f,p=n("qncB").trim,h="Number",d=r[h],g=d,m=d.prototype,v=o(n("Kuth")(m))==h,_="trim"in String.prototype,y=function(t){var e=a(t,!1);if("string"==typeof e&&e.length>2){e=_?e.trim():p(e,3);var n=e.charCodeAt(0),r,i,o;if(43===n||45===n){if(r=e.charCodeAt(2),88===r||120===r)return NaN}else if(48===n){switch(e.charCodeAt(1)){case 66:case 98:i=2,o=49;break;case 79:case 111:i=8,o=55;break;default:return+e}for(var s=e.slice(2),u=0,c=s.length,f;uo)return NaN;return parseInt(s,i)}}return+e};if(!d(" 0o1")||!d("0b1")||d("+0x1")){d=function t(e){var n=arguments.length<1?0:e,r=this;return r instanceof d&&(v?u(function(){m.valueOf.call(r)}):o(r)!=h)?s(new g(y(n)),r,d):y(n)};for(var x=n("nh4g")?c(g):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),b=0,P;x.length>b;b++)i(g,P=x[b])&&!i(d,P)&&l(d,P,f(g,P));d.prototype=m,m.constructor=d,n("KroJ")(r,h,d)}},xpql:function(t,e,n){t.exports=!n("nh4g")&&!n("eeVq")(function(){return 7!=Object.defineProperty(n("Iw71")("div"),"a",{get:function(){return 7}}).a})},y3w9:function(t,e,n){var r=n("0/R4");t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},ylqs:function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},zhAb:function(t,e,n){var r=n("aagx"),i=n("aCFj"),o=n("w2a5")(!1),s=n("YTvA")("IE_PROTO");t.exports=function(t,e){var n=i(t),a=0,u=[],c;for(c in n)c!=s&&r(n,c)&&u.push(c);while(e.length>a)r(n,c=e[a++])&&(~o(u,c)||u.push(c));return u}}})}); 2 | //# sourceMappingURL=VueTable.umd.min.js.map -------------------------------------------------------------------------------- /docs/.vuepress/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | title: 'VueTable', 3 | description: 'Simple table component for Vue.js 2.x with pagination and sortable columns', 4 | base: '/vue-table/', 5 | head: [ 6 | ['link', { rel: 'icon', href: `/logo.png` }], 7 | ['link', { rel: 'manifest', href: '/manifest.json' }], 8 | ['meta', { name: 'theme-color', content: '#3eaf7c' }], 9 | ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }], 10 | ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }], 11 | ['link', { rel: 'apple-touch-icon', href: `/icons/apple-touch-icon-152x152.png` }], 12 | ['link', { rel: 'mask-icon', href: '/icons/safari-pinned-tab.svg', color: '#3eaf7c' }], 13 | ['meta', { name: 'msapplication-TileImage', content: '/icons/msapplication-icon-144x144.png' }], 14 | ['meta', { name: 'msapplication-TileColor', content: '#000000' }], 15 | ], 16 | themeConfig: { 17 | repo: 'lossendae/vue-table', 18 | editLinks: false, 19 | docsDir: 'docs', 20 | locales: { 21 | '/': { 22 | label: 'English', 23 | selectText: 'Languages', 24 | editLinkText: 'Edit this page on GitHub', 25 | lastUpdated: 'Last Updated', 26 | nav: [ 27 | { 28 | text: 'Getting started', 29 | link: '/getting-started/', 30 | }, 31 | { 32 | text: 'Examples', 33 | link: '/examples/', 34 | }, 35 | { 36 | text: 'API references', 37 | link: '/api-references/', 38 | }, 39 | ], 40 | sidebar: { 41 | '/getting-started/': [ 42 | { 43 | title: 'Getting started', 44 | collapsable: false, 45 | children: [ 46 | '', 47 | 'credits', 48 | ], 49 | }, 50 | ], 51 | '/examples/': [ 52 | { 53 | title: 'Examples', 54 | collapsable: false, 55 | children: [ 56 | '', 57 | 'case-study', 58 | ], 59 | }, 60 | ], 61 | }, 62 | }, 63 | }, 64 | }, 65 | } 66 | -------------------------------------------------------------------------------- /docs/.vuepress/override.styl: -------------------------------------------------------------------------------- 1 | .theme-container.content-960 .content { 2 | max-width: 960px; 3 | } 4 | -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/android-chrome-192x192.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/android-chrome-512x512.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/apple-touch-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/apple-touch-icon-152x152.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/apple-touch-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/apple-touch-icon-180x180.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/favicon-16x16.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/favicon-32x32.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/msapplication-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/msapplication-icon-144x144.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/icons/mstile-150x150.png -------------------------------------------------------------------------------- /docs/.vuepress/public/icons/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /docs/.vuepress/public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lossendae/vue-table/39a16b79a640ec88d2ec5683c46f957a15dff0ff/docs/.vuepress/public/logo.png -------------------------------------------------------------------------------- /docs/.vuepress/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "VuePress", 3 | "short_name": "VuePress", 4 | "icons": [ 5 | { 6 | "src": "/icons/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/icons/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "start_url": "/index.html", 17 | "display": "standalone", 18 | "background_color": "#fff", 19 | "theme_color": "#3eaf7c" 20 | } 21 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | home: true 3 | actionText: Get Started → 4 | actionLink: /getting-started/ 5 | features: 6 | - title: Simple 7 | details: Only the basic rendering are handled by the components. You're responsible to feed data to the component via props. 8 | - title: Extensible 9 | details: All the rendering logic are in separated mixins. Therefore if you don't want to use the default markup you can easily create your own table & pagination components. 10 | - title: Simple API 11 | details: Interaction from the parent to the table is simple and uses VueJS scoped slots to allow more customization options without to much compromise. 12 | footer: MIT Licensed | Copyright © 2018-present Stéphane Boulard 13 | --- 14 | 15 | -------------------------------------------------------------------------------- /docs/api-references/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | pageClass: content-960 3 | sidebar: auto 4 | --- 5 | 6 | # API references 7 | 8 | ::: tip 9 | Both components scripts are in mixins. The API references refer to those mixins 10 | ::: 11 | 12 | ## VueTable 13 | 14 | ```js 15 | import { VueTableMixin } from '@lossendae/vue-table' 16 | ``` 17 | 18 | ### Props 19 | 20 | | Name | Type | Required | Default | Description | 21 | | ------------------|----------|:--------:|:-------:| -----------------------------------------------------------------------| 22 | | **columns** | Array | `true` | - | Array of column configuration | 23 | | **rows** | Array | `true` | - | Array of rows to show in table | 24 | | **sortBy** | String | `false` | - | Name of the column currently sorted | 25 | | **sortDirection** | String | `false` | `asc` | Direction in which the column is sorted. Can be either `asc` or `desc` | 26 | 27 | #### Columns options 28 | 29 | ```js 30 | { 31 | name: 'column-name', // Can also be a free value, which will be available as a slot in the table 32 | title: 'Nice title for the column', // Optional 33 | sortable: false, // Optional - false by default 34 | } 35 | ``` 36 | 37 | > The `name` key is used for data mapping with the `rows` props. 38 | 39 | ### Events 40 | 41 | | Name | Description | 42 | | --------------|----------------------------------------------------------------------| 43 | | column:sort | Emits an object with the following keys: `{ sortBy, sortDirection }` | 44 | 45 | ## VueTablePagination 46 | 47 | ```js 48 | import { VueTablePaginationMixin } from '@lossendae/vue-table' 49 | ``` 50 | 51 | ### Props 52 | 53 | | Name | Type | Required | Default | Description | 54 | | ------------------------------|----------|:---------:|:-------:| ------------------------------------------------------------------------------------------------| 55 | | **showRefreshButton** | Boolean | `false` | `true` | If true, will show a button which emits the `pagination:change` event on click | 56 | | **useFirstLastLinks** | Boolean | `false` | `true` | Whether the pagination should show the first and last links | 57 | | **useBoundariesNumbersLinks** | Boolean | `false` | `false` | Whether the pagination should show the boundaries links which can be either numbers or ellipses | 58 | | **useNextPrevLinks** | Boolean | `false` | `false` | Whether the pagination should show the next and previous page links | 59 | | **firstText** | String | `false` | `«` | Text of the first page link | 60 | | **lastText** | String | `false` | `»` | Text of the last page link | 61 | | **nextText** | String | `false` | `<` | Text of the next page link | 62 | | **previousText** | String | `false` | `>` | Text of the previous page link | 63 | | **useEllipses** | Boolean | `false` | `true` | Whether the table should use ellipses | 64 | | **rotate** | Boolan | `false` | `true` | Whether the page should be kept in the middle when possible | 65 | | **maxPageItems** | Number | `false` | `5` | When using ellipses, this is the maximum number of page items that will be shown | 66 | | **itemsPerPage** | Number | `false` | `15` | Amount of items per page | 67 | | **totalItems** | Number | `true` | - | Total amount of items | 68 | | **currentPage** | Number | `true` | - | Current page number | 69 | 70 | ### Events 71 | 72 | | Name | Description | 73 | | -------------------|-----------------------------------| 74 | | pagination:change | Emits the new page number to load | 75 | -------------------------------------------------------------------------------- /docs/examples/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | pageClass: content-960 3 | --- 4 | 5 | # Examples 6 | 7 | ## Simple table 8 | 9 | 10 | 11 | ## Simple table with sortable columns 12 | 13 | > The default table assume that you're using bootstrap 4 with Fontawesome 4.7 14 | > There are other examples using other CSS framework and icon sets 15 | 16 | ```js 17 | 28 | 29 | 98 | 99 | 104 | ``` 105 | 106 | 107 | -------------------------------------------------------------------------------- /docs/examples/case-study.md: -------------------------------------------------------------------------------- 1 | --- 2 | pageClass: content-960 3 | --- 4 | 5 | # Case study 6 | 7 | ::: tip 8 | In the the following example, I'm using a data provider component to simulate call to the server. 9 | This is inspired by the excellent [VueJS course](https://adamwathan.me/advanced-vue-component-design/) made by Adam Wathan 10 | ::: 11 | 12 | In this tutorial we'll review a few of the options available in order to build a dynamic table. 13 | 14 | Let's say that we have a user list fetched from a server side script and we build a UI for it. 15 | 16 | The json structure is fairly simple : 17 | 18 | ```json 19 | [ 20 | { 21 | "firstname": "Brigitte", 22 | "lastname": "Bardont", 23 | "username": "bribar", 24 | "email": "bb@example.com", 25 | "phone": "0143520987", 26 | "birth_date": "08-06-1991", 27 | "gender": "female", 28 | "revenue": 15054.08 29 | }, 30 | ... 31 | ] 32 | ``` 33 | 34 | For now we'll not add sortable columns nor pagination. 35 | 36 | See below in the sandbox the rendered table : 37 | 38 | 39 | 40 | As you can see there are quite a lot of fields and data are shown raw without formatting. 41 | 42 | VueTable uses slots to customise your table data with VueJS scoped slots. 43 | 44 | If we want to format the fields `{ firsname, lastname, username }` in one column, change the column declaration to the name of the desired scope slot : 45 | 46 | ```js 47 | [ 48 | { 49 | name: "identity" 50 | }, 51 | { 52 | name: "email" 53 | }, 54 | { 55 | name: "phone" 56 | }, 57 | { 58 | name: "birth_date" 59 | }, 60 | { 61 | name: "gender" 62 | }, 63 | { 64 | name: "revenue" 65 | } 66 | ] 67 | ``` 68 | 69 | and then use the name (here `identity`) in your template 70 | 71 | ```html 72 | 76 | 84 | 85 | ``` 86 | 87 | Each column names provided in column definition can be overridden in the parent component with a slot. 88 | It means that `{ email, phone, birth_date, gender, revenue }` and any other columns can be used as a scope slot for custom formatting. 89 | 90 | If we add an additional column `action` to the column, it will be available as a slot too. 91 | 92 | The following sandbox example combines scoped slots, pagination, custom components and custom filters to show how the table can be more dynamic : 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /docs/getting-started/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | pageClass: content-960 3 | --- 4 | 5 | # Getting started 6 | 7 | ## Installation 8 | 9 | via npm 10 | 11 | ```bash 12 | npm install --save @lossendae/vue-table 13 | ``` 14 | 15 | ## Basic usage 16 | 17 | ```js 18 | import Vue from 'vue' 19 | import VueTable from '@lossendae/vue-table' 20 | 21 | // install globally... 22 | Vue.use('vue-table', Vuetable) 23 | 24 | // Or in your Vue component 25 | export default { 26 | components: { Vuetable }, 27 | ... 28 | } 29 | ``` 30 | 31 | Then use it in your component like the following: 32 | 33 | ```vue 34 | 37 | 38 | 72 | ``` 73 | 74 | This will result in : 75 | 76 | 77 | 78 | The components uses Bootstrap4 classes per default, but the logic is externalized in mixins. 79 | 80 | Therefore you can easily build your own table template and only use the mixins without having to deal with css config options. 81 | 82 | -------------------------------------------------------------------------------- /docs/getting-started/credits.md: -------------------------------------------------------------------------------- 1 | --- 2 | pageClass: content-960 3 | --- 4 | 5 | # Credits 6 | 7 | The table component is loosely based on [vuetable-2](https://github.com/ratiw/vuetable-2) but with a lot less assumptions on how the component should work and no magic call the parent for 8 | data formatting etc. 9 | Using slots is also a lot easier in this component as it doesn't require any special declaration to work. 10 | 11 | On the other hand, [vuetable-2](https://github.com/ratiw/vuetable-2) supports more special fields by default like row count and checkbox. 12 | Definitively worth checking out. 13 | 14 | The table pagination plugin in basically a copy of [vuejs-uib-pagination](https://github.com/sant123/vuejs-uib-pagination). 15 | As i don't use Typescript and don't have time to setup the dev environment, i adapted 16 | the code from the original repository to suite my needs and eventually extends the functionalities. 17 | 18 | It turns out, i didn't see what i could bring more to the code. 19 | The adaptation being done, it would have be a waste to not provide it here for those who eventually needs it. 20 | 21 | As a bonus, the component pagination is unit tested. So there is that. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@lossendae/vue-table", 3 | "description": "Simple table component for Vue.js 2.x with pagination and sortable columns", 4 | "version": "0.1.8", 5 | "private": false, 6 | "license": "MIT", 7 | "author": "Stéphane Boulard ", 8 | "main": "dist/VueTable.umd.min.js", 9 | "module": "dist/VueTable.common.js", 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/lossendae/vue-table.git" 13 | }, 14 | "bugs": { 15 | "url": "https://github.com/lossendae/vue-table/issues" 16 | }, 17 | "scripts": { 18 | "serve": "vue-cli-service serve", 19 | "build": "vue-cli-service build --target lib --name VueTable src/main.js", 20 | "test": "vue-cli-service test:unit", 21 | "docs:dev": "vuepress dev docs", 22 | "docs:build": "vuepress build docs" 23 | }, 24 | "keywords": [ 25 | "vue.js", 26 | "vuejs", 27 | "component", 28 | "table", 29 | "datatable", 30 | "pagination-components", 31 | "json" 32 | ], 33 | "devDependencies": { 34 | "@vue/cli-plugin-babel": "^3.0.0-beta.15", 35 | "@vue/cli-plugin-unit-jest": "^3.0.0-beta.15", 36 | "@vue/cli-service": "^3.0.0-beta.15", 37 | "@vue/test-utils": "^1.0.0-beta.16", 38 | "babel-core": "^7.0.0-0", 39 | "babel-jest": "^22.0.4", 40 | "jest-mock-console": "^0.3.5", 41 | "lodash": "^4.17.10", 42 | "vue": "^2.5.16", 43 | "vue-template-compiler": "^2.5.13", 44 | "vuepress": "^0.10.0" 45 | }, 46 | "babel": { 47 | "presets": [ 48 | "@vue/app" 49 | ] 50 | }, 51 | "browserslist": [ 52 | "> 1%", 53 | "last 2 versions", 54 | "not ie <= 8" 55 | ], 56 | "jest": { 57 | "moduleFileExtensions": [ 58 | "js", 59 | "jsx", 60 | "json", 61 | "vue" 62 | ], 63 | "transform": { 64 | "^.+\\.vue$": "vue-jest", 65 | ".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub", 66 | "^.+\\.jsx?$": "babel-jest" 67 | }, 68 | "moduleNameMapper": { 69 | "^@/(.*)$": "/src/$1" 70 | }, 71 | "snapshotSerializers": [ 72 | "jest-serializer-vue" 73 | ], 74 | "testMatch": [ 75 | "/(tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx))" 76 | ] 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/VueTable.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 50 | -------------------------------------------------------------------------------- /src/VueTablePagination.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 49 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import VueTable from './VueTable' 2 | import vueTableMixin from './mixins/vueTableMixin' 3 | import VueTablePagination from './VueTablePagination' 4 | import vueTablePaginationMixin from './mixins/vueTablePaginationMixin' 5 | 6 | export default VueTable 7 | 8 | export { VueTable, vueTableMixin, VueTablePagination, vueTablePaginationMixin } 9 | -------------------------------------------------------------------------------- /src/mixins/vueTableMixin.js: -------------------------------------------------------------------------------- 1 | export default { 2 | props: { 3 | columns: { 4 | type: Array, 5 | required: true, 6 | }, 7 | rows: { 8 | type: Array, 9 | required: true, 10 | }, 11 | sortBy: { 12 | type: String, 13 | }, 14 | sortDirection: { 15 | type: String, 16 | default() { 17 | return 'asc' 18 | }, 19 | validator(value) { 20 | // The value must match one of these strings 21 | return ['asc', 'desc'].includes(value) 22 | }, 23 | }, 24 | }, 25 | data() { 26 | return { 27 | column_names: [], 28 | } 29 | }, 30 | methods: { 31 | fieldExistsInRow(row, name) { 32 | return row.hasOwnProperty(name) 33 | }, 34 | getSortKey(column) { 35 | return typeof column.sortable === 'string' ? column.sortable : column.name 36 | }, 37 | isSorted(column) { 38 | // If a column is marked as sortable, sortBy props should be defined 39 | // If not the user should be warned as it might have forgotten to set the prop 40 | if (typeof this.sortBy === 'undefined') { 41 | console.warn(`"sortBy" prop was not defined, but column "%s" is marked as sortable`, column.name) 42 | } 43 | 44 | return this.getSortKey(column) === this.sortBy 45 | }, 46 | sort(column) { 47 | // emit event to parent to change the sort parameters 48 | this.$emit('column:sort', { 49 | sortBy: this.getSortKey(column), 50 | sortDirection: this.sortDirection === 'asc' ? 'desc' : 'asc', 51 | }) 52 | }, 53 | }, 54 | mounted() { 55 | // map column names 56 | this.column_names = this.columns.map(f => f.name) 57 | }, 58 | } 59 | -------------------------------------------------------------------------------- /src/mixins/vueTablePaginationMixin.js: -------------------------------------------------------------------------------- 1 | export default { 2 | props: { 3 | showRefreshButton: { 4 | type: Boolean, 5 | default: true, 6 | }, 7 | useFirstLastLinks: { 8 | type: Boolean, 9 | default: true, 10 | }, 11 | useBoundariesNumbersLinks: { 12 | type: Boolean, 13 | default: false, 14 | }, 15 | useNextPrevLinks: { 16 | type: Boolean, 17 | default: false, 18 | }, 19 | firstText: { 20 | type: String, 21 | default: "«", 22 | }, 23 | lastText: { 24 | type: String, 25 | default: "»", 26 | }, 27 | nextText: { 28 | type: String, 29 | default: "<", 30 | }, 31 | previousText: { 32 | type: String, 33 | default: ">", 34 | }, 35 | useEllipses: { 36 | type: Boolean, 37 | default: true, 38 | }, 39 | rotate: { 40 | type: Boolean, 41 | default: true, 42 | }, 43 | maxPageItems: { 44 | type: Number, 45 | default: 5, 46 | }, 47 | itemsPerPage: { 48 | type: Number, 49 | default: 15, 50 | }, 51 | totalItems: { 52 | type: Number, 53 | required: true 54 | }, 55 | currentPage: { 56 | type: Number, 57 | required: true, 58 | }, 59 | }, 60 | computed: { 61 | is_last_page() { 62 | return this.currentPage === this.total_pages 63 | }, 64 | is_first_page() { 65 | return this.currentPage === 1 66 | }, 67 | total_pages() { 68 | let total_pages = this.itemsPerPage < 1 ? 1 : Math.ceil(this.totalItems / this.itemsPerPage) 69 | return Math.max(total_pages || 0, 1) 70 | }, 71 | from() { 72 | return this.is_first_page 73 | ? 1 74 | : (this.itemsPerPage * (this.currentPage - 1)) + 1 75 | }, 76 | to() { 77 | return this.is_last_page 78 | ? this.totalItems 79 | : this.itemsPerPage * this.currentPage 80 | }, 81 | pages() { 82 | let pages = [] 83 | 84 | if (this.currentPage <= 0 || this.currentPage > this.total_pages) { 85 | return pages 86 | } 87 | 88 | // Default page limits 89 | let start_page = 1 90 | let end_page = this.total_pages 91 | let limit_page_items = this.isDefined(this.maxPageItems) && this.maxPageItems < this.total_pages 92 | 93 | // recompute if maxPageItems 94 | if (limit_page_items) { 95 | if (this.rotate) { 96 | // Current page is displayed in the middle of the visible ones 97 | start_page = Math.max(this.currentPage - Math.floor(this.maxPageItems / 2), 1) 98 | end_page = start_page + this.maxPageItems - 1 99 | 100 | // Adjust if limit is exceeded 101 | if (end_page > this.total_pages) { 102 | end_page = this.total_pages 103 | start_page = end_page - this.maxPageItems + 1 104 | } 105 | } else { 106 | // Visible pages are paginated with maxPageItems 107 | start_page = (Math.ceil(this.currentPage / this.maxPageItems) - 1) * this.maxPageItems + 1 108 | 109 | // Adjust last page if limit is exceeded 110 | end_page = Math.min(start_page + this.maxPageItems - 1, this.total_pages) 111 | } 112 | } 113 | 114 | // Add page number links 115 | for (let number = start_page; number <= end_page; number++) { 116 | let page = this.makePage(number, number, number === this.currentPage) 117 | pages.push(page) 118 | } 119 | 120 | // Add links to move between page sets 121 | if (limit_page_items && this.maxPageItems > 0 && (!this.rotate || this.useEllipses || this.useBoundariesNumbersLinks)) { 122 | if (start_page > 1) { 123 | if (!this.useBoundariesNumbersLinks || start_page > 3) { 124 | //need ellipsis for all options unless range is too close to beginning 125 | let previous_ellipsis_page_item = this.makePage(start_page - 1, '...', false) 126 | pages.unshift(previous_ellipsis_page_item) 127 | } 128 | 129 | if (this.useBoundariesNumbersLinks) { 130 | if (start_page === 3) { 131 | //need to replace ellipsis when the buttons would be sequential 132 | let second_page_item = this.makePage(2, '2', false) 133 | pages.unshift(second_page_item) 134 | } 135 | 136 | //add the first page 137 | let first_page_item = this.makePage(1, '1', false) 138 | pages.unshift(first_page_item) 139 | } 140 | } 141 | 142 | if (end_page < this.total_pages) { 143 | if (!this.useBoundariesNumbersLinks || end_page < this.total_pages - 2) { 144 | //need ellipsis for all options unless range is too close to end 145 | let next_ellipsis_page_item = this.makePage(end_page + 1, '...', false) 146 | pages.push(next_ellipsis_page_item) 147 | } 148 | if (this.useBoundariesNumbersLinks) { 149 | if (end_page === this.total_pages - 2) { 150 | //need to replace ellipsis when the buttons would be sequential 151 | let second_to_last_page_item = this.makePage(this.total_pages - 1, this.total_pages - 1, false) 152 | pages.push(second_to_last_page_item) 153 | } 154 | 155 | //add the last page 156 | let last_page_item = this.makePage(this.total_pages, this.total_pages, false) 157 | pages.push(last_page_item) 158 | } 159 | } 160 | } 161 | 162 | return pages 163 | }, 164 | }, 165 | methods: { 166 | selectPage(page) { 167 | this.$emit('pagination:change', page) 168 | }, 169 | isDefined(value) { 170 | return typeof value !== "undefined" 171 | }, 172 | makePage(number, label, active) { 173 | return { number, label, active } 174 | }, 175 | }, 176 | } 177 | -------------------------------------------------------------------------------- /tests/unit/VueTable.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import './utils/console/' 3 | import VueTable from '@/VueTable.vue' 4 | 5 | describe('VueTable.vue', () => { 6 | describe('initialize', () => { 7 | it('should work with no columns and no rows', () => { 8 | const props = { 9 | columns: [], 10 | rows: [], 11 | } 12 | const wrapper = shallowMount(VueTable, { 13 | propsData: props, 14 | }) 15 | expect(wrapper.text()).toMatch('No results found') 16 | }) 17 | }) 18 | 19 | describe('column definition', () => { 20 | it('should map field names correctly', () => { 21 | const props = { 22 | columns: [{ 23 | name: 'column_1', 24 | }, { 25 | name: 'column_2', 26 | title: 'Second column', 27 | }], 28 | rows: [], 29 | } 30 | const wrapper = shallowMount(VueTable, { 31 | propsData: props, 32 | }) 33 | 34 | expect(wrapper.vm.$data.column_names).toEqual(['column_1', 'column_2']) 35 | }) 36 | 37 | it('should set the currently sorted column correctly', () => { 38 | const props = { 39 | columns: [{ 40 | name: 'column_1', 41 | sortable: true, 42 | }, { 43 | name: 'column_2', 44 | sortable: 'with_another_key', 45 | }, { 46 | name: 'column_3', 47 | }], 48 | rows: [{ 49 | column_1: 'value', 50 | column_2: 'value', 51 | column_3: 'value', 52 | }], 53 | sortBy: 'column_1', 54 | } 55 | const wrapper = shallowMount(VueTable, { 56 | propsData: props, 57 | }) 58 | 59 | expect(wrapper.vm.isSorted(props.columns[0])).toEqual(true) 60 | expect(wrapper.vm.isSorted(props.columns[1])).toEqual(false) 61 | expect(wrapper.vm.isSorted(props.columns[2])).toEqual(false) 62 | }) 63 | 64 | it('should get column sort key correctly', () => { 65 | const props = { 66 | columns: [{ 67 | name: 'column_1', 68 | sortable: true, 69 | }, { 70 | name: 'column_2', 71 | sortable: 'with_another_key', 72 | }], 73 | rows: [{ 74 | column_1: 'value', 75 | column_2: 'value', 76 | }], 77 | sortBy: 'column_1', 78 | } 79 | const wrapper = shallowMount(VueTable, { 80 | propsData: props, 81 | }) 82 | 83 | expect(wrapper.vm.getSortKey(props.columns[0])).toEqual('column_1') 84 | expect(wrapper.vm.getSortKey(props.columns[1])).toEqual('with_another_key') 85 | }) 86 | 87 | it('should warn when sortBy props is missing when at least one column is sortable', () => { 88 | const props = { 89 | columns: [{ 90 | name: 'column_1', 91 | sortable: true, 92 | }], 93 | rows: [{ 94 | column_1: 'value', 95 | }], 96 | } 97 | 98 | shallowMount(VueTable, { 99 | propsData: props, 100 | }) 101 | 102 | expect(console).toHaveWarnedWith( 103 | '"sortBy" prop was not defined, but column "%s" is marked as sortable', 104 | 'column_1', 105 | ) 106 | }) 107 | 108 | it('should log an error when sortDirection props validator fails', () => { 109 | const props = { 110 | columns: [{ 111 | name: 'column_1', 112 | sortable: true, 113 | }], 114 | rows: [{ 115 | column_1: 'value', 116 | }], 117 | sortBy: 'column_1', 118 | sortDirection: 'wrong', 119 | } 120 | 121 | shallowMount(VueTable, { 122 | propsData: props, 123 | }) 124 | 125 | expect(console).toHaveErrored( 126 | '[Vue warn]: Invalid prop: custom validator check failed for prop "sortDirection"', 127 | ) 128 | }) 129 | }) 130 | 131 | describe('an event', () => { 132 | it('should be emitted when a column is sorted', () => { 133 | const props = { 134 | columns: [{ 135 | name: 'column_1', 136 | sortable: true, 137 | }, { 138 | name: 'column_2', 139 | sortable: 'with_another_key', 140 | }], 141 | rows: [{ 142 | column_1: 'value', 143 | column_2: 'value', 144 | }], 145 | sortBy: 'column_1', 146 | } 147 | const wrapper = shallowMount(VueTable, { 148 | propsData: props, 149 | }) 150 | wrapper.vm.sort(props.columns[0]) 151 | expect(wrapper.emitted()['column:sort']).toEqual([[{ 152 | sortBy: 'column_1', 153 | sortDirection: 'desc', 154 | }]]) 155 | }) 156 | 157 | it('should be emitted when a column is sorted with a custom sort key', () => { 158 | const props = { 159 | columns: [{ 160 | name: 'column_1', 161 | sortable: true, 162 | }, { 163 | name: 'column_2', 164 | sortable: 'with_another_key', 165 | }], 166 | rows: [{ 167 | column_1: 'value', 168 | column_2: 'value', 169 | }], 170 | sortBy: 'column_1', 171 | } 172 | const wrapper = shallowMount(VueTable, { 173 | propsData: props, 174 | }) 175 | wrapper.vm.sort(props.columns[1]) 176 | expect(wrapper.emitted()['column:sort']).toEqual([[{ 177 | sortBy: 'with_another_key', 178 | sortDirection: 'desc', 179 | }]]) 180 | }) 181 | }) 182 | 183 | describe('row slot', () => { 184 | it('should return true when the column name exists in the row', () => { 185 | const props = { 186 | columns: [{ 187 | name: 'column_1' 188 | }, { 189 | name: 'action', 190 | }], 191 | rows: [{ 192 | column_1: 'value', 193 | }], 194 | } 195 | const wrapper = shallowMount(VueTable, { 196 | propsData: props, 197 | }) 198 | 199 | expect(wrapper.vm.fieldExistsInRow(props.rows[0], 'column_1')).toEqual(true) 200 | }) 201 | it('should return false when the column name does not exists in the row', () => { 202 | const props = { 203 | columns: [{ 204 | name: 'column_1' 205 | }, { 206 | name: 'action', 207 | }], 208 | rows: [{ 209 | column_1: 'value', 210 | }], 211 | } 212 | const wrapper = shallowMount(VueTable, { 213 | propsData: props, 214 | }) 215 | 216 | const response = { 217 | data: { 218 | data: { 219 | companies: [], 220 | sites: [], 221 | job: [], 222 | } 223 | } 224 | } 225 | 226 | expect(wrapper.vm.fieldExistsInRow(props.rows[0], 'action')).toEqual(false) 227 | }) 228 | }) 229 | }) 230 | -------------------------------------------------------------------------------- /tests/unit/VueTablePagination.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import './utils/console/' 3 | import VueTablePagination from '@/VueTablePagination.vue' 4 | 5 | describe('VueTablePagination.vue', () => { 6 | describe('initialize', () => { 7 | it('should work with minimum required configuration options', () => { 8 | const props = { 9 | totalItems: 0, 10 | currentPage: 1, 11 | } 12 | const wrapper = shallowMount(VueTablePagination, { 13 | propsData: props, 14 | }) 15 | expect(wrapper.text()).toMatch('No results') 16 | }) 17 | }) 18 | describe('computed property', () => { 19 | it('"is_last_page" gives the correct information', () => { 20 | const props = { 21 | totalItems: 50, 22 | currentPage: 1, 23 | } 24 | const wrapper = shallowMount(VueTablePagination, { 25 | propsData: props, 26 | }) 27 | 28 | expect(wrapper.vm.is_last_page).toEqual(false) 29 | 30 | wrapper.vm.currentPage = 2 31 | expect(wrapper.vm.is_last_page).toEqual(false) 32 | 33 | wrapper.vm.currentPage = 4 34 | expect(wrapper.vm.is_last_page).toEqual(true) 35 | }) 36 | it('"is_first_page" gives the correct information', () => { 37 | const props = { 38 | totalItems: 50, 39 | currentPage: 1, 40 | } 41 | const wrapper = shallowMount(VueTablePagination, { 42 | propsData: props, 43 | }) 44 | 45 | expect(wrapper.vm.is_first_page).toEqual(true) 46 | 47 | wrapper.vm.currentPage = 2 48 | expect(wrapper.vm.is_first_page).toEqual(false) 49 | 50 | wrapper.vm.currentPage = 4 51 | expect(wrapper.vm.is_first_page).toEqual(false) 52 | }) 53 | it('"from" gives the correct information', () => { 54 | const props = { 55 | totalItems: 50, 56 | currentPage: 1, 57 | } 58 | const wrapper = shallowMount(VueTablePagination, { 59 | propsData: props, 60 | }) 61 | 62 | expect(wrapper.vm.from).toEqual(1) 63 | 64 | wrapper.vm.currentPage = 2 65 | expect(wrapper.vm.from).toEqual(16) 66 | 67 | wrapper.vm.currentPage = 4 68 | expect(wrapper.vm.from).toEqual(46) 69 | }) 70 | it('"to" gives the correct information', () => { 71 | const props = { 72 | totalItems: 50, 73 | currentPage: 1, 74 | } 75 | const wrapper = shallowMount(VueTablePagination, { 76 | propsData: props, 77 | }) 78 | 79 | expect(wrapper.vm.to).toEqual(15) 80 | 81 | wrapper.vm.currentPage = 2 82 | expect(wrapper.vm.to).toEqual(30) 83 | 84 | wrapper.vm.currentPage = 4 85 | expect(wrapper.vm.to).toEqual(50) 86 | }) 87 | it('"pages" gives the correct array of pages', () => { 88 | const props = { 89 | totalItems: 5, 90 | itemsPerPage: 2, 91 | currentPage: 1, 92 | } 93 | const wrapper = shallowMount(VueTablePagination, { 94 | propsData: props, 95 | }) 96 | 97 | expect(wrapper.vm.pages).toEqual([ 98 | { "active": true, "label": 1, "number": 1 }, 99 | { "active": false, "label": 2, "number": 2 }, 100 | { "active": false, "label": 3, "number": 3 }, 101 | ]) 102 | }) 103 | }) 104 | describe('an event', () => { 105 | it('should be emitted on page change', () => { 106 | const props = { 107 | totalItems: 50, 108 | currentPage: 1, 109 | } 110 | const wrapper = shallowMount(VueTablePagination, { 111 | propsData: props, 112 | }) 113 | wrapper.vm.selectPage(2) 114 | expect(wrapper.emitted()['pagination:change']).toEqual([[2]]) 115 | }) 116 | }) 117 | 118 | }) 119 | -------------------------------------------------------------------------------- /tests/unit/utils/console/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Internal dependencies 3 | * @see https://github.com/WordPress/packages/tree/master/packages/jest-console/src 4 | */ 5 | import './matchers' 6 | 7 | /** 8 | * Sets spy on the console object's method to make it possible to fail test when method called without assertion. 9 | * 10 | * @param {String} methodName Name of console method. 11 | */ 12 | const setConsoleMethodSpy = methodName => { 13 | const spy = jest.spyOn(console, methodName).mockName(`console.${ methodName }`) 14 | 15 | beforeEach(() => { 16 | spy.mockReset() 17 | spy.assertionsNumber = 0 18 | }) 19 | 20 | afterEach(() => { 21 | if (spy.assertionsNumber === 0) { 22 | expect(spy).not.toHaveBeenCalled() 23 | } 24 | }) 25 | }; 26 | 27 | ['error', 'warn'].forEach(setConsoleMethodSpy) 28 | -------------------------------------------------------------------------------- /tests/unit/utils/console/matchers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * External dependencies 3 | */ 4 | import { matcherHint, printExpected, printReceived } from 'jest-matcher-utils' 5 | import { isEqual, some } from 'lodash' 6 | 7 | const createToBeCalledMatcher = (matcherName, methodName) => 8 | (received) => { 9 | const spy = received[methodName] 10 | const calls = spy.mock.calls 11 | const pass = calls.length > 0 12 | const message = pass ? 13 | () => 14 | matcherHint(`.not${ matcherName }`, spy.getMockName()) + 15 | '\n\n' + 16 | 'Expected mock function not to be called but it was called with:\n' + 17 | calls.map(printReceived) : 18 | () => 19 | matcherHint(matcherName, spy.getMockName()) + 20 | '\n\n' + 21 | 'Expected mock function to be called.' 22 | 23 | spy.assertionsNumber += 1 24 | 25 | return { 26 | message, 27 | pass, 28 | } 29 | } 30 | 31 | const createToBeCalledWithMatcher = (matcherName, methodName) => 32 | (received, ...expected) => { 33 | const spy = received[methodName] 34 | const calls = spy.mock.calls 35 | const pass = some( 36 | calls, 37 | objects => isEqual(objects, expected), 38 | ) 39 | const message = pass ? 40 | () => 41 | matcherHint(`.not${ matcherName }`, spy.getMockName()) + 42 | '\n\n' + 43 | 'Expected mock function not to be called with:\n' + 44 | printExpected(expected) : 45 | () => 46 | matcherHint(matcherName, spy.getMockName()) + 47 | '\n\n' + 48 | 'Expected mock function to be called with:\n' + 49 | printExpected(expected) + '\n' + 50 | 'but it was called with:\n' + 51 | calls.map(printReceived) 52 | 53 | spy.assertionsNumber += 1 54 | 55 | return { 56 | message, 57 | pass, 58 | } 59 | } 60 | 61 | expect.extend({ 62 | toHaveErrored: createToBeCalledMatcher('.toHaveErrored', 'error'), 63 | toHaveErroredWith: createToBeCalledWithMatcher('.toHaveErroredWith', 'error'), 64 | toHaveWarned: createToBeCalledMatcher('.toHaveWarned', 'warn'), 65 | toHaveWarnedWith: createToBeCalledWithMatcher('.toHaveWarnedWith', 'warn'), 66 | }) 67 | --------------------------------------------------------------------------------