@@ -6,9 +6,10 @@ import {
66 EventEmitter
77} from "@angular/core" ;
88
9- import { I18n , Overridable } from "carbon-components-angular/i18n" ;
9+ import { I18n } from "carbon-components-angular/i18n" ;
1010import { ExperimentalService } from "carbon-components-angular/experimental" ;
1111import { merge } from "carbon-components-angular/utils" ;
12+ import { range } from "carbon-components-angular/common" ;
1213
1314export interface PaginationTranslations {
1415 ITEMS_PER_PAGE : string ;
@@ -78,10 +79,8 @@ export interface PaginationTranslations {
7879 [disabled]="pageInputDisabled"
7980 class="cds--select-input">
8081 @for (option of itemsPerPageOptions; track option) {
81- <option
82- class="cds--select-option"
83- [value]="option">
84- {{ option }}
82+ <option class="cds--select-option" [value]="option">
83+ {{ option }}
8584 </option>
8685 }
8786 </select>
@@ -167,20 +166,20 @@ export interface PaginationTranslations {
167166 }
168167
169168 @if (!pagesUnknown && lastPage <= 1) {
170- <span class="cds--pagination__text">
171- @if (!showPageInput) {
172- {{currentPage}}
173- }
174- {{ofLastPageText.subject | i18nReplace: {last: lastPage} | async}}
175- </span>
169+ <span class="cds--pagination__text">
170+ @if (!showPageInput) {
171+ {{currentPage}}
172+ }
173+ {{ofLastPageText.subject | i18nReplace: {last: lastPage} | async}}
174+ </span>
176175 }
177176 @if (!pagesUnknown && lastPage > 1) {
178- <span class="cds--pagination__text">
179- @if (!showPageInput) {
180- {{currentPage}}
181- }
182- {{ofLastPagesText.subject | i18nReplace: {last: lastPage} | async}}
183- </span>
177+ <span class="cds--pagination__text">
178+ @if (!showPageInput) {
179+ {{currentPage}}
180+ }
181+ {{ofLastPagesText.subject | i18nReplace: {last: lastPage} | async}}
182+ </span>
184183 }
185184 <div class="cds--pagination__control-buttons">
186185 <button
@@ -200,9 +199,7 @@ export interface PaginationTranslations {
200199 <button
201200 cdsButton="ghost"
202201 iconOnly="true"
203- class="
204- cds--pagination__button
205- cds--pagination__button--forward"
202+ class="cds--pagination__button cds--pagination__button--forward"
206203 [ngClass]="{
207204 'cds--pagination__button--no-index': currentPage >= lastPage || disabled
208205 }"
@@ -355,11 +352,7 @@ export class Pagination {
355352 */
356353 const numberOfPages = Math . max ( Math . ceil ( this . totalDataLength / this . itemsPerPage ) , 1 ) ;
357354 if ( this . _pageOptions . length !== numberOfPages ) {
358- const pageArray = Array ( numberOfPages ) ;
359- for ( let i = 0 ; i < numberOfPages ; i ++ ) {
360- pageArray [ i ] = i + 1 ;
361- }
362- this . _pageOptions = pageArray ;
355+ this . _pageOptions = range ( numberOfPages , 1 ) ;
363356 }
364357 return this . _pageOptions ;
365358 }
0 commit comments