This repository has been archived by the owner on Dec 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rebuild the component as .vue and build as .js
- Loading branch information
Showing
12 changed files
with
1,906 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
dist/ | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "airbnb-base", | ||
"plugins": ["html"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,53 @@ | ||
/.idea | ||
|
||
# Mac stuff | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
._* | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
/.idea | ||
|
||
### OSX ### | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Dependency directory | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
We accept contributions via Pull Requests on [Github](https://github.com/pogachar/). | ||
|
||
|
||
## Pull Requests | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Create feature branches** - Don't ask us to pull from your master branch. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
**Happy coding**! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
var vueBootstrapPagination = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',[(_vm.pagination.last_page > 0)?_c('ul',{staticClass:"pagination",class:_vm.sizeClass},[(_vm.showPrevious())?_c('li',{class:{ 'disabled' : _vm.pagination.current_page <= 1 }},[(_vm.pagination.current_page <= 1)?_c('span',[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v(_vm._s(_vm.config.previousText))])]):_vm._e(),(_vm.pagination.current_page > 1 )?_c('a',{attrs:{"href":"#","aria-label":_vm.config.ariaPrevioius},on:{"click":function($event){$event.preventDefault();_vm.changePage(_vm.pagination.current_page - 1);}}},[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v(_vm._s(_vm.config.previousText))])]):_vm._e()]):_vm._e(),_vm._l((_vm.array),function(num){return _c('li',{class:{ 'active' : num === _vm.pagination.current_page }},[_c('a',{attrs:{"href":"#"},on:{"click":function($event){$event.preventDefault();_vm.changePage(num);}}},[_vm._v(_vm._s(num))])])}),(_vm.showNext())?_c('li',{class:{ 'disabled' : _vm.pagination.current_page === _vm.pagination.last_page || _vm.pagination.last_page === 0 }},[(_vm.pagination.current_page === _vm.pagination.last_page || _vm.pagination.last_page === 0)?_c('span',[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v(_vm._s(_vm.config.nextText))])]):_vm._e(),(_vm.pagination.current_page < _vm.pagination.last_page)?_c('a',{attrs:{"href":"#","aria-label":_vm.config.ariaNext},on:{"click":function($event){$event.preventDefault();_vm.changePage(_vm.pagination.current_page + 1);}}},[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v(_vm._s(_vm.config.nextText))])]):_vm._e()]):_vm._e()],2):_vm._e()])},staticRenderFns: [], | ||
props: { | ||
pagination: { | ||
type: Object, | ||
required: true, | ||
}, | ||
callback: { | ||
type: Function, | ||
required: true, | ||
}, | ||
options: { | ||
type: Object, | ||
}, | ||
size: { | ||
type: String, | ||
}, | ||
}, | ||
computed: { | ||
array() { | ||
if (this.pagination.last_page <= 0) { | ||
return []; | ||
} | ||
let from = this.pagination.current_page - this.config.offset; | ||
if (from < 1) { | ||
from = 1; | ||
} | ||
let to = from + (this.config.offset * 2); | ||
if (to >= this.pagination.last_page) { | ||
to = this.pagination.last_page; | ||
} | ||
const arr = []; | ||
while (from <= to) { | ||
arr.push(from); | ||
from += 1; | ||
} | ||
return arr; | ||
}, | ||
config() { | ||
return Object.assign({ | ||
offset: 3, | ||
ariaPrevious: 'Previous', | ||
ariaNext: 'Next', | ||
previousText: '«', | ||
nextText: '»', | ||
alwaysShowPrevNext: false, | ||
}, this.options); | ||
}, | ||
sizeClass() { | ||
if (this.size === 'large') { | ||
return 'pagination-lg'; | ||
} else if (this.size === 'small') { | ||
return 'pagination-sm'; | ||
} | ||
return ''; | ||
}, | ||
}, | ||
watch: { | ||
'pagination.per_page'(newVal, oldVal) { // eslint-disable-line | ||
if (+newVal !== +oldVal) { | ||
this.callback(); | ||
} | ||
}, | ||
}, | ||
methods: { | ||
showPrevious() { | ||
return this.config.alwaysShowPrevNext || this.pagination.current_page > 1; | ||
}, | ||
showNext() { | ||
return this.config.alwaysShowPrevNext || | ||
this.pagination.current_page < this.pagination.last_page; | ||
}, | ||
changePage(page) { | ||
if (this.pagination.current_page === page) { | ||
return; | ||
} | ||
this.$set(this.pagination, 'current_page', page); | ||
this.callback(); | ||
}, | ||
}, | ||
}; | ||
|
||
module.exports = vueBootstrapPagination; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
var vueBootstrapPagination = {render: function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',[(_vm.pagination.last_page > 0)?_c('ul',{staticClass:"pagination",class:_vm.sizeClass},[(_vm.showPrevious())?_c('li',{class:{ 'disabled' : _vm.pagination.current_page <= 1 }},[(_vm.pagination.current_page <= 1)?_c('span',[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v(_vm._s(_vm.config.previousText))])]):_vm._e(),(_vm.pagination.current_page > 1 )?_c('a',{attrs:{"href":"#","aria-label":_vm.config.ariaPrevioius},on:{"click":function($event){$event.preventDefault();_vm.changePage(_vm.pagination.current_page - 1);}}},[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v(_vm._s(_vm.config.previousText))])]):_vm._e()]):_vm._e(),_vm._l((_vm.array),function(num){return _c('li',{class:{ 'active' : num === _vm.pagination.current_page }},[_c('a',{attrs:{"href":"#"},on:{"click":function($event){$event.preventDefault();_vm.changePage(num);}}},[_vm._v(_vm._s(num))])])}),(_vm.showNext())?_c('li',{class:{ 'disabled' : _vm.pagination.current_page === _vm.pagination.last_page || _vm.pagination.last_page === 0 }},[(_vm.pagination.current_page === _vm.pagination.last_page || _vm.pagination.last_page === 0)?_c('span',[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v(_vm._s(_vm.config.nextText))])]):_vm._e(),(_vm.pagination.current_page < _vm.pagination.last_page)?_c('a',{attrs:{"href":"#","aria-label":_vm.config.ariaNext},on:{"click":function($event){$event.preventDefault();_vm.changePage(_vm.pagination.current_page + 1);}}},[_c('span',{attrs:{"aria-hidden":"true"}},[_vm._v(_vm._s(_vm.config.nextText))])]):_vm._e()]):_vm._e()],2):_vm._e()])},staticRenderFns: [], | ||
props: { | ||
pagination: { | ||
type: Object, | ||
required: true, | ||
}, | ||
callback: { | ||
type: Function, | ||
required: true, | ||
}, | ||
options: { | ||
type: Object, | ||
}, | ||
size: { | ||
type: String, | ||
}, | ||
}, | ||
computed: { | ||
array() { | ||
if (this.pagination.last_page <= 0) { | ||
return []; | ||
} | ||
let from = this.pagination.current_page - this.config.offset; | ||
if (from < 1) { | ||
from = 1; | ||
} | ||
let to = from + (this.config.offset * 2); | ||
if (to >= this.pagination.last_page) { | ||
to = this.pagination.last_page; | ||
} | ||
const arr = []; | ||
while (from <= to) { | ||
arr.push(from); | ||
from += 1; | ||
} | ||
return arr; | ||
}, | ||
config() { | ||
return Object.assign({ | ||
offset: 3, | ||
ariaPrevious: 'Previous', | ||
ariaNext: 'Next', | ||
previousText: '«', | ||
nextText: '»', | ||
alwaysShowPrevNext: false, | ||
}, this.options); | ||
}, | ||
sizeClass() { | ||
if (this.size === 'large') { | ||
return 'pagination-lg'; | ||
} else if (this.size === 'small') { | ||
return 'pagination-sm'; | ||
} | ||
return ''; | ||
}, | ||
}, | ||
watch: { | ||
'pagination.per_page'(newVal, oldVal) { // eslint-disable-line | ||
if (+newVal !== +oldVal) { | ||
this.callback(); | ||
} | ||
}, | ||
}, | ||
methods: { | ||
showPrevious() { | ||
return this.config.alwaysShowPrevNext || this.pagination.current_page > 1; | ||
}, | ||
showNext() { | ||
return this.config.alwaysShowPrevNext || | ||
this.pagination.current_page < this.pagination.last_page; | ||
}, | ||
changePage(page) { | ||
if (this.pagination.current_page === page) { | ||
return; | ||
} | ||
this.$set(this.pagination, 'current_page', page); | ||
this.callback(); | ||
}, | ||
}, | ||
}; | ||
|
||
export default vueBootstrapPagination; |
Oops, something went wrong.