New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pagination] disabled prop #456
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
74b15d4
[carousel] Fixed this arg in forEach
tmorehouse 8a961f5
[carousel] coerce querySelectorAll into an array
tmorehouse 5e6a5ba
[carousel] ESLint
tmorehouse 244800c
Merge pull request #1 from bootstrap-vue/master
tmorehouse 656a8e2
Merge pull request #2 from bootstrap-vue/master
tmorehouse 2830201
Merge pull request #3 from bootstrap-vue/master
tmorehouse a2de129
Merge pull request #4 from bootstrap-vue/master
tmorehouse c7daa0a
Merge pull request #5 from bootstrap-vue/master
tmorehouse 48ac553
Merge pull request #6 from bootstrap-vue/master
tmorehouse 916bbe0
Merge pull request #7 from bootstrap-vue/master
tmorehouse 90b4e6b
[input-group-addon] conditional ID on root element
tmorehouse fe8a289
[nav-item-dropdown] add ID to root element
tmorehouse 8a8e799
Merge pull request #8 from bootstrap-vue/master
tmorehouse 8b0a5b9
[pagination] add disabled prop
tmorehouse a885fee
[pagination] ESLint
tmorehouse File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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,7 +1,7 @@ | ||
<template> | ||
<ul :class="['pagination',btnSize]" | ||
role="group" | ||
tabindex="0" | ||
:aria-disabled="disabled ? 'true' : 'false'" | ||
:aria-label="ariaLabel ? ariaLabel : null" | ||
@focusin.self="focusCurrent" | ||
@keydown.left.prevent="focusPrev" | ||
|
@@ -10,7 +10,7 @@ | |
@keydown.shift.right.prevent="focusLast" | ||
> | ||
|
||
<li v-if="isActive(1)" class="page-item disabled" aria-hidden="true"> | ||
<li v-if="isActive(1) || disabled" class="page-item disabled" aria-hidden="true"> | ||
<span class="page-link">«</span> | ||
</li> | ||
<li v-else class="page-item"> | ||
|
@@ -27,7 +27,9 @@ | |
|
||
<li v-if="showPrev" class="page-item"> | ||
<a role="button" | ||
:class="['page-link', isActive(1)?'active':'']" | ||
:class="['page-link', {disabled}, isActive(1)?'active':'']" | ||
:disabled="disabled" | ||
:aria-disabled="disabled ? 'true' : 'false'" | ||
:aria-label="labelPage + ' 1'" | ||
:aria-current="isActive(1) ? 'true' : 'false'" | ||
:aria-posinset="1" | ||
|
@@ -45,7 +47,9 @@ | |
|
||
<li class="page-item" v-for="_,index in pageLinks" :key="index"> | ||
<a role="button" | ||
:class="['page-link', isActive(index + diff)?'active':'' , isActive(index + diff)?'':'hidden-xs-down']" | ||
:class="['page-link',{disabled},isActive(index + diff)?'active':'',isActive(index + diff)?'':'hidden-xs-down']" | ||
:disabled="disabled" | ||
:aria-disabled="disabled ? 'true' : 'false'" | ||
:aria-label="labelPage + ' ' + (index + diff)" | ||
:aria-current="isActive(index + diff) ? 'true' : 'false'" | ||
:aria-posinset="index + diff" | ||
|
@@ -63,7 +67,9 @@ | |
|
||
<li class="page-item" v-if="showNext"> | ||
<a role="button" | ||
:class="['page-link', isActive(numberOfPages) ? 'active' : '']" | ||
:class="['page-link', {disabled}, isActive(numberOfPages) ? 'active' : '']" | ||
:disabled="disabled" | ||
:aria-disabled="disabled ? 'true' : 'false'" | ||
:aria-label="labelPage + ' ' + numberOfPages" | ||
:aria-current="isActive(numberOfPages) ? 'true' : 'false'" | ||
:aria-posinset="numberOfPages" | ||
|
@@ -75,7 +81,7 @@ | |
>{{numberOfPages}}</a> | ||
</li> | ||
|
||
<li v-if="isActive(numberOfPages)" class="page-item disabled" aria-hidden="true"> | ||
<li v-if="isActive(numberOfPages) || disabled" class="page-item disabled" aria-hidden="true"> | ||
<span class="page-link">»</span> | ||
</li> | ||
<li v-else class="page-item"> | ||
|
@@ -155,6 +161,11 @@ | |
return page === this.currentPage; | ||
}, | ||
setPage(e, num) { | ||
if (disabled) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
return; | ||
} | ||
this.currentPage = num; | ||
this.$nextTick(() => { | ||
// Keep the current button focused if possible | ||
|
@@ -230,6 +241,10 @@ | |
} | ||
}, | ||
props: { | ||
disabled: { | ||
type: Boolean, | ||
default: 3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this is 3 ? :)) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, Typo |
||
}, | ||
value: { | ||
type: Number, | ||
default: 1 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this got in this PR, but it is OK.