|
27 | 27 |
|
28 | 28 | <div class="oui-pagination__selector" |
29 | 29 | ng-if="$ctrl.totalItems > $ctrl.pageSize"> |
30 | | - <button type="button" class="oui-button oui-button_secondary oui-button_icon-only oui-button_small-width" |
31 | | - type="button" |
| 30 | + <button type="button" |
| 31 | + class="oui-button oui-button_secondary oui-button_icon-only oui-button_small-width" |
32 | 32 | ng-attr-aria-label="{{ ::$ctrl.translations.previousPage }}" |
33 | 33 | ng-disabled="$ctrl.currentPage === 1" |
34 | 34 | ng-click="$ctrl.onPageChange($ctrl.getCurrentPage() - 1)"> |
35 | 35 | <span class="oui-icon oui-icon-chevron-left" aria-hidden="true"></span> |
36 | 36 | </button> |
| 37 | + |
| 38 | + <!-- Buttons (<= 5 pages) --> |
37 | 39 | <div class="oui-button-group" |
38 | 40 | ng-if="$ctrl.pageCount <= 5"> |
39 | 41 | <button type="button" |
40 | 42 | class="oui-button oui-button_small-width" |
41 | | - ng-repeat="page in $ctrl.pageRange track by page" |
| 43 | + ng-repeat="page in $ctrl.getPageRange() track by page" |
42 | 44 | ng-class="{ |
43 | 45 | 'oui-button_primary oui-pagination-button_selected': page === $ctrl.currentPage, |
44 | 46 | 'oui-button_secondary': page != $ctrl.currentPage |
|
47 | 49 | ng-bind="page" |
48 | 50 | ng-click="$ctrl.onPageChange(page)"></button> |
49 | 51 | </div> |
50 | | - <oui-dropdown ng-if="$ctrl.pageCount > 5"> |
| 52 | + <!-- /Buttons (<= 5 pages) --> |
| 53 | + |
| 54 | + <!-- Dropdown (> 5 && <= 100 pages) --> |
| 55 | + <oui-dropdown ng-if="$ctrl.pageCount > 5 && $ctrl.pageCount <= 100" |
| 56 | + align="end"> |
51 | 57 | <button oui-dropdown-trigger |
52 | 58 | type="button" |
53 | 59 | ng-attr-aria-label="{{ $ctrl.translations.currentPageOfPageCount }}" |
54 | 60 | class="oui-button oui-button_dropdown oui-dropdown__trigger"> |
55 | 61 | <span ng-bind="$ctrl.translations.currentPageOfPageCount"></span> |
56 | 62 | <span class="oui-icon oui-icon-chevron-down" aria-hidden="true"></span> |
57 | 63 | </button> |
58 | | - <oui-dropdown-content> |
59 | | - <div role="menu" class="oui-pagination-menu"> |
60 | | - <div class="oui-pagination-menu__items-list"> |
61 | | - <button type="button" |
62 | | - ng-repeat="page in $ctrl.pageRange track by page" |
63 | | - class="oui-pagination-menu__item" |
64 | | - ng-attr-aria-label="{{ ::$ctrl.getPageAriaLabel(page) }}" |
65 | | - ng-disabled="page === $ctrl.currentPage" |
66 | | - ng-bind="page" |
67 | | - ng-click="$ctrl.onPageChange(page)"></button> |
68 | | - </div> |
| 64 | + <oui-dropdown-content class="oui-pagination-menu"> |
| 65 | + <div class="oui-pagination-menu__items-list"> |
| 66 | + <button type="button" |
| 67 | + ng-repeat="page in $ctrl.getPageRange() track by page" |
| 68 | + class="oui-pagination-menu__item" |
| 69 | + ng-attr-aria-label="{{ ::$ctrl.getPageAriaLabel(page) }}" |
| 70 | + ng-disabled="page === $ctrl.currentPage" |
| 71 | + ng-bind="page" |
| 72 | + ng-click="$ctrl.onPageChange(page)"></button> |
69 | 73 | </div> |
70 | 74 | </oui-dropdown-content> |
71 | 75 | </oui-dropdown> |
72 | | - <button type="button" class="oui-button oui-button_secondary oui-button_icon-only oui-button_small-width" |
73 | | - type="button" |
| 76 | + <!-- /Dropdown (> 5 && <= 100 pages) --> |
| 77 | + |
| 78 | + <!-- Numeric (> 100 pages) --> |
| 79 | + <form class="oui-pagination-numeric" |
| 80 | + ng-if="$ctrl.pageCount > 100" |
| 81 | + ng-submit="$ctrl.checkPageRange($ctrl.inputPage)" |
| 82 | + novalidate> |
| 83 | + <span aria-hidden="true" |
| 84 | + ng-bind="$ctrl.translations.inputPageOfPageCount[0]"> |
| 85 | + </span> |
| 86 | + <input class="oui-pagination-numeric__input oui-input oui-input_xs" |
| 87 | + type="number" |
| 88 | + min="1" |
| 89 | + max="{{$ctrl.pageCount}}" |
| 90 | + ng-attr-aria-label="{{ $ctrl.getPageAriaLabel($ctrl.inputPage) }}" |
| 91 | + ng-model="$ctrl.inputPage"> |
| 92 | + <span aria-hidden="true" |
| 93 | + ng-bind="$ctrl.translations.inputPageOfPageCount[1]"> |
| 94 | + </span> |
| 95 | + </form> |
| 96 | + <!-- /Input (> 100 pages) --> |
| 97 | + |
| 98 | + <button type="button" |
| 99 | + class="oui-button oui-button_secondary oui-button_icon-only oui-button_small-width" |
74 | 100 | ng-attr-aria-label="{{ ::$ctrl.translations.nextPage }}" |
75 | 101 | ng-disabled="$ctrl.currentPage === $ctrl.pageCount" |
76 | 102 | ng-click="$ctrl.onPageChange($ctrl.currentPage + 1)"> |
|
0 commit comments