├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── .travis.yml ├── LICENSE ├── README.md ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js ├── webpack.docs.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── docs.env.js ├── index.js └── prod.env.js ├── dist ├── vue-bs-pagination.js └── vue-bs-pagination.js.map ├── package.json ├── src ├── components │ └── VuePagination.vue ├── docs │ ├── App.vue │ ├── app.js │ ├── assets │ │ └── img │ │ │ └── vue_logo.png │ ├── components │ │ ├── TheDemo.vue │ │ ├── TheFooter.vue │ │ └── TheHeader.vue │ └── index.html └── main.js ├── static └── .gitkeep └── test └── unit ├── .eslintrc ├── jest.conf.js ├── setup.js └── specs └── VuePagination.spec.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false 5 | }], 6 | "stage-2" 7 | ], 8 | "plugins": ["transform-runtime"], 9 | "env": { 10 | "test": { 11 | "presets": ["env", "stage-2"], 12 | "plugins": ["transform-es2015-modules-commonjs", "dynamic-import-node"] 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /config/ 3 | /dist/ 4 | /*.js 5 | /test/unit/coverage/ 6 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // https://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: true, 11 | }, 12 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 13 | extends: 'standard', 14 | // required to lint *.vue files 15 | plugins: [ 16 | 'html' 17 | ], 18 | // add your custom rules here 19 | rules: { 20 | // allow async-await 21 | 'generator-star-spacing': 'off', 22 | // allow debugger during development 23 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 24 | // allow comma dangle only multiline 25 | 'comma-dangle': ['error', 'only-multiline'], 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /gh-pages/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | /test/unit/coverage/ 8 | 9 | # Editor directories and files 10 | .idea 11 | .vscode 12 | *.suo 13 | *.ntvs* 14 | *.njsproj 15 | *.sln 16 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | "postcss-import": {}, 7 | "autoprefixer": {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: stable 3 | git: 4 | depth: 1 5 | branches: 6 | only: 7 | - master 8 | 9 | # S: Build Lifecycle 10 | install: 11 | - npm install 12 | 13 | script: 14 | - npm run lint 15 | - npm run test 16 | - npm run build-docs 17 | 18 | after_success: 19 | - cd ./gh-pages 20 | - git init 21 | - git config user.name "${GH_USER_NAME}" 22 | - git config user.email "{GH_USER_EMAIL}" 23 | - git add . 24 | - git commit -m "Build docs $(date +%Y%m%d%H%M)" 25 | - git push --force --quiet "https://${GH_TOKEN}@${GH_REPO}" master:gh-pages 26 | # E: Build LifeCycle 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Liu Xinyu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-bs-pagination 2 | 3 | [![build status](https://www.travis-ci.org/meteorlxy/vue-bs-pagination.svg?branch=master)](https://www.travis-ci.org/meteorlxy/vue-bs-pagination) 4 | [![npm version](https://badge.fury.io/js/vue-bs-pagination.svg)](https://badge.fury.io/js/vue-bs-pagination) 5 | 6 | > A very simple vue component - bootstrap pagination 7 | 8 | [Live Demo](https://meteorlxy.github.io/vue-bs-pagination/) 9 | 10 | --- 11 | 12 | ## Get started 13 | 14 | ### Import 15 | 16 | #### Build tools 17 | 18 | Import via `npm` 19 | 20 | ```bash 21 | npm install --save vue-bs-pagination 22 | ``` 23 | 24 | Register component 25 | 26 | ```js 27 | import Vue from 'vue' 28 | import VuePagination from 'vue-bs-pagination' 29 | Vue.component('VuePagination', VuePagination) 30 | ``` 31 | 32 | #### Browser 33 | 34 | Import via ` 38 | ``` 39 | 40 | ### Usage 41 | 42 | #### Template 43 | 44 | In HTML 45 | ```html 46 | 47 | ``` 48 | 49 | In SFC 50 | ```html 51 | 52 | ``` 53 | 54 | #### Stylesheet 55 | 56 | > Use `Bootstrap 3` or `Bootstrap 4.0-beta` 57 | 58 | ### Parameters 59 | 60 | ```js 61 | props: { 62 | total: { 63 | type: Number, 64 | required: true, 65 | validator: val => val > 0, 66 | }, 67 | eachSide: { 68 | type: Number, 69 | default: 1, 70 | validator: val => val >= 0, 71 | }, 72 | } 73 | ``` 74 | 75 | --- 76 | 77 | ## Developing & Contributing 78 | 79 | ``` bash 80 | # install dependencies 81 | npm install 82 | 83 | # serve with hot reload at localhost:8080 84 | npm run dev 85 | ``` 86 | 87 | - `/src/components` the source file of `vue-bs-pagination` component 88 | - `/src/docs` the source file of [github-pages](https://meteorlxy.github.io/vue-bs-pagination/) of this project 89 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const isDocs = process.argv.indexOf('--docs') > 0 12 | const config = isDocs ? require('../config').docs : require('../config').build 13 | const webpackConfig = isDocs ? require('./webpack.docs.conf') : require('./webpack.prod.conf') 14 | 15 | const spinner = ora('building for production...') 16 | spinner.start() 17 | 18 | rm(path.join(config.assetsRoot, config.assetsSubDirectory), err => { 19 | if (err) throw err 20 | webpack(webpackConfig, (err, stats) => { 21 | spinner.stop() 22 | if (err) throw err 23 | process.stdout.write(stats.toString({ 24 | colors: true, 25 | modules: false, 26 | children: false, 27 | chunks: false, 28 | chunkModules: false 29 | }) + '\n\n') 30 | 31 | if (stats.hasErrors()) { 32 | console.log(chalk.red(' Build failed with errors.\n')) 33 | process.exit(1) 34 | } 35 | 36 | console.log(chalk.cyan(' Build complete.\n')) 37 | console.log(chalk.yellow( 38 | ' Tip: built files are meant to be served over an HTTP server.\n' + 39 | ' Opening index.html over file:// won\'t work.\n' 40 | )) 41 | }) 42 | }) 43 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meteorlxy/vue-bs-pagination/661680a43e808b502c72bd19fb7c667974f2fe6d/build/logo.png -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const isDocs = process.argv.indexOf('--docs') > 0 5 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 6 | const packageConfig = require('../package.json') 7 | 8 | exports.assetsPath = function (_path) { 9 | const assetsSubDirectory = isDocs 10 | ? config.docs.assetsSubDirectory 11 | : config.dev.assetsSubDirectory 12 | 13 | return path.posix.join(assetsSubDirectory, _path) 14 | } 15 | 16 | exports.cssLoaders = function (options) { 17 | options = options || {} 18 | 19 | const cssLoader = { 20 | loader: 'css-loader', 21 | options: { 22 | sourceMap: options.sourceMap 23 | } 24 | } 25 | 26 | const postcssLoader = { 27 | loader: 'postcss-loader', 28 | options: { 29 | sourceMap: options.sourceMap 30 | } 31 | } 32 | 33 | // generate loader string to be used with extract text plugin 34 | function generateLoaders (loader, loaderOptions) { 35 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 36 | 37 | if (loader) { 38 | loaders.push({ 39 | loader: loader + '-loader', 40 | options: Object.assign({}, loaderOptions, { 41 | sourceMap: options.sourceMap 42 | }) 43 | }) 44 | } 45 | 46 | // Extract CSS when that option is specified 47 | // (which is the case during production build) 48 | if (options.extract) { 49 | return ExtractTextPlugin.extract({ 50 | use: loaders, 51 | fallback: 'vue-style-loader' 52 | }) 53 | } else { 54 | return ['vue-style-loader'].concat(loaders) 55 | } 56 | } 57 | 58 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 59 | return { 60 | css: generateLoaders(), 61 | postcss: generateLoaders(), 62 | less: generateLoaders('less'), 63 | sass: generateLoaders('sass', { indentedSyntax: true }), 64 | scss: generateLoaders('sass'), 65 | stylus: generateLoaders('stylus'), 66 | styl: generateLoaders('stylus') 67 | } 68 | } 69 | 70 | // Generate loaders for standalone style files (outside of .vue) 71 | exports.styleLoaders = function (options) { 72 | const output = [] 73 | const loaders = exports.cssLoaders(options) 74 | 75 | for (const extension in loaders) { 76 | const loader = loaders[extension] 77 | output.push({ 78 | test: new RegExp('\\.' + extension + '$'), 79 | use: loader 80 | }) 81 | } 82 | 83 | return output 84 | } 85 | 86 | exports.createNotifierCallback = () => { 87 | const notifier = require('node-notifier') 88 | 89 | return (severity, errors) => { 90 | if (severity !== 'error') return 91 | 92 | const error = errors[0] 93 | const filename = error.file && error.file.split('!').pop() 94 | 95 | notifier.notify({ 96 | title: packageConfig.name, 97 | message: severity + ': ' + error.name, 98 | subtitle: filename || '', 99 | icon: path.join(__dirname, 'logo.png') 100 | }) 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const isDocs = process.argv.indexOf('--docs') > 0 6 | const sourceMapEnabled = isProduction 7 | ? isDocs 8 | ? config.docs.productionSourceMap 9 | : config.build.productionSourceMap 10 | : config.dev.cssSourceMap 11 | 12 | module.exports = { 13 | loaders: utils.cssLoaders({ 14 | sourceMap: sourceMapEnabled, 15 | extract: isProduction && isDocs 16 | }), 17 | cssSourceMap: sourceMapEnabled, 18 | cacheBusting: config.dev.cacheBusting, 19 | transformToRequire: { 20 | video: ['src', 'poster'], 21 | source: 'src', 22 | img: 'src', 23 | image: 'xlink:href' 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const vueLoaderConfig = require('./vue-loader.conf') 5 | 6 | function resolve (dir) { 7 | return path.join(__dirname, '..', dir) 8 | } 9 | 10 | module.exports = { 11 | context: path.resolve(__dirname, '../'), 12 | resolve: { 13 | extensions: ['.js', '.vue', '.json'], 14 | alias: { 15 | 'vue$': 'vue/dist/vue.esm.js', 16 | '@': resolve('src'), 17 | } 18 | }, 19 | module: { 20 | rules: [ 21 | { 22 | test: /\.vue$/, 23 | loader: 'vue-loader', 24 | options: vueLoaderConfig 25 | }, 26 | { 27 | test: /\.js$/, 28 | loader: 'babel-loader', 29 | include: [resolve('src'), resolve('test')] 30 | }, 31 | { 32 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 33 | loader: 'url-loader', 34 | options: { 35 | limit: 10000, 36 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 37 | } 38 | }, 39 | { 40 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 41 | loader: 'url-loader', 42 | options: { 43 | limit: 10000, 44 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 45 | } 46 | }, 47 | { 48 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 49 | loader: 'url-loader', 50 | options: { 51 | limit: 10000, 52 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 53 | } 54 | } 55 | ] 56 | }, 57 | node: { 58 | // prevent webpack from injecting useless setImmediate polyfill because Vue 59 | // source contains it (although only uses it if it's native). 60 | setImmediate: false, 61 | // prevent webpack from injecting mocks to Node native modules 62 | // that does not make sense for the client 63 | dgram: 'empty', 64 | fs: 'empty', 65 | net: 'empty', 66 | tls: 'empty', 67 | child_process: 'empty' 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config').dev 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const HtmlWebpackPlugin = require('html-webpack-plugin') 9 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 10 | const portfinder = require('portfinder') 11 | 12 | const HOST = process.env.HOST 13 | const PORT = process.env.PORT && Number(process.env.PORT) 14 | 15 | const createLintingRule = () => ({ 16 | test: /\.(js|vue)$/, 17 | loader: 'eslint-loader', 18 | enforce: 'pre', 19 | include: [path.join(__dirname, '../src'), path.join(__dirname, '../test')], 20 | options: { 21 | formatter: require('eslint-friendly-formatter'), 22 | emitWarning: !config.showEslintErrorsInOverlay 23 | } 24 | }) 25 | 26 | const devWebpackConfig = merge(baseWebpackConfig, { 27 | entry: { 28 | app: './src/docs/app.js' 29 | }, 30 | output: { 31 | path: config.assetsRoot, 32 | filename: '[name].js', 33 | publicPath: config.assetsPublicPath 34 | }, 35 | module: { 36 | rules: [ 37 | ...(utils.styleLoaders({ sourceMap: config.cssSourceMap, usePostCSS: true })), 38 | ...(config.useEslint ? [createLintingRule()] : []), 39 | ] 40 | }, 41 | // cheap-module-eval-source-map is faster for development 42 | devtool: config.devtool, 43 | 44 | // these devServer options should be customized in /config/index.js 45 | devServer: { 46 | clientLogLevel: 'warning', 47 | historyApiFallback: true, 48 | hot: true, 49 | compress: true, 50 | host: HOST || config.host, 51 | port: PORT || config.port, 52 | open: config.autoOpenBrowser, 53 | overlay: config.errorOverlay 54 | ? { warnings: false, errors: true } 55 | : false, 56 | publicPath: config.assetsPublicPath, 57 | proxy: config.proxyTable, 58 | quiet: true, // necessary for FriendlyErrorsPlugin 59 | watchOptions: { 60 | poll: config.poll, 61 | } 62 | }, 63 | plugins: [ 64 | new webpack.DefinePlugin({ 65 | 'process.env': require('../config/dev.env') 66 | }), 67 | new webpack.HotModuleReplacementPlugin(), 68 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 69 | new webpack.NoEmitOnErrorsPlugin(), 70 | // https://github.com/ampedandwired/html-webpack-plugin 71 | new HtmlWebpackPlugin({ 72 | filename: 'index.html', 73 | template: 'src/docs/index.html', 74 | inject: true 75 | }), 76 | ] 77 | }) 78 | 79 | module.exports = new Promise((resolve, reject) => { 80 | portfinder.basePort = process.env.PORT || config.port 81 | portfinder.getPort((err, port) => { 82 | if (err) { 83 | reject(err) 84 | } else { 85 | // publish the new Port, necessary for e2e tests 86 | process.env.PORT = port 87 | // add port to devServer config 88 | devWebpackConfig.devServer.port = port 89 | 90 | // Add FriendlyErrorsPlugin 91 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 92 | compilationSuccessInfo: { 93 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 94 | }, 95 | onErrors: config.notifyOnErrors 96 | ? utils.createNotifierCallback() 97 | : undefined 98 | })) 99 | 100 | resolve(devWebpackConfig) 101 | } 102 | }) 103 | }) 104 | -------------------------------------------------------------------------------- /build/webpack.docs.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 13 | 14 | const webpackConfig = merge(baseWebpackConfig, { 15 | entry: { 16 | app: './src/docs/app.js' 17 | }, 18 | module: { 19 | rules: utils.styleLoaders({ 20 | sourceMap: config.docs.productionSourceMap, 21 | extract: true, 22 | usePostCSS: true 23 | }) 24 | }, 25 | devtool: config.docs.productionSourceMap ? config.docs.devtool : false, 26 | output: { 27 | path: config.docs.assetsRoot, 28 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 29 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js'), 30 | publicPath: config.docs.assetsPublicPath 31 | }, 32 | plugins: [ 33 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 34 | new webpack.DefinePlugin({ 35 | 'process.env': require('../config/docs.env') 36 | }), 37 | new UglifyJsPlugin({ 38 | uglifyOptions: { 39 | compress: { 40 | warnings: false 41 | } 42 | }, 43 | sourceMap: config.docs.productionSourceMap, 44 | parallel: true 45 | }), 46 | // extract css into its own file 47 | new ExtractTextPlugin({ 48 | filename: utils.assetsPath('css/[name].[contenthash].css'), 49 | // set the following option to `true` if you want to extract CSS from 50 | // codesplit chunks into this main css file as well. 51 | // This will result in *all* of your app's CSS being loaded upfront. 52 | allChunks: false, 53 | }), 54 | // Compress extracted CSS. We are using this plugin so that possible 55 | // duplicated CSS from different components can be deduped. 56 | new OptimizeCSSPlugin({ 57 | cssProcessorOptions: config.docs.productionSourceMap 58 | ? { safe: true, map: { inline: false } } 59 | : { safe: true } 60 | }), 61 | // generate dist index.html with correct asset hash for caching. 62 | // you can customize output by editing /index.html 63 | // see https://github.com/ampedandwired/html-webpack-plugin 64 | new HtmlWebpackPlugin({ 65 | filename: process.env.NODE_ENV === 'testing' 66 | ? 'index.html' 67 | : config.docs.index, 68 | template: 'src/docs/index.html', 69 | inject: true, 70 | minify: { 71 | removeComments: true, 72 | collapseWhitespace: true, 73 | removeAttributeQuotes: true 74 | // more options: 75 | // https://github.com/kangax/html-minifier#options-quick-reference 76 | }, 77 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 78 | chunksSortMode: 'dependency' 79 | }), 80 | // keep module.id stable when vender modules does not change 81 | new webpack.HashedModuleIdsPlugin(), 82 | // enable scope hoisting 83 | new webpack.optimize.ModuleConcatenationPlugin(), 84 | // split vendor js into its own file 85 | new webpack.optimize.CommonsChunkPlugin({ 86 | name: 'vendor', 87 | minChunks (module) { 88 | // any required modules inside node_modules are extracted to vendor 89 | return ( 90 | module.resource && 91 | /\.js$/.test(module.resource) && 92 | module.resource.indexOf( 93 | path.join(__dirname, '../node_modules') 94 | ) === 0 95 | ) 96 | } 97 | }), 98 | // extract webpack runtime and module manifest to its own file in order to 99 | // prevent vendor hash from being updated whenever app bundle is updated 100 | new webpack.optimize.CommonsChunkPlugin({ 101 | name: 'manifest', 102 | minChunks: Infinity 103 | }), 104 | // This instance extracts shared chunks from code splitted chunks and bundles them 105 | // in a separate chunk, similar to the vendor chunk 106 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk 107 | new webpack.optimize.CommonsChunkPlugin({ 108 | name: 'app', 109 | async: 'vendor-async', 110 | children: true, 111 | minChunks: 3 112 | }), 113 | 114 | // copy custom static assets 115 | new CopyWebpackPlugin([ 116 | { 117 | from: path.resolve(__dirname, '../static'), 118 | to: config.docs.assetsSubDirectory, 119 | ignore: ['.*'] 120 | } 121 | ]) 122 | ] 123 | }) 124 | 125 | if (config.docs.productionGzip) { 126 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 127 | 128 | webpackConfig.plugins.push( 129 | new CompressionWebpackPlugin({ 130 | asset: '[path].gz[query]', 131 | algorithm: 'gzip', 132 | test: new RegExp( 133 | '\\.(' + 134 | config.docs.productionGzipExtensions.join('|') + 135 | ')$' 136 | ), 137 | threshold: 10240, 138 | minRatio: 0.8 139 | }) 140 | ) 141 | } 142 | 143 | if (config.docs.bundleAnalyzerReport) { 144 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 145 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 146 | } 147 | 148 | module.exports = webpackConfig 149 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 9 | 10 | const webpackConfig = merge(baseWebpackConfig, { 11 | entry: { 12 | app: './src/main.js' 13 | }, 14 | module: { 15 | rules: utils.styleLoaders({ 16 | sourceMap: config.build.productionSourceMap, 17 | extract: true, 18 | usePostCSS: true 19 | }) 20 | }, 21 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 22 | output: { 23 | path: config.build.assetsRoot, 24 | filename: 'vue-bs-pagination.js', 25 | library: 'VuePagination', 26 | libraryTarget: 'umd' 27 | }, 28 | plugins: [ 29 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 30 | new webpack.DefinePlugin({ 31 | 'process.env': require('../config/prod.env') 32 | }), 33 | new UglifyJsPlugin({ 34 | uglifyOptions: { 35 | compress: { 36 | warnings: false 37 | } 38 | }, 39 | sourceMap: config.build.productionSourceMap, 40 | parallel: true 41 | }), 42 | ] 43 | }) 44 | 45 | if (config.build.productionGzip) { 46 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 47 | 48 | webpackConfig.plugins.push( 49 | new CompressionWebpackPlugin({ 50 | asset: '[path].gz[query]', 51 | algorithm: 'gzip', 52 | test: new RegExp( 53 | '\\.(' + 54 | config.build.productionGzipExtensions.join('|') + 55 | ')$' 56 | ), 57 | threshold: 10240, 58 | minRatio: 0.8 59 | }) 60 | ) 61 | } 62 | 63 | if (config.build.bundleAnalyzerReport) { 64 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 65 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 66 | } 67 | 68 | module.exports = webpackConfig 69 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /config/docs.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.2.5 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '/', 13 | proxyTable: {}, 14 | 15 | // Various Dev Server settings 16 | host: '0.0.0.0', // can be overwritten by process.env.HOST 17 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 18 | autoOpenBrowser: false, 19 | errorOverlay: true, 20 | notifyOnErrors: true, 21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 22 | 23 | // Use Eslint Loader? 24 | // If true, your code will be linted during bundling and 25 | // linting errors and warnings will be shown in the console. 26 | useEslint: true, 27 | // If true, eslint errors and warnings will also be shown in the error overlay 28 | // in the browser. 29 | showEslintErrorsInOverlay: false, 30 | 31 | /** 32 | * Source Maps 33 | */ 34 | 35 | // https://webpack.js.org/configuration/devtool/#development 36 | devtool: 'eval-source-map', 37 | 38 | // If you have problems debugging vue-files in devtools, 39 | // set this to false - it *may* help 40 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 41 | cacheBusting: true, 42 | 43 | // CSS Sourcemaps off by default because relative paths are "buggy" 44 | // with this option, according to the CSS-Loader README 45 | // (https://github.com/webpack/css-loader#sourcemaps) 46 | // In our experience, they generally work as expected, 47 | // just be aware of this issue when enabling this option. 48 | cssSourceMap: false, 49 | }, 50 | 51 | build: { 52 | // Paths 53 | assetsRoot: path.resolve(__dirname, '../dist'), 54 | assetsSubDirectory: 'static', 55 | 56 | /** 57 | * Source Maps 58 | */ 59 | productionSourceMap: true, 60 | // https://webpack.js.org/configuration/devtool/#production 61 | devtool: '#source-map', 62 | 63 | // Gzip off by default as many popular static hosts such as 64 | // Surge or Netlify already gzip all static assets for you. 65 | // Before setting to `true`, make sure to: 66 | // npm install --save-dev compression-webpack-plugin 67 | productionGzip: false, 68 | productionGzipExtensions: ['js', 'css'], 69 | 70 | // Run the build command with an extra argument to 71 | // View the bundle analyzer report after build finishes: 72 | // `npm run build --report` 73 | // Set to `true` or `false` to always turn it on or off 74 | bundleAnalyzerReport: process.env.npm_config_report 75 | }, 76 | 77 | docs: { 78 | // Template for index.html 79 | index: path.resolve(__dirname, '../gh-pages/index.html'), 80 | 81 | // Paths 82 | assetsRoot: path.resolve(__dirname, '../gh-pages'), 83 | assetsSubDirectory: 'static', 84 | assetsPublicPath: '', 85 | 86 | /** 87 | * Source Maps 88 | */ 89 | productionSourceMap: true, 90 | // https://webpack.js.org/configuration/devtool/#production 91 | devtool: '#source-map', 92 | 93 | // Gzip off by default as many popular static hosts such as 94 | // Surge or Netlify already gzip all static assets for you. 95 | // Before setting to `true`, make sure to: 96 | // npm install --save-dev compression-webpack-plugin 97 | productionGzip: false, 98 | productionGzipExtensions: ['js', 'css'], 99 | 100 | // Run the build command with an extra argument to 101 | // View the bundle analyzer report after build finishes: 102 | // `npm run build --report` 103 | // Set to `true` or `false` to always turn it on or off 104 | bundleAnalyzerReport: process.env.npm_config_report 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /dist/vue-bs-pagination.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VuePagination=t():e.VuePagination=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(a){if(n[a])return n[a].exports;var r=n[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n(1);t.default=a.a,"undefined"!=typeof window&&window.Vue&&window.Vue.component("VuePagination",a.a)},function(e,t,n){"use strict";var a=n(8),r=n(9),i=function(e){n(2)},s=n(7)(a.a,r.a,!1,i,null,null);t.a=s.exports},function(e,t,n){var a=n(3);"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);n(5)("8f62a7f4",a,!0)},function(e,t,n){(e.exports=n(4)(!0)).push([e.i,"\n.pagination a.page-link:not(.disabled) {\n cursor: pointer;\n}\n","",{version:3,sources:["/workspace/projects/meteorlxy/vue-bs-pagination/src/components/VuePagination.vue"],names:[],mappings:";AACA;EACE,gBAAgB;CACjB",file:"VuePagination.vue",sourcesContent:["\n.pagination a.page-link:not(.disabled) {\n cursor: pointer;\n}\n"],sourceRoot:""}])},function(e,t){function n(e,t){var n=e[1]||"",a=e[3];if(!a)return n;if(t&&"function"==typeof btoa){var r=function(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}(a),i=a.sources.map(function(e){return"/*# sourceURL="+a.sourceRoot+e+" */"});return[n].concat(i).concat([r]).join("\n")}return[n].join("\n")}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var a=n(t,e);return t[2]?"@media "+t[2]+"{"+a+"}":a}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var a={},r=0;rn.parts.length&&(a.parts.length=n.parts.length)}else{var s=[];for(r=0;r0}},total:{type:Number,required:!0,validator:function(e){return e>0}},eachSide:{type:Number,default:1,validator:function(e){return e>=0}}},computed:{firstPage:function(){return 1},lastPage:function(){return this.total},onFirstPage:function(){return this.currentPage===this.firstPage},onLastPage:function(){return this.currentPage===this.lastPage},currentPage:function(){return this.value},paginators:function(){var e=[];if(this.lastPage<2*this.eachSide+4)for(var t=this.firstPage;t=this.firstPage&&this.$emit("input",e)}}}},function(e,t,n){"use strict";var a={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("ul",{staticClass:"pagination"},[n("li",{staticClass:"page-item",class:{disabled:e.onFirstPage}},[n("a",{staticClass:"page-link",attrs:{rel:"prev","aria-label":"Previous"},on:{click:function(t){t.preventDefault(),e.prevPage(t)}}},[n("span",{attrs:{"aria-hidden":"true"}},[e._v("«")])])]),e._v(" "),e._l(e.paginators,function(t){return n("li",{staticClass:"page-item",class:{active:t.value===e.currentPage,disabled:!t.enable}},[n("a",{staticClass:"page-link",attrs:{disabled:!t.enable},on:{click:function(n){n.preventDefault(),e.setPage(t.value)}}},[n("span",[e._v(e._s(t.value))])])])}),e._v(" "),n("li",{staticClass:"page-item",class:{disabled:e.onLastPage}},[n("a",{staticClass:"page-link",attrs:{rel:"next","aria-label":"Next"},on:{click:function(t){t.preventDefault(),e.nextPage(t)}}},[n("span",{attrs:{"aria-hidden":"true"}},[e._v("»")])])])],2)},staticRenderFns:[]};t.a=a}])}); 2 | //# sourceMappingURL=vue-bs-pagination.js.map -------------------------------------------------------------------------------- /dist/vue-bs-pagination.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 531b34a595b261a41e34","webpack:///./src/main.js","webpack:///./src/components/VuePagination.vue","webpack:///./src/components/VuePagination.vue?2d8f","webpack:///./src/components/VuePagination.vue?a715","webpack:///./node_modules/_css-loader@0.28.7@css-loader/lib/css-base.js","webpack:///./node_modules/_vue-style-loader@3.0.3@vue-style-loader/lib/addStylesClient.js","webpack:///./node_modules/_vue-style-loader@3.0.3@vue-style-loader/lib/listToStyles.js","webpack:///./node_modules/_vue-loader@13.5.0@vue-loader/lib/component-normalizer.js","webpack:///src/components/VuePagination.vue","webpack:///./src/components/VuePagination.vue?9335"],"names":["root","factory","exports","module","define","amd","self","this","__webpack_require__","moduleId","installedModules","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","__WEBPACK_IMPORTED_MODULE_0__components_VuePagination__","window","Vue","component","__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_13_5_0_vue_loader_lib_template_compiler_index_id_data_v_6006ba89_hasScoped_false_transformToRequire_video_src_poster_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_13_5_0_vue_loader_lib_selector_type_template_index_0_VuePagination_vue__","__vue_styles__","ssrContext","Component","normalizeComponent","__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_5_0_vue_loader_lib_selector_type_script_index_0_VuePagination_vue__","content","locals","push","version","sources","names","mappings","file","sourcesContent","sourceRoot","cssWithMappingToString","item","useSourceMap","cssMapping","btoa","sourceMapping","sourceMap","unescape","encodeURIComponent","JSON","stringify","toComment","sourceURLs","map","source","concat","join","list","toString","mediaQuery","alreadyImportedModules","length","id","addStylesToDom","styles","domStyle","stylesInDom","refs","j","parts","addStyle","createStyleElement","styleElement","document","createElement","type","head","appendChild","obj","update","remove","querySelector","isProduction","noop","parentNode","removeChild","isOldIE","styleIndex","singletonCounter","singletonElement","applyToSingletonTag","bind","css","media","setAttribute","styleSheet","cssText","firstChild","createTextNode","newObj","index","replaceText","cssNode","childNodes","insertBefore","hasDocument","DEBUG","Error","listToStyles","getElementsByTagName","navigator","test","userAgent","toLowerCase","parentId","_isProduction","newList","mayRemove","textStore","replacement","filter","Boolean","newStyles","part","rawScriptExports","compiledTemplate","functionalTemplate","injectStyles","scopeId","moduleIdentifier","esModule","scriptExports","default","options","render","staticRenderFns","_compiled","functional","_scopeId","hook","context","$vnode","parent","__VUE_SSR_CONTEXT__","_registeredComponents","add","_ssrRegister","existing","beforeCreate","_injectStyles","h","Number","total","firstPage","lastPage","value","_i","_i2","_i3","paginators","targetPage","esExports","_vm","_h","$createElement","_c","_self","staticClass","class","disabled","onFirstPage","attrs","rel","aria-label","on","click","$event","preventDefault","prevPage","aria-hidden","_v","_l","paginator","active","currentPage","enable","setPage","_s","onLastPage","nextPage"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,cAAAD,IAEAD,EAAA,cAAAC,IARA,CASC,oBAAAK,UAAAC,KAAA,WACD,mBCNA,SAAAC,EAAAC,GAGA,GAAAC,EAAAD,GACA,OAAAC,EAAAD,GAAAP,QAGA,IAAAC,EAAAO,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAV,YAUA,OANAW,EAAAJ,GAAAK,KAAAX,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,GAAA,EAGAT,EAAAD,QAvBA,IAAAQ,KA4DA,OAhCAF,EAAAO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,YAAA,YAAAC,OAA+Be,OAAAD,EAAA3B,QAAAO,EAAAsB,YAAAf,UAAAa,EAAAG,UAA2EpB,EAAA,KAAUE,YAAA,YAAAI,OAA+BF,UAAAa,EAAAG,QAA6BX,IAAKC,MAAA,SAAAC,GAAyBA,EAAAC,iBAAwBf,EAAAwB,QAAAJ,EAAA3B,WAA+BU,EAAA,QAAAH,EAAAkB,GAAAlB,EAAAyB,GAAAL,EAAA3B,gBAAmDO,EAAAkB,GAAA,KAAAf,EAAA,MAAuBE,YAAA,YAAAC,OAA+BC,SAAAP,EAAA0B,cAA4BvB,EAAA,KAAUE,YAAA,YAAAI,OAA+BC,IAAA,OAAAC,aAAA,QAAiCC,IAAKC,MAAA,SAAAC,GAAyBA,EAAAC,iBAAwBf,EAAA2B,SAAAb,OAAuBX,EAAA,QAAaM,OAAOQ,cAAA,UAAsBjB,EAAAkB,GAAA,gBAEpiC7C,oBACjBpH,EAAA","file":"vue-bs-pagination.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[\"VuePagination\"] = factory();\n\telse\n\t\troot[\"VuePagination\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \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, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\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 \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 531b34a595b261a41e34","import VuePagination from './components/VuePagination'\n\nexport default VuePagination\n\nif (typeof window !== 'undefined' && window.Vue) {\n window.Vue.component('VuePagination', VuePagination)\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/main.js","function injectStyle (ssrContext) {\n require(\"!!vue-style-loader!css-loader?{\\\"sourceMap\\\":true}!../../node_modules/_vue-loader@13.5.0@vue-loader/lib/style-compiler/index?{\\\"vue\\\":true,\\\"id\\\":\\\"data-v-6006ba89\\\",\\\"scoped\\\":false,\\\"hasInlineConfig\\\":false}!sass-loader?{\\\"sourceMap\\\":true}!../../node_modules/_vue-loader@13.5.0@vue-loader/lib/selector?type=styles&index=0!./VuePagination.vue\")\n}\nvar normalizeComponent = require(\"!../../node_modules/_vue-loader@13.5.0@vue-loader/lib/component-normalizer\")\n/* script */\nimport __vue_script__ from \"!!babel-loader!../../node_modules/_vue-loader@13.5.0@vue-loader/lib/selector?type=script&index=0!./VuePagination.vue\"\n/* template */\nimport __vue_template__ from \"!!../../node_modules/_vue-loader@13.5.0@vue-loader/lib/template-compiler/index?{\\\"id\\\":\\\"data-v-6006ba89\\\",\\\"hasScoped\\\":false,\\\"transformToRequire\\\":{\\\"video\\\":[\\\"src\\\",\\\"poster\\\"],\\\"source\\\":\\\"src\\\",\\\"img\\\":\\\"src\\\",\\\"image\\\":\\\"xlink:href\\\"},\\\"buble\\\":{\\\"transforms\\\":{}}}!../../node_modules/_vue-loader@13.5.0@vue-loader/lib/selector?type=template&index=0!./VuePagination.vue\"\n/* template functional */\nvar __vue_template_functional__ = false\n/* styles */\nvar __vue_styles__ = injectStyle\n/* scopeId */\nvar __vue_scopeId__ = null\n/* moduleIdentifier (server only) */\nvar __vue_module_identifier__ = null\nvar Component = normalizeComponent(\n __vue_script__,\n __vue_template__,\n __vue_template_functional__,\n __vue_styles__,\n __vue_scopeId__,\n __vue_module_identifier__\n)\n\nexport default Component.exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/components/VuePagination.vue\n// module id = 1\n// module chunks = 0","// style-loader: Adds some css to the DOM by adding a \n\n\n// WEBPACK FOOTER //\n// src/components/VuePagination.vue","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{staticClass:\"pagination\"},[_c('li',{staticClass:\"page-item\",class:{ disabled: _vm.onFirstPage }},[_c('a',{staticClass:\"page-link\",attrs:{\"rel\":\"prev\",\"aria-label\":\"Previous\"},on:{\"click\":function($event){$event.preventDefault();_vm.prevPage($event)}}},[_c('span',{attrs:{\"aria-hidden\":\"true\"}},[_vm._v(\"«\")])])]),_vm._v(\" \"),_vm._l((_vm.paginators),function(paginator){return _c('li',{staticClass:\"page-item\",class:{ active: paginator.value === _vm.currentPage, disabled: !paginator.enable}},[_c('a',{staticClass:\"page-link\",attrs:{\"disabled\":!paginator.enable},on:{\"click\":function($event){$event.preventDefault();_vm.setPage(paginator.value)}}},[_c('span',[_vm._v(_vm._s(paginator.value))])])])}),_vm._v(\" \"),_c('li',{staticClass:\"page-item\",class:{ disabled: _vm.onLastPage }},[_c('a',{staticClass:\"page-link\",attrs:{\"rel\":\"next\",\"aria-label\":\"Next\"},on:{\"click\":function($event){$event.preventDefault();_vm.nextPage($event)}}},[_c('span',{attrs:{\"aria-hidden\":\"true\"}},[_vm._v(\"»\")])])])],2)}\nvar staticRenderFns = []\nvar esExports = { render: render, staticRenderFns: staticRenderFns }\nexport default esExports\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/_vue-loader@13.5.0@vue-loader/lib/template-compiler?{\"id\":\"data-v-6006ba89\",\"hasScoped\":false,\"transformToRequire\":{\"video\":[\"src\",\"poster\"],\"source\":\"src\",\"img\":\"src\",\"image\":\"xlink:href\"},\"buble\":{\"transforms\":{}}}!./node_modules/_vue-loader@13.5.0@vue-loader/lib/selector.js?type=template&index=0!./src/components/VuePagination.vue\n// module id = 9\n// module chunks = 0"],"sourceRoot":""} -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-bs-pagination", 3 | "version": "1.1.2", 4 | "description": "A very simple vue component - bootstrap pagination", 5 | "author": "meteorlxy ", 6 | "keywords": [ 7 | "vue", 8 | "bootstrap", 9 | "pagination" 10 | ], 11 | "license": "MIT", 12 | "main": "dist/vue-bs-pagination.js", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/meteorlxy/vue-bs-pagination.git" 16 | }, 17 | "scripts": { 18 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 19 | "unit": "jest --config test/unit/jest.conf.js --coverage", 20 | "test": "npm run unit", 21 | "lint": "eslint --ext .js,.vue src test/unit/specs", 22 | "build": "node build/build.js", 23 | "build-docs": "node build/build.js --docs" 24 | }, 25 | "dependencies": { 26 | "vue": "^2.2" 27 | }, 28 | "devDependencies": { 29 | "autoprefixer": "^7.1.2", 30 | "babel-core": "^6.22.1", 31 | "babel-eslint": "^7.1.1", 32 | "babel-jest": "^21.0.2", 33 | "babel-loader": "^7.1.1", 34 | "babel-plugin-dynamic-import-node": "^1.2.0", 35 | "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", 36 | "babel-plugin-transform-runtime": "^6.22.0", 37 | "babel-preset-env": "^1.3.2", 38 | "babel-preset-stage-2": "^6.22.0", 39 | "chalk": "^2.0.1", 40 | "copy-webpack-plugin": "^4.0.1", 41 | "css-loader": "^0.28.0", 42 | "eslint": "^3.19.0", 43 | "eslint-config-standard": "^10.2.1", 44 | "eslint-friendly-formatter": "^3.0.0", 45 | "eslint-loader": "^1.7.1", 46 | "eslint-plugin-html": "^3.0.0", 47 | "eslint-plugin-import": "^2.7.0", 48 | "eslint-plugin-node": "^5.2.0", 49 | "eslint-plugin-promise": "^3.4.0", 50 | "eslint-plugin-standard": "^3.0.1", 51 | "eventsource-polyfill": "^0.9.6", 52 | "extract-text-webpack-plugin": "^3.0.0", 53 | "file-loader": "^1.1.4", 54 | "friendly-errors-webpack-plugin": "^1.6.1", 55 | "html-webpack-plugin": "^2.30.1", 56 | "jest": "^21.2.0", 57 | "jest-serializer-vue": "^0.3.0", 58 | "node-notifier": "^5.1.2", 59 | "node-sass": "^4.7.2", 60 | "optimize-css-assets-webpack-plugin": "^3.2.0", 61 | "ora": "^1.2.0", 62 | "portfinder": "^1.0.13", 63 | "postcss-import": "^11.0.0", 64 | "postcss-loader": "^2.0.8", 65 | "rimraf": "^2.6.0", 66 | "sass-loader": "^6.0.6", 67 | "semver": "^5.3.0", 68 | "shelljs": "^0.7.6", 69 | "uglifyjs-webpack-plugin": "^1.1.1", 70 | "url-loader": "^0.5.8", 71 | "vue-jest": "^1.0.2", 72 | "vue-loader": "^13.3.0", 73 | "vue-style-loader": "^3.0.1", 74 | "vue-template-compiler": "^2.5.2", 75 | "vue-test-utils": "^1.0.0-beta.6", 76 | "webpack": "^3.6.0", 77 | "webpack-bundle-analyzer": "^2.9.0", 78 | "webpack-dev-server": "^2.9.1", 79 | "webpack-merge": "^4.1.0" 80 | }, 81 | "engines": { 82 | "node": ">= 4.0.0", 83 | "npm": ">= 3.0.0" 84 | }, 85 | "browserslist": [ 86 | "> 1%", 87 | "last 2 versions", 88 | "not ie <= 8" 89 | ] 90 | } 91 | -------------------------------------------------------------------------------- /src/components/VuePagination.vue: -------------------------------------------------------------------------------- 1 | 57 | 58 | 176 | 177 | -------------------------------------------------------------------------------- /src/docs/App.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 26 | 27 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/docs/app.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | 6 | Vue.config.productionTip = false 7 | 8 | /* eslint-disable no-new */ 9 | new Vue({ 10 | el: '#app', 11 | render: (h) => h(App), 12 | }) 13 | -------------------------------------------------------------------------------- /src/docs/assets/img/vue_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meteorlxy/vue-bs-pagination/661680a43e808b502c72bd19fb7c667974f2fe6d/src/docs/assets/img/vue_logo.png -------------------------------------------------------------------------------- /src/docs/components/TheDemo.vue: -------------------------------------------------------------------------------- 1 | 56 | 57 | -------------------------------------------------------------------------------- /src/docs/components/TheFooter.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | -------------------------------------------------------------------------------- /src/docs/components/TheHeader.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 29 | 30 | -------------------------------------------------------------------------------- /src/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | vue-bs-pagination - Bootstrap Pagination for Vue 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import VuePagination from './components/VuePagination' 2 | 3 | export default VuePagination 4 | 5 | if (typeof window !== 'undefined' && window.Vue) { 6 | window.Vue.component('VuePagination', VuePagination) 7 | } 8 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meteorlxy/vue-bs-pagination/661680a43e808b502c72bd19fb7c667974f2fe6d/static/.gitkeep -------------------------------------------------------------------------------- /test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "jest": true 4 | }, 5 | "globals": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/unit/jest.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | rootDir: path.resolve(__dirname, '../../'), 5 | moduleFileExtensions: [ 6 | 'js', 7 | 'json', 8 | 'vue' 9 | ], 10 | moduleNameMapper: { 11 | '^@/(.*)$': '/src/$1' 12 | }, 13 | transform: { 14 | '^.+\\.js$': '/node_modules/babel-jest', 15 | '.*\\.(vue)$': '/node_modules/vue-jest' 16 | }, 17 | snapshotSerializers: ['/node_modules/jest-serializer-vue'], 18 | setupFiles: ['/test/unit/setup'], 19 | mapCoverage: true, 20 | coverageDirectory: '/test/unit/coverage', 21 | collectCoverageFrom: [ 22 | 'src/**/*.{js,vue}', 23 | '!src/docs/**', 24 | '!src/main.js', 25 | '!src/router/index.js', 26 | '!**/node_modules/**' 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /test/unit/setup.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | -------------------------------------------------------------------------------- /test/unit/specs/VuePagination.spec.js: -------------------------------------------------------------------------------- 1 | import { mount } from 'vue-test-utils' 2 | import VuePagination from '@/components/VuePagination' 3 | 4 | describe('VuePagination.vue', () => { 5 | const createWrapper = propsData => mount(VuePagination, { propsData }) 6 | 7 | let wrapper 8 | 9 | let props 10 | 11 | // vue properties and methods 12 | describe('test vue properties and methods', () => { 13 | props = { 14 | value: 5, 15 | total: 20, 16 | eachSide: 2, 17 | } 18 | 19 | beforeEach(() => { 20 | wrapper = createWrapper(props) 21 | }) 22 | 23 | describe('test computed properties', () => { 24 | it('firstPage', () => { 25 | expect(wrapper.vm.firstPage).toEqual(1) 26 | }) 27 | 28 | it('lastPage', () => { 29 | expect(wrapper.vm.lastPage).toEqual(props.total) 30 | }) 31 | 32 | it('currentPage', () => { 33 | expect(wrapper.vm.currentPage).toEqual(props.value) 34 | }) 35 | 36 | it('onFirstPage', () => { 37 | wrapper.setProps({ value: 1 }) 38 | expect(wrapper.vm.onFirstPage).toBe(true) 39 | wrapper.setProps({ value: props.total }) 40 | expect(wrapper.vm.onFirstPage).toBe(props.total === 1) 41 | }) 42 | 43 | it('onLastPage', () => { 44 | wrapper.setProps({ value: 1 }) 45 | expect(wrapper.vm.onLastPage).toBe(props.total === 1) 46 | wrapper.setProps({ value: props.total }) 47 | expect(wrapper.vm.onLastPage).toBe(true) 48 | }) 49 | }) 50 | 51 | describe('test methods', () => { 52 | it('nextPage', () => { 53 | jest.spyOn(wrapper.vm, 'setPage') 54 | wrapper.vm.nextPage() 55 | expect(wrapper.vm.setPage).toBeCalledWith(props.value + 1) 56 | }) 57 | 58 | it('prevPage', () => { 59 | jest.spyOn(wrapper.vm, 'setPage') 60 | wrapper.vm.prevPage() 61 | expect(wrapper.vm.setPage).toBeCalledWith(props.value - 1) 62 | }) 63 | 64 | it('setPage', () => { 65 | wrapper.vm.setPage(10) 66 | wrapper.vm.setPage(21) 67 | wrapper.vm.setPage(0) 68 | expect(wrapper.emitted().input).toBeTruthy() 69 | expect(wrapper.emitted().input.length).toEqual(1) 70 | expect(wrapper.emitted().input[0]).toEqual([10]) 71 | }) 72 | }) 73 | 74 | describe('test click event handler', () => { 75 | it('the button of prev-page clicked', () => { 76 | jest.spyOn(wrapper.vm, 'prevPage') 77 | wrapper.find('.pagination li:nth-child(1) a').trigger('click') 78 | expect(wrapper.vm.prevPage).toBeCalled() 79 | }) 80 | it('the button of next-page clicked', () => { 81 | jest.spyOn(wrapper.vm, 'nextPage') 82 | wrapper.find('.pagination li:nth-last-child(1) a').trigger('click') 83 | expect(wrapper.vm.nextPage).toBeCalled() 84 | }) 85 | it('the button of a-certain-page clicked', () => { 86 | jest.spyOn(wrapper.vm, 'setPage') 87 | wrapper.find('.pagination li:nth-child(2) a').trigger('click') 88 | expect(wrapper.vm.setPage).toBeCalledWith(1) 89 | }) 90 | }) 91 | }) 92 | 93 | // paginators generation 94 | describe('test paginators generation', () => { 95 | it('eachSide prop is great enough to list all the page links', () => { 96 | wrapper = createWrapper({ 97 | value: 1, 98 | total: 10, 99 | eachSide: 4, 100 | }) 101 | expect(wrapper.vm.paginators.length).toEqual(10) 102 | }) 103 | it('currentPage near firstPage', () => { 104 | wrapper = createWrapper({ 105 | value: 2, 106 | total: 10, 107 | eachSide: 1, 108 | }) 109 | expect(wrapper.vm.paginators).toEqual([ 110 | { 111 | value: 1, 112 | enable: true 113 | }, 114 | { 115 | value: 2, 116 | enable: true 117 | }, 118 | { 119 | value: 3, 120 | enable: true 121 | }, 122 | { 123 | value: '...', 124 | enable: false 125 | }, 126 | { 127 | value: 10, 128 | enable: true 129 | }, 130 | ]) 131 | }) 132 | it('currentPage near lastPage', () => { 133 | wrapper = createWrapper({ 134 | value: 9, 135 | total: 10, 136 | eachSide: 1, 137 | }) 138 | expect(wrapper.vm.paginators).toEqual([ 139 | { 140 | value: 1, 141 | enable: true 142 | }, 143 | { 144 | value: '...', 145 | enable: false 146 | }, 147 | { 148 | value: 8, 149 | enable: true 150 | }, 151 | { 152 | value: 9, 153 | enable: true 154 | }, 155 | { 156 | value: 10, 157 | enable: true 158 | }, 159 | ]) 160 | }) 161 | it('currentPage in the middle', () => { 162 | wrapper = createWrapper({ 163 | value: 5, 164 | total: 10, 165 | eachSide: 1, 166 | }) 167 | expect(wrapper.vm.paginators).toEqual([ 168 | { 169 | value: 1, 170 | enable: true 171 | }, 172 | { 173 | value: '...', 174 | enable: false 175 | }, 176 | { 177 | value: 4, 178 | enable: true 179 | }, 180 | { 181 | value: 5, 182 | enable: true 183 | }, 184 | { 185 | value: 6, 186 | enable: true 187 | }, 188 | { 189 | value: '...', 190 | enable: false 191 | }, 192 | { 193 | value: 10, 194 | enable: true 195 | }, 196 | ]) 197 | }) 198 | }) 199 | }) 200 | --------------------------------------------------------------------------------