diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index 9dee646..0000000 --- a/.browserslistrc +++ /dev/null @@ -1,3 +0,0 @@ -> 1% -last 2 versions -not ie <= 8 diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 20b097e..0000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -tests/* \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index bd72a96..ce4e047 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,19 +1,36 @@ module.exports = { - root: true, - env: { - node: true - }, - 'extends': [ - 'plugin:vue/essential', - '@vue/standard' + extends: [ + 'eslint:recommended', + 'plugin:vue/vue3-strongly-recommended', + 'prettier', ], + plugins: ['prettier'], rules: { - 'indent': ['error', 4], - 'semi': 'off', - 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', - 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' + indent: [ + 'error', + 4, + { + SwitchCase: 1, + }, + ], + 'linebreak-style': ['error', 'unix'], + quotes: [ + 'error', + 'single', + { + avoidEscape: true, + }, + ], + 'no-empty': [ + 'error', + { + allowEmptyCatch: true, + }, + ], + semi: 0, + 'no-undef': 0, + 'no-console': 0, + 'vue/html-indent': ['error', 4], + 'vue/max-attributes-per-line': 0, }, - parserOptions: { - parser: 'babel-eslint' - } -} +}; diff --git a/.github/workflows/close-issues.yml b/.github/workflows/close-issues.yml new file mode 100644 index 0000000..2a67c1a --- /dev/null +++ b/.github/workflows/close-issues.yml @@ -0,0 +1,23 @@ +name: Close inactive issues + +on: + schedule: + - cron: "20 1 * * *" + +jobs: + close-issues: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v3 + with: + days-before-issue-stale: 90 + days-before-issue-close: 30 + stale-issue-label: "stale" + stale-issue-message: "This issue is stale because it has been open for 90 days with no activity." + close-issue-message: "This issue was closed because it has been inactive for 30 days since being marked as stale." + days-before-pr-stale: -1 + days-before-pr-close: -1 + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..6e0623a --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,29 @@ +name: Publish to NPM + +on: + release: + types: [created] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + - run: yarn && yarn test + + publish: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - run: yarn && yarn build + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fd6ac1a..08f28e6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,24 +1,17 @@ -name: Tests +name: Run tests on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + branches: [master] jobs: - build: + test: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: - node-version: '14' - - name: Install dependencies - run: yarn - - name: Run tests - run: yarn test + node-version: 16 + - run: yarn && yarn test diff --git a/.gitignore b/.gitignore index 78c0391..6551a5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,24 @@ -.DS_Store -node_modules -/dist/*.html - -# local env files -.env.local -.env.*.local - -# Log files +# Logs +logs +*.log npm-debug.log* yarn-debug.log* yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist-ssr +*.local # Editor directories and files +.vscode/* +!.vscode/extensions.json +!.vscode/settings.json .idea -.vscode +.DS_Store *.suo *.ntvs* *.njsproj *.sln -*.sw* +*.sw? diff --git a/.nowignore b/.nowignore deleted file mode 100644 index 3c3629e..0000000 --- a/.nowignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..9b0bb43 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 4, + "singleQuote": true +} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2af7660..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: node_js -node_js: -- stable - -deploy: - provider: npm - email: gilbert@pellegrom.me - api_key: - secure: coRWDkgvP+3zHqW+GtqD20MVij9XYvn7uS7848eG4Rq1l3MVSuPsOSL1zbWw/a9nX+paIInQMxOSueFK3j3JgHMn0ikqMLG3zw/6QzDOe84QM3oSegynsDfRKxcMtTgeciSArnt5WValC6qv0cqeT4ha1q7AjZEjlEvRtImc0GOYkLVqA1tk3jHA30hQkyJJ9l7oSMzHZmUp1hKEeKrlMKZJMzGPRfblSgXCIpGEdohS5h0LdlowbLiIi8isW/C1vRp7XBkskKjI2THXI94lzYHasQLabPNW3DL1Wra9318LSAWUS9CzHEH+ktobH2mr1hvrs0s5gTaR3VyjNsX9iJd82KGT9yQMz11jmq/OYxAftgVlJadKWt5pPskqCXi2QkGM66vNMJXhGVVysB9YaJ0KhBYbbvtz7y6F2FMrh+zdNCOlgrLk7Q3u+IWnOmBWBv/YYDz/3SB26XnRhljlMrLxETRBiwxtQA8/r6W4v51njC/Jqrt1cAVNaZXSWJIXsYEWgj4Gv1KoJjeoZLYb5fnKMP0S27QFXBZWvjMQJcC40HxFO4/U7r6Zf4EeDkeeUBmV5tSS+9IvcuckUrjxeAKSefXn9BpOFkLXJRHuW0KZ2M+Ef9yY0+SPcVtotuXskeeZYQzpF3gvUl1zwZ/BijtCiEBKNhgqB0C88AQedpM= - on: - tags: true - repo: gilbitron/laravel-vue-pagination \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..eb4a9fd --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "dbaeumer.vscode-eslint", + "johnsoncodehk.volar" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..64da98a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "eslint.validate": [ + "javascript", + "javascriptreact", + "vue" + ], + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, +} diff --git a/LICENSE b/LICENSE index 9ebc9ae..8272308 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/README.md b/README.md index 056c90e..0c22767 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -[![Build Status](https://travis-ci.org/gilbitron/laravel-vue-pagination.svg?branch=master)](https://travis-ci.org/gilbitron/laravel-vue-pagination) [![npm](https://img.shields.io/npm/v/laravel-vue-pagination.svg)](https://www.npmjs.com/package/laravel-vue-pagination) [![Downloads](https://img.shields.io/npm/dt/laravel-vue-pagination.svg)](https://www.npmjs.com/package/laravel-vue-pagination) +[![npm](https://img.shields.io/npm/v/laravel-vue-pagination.svg)](https://www.npmjs.com/package/laravel-vue-pagination) [![Downloads](https://img.shields.io/npm/dt/laravel-vue-pagination.svg)](https://www.npmjs.com/package/laravel-vue-pagination) > Want your logo here? [Sponsor me on GitHub](https://github.com/users/gilbitron/sponsorship) # Laravel Vue Pagination -A Vue.js pagination component for Laravel paginators that works with Bootstrap. +A Vue.js pagination component for Laravel paginators. ## Requirements -* [Vue.js](https://vuejs.org/) 2.x ([Looking for Vue 3 support?](https://github.com/gilbitron/laravel-vue-pagination/issues/124)) -* [Laravel](http://laravel.com/docs/) 5.x +* [Vue.js](https://vuejs.org/) 3 +* [Laravel](http://laravel.com/docs/) 5+ * [Bootstrap](http://getbootstrap.com/) 4 ## Install @@ -28,7 +28,13 @@ See [https://laravel-vue-pagination.now.sh](https://laravel-vue-pagination.now.s Register the component: ```javascript -Vue.component('pagination', require('laravel-vue-pagination')); +import LaravelVuePagination from 'laravel-vue-pagination'; + +export default { + components: { + 'Pagination': LaravelVuePagination + } +} ``` Use the component: @@ -38,33 +44,32 @@ Use the component:
  • {{ post.title }}
  • - + ``` ```javascript export default { - - data() { - return { - // Our data object that holds the Laravel paginator data - laravelData: {}, - } - }, - - mounted() { - // Fetch initial results - this.getResults(); - }, - - methods: { - // Our method to GET results from a Laravel endpoint - getResults(page = 1) { - axios.get('example/results?page=' + page) - .then(response => { - this.laravelData = response.data; - }); - } - } + data() { + return { + // Our data object that holds the Laravel paginator data + laravelData: {}, + } + }, + + mounted() { + // Fetch initial results + this.getResults(); + }, + + methods: { + // Our method to GET results from a Laravel endpoint + getResults(page = 1) { + axios.get('example/results?page=' + page) + .then(response => { + this.laravelData = response.data; + }); + } + } } ``` @@ -75,8 +80,12 @@ Prev/Next buttons can be customized using the `prev-nav` and `next-nav` slots: ```html - < Previous - Next > + + ``` @@ -86,7 +95,7 @@ Prev/Next buttons can be customized using the `prev-nav` and `next-nav` slots: | Name | Type | Description | | --- | --- | --- | -| `data` | Object | An object containing the structure of a [Laravel paginator](https://laravel.com/docs/5.7/pagination) response or a [Laravel API Resource](https://laravel.com/docs/5.7/eloquent-resources) response. | +| `data` | Object | An object containing the structure of a [Laravel paginator](https://laravel.com/docs/8.x/pagination) response or a [Laravel API Resource](https://laravel.com/docs/8.x/eloquent-resources) response. | | `limit` | Number | (optional) Limit of pages to be rendered. `0` shows all pages (default). `-1` will hide numeric pages and leave only arrow navigation. Any positive integer (e.g. `2`) will define how many pages should be shown on either side of the current page when only a range of pages are shown. | | `show-disabled` | Boolean | (optional) Show disabled prev/next buttons instead of hiding them. `false` hides disabled buttons (default). `true` shows disables buttons. | | `size` | String | (optional) One of `small`, `default` or `large` | diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index c8e40fd..0000000 --- a/babel.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - presets: [ - ['@vue/app', { useBuiltIns: false }] - ] -} diff --git a/dist/laravel-vue-pagination.common.js b/dist/laravel-vue-pagination.common.js deleted file mode 100644 index 5739f5b..0000000 --- a/dist/laravel-vue-pagination.common.js +++ /dev/null @@ -1,583 +0,0 @@ -module.exports = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "fb15"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "f6fd": -/***/ (function(module, exports) { - -// document.currentScript polyfill by Adam Miller - -// MIT license - -(function(document){ - var currentScript = "currentScript", - scripts = document.getElementsByTagName('script'); // Live NodeList collection - - // If browser needs currentScript polyfill, add get currentScript() to the document object - if (!(currentScript in document)) { - Object.defineProperty(document, currentScript, { - get: function(){ - - // IE 6-10 supports script readyState - // IE 10+ support stack trace - try { throw new Error(); } - catch (err) { - - // Find the second match for the "at" string to get file src url from stack. - // Specifically works with the format of stack traces in IE. - var i, res = ((/.*at [^\(]*\((.*):.+:.+\)$/ig).exec(err.stack) || [false])[1]; - - // For all scripts on the page, if src matches or if ready state is interactive, return the script tag - for(i in scripts){ - if(scripts[i].src == res || scripts[i].readyState == "interactive"){ - return scripts[i]; - } - } - - // If no match, return null - return null; - } - } - }); - } -})(document); - - -/***/ }), - -/***/ "fb15": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js -// This file is imported into lib/wc client bundles. - -if (typeof window !== 'undefined') { - if (true) { - __webpack_require__("f6fd") - } - - var i - if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) { - __webpack_require__.p = i[1] // eslint-disable-line - } -} - -// Indicate to webpack that this file can be concatenated -/* harmony default export */ var setPublicPath = (null); - -// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d78bd3a-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/LaravelVuePagination.vue?vue&type=template&id=7f71b5a7& -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('renderless-laravel-vue-pagination',{attrs:{"data":_vm.data,"limit":_vm.limit,"show-disabled":_vm.showDisabled,"size":_vm.size,"align":_vm.align},on:{"pagination-change-page":_vm.onPaginationChangePage},scopedSlots:_vm._u([{key:"default",fn:function(ref){ -var data = ref.data; -var limit = ref.limit; -var showDisabled = ref.showDisabled; -var size = ref.size; -var align = ref.align; -var computed = ref.computed; -var prevButtonEvents = ref.prevButtonEvents; -var nextButtonEvents = ref.nextButtonEvents; -var pageButtonEvents = ref.pageButtonEvents; -return (computed.total > computed.perPage)?_c('ul',{staticClass:"pagination",class:{ - 'pagination-sm': size == 'small', - 'pagination-lg': size == 'large', - 'justify-content-center': align == 'center', - 'justify-content-end': align == 'right' - }},[(computed.prevPageUrl || showDisabled)?_c('li',{staticClass:"page-item pagination-prev-nav",class:{'disabled': !computed.prevPageUrl}},[_c('a',_vm._g({staticClass:"page-link",attrs:{"href":"#","aria-label":"Previous","tabindex":!computed.prevPageUrl && -1}},prevButtonEvents),[_vm._t("prev-nav",[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v("«")]),_c('span',{staticClass:"sr-only"},[_vm._v("Previous")])])],2)]):_vm._e(),_vm._l((computed.pageRange),function(page,key){return _c('li',{key:key,staticClass:"page-item pagination-page-nav",class:{ 'active': page == computed.currentPage }},[_c('a',_vm._g({staticClass:"page-link",attrs:{"href":"#"}},pageButtonEvents(page)),[_vm._v("\n "+_vm._s(page)+"\n "),(page == computed.currentPage)?_c('span',{staticClass:"sr-only"},[_vm._v("(current)")]):_vm._e()])])}),(computed.nextPageUrl || showDisabled)?_c('li',{staticClass:"page-item pagination-next-nav",class:{'disabled': !computed.nextPageUrl}},[_c('a',_vm._g({staticClass:"page-link",attrs:{"href":"#","aria-label":"Next","tabindex":!computed.nextPageUrl && -1}},nextButtonEvents),[_vm._t("next-nav",[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v("»")]),_c('span',{staticClass:"sr-only"},[_vm._v("Next")])])],2)]):_vm._e()],2):_vm._e()}}],null,true)})} -var staticRenderFns = [] - - -// CONCATENATED MODULE: ./src/LaravelVuePagination.vue?vue&type=template&id=7f71b5a7& - -// 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/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/RenderlessLaravelVuePagination.vue?vue&type=script&lang=js& -/* harmony default export */ var RenderlessLaravelVuePaginationvue_type_script_lang_js_ = ({ - props: { - data: { - type: Object, - default: function _default() {} - }, - limit: { - type: Number, - default: 0 - }, - showDisabled: { - type: Boolean, - default: false - }, - size: { - type: String, - default: 'default', - validator: function validator(value) { - return ['small', 'default', 'large'].indexOf(value) !== -1; - } - }, - align: { - type: String, - default: 'left', - validator: function validator(value) { - return ['left', 'center', 'right'].indexOf(value) !== -1; - } - } - }, - computed: { - isApiResource: function isApiResource() { - return !!this.data.meta; - }, - currentPage: function currentPage() { - return this.isApiResource ? this.data.meta.current_page : this.data.current_page; - }, - firstPageUrl: function firstPageUrl() { - return this.isApiResource ? this.data.links.first : null; - }, - from: function from() { - return this.isApiResource ? this.data.meta.from : this.data.from; - }, - lastPage: function lastPage() { - return this.isApiResource ? this.data.meta.last_page : this.data.last_page; - }, - lastPageUrl: function lastPageUrl() { - return this.isApiResource ? this.data.links.last : null; - }, - nextPageUrl: function nextPageUrl() { - return this.isApiResource ? this.data.links.next : this.data.next_page_url; - }, - perPage: function perPage() { - return this.isApiResource ? this.data.meta.per_page : this.data.per_page; - }, - prevPageUrl: function prevPageUrl() { - return this.isApiResource ? this.data.links.prev : this.data.prev_page_url; - }, - to: function to() { - return this.isApiResource ? this.data.meta.to : this.data.to; - }, - total: function total() { - return this.isApiResource ? this.data.meta.total : this.data.total; - }, - pageRange: function pageRange() { - if (this.limit === -1) { - return 0; - } - - if (this.limit === 0) { - return this.lastPage; - } - - var current = this.currentPage; - var last = this.lastPage; - var delta = this.limit; - var left = current - delta; - var right = current + delta + 1; - var range = []; - var pages = []; - var l; - - for (var i = 1; i <= last; i++) { - if (i === 1 || i === last || i >= left && i < right) { - range.push(i); - } - } - - range.forEach(function (i) { - if (l) { - if (i - l === 2) { - pages.push(l + 1); - } else if (i - l !== 1) { - pages.push('...'); - } - } - - pages.push(i); - l = i; - }); - return pages; - } - }, - methods: { - previousPage: function previousPage() { - this.selectPage(this.currentPage - 1); - }, - nextPage: function nextPage() { - this.selectPage(this.currentPage + 1); - }, - selectPage: function selectPage(page) { - if (page === '...') { - return; - } - - this.$emit('pagination-change-page', page); - } - }, - render: function render() { - var _this = this; - - return this.$scopedSlots.default({ - data: this.data, - limit: this.limit, - showDisabled: this.showDisabled, - size: this.size, - align: this.align, - computed: { - isApiResource: this.isApiResource, - currentPage: this.currentPage, - firstPageUrl: this.firstPageUrl, - from: this.from, - lastPage: this.lastPage, - lastPageUrl: this.lastPageUrl, - nextPageUrl: this.nextPageUrl, - perPage: this.perPage, - prevPageUrl: this.prevPageUrl, - to: this.to, - total: this.total, - pageRange: this.pageRange - }, - prevButtonEvents: { - click: function click(e) { - e.preventDefault(); - - _this.previousPage(); - } - }, - nextButtonEvents: { - click: function click(e) { - e.preventDefault(); - - _this.nextPage(); - } - }, - pageButtonEvents: function pageButtonEvents(page) { - return { - click: function click(e) { - e.preventDefault(); - - _this.selectPage(page); - } - }; - } - }); - } -}); -// CONCATENATED MODULE: ./src/RenderlessLaravelVuePagination.vue?vue&type=script&lang=js& - /* harmony default export */ var src_RenderlessLaravelVuePaginationvue_type_script_lang_js_ = (RenderlessLaravelVuePaginationvue_type_script_lang_js_); -// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js -/* globals __VUE_SSR_CONTEXT__ */ - -// IMPORTANT: Do NOT use ES2015 features in this file (except for modules). -// This module is a runtime utility for cleaner component module output and will -// be included in the final webpack user bundle. - -function normalizeComponent ( - scriptExports, - render, - staticRenderFns, - functionalTemplate, - injectStyles, - scopeId, - moduleIdentifier, /* server only */ - shadowMode /* vue-cli only */ -) { - // Vue.extend constructor export interop - var options = typeof scriptExports === 'function' - ? scriptExports.options - : scriptExports - - // render functions - if (render) { - options.render = render - options.staticRenderFns = staticRenderFns - options._compiled = true - } - - // functional template - if (functionalTemplate) { - options.functional = true - } - - // scopedId - if (scopeId) { - options._scopeId = 'data-v-' + scopeId - } - - var hook - if (moduleIdentifier) { // server build - hook = function (context) { - // 2.3 injection - context = - context || // cached call - (this.$vnode && this.$vnode.ssrContext) || // stateful - (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional - // 2.2 with runInNewContext: true - if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { - context = __VUE_SSR_CONTEXT__ - } - // inject component styles - if (injectStyles) { - injectStyles.call(this, context) - } - // register component module identifier for async chunk inferrence - if (context && context._registeredComponents) { - context._registeredComponents.add(moduleIdentifier) - } - } - // used by ssr in case component is cached and beforeCreate - // never gets called - options._ssrRegister = hook - } else if (injectStyles) { - hook = shadowMode - ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) } - : injectStyles - } - - if (hook) { - if (options.functional) { - // for template-only hot-reload because in that case the render fn doesn't - // go through the normalizer - options._injectStyles = hook - // register for functioal component in vue file - var originalRender = options.render - options.render = function renderWithStyleInjection (h, context) { - hook.call(context) - return originalRender(h, context) - } - } else { - // inject component registration as beforeCreate hook - var existing = options.beforeCreate - options.beforeCreate = existing - ? [].concat(existing, hook) - : [hook] - } - } - - return { - exports: scriptExports, - options: options - } -} - -// CONCATENATED MODULE: ./src/RenderlessLaravelVuePagination.vue -var RenderlessLaravelVuePagination_render, RenderlessLaravelVuePagination_staticRenderFns - - - - -/* normalize component */ - -var component = normalizeComponent( - src_RenderlessLaravelVuePaginationvue_type_script_lang_js_, - RenderlessLaravelVuePagination_render, - RenderlessLaravelVuePagination_staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var RenderlessLaravelVuePagination = (component.exports); -// 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/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/LaravelVuePagination.vue?vue&type=script&lang=js& -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -/* harmony default export */ var LaravelVuePaginationvue_type_script_lang_js_ = ({ - props: { - data: { - type: Object, - default: function _default() {} - }, - limit: { - type: Number, - default: 0 - }, - showDisabled: { - type: Boolean, - default: false - }, - size: { - type: String, - default: 'default', - validator: function validator(value) { - return ['small', 'default', 'large'].indexOf(value) !== -1; - } - }, - align: { - type: String, - default: 'left', - validator: function validator(value) { - return ['left', 'center', 'right'].indexOf(value) !== -1; - } - } - }, - methods: { - onPaginationChangePage: function onPaginationChangePage(page) { - this.$emit('pagination-change-page', page); - } - }, - components: { - RenderlessLaravelVuePagination: RenderlessLaravelVuePagination - } -}); -// CONCATENATED MODULE: ./src/LaravelVuePagination.vue?vue&type=script&lang=js& - /* harmony default export */ var src_LaravelVuePaginationvue_type_script_lang_js_ = (LaravelVuePaginationvue_type_script_lang_js_); -// CONCATENATED MODULE: ./src/LaravelVuePagination.vue - - - - - -/* normalize component */ - -var LaravelVuePagination_component = normalizeComponent( - src_LaravelVuePaginationvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var LaravelVuePagination = (LaravelVuePagination_component.exports); -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js - - -/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (LaravelVuePagination); - - - -/***/ }) - -/******/ })["default"]; -//# sourceMappingURL=laravel-vue-pagination.common.js.map \ No newline at end of file diff --git a/dist/laravel-vue-pagination.common.js.map b/dist/laravel-vue-pagination.common.js.map deleted file mode 100644 index e738e07..0000000 --- a/dist/laravel-vue-pagination.common.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://laravel-vue-pagination/webpack/bootstrap","webpack://laravel-vue-pagination/./node_modules/current-script-polyfill/currentScript.js","webpack://laravel-vue-pagination/./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js","webpack://laravel-vue-pagination/./src/LaravelVuePagination.vue?06b0","webpack://laravel-vue-pagination/src/RenderlessLaravelVuePagination.vue","webpack://laravel-vue-pagination/./src/RenderlessLaravelVuePagination.vue?d4de","webpack://laravel-vue-pagination/./node_modules/vue-loader/lib/runtime/componentNormalizer.js","webpack://laravel-vue-pagination/./src/RenderlessLaravelVuePagination.vue","webpack://laravel-vue-pagination/src/LaravelVuePagination.vue","webpack://laravel-vue-pagination/./src/LaravelVuePagination.vue?7c0d","webpack://laravel-vue-pagination/./src/LaravelVuePagination.vue","webpack://laravel-vue-pagination/./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js"],"names":[],"mappings":"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A;AACA;AACA;;AACA;AACA;AAJA,OA1BA;AAgCA;AAAA;AACA;AACA;;AACA;AACA;AAJA;AAAA;AAhCA;AAuCA;AAhKA,G;;ACDyU,CAAgB,qJAAG,EAAC,C;;ACA7V;;AAEA;AACA;AACA;;AAEe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AC5FA,IAAI,qCAAM,EAAE,8CAAe;AACuD;AACL;;;AAG7E;AACuF;AACvF,gBAAgB,kBAAU;AAC1B,EAAE,0DAAM;AACR,EAAE,qCAAM;AACR,EAAE,8CAAe;AACjB;AACA;AACA;AACA;;AAEA;;AAEe,oF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgCf;AAEA;AACA;AACA;AACA,kBADA;AAEA;AAFA,KADA;AAKA;AACA,kBADA;AAEA;AAFA,KALA;AASA;AACA,mBADA;AAEA;AAFA,KATA;AAaA;AACA,kBADA;AAEA,wBAFA;AAGA;AACA;AACA;AALA,KAbA;AAoBA;AACA,kBADA;AAEA,qBAFA;AAGA;AACA;AACA;AALA;AApBA,GADA;AA8BA;AACA,0BADA,kCACA,IADA,EACA;AACA;AACA;AAHA,GA9BA;AAoCA;AACA;AADA;AApCA,G;;ACpD+T,CAAgB,iIAAG,EAAC,C;;ACAhP;AAC3B;AACL;;;AAGnE;AACuF;AACvF,IAAI,8BAAS,GAAG,kBAAU;AAC1B,EAAE,gDAAM;AACR,EAAE,MAAM;AACR,EAAE,eAAe;AACjB;AACA;AACA;AACA;;AAEA;;AAEe,uFAAS,Q;;AClBA;AACA;AACT,mGAAG;AACI","file":"laravel-vue-pagination.common.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"fb15\");\n","// document.currentScript polyfill by Adam Miller\n\n// MIT license\n\n(function(document){\n var currentScript = \"currentScript\",\n scripts = document.getElementsByTagName('script'); // Live NodeList collection\n\n // If browser needs currentScript polyfill, add get currentScript() to the document object\n if (!(currentScript in document)) {\n Object.defineProperty(document, currentScript, {\n get: function(){\n\n // IE 6-10 supports script readyState\n // IE 10+ support stack trace\n try { throw new Error(); }\n catch (err) {\n\n // Find the second match for the \"at\" string to get file src url from stack.\n // Specifically works with the format of stack traces in IE.\n var i, res = ((/.*at [^\\(]*\\((.*):.+:.+\\)$/ig).exec(err.stack) || [false])[1];\n\n // For all scripts on the page, if src matches or if ready state is interactive, return the script tag\n for(i in scripts){\n if(scripts[i].src == res || scripts[i].readyState == \"interactive\"){\n return scripts[i];\n }\n }\n\n // If no match, return null\n return null;\n }\n }\n });\n }\n})(document);\n","// This file is imported into lib/wc client bundles.\n\nif (typeof window !== 'undefined') {\n if (process.env.NEED_CURRENTSCRIPT_POLYFILL) {\n require('current-script-polyfill')\n }\n\n var i\n if ((i = window.document.currentScript) && (i = i.src.match(/(.+\\/)[^/]+\\.js(\\?.*)?$/))) {\n __webpack_public_path__ = i[1] // eslint-disable-line\n }\n}\n\n// Indicate to webpack that this file can be concatenated\nexport default null\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('renderless-laravel-vue-pagination',{attrs:{\"data\":_vm.data,\"limit\":_vm.limit,\"show-disabled\":_vm.showDisabled,\"size\":_vm.size,\"align\":_vm.align},on:{\"pagination-change-page\":_vm.onPaginationChangePage},scopedSlots:_vm._u([{key:\"default\",fn:function(ref){\nvar data = ref.data;\nvar limit = ref.limit;\nvar showDisabled = ref.showDisabled;\nvar size = ref.size;\nvar align = ref.align;\nvar computed = ref.computed;\nvar prevButtonEvents = ref.prevButtonEvents;\nvar nextButtonEvents = ref.nextButtonEvents;\nvar pageButtonEvents = ref.pageButtonEvents;\nreturn (computed.total > computed.perPage)?_c('ul',{staticClass:\"pagination\",class:{\n 'pagination-sm': size == 'small',\n 'pagination-lg': size == 'large',\n 'justify-content-center': align == 'center',\n 'justify-content-end': align == 'right'\n }},[(computed.prevPageUrl || showDisabled)?_c('li',{staticClass:\"page-item pagination-prev-nav\",class:{'disabled': !computed.prevPageUrl}},[_c('a',_vm._g({staticClass:\"page-link\",attrs:{\"href\":\"#\",\"aria-label\":\"Previous\",\"tabindex\":!computed.prevPageUrl && -1}},prevButtonEvents),[_vm._t(\"prev-nav\",[_c('span',{attrs:{\"aria-hidden\":\"true\"}},[_vm._v(\"«\")]),_c('span',{staticClass:\"sr-only\"},[_vm._v(\"Previous\")])])],2)]):_vm._e(),_vm._l((computed.pageRange),function(page,key){return _c('li',{key:key,staticClass:\"page-item pagination-page-nav\",class:{ 'active': page == computed.currentPage }},[_c('a',_vm._g({staticClass:\"page-link\",attrs:{\"href\":\"#\"}},pageButtonEvents(page)),[_vm._v(\"\\n \"+_vm._s(page)+\"\\n \"),(page == computed.currentPage)?_c('span',{staticClass:\"sr-only\"},[_vm._v(\"(current)\")]):_vm._e()])])}),(computed.nextPageUrl || showDisabled)?_c('li',{staticClass:\"page-item pagination-next-nav\",class:{'disabled': !computed.nextPageUrl}},[_c('a',_vm._g({staticClass:\"page-link\",attrs:{\"href\":\"#\",\"aria-label\":\"Next\",\"tabindex\":!computed.nextPageUrl && -1}},nextButtonEvents),[_vm._t(\"next-nav\",[_c('span',{attrs:{\"aria-hidden\":\"true\"}},[_vm._v(\"»\")]),_c('span',{staticClass:\"sr-only\"},[_vm._v(\"Next\")])])],2)]):_vm._e()],2):_vm._e()}}],null,true)})}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n","import mod from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","var render, staticRenderFns\nimport script from \"./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"\nexport * from \"./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","\n\n\n","import mod from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./LaravelVuePagination.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./LaravelVuePagination.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./LaravelVuePagination.vue?vue&type=template&id=7f71b5a7&\"\nimport script from \"./LaravelVuePagination.vue?vue&type=script&lang=js&\"\nexport * from \"./LaravelVuePagination.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","import './setPublicPath'\nimport mod from '~entry'\nexport default mod\nexport * from '~entry'\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/laravel-vue-pagination.es.js b/dist/laravel-vue-pagination.es.js new file mode 100644 index 0000000..5da8d4a --- /dev/null +++ b/dist/laravel-vue-pagination.es.js @@ -0,0 +1,286 @@ +import { resolveComponent, openBlock, createBlock, withCtx, createElementBlock, mergeProps, normalizeClass, createElementVNode, toHandlers, renderSlot, createCommentVNode, Fragment, renderList, createTextVNode, toDisplayString } from "vue"; +const _sfc_main$1 = { + emits: ["pagination-change-page"], + props: { + data: { + type: Object, + default: () => { + } + }, + limit: { + type: Number, + default: 0 + }, + showDisabled: { + type: Boolean, + default: false + }, + size: { + type: String, + default: "default", + validator: (value) => { + return ["small", "default", "large"].indexOf(value) !== -1; + } + }, + align: { + type: String, + default: "left", + validator: (value) => { + return ["left", "center", "right"].indexOf(value) !== -1; + } + } + }, + computed: { + isApiResource() { + return !!this.data.meta; + }, + currentPage() { + return this.isApiResource ? this.data.meta.current_page : this.data.current_page; + }, + firstPageUrl() { + return this.isApiResource ? this.data.links.first : null; + }, + from() { + return this.isApiResource ? this.data.meta.from : this.data.from; + }, + lastPage() { + return this.isApiResource ? this.data.meta.last_page : this.data.last_page; + }, + lastPageUrl() { + return this.isApiResource ? this.data.links.last : null; + }, + nextPageUrl() { + return this.isApiResource ? this.data.links.next : this.data.next_page_url; + }, + perPage() { + return this.isApiResource ? this.data.meta.per_page : this.data.per_page; + }, + prevPageUrl() { + return this.isApiResource ? this.data.links.prev : this.data.prev_page_url; + }, + to() { + return this.isApiResource ? this.data.meta.to : this.data.to; + }, + total() { + return this.isApiResource ? this.data.meta.total : this.data.total; + }, + pageRange() { + if (this.limit === -1) { + return 0; + } + if (this.limit === 0) { + return this.lastPage; + } + var current = this.currentPage; + var last = this.lastPage; + var delta = this.limit; + var left = current - delta; + var right = current + delta + 1; + var range = []; + var pages = []; + var l; + for (var i = 1; i <= last; i++) { + if (i === 1 || i === last || i >= left && i < right) { + range.push(i); + } + } + range.forEach(function(i2) { + if (l) { + if (i2 - l === 2) { + pages.push(l + 1); + } else if (i2 - l !== 1) { + pages.push("..."); + } + } + pages.push(i2); + l = i2; + }); + return pages; + } + }, + methods: { + previousPage() { + this.selectPage(this.currentPage - 1); + }, + nextPage() { + this.selectPage(this.currentPage + 1); + }, + selectPage(page) { + if (page === "...") { + return; + } + this.$emit("pagination-change-page", page); + } + }, + render() { + return this.$slots.default({ + data: this.data, + limit: this.limit, + showDisabled: this.showDisabled, + size: this.size, + align: this.align, + computed: { + isApiResource: this.isApiResource, + currentPage: this.currentPage, + firstPageUrl: this.firstPageUrl, + from: this.from, + lastPage: this.lastPage, + lastPageUrl: this.lastPageUrl, + nextPageUrl: this.nextPageUrl, + perPage: this.perPage, + prevPageUrl: this.prevPageUrl, + to: this.to, + total: this.total, + pageRange: this.pageRange + }, + prevButtonEvents: { + click: (e) => { + e.preventDefault(); + this.previousPage(); + } + }, + nextButtonEvents: { + click: (e) => { + e.preventDefault(); + this.nextPage(); + } + }, + pageButtonEvents: (page) => ({ + click: (e) => { + e.preventDefault(); + this.selectPage(page); + } + }) + }); + } +}; +var _export_sfc = (sfc, props) => { + const target = sfc.__vccOpts || sfc; + for (const [key, val] of props) { + target[key] = val; + } + return target; +}; +const _sfc_main = { + inheritAttrs: false, + emits: ["pagination-change-page"], + components: { + RenderlessLaravelVuePagination: _sfc_main$1 + }, + props: { + data: { + type: Object, + default: () => { + } + }, + limit: { + type: Number, + default: 0 + }, + showDisabled: { + type: Boolean, + default: false + }, + size: { + type: String, + default: "default", + validator: (value) => { + return ["small", "default", "large"].indexOf(value) !== -1; + } + }, + align: { + type: String, + default: "left", + validator: (value) => { + return ["left", "center", "right"].indexOf(value) !== -1; + } + } + }, + methods: { + onPaginationChangePage(page) { + this.$emit("pagination-change-page", page); + } + } +}; +const _hoisted_1 = ["tabindex"]; +const _hoisted_2 = /* @__PURE__ */ createElementVNode("span", { "aria-hidden": "true" }, "\xAB", -1); +const _hoisted_3 = /* @__PURE__ */ createElementVNode("span", { class: "sr-only" }, "Previous", -1); +const _hoisted_4 = { + key: 0, + class: "sr-only" +}; +const _hoisted_5 = ["tabindex"]; +const _hoisted_6 = /* @__PURE__ */ createElementVNode("span", { "aria-hidden": "true" }, "\xBB", -1); +const _hoisted_7 = /* @__PURE__ */ createElementVNode("span", { class: "sr-only" }, "Next", -1); +function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { + const _component_RenderlessLaravelVuePagination = resolveComponent("RenderlessLaravelVuePagination"); + return openBlock(), createBlock(_component_RenderlessLaravelVuePagination, { + data: $props.data, + limit: $props.limit, + "show-disabled": $props.showDisabled, + size: $props.size, + align: $props.align, + onPaginationChangePage: $options.onPaginationChangePage + }, { + default: withCtx((slotProps) => [ + slotProps.computed.total > slotProps.computed.perPage ? (openBlock(), createElementBlock("ul", mergeProps({ key: 0 }, _ctx.$attrs, { + class: ["pagination", { + "pagination-sm": slotProps.size == "small", + "pagination-lg": slotProps.size == "large", + "justify-content-center": slotProps.align == "center", + "justify-content-end": slotProps.align == "right" + }] + }), [ + slotProps.computed.prevPageUrl || slotProps.showDisabled ? (openBlock(), createElementBlock("li", { + key: 0, + class: normalizeClass(["page-item pagination-prev-nav", { "disabled": !slotProps.computed.prevPageUrl }]) + }, [ + createElementVNode("a", mergeProps({ + class: "page-link", + href: "#", + "aria-label": "Previous", + tabindex: !slotProps.computed.prevPageUrl && -1 + }, toHandlers(slotProps.prevButtonEvents)), [ + renderSlot(_ctx.$slots, "prev-nav", {}, () => [ + _hoisted_2, + _hoisted_3 + ]) + ], 16, _hoisted_1) + ], 2)) : createCommentVNode("", true), + (openBlock(true), createElementBlock(Fragment, null, renderList(slotProps.computed.pageRange, (page, key) => { + return openBlock(), createElementBlock("li", { + class: normalizeClass(["page-item pagination-page-nav", { "active": page == slotProps.computed.currentPage }]), + key + }, [ + createElementVNode("a", mergeProps({ + class: "page-link", + href: "#" + }, toHandlers(slotProps.pageButtonEvents(page))), [ + createTextVNode(toDisplayString(page) + " ", 1), + page == slotProps.computed.currentPage ? (openBlock(), createElementBlock("span", _hoisted_4, "(current)")) : createCommentVNode("", true) + ], 16) + ], 2); + }), 128)), + slotProps.computed.nextPageUrl || slotProps.showDisabled ? (openBlock(), createElementBlock("li", { + key: 1, + class: normalizeClass(["page-item pagination-next-nav", { "disabled": !slotProps.computed.nextPageUrl }]) + }, [ + createElementVNode("a", mergeProps({ + class: "page-link", + href: "#", + "aria-label": "Next", + tabindex: !slotProps.computed.nextPageUrl && -1 + }, toHandlers(slotProps.nextButtonEvents)), [ + renderSlot(_ctx.$slots, "next-nav", {}, () => [ + _hoisted_6, + _hoisted_7 + ]) + ], 16, _hoisted_5) + ], 2)) : createCommentVNode("", true) + ], 16)) : createCommentVNode("", true) + ]), + _: 3 + }, 8, ["data", "limit", "show-disabled", "size", "align", "onPaginationChangePage"]); +} +var LaravelVuePagination = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); +export { LaravelVuePagination as default }; diff --git a/dist/laravel-vue-pagination.umd.js b/dist/laravel-vue-pagination.umd.js index 027afdc..e311ff5 100644 --- a/dist/laravel-vue-pagination.umd.js +++ b/dist/laravel-vue-pagination.umd.js @@ -1,593 +1 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["laravel-vue-pagination"] = factory(); - else - root["laravel-vue-pagination"] = factory(); -})((typeof self !== 'undefined' ? self : this), function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "fb15"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "f6fd": -/***/ (function(module, exports) { - -// document.currentScript polyfill by Adam Miller - -// MIT license - -(function(document){ - var currentScript = "currentScript", - scripts = document.getElementsByTagName('script'); // Live NodeList collection - - // If browser needs currentScript polyfill, add get currentScript() to the document object - if (!(currentScript in document)) { - Object.defineProperty(document, currentScript, { - get: function(){ - - // IE 6-10 supports script readyState - // IE 10+ support stack trace - try { throw new Error(); } - catch (err) { - - // Find the second match for the "at" string to get file src url from stack. - // Specifically works with the format of stack traces in IE. - var i, res = ((/.*at [^\(]*\((.*):.+:.+\)$/ig).exec(err.stack) || [false])[1]; - - // For all scripts on the page, if src matches or if ready state is interactive, return the script tag - for(i in scripts){ - if(scripts[i].src == res || scripts[i].readyState == "interactive"){ - return scripts[i]; - } - } - - // If no match, return null - return null; - } - } - }); - } -})(document); - - -/***/ }), - -/***/ "fb15": -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js -// This file is imported into lib/wc client bundles. - -if (typeof window !== 'undefined') { - if (true) { - __webpack_require__("f6fd") - } - - var i - if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) { - __webpack_require__.p = i[1] // eslint-disable-line - } -} - -// Indicate to webpack that this file can be concatenated -/* harmony default export */ var setPublicPath = (null); - -// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d78bd3a-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/LaravelVuePagination.vue?vue&type=template&id=7f71b5a7& -var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('renderless-laravel-vue-pagination',{attrs:{"data":_vm.data,"limit":_vm.limit,"show-disabled":_vm.showDisabled,"size":_vm.size,"align":_vm.align},on:{"pagination-change-page":_vm.onPaginationChangePage},scopedSlots:_vm._u([{key:"default",fn:function(ref){ -var data = ref.data; -var limit = ref.limit; -var showDisabled = ref.showDisabled; -var size = ref.size; -var align = ref.align; -var computed = ref.computed; -var prevButtonEvents = ref.prevButtonEvents; -var nextButtonEvents = ref.nextButtonEvents; -var pageButtonEvents = ref.pageButtonEvents; -return (computed.total > computed.perPage)?_c('ul',{staticClass:"pagination",class:{ - 'pagination-sm': size == 'small', - 'pagination-lg': size == 'large', - 'justify-content-center': align == 'center', - 'justify-content-end': align == 'right' - }},[(computed.prevPageUrl || showDisabled)?_c('li',{staticClass:"page-item pagination-prev-nav",class:{'disabled': !computed.prevPageUrl}},[_c('a',_vm._g({staticClass:"page-link",attrs:{"href":"#","aria-label":"Previous","tabindex":!computed.prevPageUrl && -1}},prevButtonEvents),[_vm._t("prev-nav",[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v("«")]),_c('span',{staticClass:"sr-only"},[_vm._v("Previous")])])],2)]):_vm._e(),_vm._l((computed.pageRange),function(page,key){return _c('li',{key:key,staticClass:"page-item pagination-page-nav",class:{ 'active': page == computed.currentPage }},[_c('a',_vm._g({staticClass:"page-link",attrs:{"href":"#"}},pageButtonEvents(page)),[_vm._v("\n "+_vm._s(page)+"\n "),(page == computed.currentPage)?_c('span',{staticClass:"sr-only"},[_vm._v("(current)")]):_vm._e()])])}),(computed.nextPageUrl || showDisabled)?_c('li',{staticClass:"page-item pagination-next-nav",class:{'disabled': !computed.nextPageUrl}},[_c('a',_vm._g({staticClass:"page-link",attrs:{"href":"#","aria-label":"Next","tabindex":!computed.nextPageUrl && -1}},nextButtonEvents),[_vm._t("next-nav",[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v("»")]),_c('span',{staticClass:"sr-only"},[_vm._v("Next")])])],2)]):_vm._e()],2):_vm._e()}}],null,true)})} -var staticRenderFns = [] - - -// CONCATENATED MODULE: ./src/LaravelVuePagination.vue?vue&type=template&id=7f71b5a7& - -// 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/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/RenderlessLaravelVuePagination.vue?vue&type=script&lang=js& -/* harmony default export */ var RenderlessLaravelVuePaginationvue_type_script_lang_js_ = ({ - props: { - data: { - type: Object, - default: function _default() {} - }, - limit: { - type: Number, - default: 0 - }, - showDisabled: { - type: Boolean, - default: false - }, - size: { - type: String, - default: 'default', - validator: function validator(value) { - return ['small', 'default', 'large'].indexOf(value) !== -1; - } - }, - align: { - type: String, - default: 'left', - validator: function validator(value) { - return ['left', 'center', 'right'].indexOf(value) !== -1; - } - } - }, - computed: { - isApiResource: function isApiResource() { - return !!this.data.meta; - }, - currentPage: function currentPage() { - return this.isApiResource ? this.data.meta.current_page : this.data.current_page; - }, - firstPageUrl: function firstPageUrl() { - return this.isApiResource ? this.data.links.first : null; - }, - from: function from() { - return this.isApiResource ? this.data.meta.from : this.data.from; - }, - lastPage: function lastPage() { - return this.isApiResource ? this.data.meta.last_page : this.data.last_page; - }, - lastPageUrl: function lastPageUrl() { - return this.isApiResource ? this.data.links.last : null; - }, - nextPageUrl: function nextPageUrl() { - return this.isApiResource ? this.data.links.next : this.data.next_page_url; - }, - perPage: function perPage() { - return this.isApiResource ? this.data.meta.per_page : this.data.per_page; - }, - prevPageUrl: function prevPageUrl() { - return this.isApiResource ? this.data.links.prev : this.data.prev_page_url; - }, - to: function to() { - return this.isApiResource ? this.data.meta.to : this.data.to; - }, - total: function total() { - return this.isApiResource ? this.data.meta.total : this.data.total; - }, - pageRange: function pageRange() { - if (this.limit === -1) { - return 0; - } - - if (this.limit === 0) { - return this.lastPage; - } - - var current = this.currentPage; - var last = this.lastPage; - var delta = this.limit; - var left = current - delta; - var right = current + delta + 1; - var range = []; - var pages = []; - var l; - - for (var i = 1; i <= last; i++) { - if (i === 1 || i === last || i >= left && i < right) { - range.push(i); - } - } - - range.forEach(function (i) { - if (l) { - if (i - l === 2) { - pages.push(l + 1); - } else if (i - l !== 1) { - pages.push('...'); - } - } - - pages.push(i); - l = i; - }); - return pages; - } - }, - methods: { - previousPage: function previousPage() { - this.selectPage(this.currentPage - 1); - }, - nextPage: function nextPage() { - this.selectPage(this.currentPage + 1); - }, - selectPage: function selectPage(page) { - if (page === '...') { - return; - } - - this.$emit('pagination-change-page', page); - } - }, - render: function render() { - var _this = this; - - return this.$scopedSlots.default({ - data: this.data, - limit: this.limit, - showDisabled: this.showDisabled, - size: this.size, - align: this.align, - computed: { - isApiResource: this.isApiResource, - currentPage: this.currentPage, - firstPageUrl: this.firstPageUrl, - from: this.from, - lastPage: this.lastPage, - lastPageUrl: this.lastPageUrl, - nextPageUrl: this.nextPageUrl, - perPage: this.perPage, - prevPageUrl: this.prevPageUrl, - to: this.to, - total: this.total, - pageRange: this.pageRange - }, - prevButtonEvents: { - click: function click(e) { - e.preventDefault(); - - _this.previousPage(); - } - }, - nextButtonEvents: { - click: function click(e) { - e.preventDefault(); - - _this.nextPage(); - } - }, - pageButtonEvents: function pageButtonEvents(page) { - return { - click: function click(e) { - e.preventDefault(); - - _this.selectPage(page); - } - }; - } - }); - } -}); -// CONCATENATED MODULE: ./src/RenderlessLaravelVuePagination.vue?vue&type=script&lang=js& - /* harmony default export */ var src_RenderlessLaravelVuePaginationvue_type_script_lang_js_ = (RenderlessLaravelVuePaginationvue_type_script_lang_js_); -// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js -/* globals __VUE_SSR_CONTEXT__ */ - -// IMPORTANT: Do NOT use ES2015 features in this file (except for modules). -// This module is a runtime utility for cleaner component module output and will -// be included in the final webpack user bundle. - -function normalizeComponent ( - scriptExports, - render, - staticRenderFns, - functionalTemplate, - injectStyles, - scopeId, - moduleIdentifier, /* server only */ - shadowMode /* vue-cli only */ -) { - // Vue.extend constructor export interop - var options = typeof scriptExports === 'function' - ? scriptExports.options - : scriptExports - - // render functions - if (render) { - options.render = render - options.staticRenderFns = staticRenderFns - options._compiled = true - } - - // functional template - if (functionalTemplate) { - options.functional = true - } - - // scopedId - if (scopeId) { - options._scopeId = 'data-v-' + scopeId - } - - var hook - if (moduleIdentifier) { // server build - hook = function (context) { - // 2.3 injection - context = - context || // cached call - (this.$vnode && this.$vnode.ssrContext) || // stateful - (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional - // 2.2 with runInNewContext: true - if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { - context = __VUE_SSR_CONTEXT__ - } - // inject component styles - if (injectStyles) { - injectStyles.call(this, context) - } - // register component module identifier for async chunk inferrence - if (context && context._registeredComponents) { - context._registeredComponents.add(moduleIdentifier) - } - } - // used by ssr in case component is cached and beforeCreate - // never gets called - options._ssrRegister = hook - } else if (injectStyles) { - hook = shadowMode - ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) } - : injectStyles - } - - if (hook) { - if (options.functional) { - // for template-only hot-reload because in that case the render fn doesn't - // go through the normalizer - options._injectStyles = hook - // register for functioal component in vue file - var originalRender = options.render - options.render = function renderWithStyleInjection (h, context) { - hook.call(context) - return originalRender(h, context) - } - } else { - // inject component registration as beforeCreate hook - var existing = options.beforeCreate - options.beforeCreate = existing - ? [].concat(existing, hook) - : [hook] - } - } - - return { - exports: scriptExports, - options: options - } -} - -// CONCATENATED MODULE: ./src/RenderlessLaravelVuePagination.vue -var RenderlessLaravelVuePagination_render, RenderlessLaravelVuePagination_staticRenderFns - - - - -/* normalize component */ - -var component = normalizeComponent( - src_RenderlessLaravelVuePaginationvue_type_script_lang_js_, - RenderlessLaravelVuePagination_render, - RenderlessLaravelVuePagination_staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var RenderlessLaravelVuePagination = (component.exports); -// 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/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/LaravelVuePagination.vue?vue&type=script&lang=js& -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -/* harmony default export */ var LaravelVuePaginationvue_type_script_lang_js_ = ({ - props: { - data: { - type: Object, - default: function _default() {} - }, - limit: { - type: Number, - default: 0 - }, - showDisabled: { - type: Boolean, - default: false - }, - size: { - type: String, - default: 'default', - validator: function validator(value) { - return ['small', 'default', 'large'].indexOf(value) !== -1; - } - }, - align: { - type: String, - default: 'left', - validator: function validator(value) { - return ['left', 'center', 'right'].indexOf(value) !== -1; - } - } - }, - methods: { - onPaginationChangePage: function onPaginationChangePage(page) { - this.$emit('pagination-change-page', page); - } - }, - components: { - RenderlessLaravelVuePagination: RenderlessLaravelVuePagination - } -}); -// CONCATENATED MODULE: ./src/LaravelVuePagination.vue?vue&type=script&lang=js& - /* harmony default export */ var src_LaravelVuePaginationvue_type_script_lang_js_ = (LaravelVuePaginationvue_type_script_lang_js_); -// CONCATENATED MODULE: ./src/LaravelVuePagination.vue - - - - - -/* normalize component */ - -var LaravelVuePagination_component = normalizeComponent( - src_LaravelVuePaginationvue_type_script_lang_js_, - render, - staticRenderFns, - false, - null, - null, - null - -) - -/* harmony default export */ var LaravelVuePagination = (LaravelVuePagination_component.exports); -// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js - - -/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (LaravelVuePagination); - - - -/***/ }) - -/******/ })["default"]; -}); -//# sourceMappingURL=laravel-vue-pagination.umd.js.map \ No newline at end of file +(function(e,o){typeof exports=="object"&&typeof module!="undefined"?module.exports=o(require("vue")):typeof define=="function"&&define.amd?define(["vue"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,e.LaravelVuePagination=o(e.Vue))})(this,function(e){"use strict";const o={emits:["pagination-change-page"],props:{data:{type:Object,default:()=>{}},limit:{type:Number,default:0},showDisabled:{type:Boolean,default:!1},size:{type:String,default:"default",validator:t=>["small","default","large"].indexOf(t)!==-1},align:{type:String,default:"left",validator:t=>["left","center","right"].indexOf(t)!==-1}},computed:{isApiResource(){return!!this.data.meta},currentPage(){return this.isApiResource?this.data.meta.current_page:this.data.current_page},firstPageUrl(){return this.isApiResource?this.data.links.first:null},from(){return this.isApiResource?this.data.meta.from:this.data.from},lastPage(){return this.isApiResource?this.data.meta.last_page:this.data.last_page},lastPageUrl(){return this.isApiResource?this.data.links.last:null},nextPageUrl(){return this.isApiResource?this.data.links.next:this.data.next_page_url},perPage(){return this.isApiResource?this.data.meta.per_page:this.data.per_page},prevPageUrl(){return this.isApiResource?this.data.links.prev:this.data.prev_page_url},to(){return this.isApiResource?this.data.meta.to:this.data.to},total(){return this.isApiResource?this.data.meta.total:this.data.total},pageRange(){if(this.limit===-1)return 0;if(this.limit===0)return this.lastPage;for(var t=this.currentPage,r=this.lastPage,n=this.limit,d=t-n,c=t+n+1,g=[],s=[],a,i=1;i<=r;i++)(i===1||i===r||i>=d&&i{t.preventDefault(),this.previousPage()}},nextButtonEvents:{click:t=>{t.preventDefault(),this.nextPage()}},pageButtonEvents:t=>({click:r=>{r.preventDefault(),this.selectPage(t)}})})}};var h=(t,r)=>{const n=t.__vccOpts||t;for(const[d,c]of r)n[d]=c;return n};const p={inheritAttrs:!1,emits:["pagination-change-page"],components:{RenderlessLaravelVuePagination:o},props:{data:{type:Object,default:()=>{}},limit:{type:Number,default:0},showDisabled:{type:Boolean,default:!1},size:{type:String,default:"default",validator:t=>["small","default","large"].indexOf(t)!==-1},align:{type:String,default:"left",validator:t=>["left","center","right"].indexOf(t)!==-1}},methods:{onPaginationChangePage(t){this.$emit("pagination-change-page",t)}}},u=["tabindex"],m=e.createElementVNode("span",{"aria-hidden":"true"},"\xAB",-1),f=e.createElementVNode("span",{class:"sr-only"},"Previous",-1),P={key:0,class:"sr-only"},_=["tabindex"],k=e.createElementVNode("span",{"aria-hidden":"true"},"\xBB",-1),x=e.createElementVNode("span",{class:"sr-only"},"Next",-1);function y(t,r,n,d,c,g){const s=e.resolveComponent("RenderlessLaravelVuePagination");return e.openBlock(),e.createBlock(s,{data:n.data,limit:n.limit,"show-disabled":n.showDisabled,size:n.size,align:n.align,onPaginationChangePage:g.onPaginationChangePage},{default:e.withCtx(a=>[a.computed.total>a.computed.perPage?(e.openBlock(),e.createElementBlock("ul",e.mergeProps({key:0},t.$attrs,{class:["pagination",{"pagination-sm":a.size=="small","pagination-lg":a.size=="large","justify-content-center":a.align=="center","justify-content-end":a.align=="right"}]}),[a.computed.prevPageUrl||a.showDisabled?(e.openBlock(),e.createElementBlock("li",{key:0,class:e.normalizeClass(["page-item pagination-prev-nav",{disabled:!a.computed.prevPageUrl}])},[e.createElementVNode("a",e.mergeProps({class:"page-link",href:"#","aria-label":"Previous",tabindex:!a.computed.prevPageUrl&&-1},e.toHandlers(a.prevButtonEvents)),[e.renderSlot(t.$slots,"prev-nav",{},()=>[m,f])],16,u)],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.computed.pageRange,(i,l)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(["page-item pagination-page-nav",{active:i==a.computed.currentPage}]),key:l},[e.createElementVNode("a",e.mergeProps({class:"page-link",href:"#"},e.toHandlers(a.pageButtonEvents(i))),[e.createTextVNode(e.toDisplayString(i)+" ",1),i==a.computed.currentPage?(e.openBlock(),e.createElementBlock("span",P,"(current)")):e.createCommentVNode("",!0)],16)],2))),128)),a.computed.nextPageUrl||a.showDisabled?(e.openBlock(),e.createElementBlock("li",{key:1,class:e.normalizeClass(["page-item pagination-next-nav",{disabled:!a.computed.nextPageUrl}])},[e.createElementVNode("a",e.mergeProps({class:"page-link",href:"#","aria-label":"Next",tabindex:!a.computed.nextPageUrl&&-1},e.toHandlers(a.nextButtonEvents)),[e.renderSlot(t.$slots,"next-nav",{},()=>[k,x])],16,_)],2)):e.createCommentVNode("",!0)],16)):e.createCommentVNode("",!0)]),_:3},8,["data","limit","show-disabled","size","align","onPaginationChangePage"])}var B=h(p,[["render",y]]);return B}); diff --git a/dist/laravel-vue-pagination.umd.js.map b/dist/laravel-vue-pagination.umd.js.map deleted file mode 100644 index 0038ead..0000000 --- a/dist/laravel-vue-pagination.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://laravel-vue-pagination/webpack/universalModuleDefinition","webpack://laravel-vue-pagination/webpack/bootstrap","webpack://laravel-vue-pagination/./node_modules/current-script-polyfill/currentScript.js","webpack://laravel-vue-pagination/./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js","webpack://laravel-vue-pagination/./src/LaravelVuePagination.vue?06b0","webpack://laravel-vue-pagination/src/RenderlessLaravelVuePagination.vue","webpack://laravel-vue-pagination/./src/RenderlessLaravelVuePagination.vue?d4de","webpack://laravel-vue-pagination/./node_modules/vue-loader/lib/runtime/componentNormalizer.js","webpack://laravel-vue-pagination/./src/RenderlessLaravelVuePagination.vue","webpack://laravel-vue-pagination/src/LaravelVuePagination.vue","webpack://laravel-vue-pagination/./src/LaravelVuePagination.vue?7c0d","webpack://laravel-vue-pagination/./src/LaravelVuePagination.vue","webpack://laravel-vue-pagination/./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js"],"names":[],"mappings":"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XA;AAYA;AAZA,OANA;AAoBA;AACA;AACA;;AACA;AACA;AAJA,OApBA;AA0BA;AACA;AACA;;AACA;AACA;AAJA,OA1BA;AAgCA;AAAA;AACA;AACA;;AACA;AACA;AAJA;AAAA;AAhCA;AAuCA;AAhKA,G;;ACDyU,CAAgB,qJAAG,EAAC,C;;ACA7V;;AAEA;AACA;AACA;;AAEe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AC5FA,IAAI,qCAAM,EAAE,8CAAe;AACuD;AACL;;;AAG7E;AACuF;AACvF,gBAAgB,kBAAU;AAC1B,EAAE,0DAAM;AACR,EAAE,qCAAM;AACR,EAAE,8CAAe;AACjB;AACA;AACA;AACA;;AAEA;;AAEe,oF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgCf;AAEA;AACA;AACA;AACA,kBADA;AAEA;AAFA,KADA;AAKA;AACA,kBADA;AAEA;AAFA,KALA;AASA;AACA,mBADA;AAEA;AAFA,KATA;AAaA;AACA,kBADA;AAEA,wBAFA;AAGA;AACA;AACA;AALA,KAbA;AAoBA;AACA,kBADA;AAEA,qBAFA;AAGA;AACA;AACA;AALA;AApBA,GADA;AA8BA;AACA,0BADA,kCACA,IADA,EACA;AACA;AACA;AAHA,GA9BA;AAoCA;AACA;AADA;AApCA,G;;ACpD+T,CAAgB,iIAAG,EAAC,C;;ACAhP;AAC3B;AACL;;;AAGnE;AACuF;AACvF,IAAI,8BAAS,GAAG,kBAAU;AAC1B,EAAE,gDAAM;AACR,EAAE,MAAM;AACR,EAAE,eAAe;AACjB;AACA;AACA;AACA;;AAEA;;AAEe,uFAAS,Q;;AClBA;AACA;AACT,mGAAG;AACI","file":"laravel-vue-pagination.umd.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"laravel-vue-pagination\"] = factory();\n\telse\n\t\troot[\"laravel-vue-pagination\"] = factory();\n})((typeof self !== 'undefined' ? self : this), function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"fb15\");\n","// document.currentScript polyfill by Adam Miller\n\n// MIT license\n\n(function(document){\n var currentScript = \"currentScript\",\n scripts = document.getElementsByTagName('script'); // Live NodeList collection\n\n // If browser needs currentScript polyfill, add get currentScript() to the document object\n if (!(currentScript in document)) {\n Object.defineProperty(document, currentScript, {\n get: function(){\n\n // IE 6-10 supports script readyState\n // IE 10+ support stack trace\n try { throw new Error(); }\n catch (err) {\n\n // Find the second match for the \"at\" string to get file src url from stack.\n // Specifically works with the format of stack traces in IE.\n var i, res = ((/.*at [^\\(]*\\((.*):.+:.+\\)$/ig).exec(err.stack) || [false])[1];\n\n // For all scripts on the page, if src matches or if ready state is interactive, return the script tag\n for(i in scripts){\n if(scripts[i].src == res || scripts[i].readyState == \"interactive\"){\n return scripts[i];\n }\n }\n\n // If no match, return null\n return null;\n }\n }\n });\n }\n})(document);\n","// This file is imported into lib/wc client bundles.\n\nif (typeof window !== 'undefined') {\n if (process.env.NEED_CURRENTSCRIPT_POLYFILL) {\n require('current-script-polyfill')\n }\n\n var i\n if ((i = window.document.currentScript) && (i = i.src.match(/(.+\\/)[^/]+\\.js(\\?.*)?$/))) {\n __webpack_public_path__ = i[1] // eslint-disable-line\n }\n}\n\n// Indicate to webpack that this file can be concatenated\nexport default null\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('renderless-laravel-vue-pagination',{attrs:{\"data\":_vm.data,\"limit\":_vm.limit,\"show-disabled\":_vm.showDisabled,\"size\":_vm.size,\"align\":_vm.align},on:{\"pagination-change-page\":_vm.onPaginationChangePage},scopedSlots:_vm._u([{key:\"default\",fn:function(ref){\nvar data = ref.data;\nvar limit = ref.limit;\nvar showDisabled = ref.showDisabled;\nvar size = ref.size;\nvar align = ref.align;\nvar computed = ref.computed;\nvar prevButtonEvents = ref.prevButtonEvents;\nvar nextButtonEvents = ref.nextButtonEvents;\nvar pageButtonEvents = ref.pageButtonEvents;\nreturn (computed.total > computed.perPage)?_c('ul',{staticClass:\"pagination\",class:{\n 'pagination-sm': size == 'small',\n 'pagination-lg': size == 'large',\n 'justify-content-center': align == 'center',\n 'justify-content-end': align == 'right'\n }},[(computed.prevPageUrl || showDisabled)?_c('li',{staticClass:\"page-item pagination-prev-nav\",class:{'disabled': !computed.prevPageUrl}},[_c('a',_vm._g({staticClass:\"page-link\",attrs:{\"href\":\"#\",\"aria-label\":\"Previous\",\"tabindex\":!computed.prevPageUrl && -1}},prevButtonEvents),[_vm._t(\"prev-nav\",[_c('span',{attrs:{\"aria-hidden\":\"true\"}},[_vm._v(\"«\")]),_c('span',{staticClass:\"sr-only\"},[_vm._v(\"Previous\")])])],2)]):_vm._e(),_vm._l((computed.pageRange),function(page,key){return _c('li',{key:key,staticClass:\"page-item pagination-page-nav\",class:{ 'active': page == computed.currentPage }},[_c('a',_vm._g({staticClass:\"page-link\",attrs:{\"href\":\"#\"}},pageButtonEvents(page)),[_vm._v(\"\\n \"+_vm._s(page)+\"\\n \"),(page == computed.currentPage)?_c('span',{staticClass:\"sr-only\"},[_vm._v(\"(current)\")]):_vm._e()])])}),(computed.nextPageUrl || showDisabled)?_c('li',{staticClass:\"page-item pagination-next-nav\",class:{'disabled': !computed.nextPageUrl}},[_c('a',_vm._g({staticClass:\"page-link\",attrs:{\"href\":\"#\",\"aria-label\":\"Next\",\"tabindex\":!computed.nextPageUrl && -1}},nextButtonEvents),[_vm._t(\"next-nav\",[_c('span',{attrs:{\"aria-hidden\":\"true\"}},[_vm._v(\"»\")]),_c('span',{staticClass:\"sr-only\"},[_vm._v(\"Next\")])])],2)]):_vm._e()],2):_vm._e()}}],null,true)})}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n","import mod from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","var render, staticRenderFns\nimport script from \"./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"\nexport * from \"./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","\n\n\n","import mod from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./LaravelVuePagination.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./LaravelVuePagination.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./LaravelVuePagination.vue?vue&type=template&id=7f71b5a7&\"\nimport script from \"./LaravelVuePagination.vue?vue&type=script&lang=js&\"\nexport * from \"./LaravelVuePagination.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","import './setPublicPath'\nimport mod from '~entry'\nexport default mod\nexport * from '~entry'\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/laravel-vue-pagination.umd.min.js b/dist/laravel-vue-pagination.umd.min.js deleted file mode 100644 index 0903d5e..0000000 --- a/dist/laravel-vue-pagination.umd.min.js +++ /dev/null @@ -1,2 +0,0 @@ -(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["laravel-vue-pagination"]=e():t["laravel-vue-pagination"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function n(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(a,i,function(e){return t[e]}.bind(null,i));return a},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){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="fb15")}({f6fd:function(t,e){(function(t){var e="currentScript",n=t.getElementsByTagName("script");e in t||Object.defineProperty(t,e,{get:function(){try{throw new Error}catch(a){var t,e=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(a.stack)||[!1])[1];for(t in n)if(n[t].src==e||"interactive"==n[t].readyState)return n[t];return null}}})})(document)},fb15:function(t,e,n){"use strict";var a;(n.r(e),"undefined"!==typeof window)&&(n("f6fd"),(a=window.document.currentScript)&&(a=a.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=a[1]));var i,r,s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("renderless-laravel-vue-pagination",{attrs:{data:t.data,limit:t.limit,"show-disabled":t.showDisabled,size:t.size,align:t.align},on:{"pagination-change-page":t.onPaginationChangePage},scopedSlots:t._u([{key:"default",fn:function(e){e.data,e.limit;var a=e.showDisabled,i=e.size,r=e.align,s=e.computed,o=e.prevButtonEvents,l=e.nextButtonEvents,u=e.pageButtonEvents;return s.total>s.perPage?n("ul",{staticClass:"pagination",class:{"pagination-sm":"small"==i,"pagination-lg":"large"==i,"justify-content-center":"center"==r,"justify-content-end":"right"==r}},[s.prevPageUrl||a?n("li",{staticClass:"page-item pagination-prev-nav",class:{disabled:!s.prevPageUrl}},[n("a",t._g({staticClass:"page-link",attrs:{href:"#","aria-label":"Previous",tabindex:!s.prevPageUrl&&-1}},o),[t._t("prev-nav",[n("span",{attrs:{"aria-hidden":"true"}},[t._v("«")]),n("span",{staticClass:"sr-only"},[t._v("Previous")])])],2)]):t._e(),t._l(s.pageRange,(function(e,a){return n("li",{key:a,staticClass:"page-item pagination-page-nav",class:{active:e==s.currentPage}},[n("a",t._g({staticClass:"page-link",attrs:{href:"#"}},u(e)),[t._v("\n "+t._s(e)+"\n "),e==s.currentPage?n("span",{staticClass:"sr-only"},[t._v("(current)")]):t._e()])])})),s.nextPageUrl||a?n("li",{staticClass:"page-item pagination-next-nav",class:{disabled:!s.nextPageUrl}},[n("a",t._g({staticClass:"page-link",attrs:{href:"#","aria-label":"Next",tabindex:!s.nextPageUrl&&-1}},l),[t._t("next-nav",[n("span",{attrs:{"aria-hidden":"true"}},[t._v("»")]),n("span",{staticClass:"sr-only"},[t._v("Next")])])],2)]):t._e()],2):t._e()}}],null,!0)})},o=[],l={props:{data:{type:Object,default:function(){}},limit:{type:Number,default:0},showDisabled:{type:Boolean,default:!1},size:{type:String,default:"default",validator:function(t){return-1!==["small","default","large"].indexOf(t)}},align:{type:String,default:"left",validator:function(t){return-1!==["left","center","right"].indexOf(t)}}},computed:{isApiResource:function(){return!!this.data.meta},currentPage:function(){return this.isApiResource?this.data.meta.current_page:this.data.current_page},firstPageUrl:function(){return this.isApiResource?this.data.links.first:null},from:function(){return this.isApiResource?this.data.meta.from:this.data.from},lastPage:function(){return this.isApiResource?this.data.meta.last_page:this.data.last_page},lastPageUrl:function(){return this.isApiResource?this.data.links.last:null},nextPageUrl:function(){return this.isApiResource?this.data.links.next:this.data.next_page_url},perPage:function(){return this.isApiResource?this.data.meta.per_page:this.data.per_page},prevPageUrl:function(){return this.isApiResource?this.data.links.prev:this.data.prev_page_url},to:function(){return this.isApiResource?this.data.meta.to:this.data.to},total:function(){return this.isApiResource?this.data.meta.total:this.data.total},pageRange:function(){if(-1===this.limit)return 0;if(0===this.limit)return this.lastPage;for(var t,e=this.currentPage,n=this.lastPage,a=this.limit,i=e-a,r=e+a+1,s=[],o=[],l=1;l<=n;l++)(1===l||l===n||l>=i&&l computed.perPage)?_c('ul',{staticClass:\"pagination\",class:{\n 'pagination-sm': size == 'small',\n 'pagination-lg': size == 'large',\n 'justify-content-center': align == 'center',\n 'justify-content-end': align == 'right'\n }},[(computed.prevPageUrl || showDisabled)?_c('li',{staticClass:\"page-item pagination-prev-nav\",class:{'disabled': !computed.prevPageUrl}},[_c('a',_vm._g({staticClass:\"page-link\",attrs:{\"href\":\"#\",\"aria-label\":\"Previous\",\"tabindex\":!computed.prevPageUrl && -1}},prevButtonEvents),[_vm._t(\"prev-nav\",[_c('span',{attrs:{\"aria-hidden\":\"true\"}},[_vm._v(\"«\")]),_c('span',{staticClass:\"sr-only\"},[_vm._v(\"Previous\")])])],2)]):_vm._e(),_vm._l((computed.pageRange),function(page,key){return _c('li',{key:key,staticClass:\"page-item pagination-page-nav\",class:{ 'active': page == computed.currentPage }},[_c('a',_vm._g({staticClass:\"page-link\",attrs:{\"href\":\"#\"}},pageButtonEvents(page)),[_vm._v(\"\\n \"+_vm._s(page)+\"\\n \"),(page == computed.currentPage)?_c('span',{staticClass:\"sr-only\"},[_vm._v(\"(current)\")]):_vm._e()])])}),(computed.nextPageUrl || showDisabled)?_c('li',{staticClass:\"page-item pagination-next-nav\",class:{'disabled': !computed.nextPageUrl}},[_c('a',_vm._g({staticClass:\"page-link\",attrs:{\"href\":\"#\",\"aria-label\":\"Next\",\"tabindex\":!computed.nextPageUrl && -1}},nextButtonEvents),[_vm._t(\"next-nav\",[_c('span',{attrs:{\"aria-hidden\":\"true\"}},[_vm._v(\"»\")]),_c('span',{staticClass:\"sr-only\"},[_vm._v(\"Next\")])])],2)]):_vm._e()],2):_vm._e()}}],null,true)})}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n","import mod from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./RenderlessLaravelVuePagination.vue?vue&type=script&lang=js&\"","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functioal component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","\n\n\n","import mod from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./LaravelVuePagination.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../node_modules/cache-loader/dist/cjs.js??ref--12-0!../node_modules/thread-loader/dist/cjs.js!../node_modules/babel-loader/lib/index.js!../node_modules/cache-loader/dist/cjs.js??ref--0-0!../node_modules/vue-loader/lib/index.js??vue-loader-options!./LaravelVuePagination.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./LaravelVuePagination.vue?vue&type=template&id=7f71b5a7&\"\nimport script from \"./LaravelVuePagination.vue?vue&type=script&lang=js&\"\nexport * from \"./LaravelVuePagination.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","import './setPublicPath'\nimport mod from '~entry'\nexport default mod\nexport * from '~entry'\n"],"sourceRoot":""} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..a08fe86 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + + Laravel Vue Pagination + + +
    + + + diff --git a/jest.config.js b/jest.config.js index c066dec..7370bf1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,23 +1,9 @@ module.exports = { - moduleFileExtensions: [ - 'js', - 'jsx', - 'json', - 'vue' - ], - transform: { - '^.+\\.vue$': 'vue-jest', - '.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', - '^.+\\.jsx?$': 'babel-jest' - }, - moduleNameMapper: { - '^@/(.*)$': '/src/$1' - }, - snapshotSerializers: [ - 'jest-serializer-vue' - ], + preset: 'vite-jest', + testMatch: [ - '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' + '**/tests/unit/**/*.spec.(mjs|jsx)', + '**/__tests__/*.(mjs|jsx)', ], - testURL: 'http://localhost/' -} + testEnvironment: 'jest-environment-jsdom', +}; diff --git a/now.json b/now.json index 9b91bc0..4372793 100644 --- a/now.json +++ b/now.json @@ -1,12 +1,12 @@ { - "version": 2, - "name": "laravel-vue-pagination", - "builds": [{ "src": "package.json", "use": "@now/static-build" }], - "routes": [ - { "src": "^/js/(.*)", "dest": "/js/$1" }, - { "src": "^/css/(.*)", "dest": "/css/$1" }, - { "src": "^/img/(.*)", "dest": "/img/$1" }, - { "src": ".*", "dest": "/index.html" } - ], - "alias": "laravel-vue-pagination" + "version": 2, + "name": "laravel-vue-pagination", + "builds": [{ "src": "package.json", "use": "@now/static-build" }], + "routes": [ + { "src": "^/js/(.*)", "dest": "/js/$1" }, + { "src": "^/css/(.*)", "dest": "/css/$1" }, + { "src": "^/img/(.*)", "dest": "/img/$1" }, + { "src": ".*", "dest": "/index.html" } + ], + "alias": "laravel-vue-pagination" } diff --git a/package.json b/package.json index a96e477..f093838 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "laravel-vue-pagination", - "version": "2.3.2", - "description": "Vue.js pagination component for Laravel paginators and Bootstrap styles", + "version": "3.0.0", + "description": "Vue.js pagination component for Laravel paginators", "author": "Gilbert Pellegrom ", "homepage": "https://github.com/gilbitron/laravel-vue-pagination", "license": "MIT", @@ -16,29 +16,33 @@ "type": "git", "url": "https://github.com/gilbitron/laravel-vue-pagination.git" }, - "main": "dist/laravel-vue-pagination.common.js", + "files": [ + "dist", + "src" + ], + "main": "./dist/laravel-vue-pagination.umd.js", + "module": "./dist/laravel-vue-pagination.es.js", "scripts": { - "serve": "vue-cli-service serve --open", - "build": "vue-cli-service build --target lib src/LaravelVuePagination.vue", - "lint": "vue-cli-service lint", - "test": "vue-cli-service test:unit", - "now-build": "vue-cli-service build", - "deploy": "npm run now-build && now && now alias" + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "lint": "eslint --fix src", + "test": "vite-jest --no-cache" + }, + "dependencies": { + "vue": "^3.2.25" }, "devDependencies": { - "@vue/cli-plugin-babel": "^3.4.1", - "@vue/cli-plugin-eslint": "^3.4.1", - "@vue/cli-plugin-unit-jest": "^3.4.1", - "@vue/cli-service": "^3.4.1", - "@vue/eslint-config-standard": "^4.0.0", - "@vue/test-utils": "^1.0.0-beta.29", - "babel-core": "7.0.0-bridge.0", - "babel-eslint": "^10.0.1", - "babel-jest": "^23.6.0", - "bootstrap": "^4.3.1", - "eslint": "^5.14.1", - "eslint-plugin-vue": "^5.2.2", - "vue": "^2.6.7", - "vue-template-compiler": "^2.6.7" + "@vitejs/plugin-vue": "^2.2.0", + "@vue/test-utils": "^2.0.0-rc.17", + "bootstrap": "^4", + "eslint": "^8.8.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-vue": "^8.4.1", + "jest": "^27.5.1", + "jest-environment-jsdom": "^27.5.1", + "vite": "^2.8.0", + "vite-jest": "^0.1.4" } } diff --git a/postcss.config.js b/postcss.config.js deleted file mode 100644 index 57b9e1c..0000000 --- a/postcss.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - plugins: { - autoprefixer: {} - } -} diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 1ddc57c..0000000 --- a/public/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - Laravel Vue Pagination - - - -
    - - - diff --git a/src/App.vue b/src/App.vue index e06322f..01bd980 100644 --- a/src/App.vue +++ b/src/App.vue @@ -38,24 +38,22 @@
    -
    - + - -
    +
    @@ -100,6 +98,10 @@ const dummyData = [ ]; export default { + components: { + 'BootstrapPagination': LaravelVuePagination + }, + data () { return { laravelData: {}, @@ -167,10 +169,6 @@ export default { this.limit = 0; } } - }, - - components: { - 'pagination': LaravelVuePagination } } diff --git a/src/LaravelVuePagination.vue b/src/LaravelVuePagination.vue index f1119ba..c4c5200 100644 --- a/src/LaravelVuePagination.vue +++ b/src/LaravelVuePagination.vue @@ -1,24 +1,26 @@ diff --git a/src/RenderlessLaravelVuePagination.vue b/src/RenderlessLaravelVuePagination.vue index f695d9a..a4b4baa 100644 --- a/src/RenderlessLaravelVuePagination.vue +++ b/src/RenderlessLaravelVuePagination.vue @@ -1,5 +1,7 @@