ng-zorro-antd-pagination.mjs 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. import { __esDecorate, __runInitializers } from 'tslib';
  2. import { NgTemplateOutlet } from '@angular/common';
  3. import * as i0 from '@angular/core';
  4. import { EventEmitter, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, ViewChild, numberAttribute, booleanAttribute, NgModule } from '@angular/core';
  5. import { Subject, ReplaySubject } from 'rxjs';
  6. import { takeUntil } from 'rxjs/operators';
  7. import * as i3 from 'ng-zorro-antd/core/config';
  8. import { WithConfig } from 'ng-zorro-antd/core/config';
  9. import * as i2$1 from 'ng-zorro-antd/core/services';
  10. import { gridResponsiveMap, NzBreakpointEnum } from 'ng-zorro-antd/core/services';
  11. import * as i1 from 'ng-zorro-antd/icon';
  12. import { NzIconModule } from 'ng-zorro-antd/icon';
  13. import * as i2 from '@angular/forms';
  14. import { FormsModule } from '@angular/forms';
  15. import { toNumber } from 'ng-zorro-antd/core/util';
  16. import * as i1$1 from 'ng-zorro-antd/select';
  17. import { NzSelectModule } from 'ng-zorro-antd/select';
  18. import * as i1$2 from '@angular/cdk/bidi';
  19. import * as i1$3 from 'ng-zorro-antd/i18n';
  20. /* eslint-disable */
  21. /**
  22. * Use of this source code is governed by an MIT-style license that can be
  23. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  24. */
  25. class NzPaginationItemComponent {
  26. active = false;
  27. locale;
  28. index = null;
  29. disabled = false;
  30. direction = 'ltr';
  31. type = null;
  32. itemRender = null;
  33. diffIndex = new EventEmitter();
  34. gotoIndex = new EventEmitter();
  35. title = null;
  36. clickItem() {
  37. if (!this.disabled) {
  38. if (this.type === 'page') {
  39. this.gotoIndex.emit(this.index);
  40. }
  41. else {
  42. this.diffIndex.emit({
  43. next: 1,
  44. prev: -1,
  45. prev_5: -5,
  46. next_5: 5
  47. }[this.type]);
  48. }
  49. }
  50. }
  51. ngOnChanges(changes) {
  52. const { locale, index, type } = changes;
  53. if (locale || index || type) {
  54. this.title = {
  55. page: `${this.index}`,
  56. next: this.locale?.next_page,
  57. prev: this.locale?.prev_page,
  58. prev_5: this.locale?.prev_5,
  59. next_5: this.locale?.next_5
  60. }[this.type];
  61. }
  62. }
  63. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  64. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzPaginationItemComponent, isStandalone: true, selector: "li[nz-pagination-item]", inputs: { active: "active", locale: "locale", index: "index", disabled: "disabled", direction: "direction", type: "type", itemRender: "itemRender" }, outputs: { diffIndex: "diffIndex", gotoIndex: "gotoIndex" }, host: { listeners: { "click": "clickItem()" }, properties: { "class.ant-pagination-prev": "type === 'prev'", "class.ant-pagination-next": "type === 'next'", "class.ant-pagination-item": "type === 'page'", "class.ant-pagination-jump-prev": "type === 'prev_5'", "class.ant-pagination-jump-prev-custom-icon": "type === 'prev_5'", "class.ant-pagination-jump-next": "type === 'next_5'", "class.ant-pagination-jump-next-custom-icon": "type === 'next_5'", "class.ant-pagination-disabled": "disabled", "class.ant-pagination-item-active": "active", "attr.title": "title" } }, usesOnChanges: true, ngImport: i0, template: `
  65. <ng-template #renderItemTemplate let-type let-page="page">
  66. @switch (type) {
  67. @case ('page') {
  68. <a>{{ page }}</a>
  69. }
  70. @case ('prev') {
  71. <button type="button" [disabled]="disabled" [attr.title]="locale.prev_page" class="ant-pagination-item-link">
  72. @if (direction === 'rtl') {
  73. <nz-icon nzType="right" />
  74. } @else {
  75. <nz-icon nzType="left" />
  76. }
  77. </button>
  78. }
  79. @case ('next') {
  80. <button type="button" [disabled]="disabled" [attr.title]="locale.next_page" class="ant-pagination-item-link">
  81. @if (direction === 'rtl') {
  82. <nz-icon nzType="left" />
  83. } @else {
  84. <nz-icon nzType="right" />
  85. }
  86. </button>
  87. }
  88. @default {
  89. <a class="ant-pagination-item-link">
  90. <div class="ant-pagination-item-container">
  91. @switch (type) {
  92. @case ('prev_5') {
  93. @if (direction === 'rtl') {
  94. <nz-icon nzType="double-right" class="ant-pagination-item-link-icon" />
  95. } @else {
  96. <nz-icon nzType="double-left" class="ant-pagination-item-link-icon" />
  97. }
  98. }
  99. @case ('next_5') {
  100. @if (direction === 'rtl') {
  101. <nz-icon nzType="double-left" class="ant-pagination-item-link-icon" />
  102. } @else {
  103. <nz-icon nzType="double-right" class="ant-pagination-item-link-icon" />
  104. }
  105. }
  106. }
  107. <span class="ant-pagination-item-ellipsis">•••</span>
  108. </div>
  109. </a>
  110. }
  111. }
  112. </ng-template>
  113. <ng-template
  114. [ngTemplateOutlet]="itemRender || renderItemTemplate"
  115. [ngTemplateOutletContext]="{ $implicit: type, page: index }"
  116. />
  117. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i1.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  118. }
  119. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationItemComponent, decorators: [{
  120. type: Component,
  121. args: [{
  122. selector: 'li[nz-pagination-item]',
  123. preserveWhitespaces: false,
  124. encapsulation: ViewEncapsulation.None,
  125. changeDetection: ChangeDetectionStrategy.OnPush,
  126. template: `
  127. <ng-template #renderItemTemplate let-type let-page="page">
  128. @switch (type) {
  129. @case ('page') {
  130. <a>{{ page }}</a>
  131. }
  132. @case ('prev') {
  133. <button type="button" [disabled]="disabled" [attr.title]="locale.prev_page" class="ant-pagination-item-link">
  134. @if (direction === 'rtl') {
  135. <nz-icon nzType="right" />
  136. } @else {
  137. <nz-icon nzType="left" />
  138. }
  139. </button>
  140. }
  141. @case ('next') {
  142. <button type="button" [disabled]="disabled" [attr.title]="locale.next_page" class="ant-pagination-item-link">
  143. @if (direction === 'rtl') {
  144. <nz-icon nzType="left" />
  145. } @else {
  146. <nz-icon nzType="right" />
  147. }
  148. </button>
  149. }
  150. @default {
  151. <a class="ant-pagination-item-link">
  152. <div class="ant-pagination-item-container">
  153. @switch (type) {
  154. @case ('prev_5') {
  155. @if (direction === 'rtl') {
  156. <nz-icon nzType="double-right" class="ant-pagination-item-link-icon" />
  157. } @else {
  158. <nz-icon nzType="double-left" class="ant-pagination-item-link-icon" />
  159. }
  160. }
  161. @case ('next_5') {
  162. @if (direction === 'rtl') {
  163. <nz-icon nzType="double-left" class="ant-pagination-item-link-icon" />
  164. } @else {
  165. <nz-icon nzType="double-right" class="ant-pagination-item-link-icon" />
  166. }
  167. }
  168. }
  169. <span class="ant-pagination-item-ellipsis">•••</span>
  170. </div>
  171. </a>
  172. }
  173. }
  174. </ng-template>
  175. <ng-template
  176. [ngTemplateOutlet]="itemRender || renderItemTemplate"
  177. [ngTemplateOutletContext]="{ $implicit: type, page: index }"
  178. />
  179. `,
  180. host: {
  181. '[class.ant-pagination-prev]': `type === 'prev'`,
  182. '[class.ant-pagination-next]': `type === 'next'`,
  183. '[class.ant-pagination-item]': `type === 'page'`,
  184. '[class.ant-pagination-jump-prev]': `type === 'prev_5'`,
  185. '[class.ant-pagination-jump-prev-custom-icon]': `type === 'prev_5'`,
  186. '[class.ant-pagination-jump-next]': `type === 'next_5'`,
  187. '[class.ant-pagination-jump-next-custom-icon]': `type === 'next_5'`,
  188. '[class.ant-pagination-disabled]': 'disabled',
  189. '[class.ant-pagination-item-active]': 'active',
  190. '[attr.title]': 'title',
  191. '(click)': 'clickItem()'
  192. },
  193. imports: [NzIconModule, NgTemplateOutlet]
  194. }]
  195. }], propDecorators: { active: [{
  196. type: Input
  197. }], locale: [{
  198. type: Input
  199. }], index: [{
  200. type: Input
  201. }], disabled: [{
  202. type: Input
  203. }], direction: [{
  204. type: Input
  205. }], type: [{
  206. type: Input
  207. }], itemRender: [{
  208. type: Input
  209. }], diffIndex: [{
  210. type: Output
  211. }], gotoIndex: [{
  212. type: Output
  213. }] } });
  214. /**
  215. * Use of this source code is governed by an MIT-style license that can be
  216. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  217. */
  218. class NzPaginationOptionsComponent {
  219. nzSize = 'default';
  220. disabled = false;
  221. showSizeChanger = false;
  222. showQuickJumper = false;
  223. locale;
  224. total = 0;
  225. pageIndex = 1;
  226. pageSize = 10;
  227. pageSizeOptions = [];
  228. pageIndexChange = new EventEmitter();
  229. pageSizeChange = new EventEmitter();
  230. listOfPageSizeOption = [];
  231. onPageSizeChange(size) {
  232. if (this.pageSize !== size) {
  233. this.pageSizeChange.next(size);
  234. }
  235. }
  236. jumpToPageViaInput($event) {
  237. const target = $event.target;
  238. const index = Math.floor(toNumber(target.value, this.pageIndex));
  239. this.pageIndexChange.next(index);
  240. target.value = '';
  241. }
  242. ngOnChanges(changes) {
  243. const { pageSize, pageSizeOptions, locale } = changes;
  244. if (pageSize || pageSizeOptions || locale) {
  245. this.listOfPageSizeOption = [...new Set([...this.pageSizeOptions, this.pageSize])].map(item => ({
  246. value: item,
  247. label: `${item} ${this.locale.items_per_page}`
  248. }));
  249. }
  250. }
  251. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationOptionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
  252. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzPaginationOptionsComponent, isStandalone: true, selector: "li[nz-pagination-options]", inputs: { nzSize: "nzSize", disabled: "disabled", showSizeChanger: "showSizeChanger", showQuickJumper: "showQuickJumper", locale: "locale", total: "total", pageIndex: "pageIndex", pageSize: "pageSize", pageSizeOptions: "pageSizeOptions" }, outputs: { pageIndexChange: "pageIndexChange", pageSizeChange: "pageSizeChange" }, host: { classAttribute: "ant-pagination-options" }, usesOnChanges: true, ngImport: i0, template: `
  253. @if (showSizeChanger) {
  254. <nz-select
  255. class="ant-pagination-options-size-changer"
  256. [nzDisabled]="disabled"
  257. [nzSize]="nzSize"
  258. [ngModel]="pageSize"
  259. (ngModelChange)="onPageSizeChange($event)"
  260. >
  261. @for (option of listOfPageSizeOption; track option.value) {
  262. <nz-option [nzLabel]="option.label" [nzValue]="option.value" />
  263. }
  264. </nz-select>
  265. }
  266. @if (showQuickJumper) {
  267. <div class="ant-pagination-options-quick-jumper">
  268. {{ locale.jump_to }}
  269. <input [disabled]="disabled" (keydown.enter)="jumpToPageViaInput($event)" />
  270. {{ locale.page }}
  271. </div>
  272. }
  273. `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzSelectModule }, { kind: "component", type: i1$1.NzOptionComponent, selector: "nz-option", inputs: ["nzTitle", "nzLabel", "nzValue", "nzKey", "nzDisabled", "nzHide", "nzCustomContent"], exportAs: ["nzOption"] }, { kind: "component", type: i1$1.NzSelectComponent, selector: "nz-select", inputs: ["nzId", "nzSize", "nzStatus", "nzOptionHeightPx", "nzOptionOverflowSize", "nzDropdownClassName", "nzDropdownMatchSelectWidth", "nzDropdownStyle", "nzNotFoundContent", "nzPlaceHolder", "nzPlacement", "nzMaxTagCount", "nzDropdownRender", "nzCustomTemplate", "nzSuffixIcon", "nzClearIcon", "nzRemoveIcon", "nzMenuItemSelectedIcon", "nzTokenSeparators", "nzMaxTagPlaceholder", "nzMaxMultipleCount", "nzMode", "nzFilterOption", "compareWith", "nzAllowClear", "nzBorderless", "nzShowSearch", "nzLoading", "nzAutoFocus", "nzAutoClearSearchValue", "nzServerSearch", "nzDisabled", "nzOpen", "nzSelectOnTab", "nzBackdrop", "nzOptions", "nzShowArrow"], outputs: ["nzOnSearch", "nzScrollToBottom", "nzOpenChange", "nzBlur", "nzFocus"], exportAs: ["nzSelect"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  274. }
  275. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationOptionsComponent, decorators: [{
  276. type: Component,
  277. args: [{
  278. selector: 'li[nz-pagination-options]',
  279. preserveWhitespaces: false,
  280. encapsulation: ViewEncapsulation.None,
  281. changeDetection: ChangeDetectionStrategy.OnPush,
  282. template: `
  283. @if (showSizeChanger) {
  284. <nz-select
  285. class="ant-pagination-options-size-changer"
  286. [nzDisabled]="disabled"
  287. [nzSize]="nzSize"
  288. [ngModel]="pageSize"
  289. (ngModelChange)="onPageSizeChange($event)"
  290. >
  291. @for (option of listOfPageSizeOption; track option.value) {
  292. <nz-option [nzLabel]="option.label" [nzValue]="option.value" />
  293. }
  294. </nz-select>
  295. }
  296. @if (showQuickJumper) {
  297. <div class="ant-pagination-options-quick-jumper">
  298. {{ locale.jump_to }}
  299. <input [disabled]="disabled" (keydown.enter)="jumpToPageViaInput($event)" />
  300. {{ locale.page }}
  301. </div>
  302. }
  303. `,
  304. host: { class: 'ant-pagination-options' },
  305. imports: [NzSelectModule, FormsModule]
  306. }]
  307. }], propDecorators: { nzSize: [{
  308. type: Input
  309. }], disabled: [{
  310. type: Input
  311. }], showSizeChanger: [{
  312. type: Input
  313. }], showQuickJumper: [{
  314. type: Input
  315. }], locale: [{
  316. type: Input
  317. }], total: [{
  318. type: Input
  319. }], pageIndex: [{
  320. type: Input
  321. }], pageSize: [{
  322. type: Input
  323. }], pageSizeOptions: [{
  324. type: Input
  325. }], pageIndexChange: [{
  326. type: Output
  327. }], pageSizeChange: [{
  328. type: Output
  329. }] } });
  330. class NzPaginationDefaultComponent {
  331. cdr;
  332. renderer;
  333. elementRef;
  334. directionality;
  335. template;
  336. nzSize = 'default';
  337. itemRender = null;
  338. showTotal = null;
  339. disabled = false;
  340. locale;
  341. showSizeChanger = false;
  342. showQuickJumper = false;
  343. total = 0;
  344. pageIndex = 1;
  345. pageSize = 10;
  346. pageSizeOptions = [10, 20, 30, 40];
  347. pageIndexChange = new EventEmitter();
  348. pageSizeChange = new EventEmitter();
  349. ranges = [0, 0];
  350. listOfPageItem = [];
  351. dir = 'ltr';
  352. destroy$ = new Subject();
  353. constructor(cdr, renderer, elementRef, directionality) {
  354. this.cdr = cdr;
  355. this.renderer = renderer;
  356. this.elementRef = elementRef;
  357. this.directionality = directionality;
  358. renderer.removeChild(renderer.parentNode(elementRef.nativeElement), elementRef.nativeElement);
  359. }
  360. ngOnInit() {
  361. this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
  362. this.dir = direction;
  363. this.updateRtlStyle();
  364. this.cdr.detectChanges();
  365. });
  366. this.dir = this.directionality.value;
  367. this.updateRtlStyle();
  368. }
  369. updateRtlStyle() {
  370. if (this.dir === 'rtl') {
  371. this.renderer.addClass(this.elementRef.nativeElement, 'ant-pagination-rtl');
  372. }
  373. else {
  374. this.renderer.removeClass(this.elementRef.nativeElement, 'ant-pagination-rtl');
  375. }
  376. }
  377. ngOnDestroy() {
  378. this.destroy$.next();
  379. this.destroy$.complete();
  380. }
  381. jumpPage(index) {
  382. this.onPageIndexChange(index);
  383. }
  384. jumpDiff(diff) {
  385. this.jumpPage(this.pageIndex + diff);
  386. }
  387. trackByPageItem(_, value) {
  388. return `${value.type}-${value.index}`;
  389. }
  390. onPageIndexChange(index) {
  391. this.pageIndexChange.next(index);
  392. }
  393. onPageSizeChange(size) {
  394. this.pageSizeChange.next(size);
  395. }
  396. getLastIndex(total, pageSize) {
  397. return Math.ceil(total / pageSize);
  398. }
  399. buildIndexes() {
  400. const lastIndex = this.getLastIndex(this.total, this.pageSize);
  401. this.listOfPageItem = this.getListOfPageItem(this.pageIndex, lastIndex);
  402. }
  403. getListOfPageItem(pageIndex, lastIndex) {
  404. // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
  405. const concatWithPrevNext = (listOfPage) => {
  406. const prevItem = {
  407. type: 'prev',
  408. disabled: pageIndex === 1
  409. };
  410. const nextItem = {
  411. type: 'next',
  412. disabled: pageIndex === lastIndex
  413. };
  414. return [prevItem, ...listOfPage, nextItem];
  415. };
  416. const generatePage = (start, end) => {
  417. const list = [];
  418. for (let i = start; i <= end; i++) {
  419. list.push({
  420. index: i,
  421. type: 'page'
  422. });
  423. }
  424. return list;
  425. };
  426. if (lastIndex <= 9) {
  427. return concatWithPrevNext(generatePage(1, lastIndex));
  428. }
  429. else {
  430. // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
  431. const generateRangeItem = (selected, last) => {
  432. let listOfRange = [];
  433. const prevFiveItem = {
  434. type: 'prev_5'
  435. };
  436. const nextFiveItem = {
  437. type: 'next_5'
  438. };
  439. const firstPageItem = generatePage(1, 1);
  440. const lastPageItem = generatePage(lastIndex, lastIndex);
  441. if (selected < 5) {
  442. // If the 4th is selected, one more page will be displayed.
  443. const maxLeft = selected === 4 ? 6 : 5;
  444. listOfRange = [...generatePage(2, maxLeft), nextFiveItem];
  445. }
  446. else if (selected < last - 3) {
  447. listOfRange = [prevFiveItem, ...generatePage(selected - 2, selected + 2), nextFiveItem];
  448. }
  449. else {
  450. // If the 4th from last is selected, one more page will be displayed.
  451. const minRight = selected === last - 3 ? last - 5 : last - 4;
  452. listOfRange = [prevFiveItem, ...generatePage(minRight, last - 1)];
  453. }
  454. return [...firstPageItem, ...listOfRange, ...lastPageItem];
  455. };
  456. return concatWithPrevNext(generateRangeItem(pageIndex, lastIndex));
  457. }
  458. }
  459. ngOnChanges(changes) {
  460. const { pageIndex, pageSize, total } = changes;
  461. if (pageIndex || pageSize || total) {
  462. this.ranges = [(this.pageIndex - 1) * this.pageSize + 1, Math.min(this.pageIndex * this.pageSize, this.total)];
  463. this.buildIndexes();
  464. }
  465. }
  466. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationDefaultComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1$2.Directionality }], target: i0.ɵɵFactoryTarget.Component });
  467. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzPaginationDefaultComponent, isStandalone: true, selector: "nz-pagination-default", inputs: { nzSize: "nzSize", itemRender: "itemRender", showTotal: "showTotal", disabled: "disabled", locale: "locale", showSizeChanger: "showSizeChanger", showQuickJumper: "showQuickJumper", total: "total", pageIndex: "pageIndex", pageSize: "pageSize", pageSizeOptions: "pageSizeOptions" }, outputs: { pageIndexChange: "pageIndexChange", pageSizeChange: "pageSizeChange" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["containerTemplate"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
  468. <ng-template #containerTemplate>
  469. <ul>
  470. @if (showTotal) {
  471. <li class="ant-pagination-total-text">
  472. <ng-template
  473. [ngTemplateOutlet]="showTotal"
  474. [ngTemplateOutletContext]="{ $implicit: total, range: ranges }"
  475. />
  476. </li>
  477. }
  478. @for (page of listOfPageItem; track trackByPageItem($index, page)) {
  479. <li
  480. nz-pagination-item
  481. [locale]="locale"
  482. [type]="page.type"
  483. [index]="page.index"
  484. [disabled]="!!page.disabled"
  485. [itemRender]="itemRender"
  486. [active]="pageIndex === page.index"
  487. (gotoIndex)="jumpPage($event)"
  488. (diffIndex)="jumpDiff($event)"
  489. [direction]="dir"
  490. ></li>
  491. }
  492. @if (showQuickJumper || showSizeChanger) {
  493. <li
  494. nz-pagination-options
  495. [total]="total"
  496. [locale]="locale"
  497. [disabled]="disabled"
  498. [nzSize]="nzSize"
  499. [showSizeChanger]="showSizeChanger"
  500. [showQuickJumper]="showQuickJumper"
  501. [pageIndex]="pageIndex"
  502. [pageSize]="pageSize"
  503. [pageSizeOptions]="pageSizeOptions"
  504. (pageIndexChange)="onPageIndexChange($event)"
  505. (pageSizeChange)="onPageSizeChange($event)"
  506. ></li>
  507. }
  508. </ul>
  509. </ng-template>
  510. `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NzPaginationItemComponent, selector: "li[nz-pagination-item]", inputs: ["active", "locale", "index", "disabled", "direction", "type", "itemRender"], outputs: ["diffIndex", "gotoIndex"] }, { kind: "component", type: NzPaginationOptionsComponent, selector: "li[nz-pagination-options]", inputs: ["nzSize", "disabled", "showSizeChanger", "showQuickJumper", "locale", "total", "pageIndex", "pageSize", "pageSizeOptions"], outputs: ["pageIndexChange", "pageSizeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  511. }
  512. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationDefaultComponent, decorators: [{
  513. type: Component,
  514. args: [{
  515. selector: 'nz-pagination-default',
  516. preserveWhitespaces: false,
  517. encapsulation: ViewEncapsulation.None,
  518. changeDetection: ChangeDetectionStrategy.OnPush,
  519. template: `
  520. <ng-template #containerTemplate>
  521. <ul>
  522. @if (showTotal) {
  523. <li class="ant-pagination-total-text">
  524. <ng-template
  525. [ngTemplateOutlet]="showTotal"
  526. [ngTemplateOutletContext]="{ $implicit: total, range: ranges }"
  527. />
  528. </li>
  529. }
  530. @for (page of listOfPageItem; track trackByPageItem($index, page)) {
  531. <li
  532. nz-pagination-item
  533. [locale]="locale"
  534. [type]="page.type"
  535. [index]="page.index"
  536. [disabled]="!!page.disabled"
  537. [itemRender]="itemRender"
  538. [active]="pageIndex === page.index"
  539. (gotoIndex)="jumpPage($event)"
  540. (diffIndex)="jumpDiff($event)"
  541. [direction]="dir"
  542. ></li>
  543. }
  544. @if (showQuickJumper || showSizeChanger) {
  545. <li
  546. nz-pagination-options
  547. [total]="total"
  548. [locale]="locale"
  549. [disabled]="disabled"
  550. [nzSize]="nzSize"
  551. [showSizeChanger]="showSizeChanger"
  552. [showQuickJumper]="showQuickJumper"
  553. [pageIndex]="pageIndex"
  554. [pageSize]="pageSize"
  555. [pageSizeOptions]="pageSizeOptions"
  556. (pageIndexChange)="onPageIndexChange($event)"
  557. (pageSizeChange)="onPageSizeChange($event)"
  558. ></li>
  559. }
  560. </ul>
  561. </ng-template>
  562. `,
  563. imports: [NgTemplateOutlet, NzPaginationItemComponent, NzPaginationOptionsComponent]
  564. }]
  565. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1$2.Directionality }], propDecorators: { template: [{
  566. type: ViewChild,
  567. args: ['containerTemplate', { static: true }]
  568. }], nzSize: [{
  569. type: Input
  570. }], itemRender: [{
  571. type: Input
  572. }], showTotal: [{
  573. type: Input
  574. }], disabled: [{
  575. type: Input
  576. }], locale: [{
  577. type: Input
  578. }], showSizeChanger: [{
  579. type: Input
  580. }], showQuickJumper: [{
  581. type: Input
  582. }], total: [{
  583. type: Input
  584. }], pageIndex: [{
  585. type: Input
  586. }], pageSize: [{
  587. type: Input
  588. }], pageSizeOptions: [{
  589. type: Input
  590. }], pageIndexChange: [{
  591. type: Output
  592. }], pageSizeChange: [{
  593. type: Output
  594. }] } });
  595. class NzPaginationSimpleComponent {
  596. cdr;
  597. renderer;
  598. elementRef;
  599. directionality;
  600. template;
  601. itemRender = null;
  602. disabled = false;
  603. locale;
  604. total = 0;
  605. pageIndex = 1;
  606. pageSize = 10;
  607. pageIndexChange = new EventEmitter();
  608. lastIndex = 0;
  609. isFirstIndex = false;
  610. isLastIndex = false;
  611. dir = 'ltr';
  612. destroy$ = new Subject();
  613. constructor(cdr, renderer, elementRef, directionality) {
  614. this.cdr = cdr;
  615. this.renderer = renderer;
  616. this.elementRef = elementRef;
  617. this.directionality = directionality;
  618. renderer.removeChild(renderer.parentNode(elementRef.nativeElement), elementRef.nativeElement);
  619. }
  620. ngOnInit() {
  621. this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
  622. this.dir = direction;
  623. this.updateRtlStyle();
  624. this.cdr.detectChanges();
  625. });
  626. this.dir = this.directionality.value;
  627. this.updateRtlStyle();
  628. }
  629. updateRtlStyle() {
  630. if (this.dir === 'rtl') {
  631. this.renderer.addClass(this.elementRef.nativeElement, 'ant-pagination-rtl');
  632. }
  633. else {
  634. this.renderer.removeClass(this.elementRef.nativeElement, 'ant-pagination-rtl');
  635. }
  636. }
  637. ngOnDestroy() {
  638. this.destroy$.next();
  639. this.destroy$.complete();
  640. }
  641. jumpToPageViaInput($event) {
  642. const target = $event.target;
  643. const index = toNumber(target.value, this.pageIndex);
  644. this.onPageIndexChange(index);
  645. target.value = `${this.pageIndex}`;
  646. }
  647. prePage() {
  648. this.onPageIndexChange(this.pageIndex - 1);
  649. }
  650. nextPage() {
  651. this.onPageIndexChange(this.pageIndex + 1);
  652. }
  653. onPageIndexChange(index) {
  654. this.pageIndexChange.next(index);
  655. }
  656. updateBindingValue() {
  657. this.lastIndex = Math.ceil(this.total / this.pageSize);
  658. this.isFirstIndex = this.pageIndex === 1;
  659. this.isLastIndex = this.pageIndex === this.lastIndex;
  660. }
  661. ngOnChanges(changes) {
  662. const { pageIndex, total, pageSize } = changes;
  663. if (pageIndex || total || pageSize) {
  664. this.updateBindingValue();
  665. }
  666. }
  667. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationSimpleComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1$2.Directionality }], target: i0.ɵɵFactoryTarget.Component });
  668. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", type: NzPaginationSimpleComponent, isStandalone: true, selector: "nz-pagination-simple", inputs: { itemRender: "itemRender", disabled: "disabled", locale: "locale", total: "total", pageIndex: "pageIndex", pageSize: "pageSize" }, outputs: { pageIndexChange: "pageIndexChange" }, viewQueries: [{ propertyName: "template", first: true, predicate: ["containerTemplate"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `
  669. <ng-template #containerTemplate>
  670. <ul>
  671. <li
  672. nz-pagination-item
  673. [locale]="locale"
  674. [attr.title]="locale.prev_page"
  675. [disabled]="isFirstIndex"
  676. [direction]="dir"
  677. (click)="prePage()"
  678. type="prev"
  679. [itemRender]="itemRender"
  680. ></li>
  681. <li [attr.title]="pageIndex + '/' + lastIndex" class="ant-pagination-simple-pager">
  682. <input [disabled]="disabled" [value]="pageIndex" (keydown.enter)="jumpToPageViaInput($event)" size="3" />
  683. <span class="ant-pagination-slash">/</span>
  684. {{ lastIndex }}
  685. </li>
  686. <li
  687. nz-pagination-item
  688. [locale]="locale"
  689. [attr.title]="locale?.next_page"
  690. [disabled]="isLastIndex"
  691. [direction]="dir"
  692. (click)="nextPage()"
  693. type="next"
  694. [itemRender]="itemRender"
  695. ></li>
  696. </ul>
  697. </ng-template>
  698. `, isInline: true, dependencies: [{ kind: "component", type: NzPaginationItemComponent, selector: "li[nz-pagination-item]", inputs: ["active", "locale", "index", "disabled", "direction", "type", "itemRender"], outputs: ["diffIndex", "gotoIndex"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  699. }
  700. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationSimpleComponent, decorators: [{
  701. type: Component,
  702. args: [{
  703. selector: 'nz-pagination-simple',
  704. preserveWhitespaces: false,
  705. encapsulation: ViewEncapsulation.None,
  706. changeDetection: ChangeDetectionStrategy.OnPush,
  707. template: `
  708. <ng-template #containerTemplate>
  709. <ul>
  710. <li
  711. nz-pagination-item
  712. [locale]="locale"
  713. [attr.title]="locale.prev_page"
  714. [disabled]="isFirstIndex"
  715. [direction]="dir"
  716. (click)="prePage()"
  717. type="prev"
  718. [itemRender]="itemRender"
  719. ></li>
  720. <li [attr.title]="pageIndex + '/' + lastIndex" class="ant-pagination-simple-pager">
  721. <input [disabled]="disabled" [value]="pageIndex" (keydown.enter)="jumpToPageViaInput($event)" size="3" />
  722. <span class="ant-pagination-slash">/</span>
  723. {{ lastIndex }}
  724. </li>
  725. <li
  726. nz-pagination-item
  727. [locale]="locale"
  728. [attr.title]="locale?.next_page"
  729. [disabled]="isLastIndex"
  730. [direction]="dir"
  731. (click)="nextPage()"
  732. type="next"
  733. [itemRender]="itemRender"
  734. ></li>
  735. </ul>
  736. </ng-template>
  737. `,
  738. imports: [NzPaginationItemComponent]
  739. }]
  740. }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1$2.Directionality }], propDecorators: { template: [{
  741. type: ViewChild,
  742. args: ['containerTemplate', { static: true }]
  743. }], itemRender: [{
  744. type: Input
  745. }], disabled: [{
  746. type: Input
  747. }], locale: [{
  748. type: Input
  749. }], total: [{
  750. type: Input
  751. }], pageIndex: [{
  752. type: Input
  753. }], pageSize: [{
  754. type: Input
  755. }], pageIndexChange: [{
  756. type: Output
  757. }] } });
  758. const NZ_CONFIG_MODULE_NAME = 'pagination';
  759. let NzPaginationComponent = (() => {
  760. let _nzSize_decorators;
  761. let _nzSize_initializers = [];
  762. let _nzSize_extraInitializers = [];
  763. let _nzPageSizeOptions_decorators;
  764. let _nzPageSizeOptions_initializers = [];
  765. let _nzPageSizeOptions_extraInitializers = [];
  766. let _nzShowSizeChanger_decorators;
  767. let _nzShowSizeChanger_initializers = [];
  768. let _nzShowSizeChanger_extraInitializers = [];
  769. let _nzShowQuickJumper_decorators;
  770. let _nzShowQuickJumper_initializers = [];
  771. let _nzShowQuickJumper_extraInitializers = [];
  772. let _nzSimple_decorators;
  773. let _nzSimple_initializers = [];
  774. let _nzSimple_extraInitializers = [];
  775. return class NzPaginationComponent {
  776. static {
  777. const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
  778. _nzSize_decorators = [WithConfig()];
  779. _nzPageSizeOptions_decorators = [WithConfig()];
  780. _nzShowSizeChanger_decorators = [WithConfig()];
  781. _nzShowQuickJumper_decorators = [WithConfig()];
  782. _nzSimple_decorators = [WithConfig()];
  783. __esDecorate(null, null, _nzSize_decorators, { kind: "field", name: "nzSize", static: false, private: false, access: { has: obj => "nzSize" in obj, get: obj => obj.nzSize, set: (obj, value) => { obj.nzSize = value; } }, metadata: _metadata }, _nzSize_initializers, _nzSize_extraInitializers);
  784. __esDecorate(null, null, _nzPageSizeOptions_decorators, { kind: "field", name: "nzPageSizeOptions", static: false, private: false, access: { has: obj => "nzPageSizeOptions" in obj, get: obj => obj.nzPageSizeOptions, set: (obj, value) => { obj.nzPageSizeOptions = value; } }, metadata: _metadata }, _nzPageSizeOptions_initializers, _nzPageSizeOptions_extraInitializers);
  785. __esDecorate(null, null, _nzShowSizeChanger_decorators, { kind: "field", name: "nzShowSizeChanger", static: false, private: false, access: { has: obj => "nzShowSizeChanger" in obj, get: obj => obj.nzShowSizeChanger, set: (obj, value) => { obj.nzShowSizeChanger = value; } }, metadata: _metadata }, _nzShowSizeChanger_initializers, _nzShowSizeChanger_extraInitializers);
  786. __esDecorate(null, null, _nzShowQuickJumper_decorators, { kind: "field", name: "nzShowQuickJumper", static: false, private: false, access: { has: obj => "nzShowQuickJumper" in obj, get: obj => obj.nzShowQuickJumper, set: (obj, value) => { obj.nzShowQuickJumper = value; } }, metadata: _metadata }, _nzShowQuickJumper_initializers, _nzShowQuickJumper_extraInitializers);
  787. __esDecorate(null, null, _nzSimple_decorators, { kind: "field", name: "nzSimple", static: false, private: false, access: { has: obj => "nzSimple" in obj, get: obj => obj.nzSimple, set: (obj, value) => { obj.nzSimple = value; } }, metadata: _metadata }, _nzSimple_initializers, _nzSimple_extraInitializers);
  788. if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
  789. }
  790. i18n;
  791. cdr;
  792. breakpointService;
  793. nzConfigService;
  794. directionality;
  795. _nzModuleName = NZ_CONFIG_MODULE_NAME;
  796. nzPageSizeChange = new EventEmitter();
  797. nzPageIndexChange = new EventEmitter();
  798. nzShowTotal = null;
  799. nzItemRender = null;
  800. nzSize = __runInitializers(this, _nzSize_initializers, 'default');
  801. nzPageSizeOptions = (__runInitializers(this, _nzSize_extraInitializers), __runInitializers(this, _nzPageSizeOptions_initializers, [10, 20, 30, 40]));
  802. nzShowSizeChanger = (__runInitializers(this, _nzPageSizeOptions_extraInitializers), __runInitializers(this, _nzShowSizeChanger_initializers, false));
  803. nzShowQuickJumper = (__runInitializers(this, _nzShowSizeChanger_extraInitializers), __runInitializers(this, _nzShowQuickJumper_initializers, false));
  804. nzSimple = (__runInitializers(this, _nzShowQuickJumper_extraInitializers), __runInitializers(this, _nzSimple_initializers, false));
  805. nzDisabled = (__runInitializers(this, _nzSimple_extraInitializers), false);
  806. nzResponsive = false;
  807. nzHideOnSinglePage = false;
  808. nzTotal = 0;
  809. nzPageIndex = 1;
  810. nzPageSize = 10;
  811. showPagination = true;
  812. locale;
  813. size = 'default';
  814. dir = 'ltr';
  815. destroy$ = new Subject();
  816. total$ = new ReplaySubject(1);
  817. validatePageIndex(value, lastIndex) {
  818. if (value > lastIndex) {
  819. return lastIndex;
  820. }
  821. else if (value < 1) {
  822. return 1;
  823. }
  824. else {
  825. return value;
  826. }
  827. }
  828. onPageIndexChange(index) {
  829. const lastIndex = this.getLastIndex(this.nzTotal, this.nzPageSize);
  830. const validIndex = this.validatePageIndex(index, lastIndex);
  831. if (validIndex !== this.nzPageIndex && !this.nzDisabled) {
  832. this.nzPageIndex = validIndex;
  833. this.nzPageIndexChange.emit(this.nzPageIndex);
  834. }
  835. }
  836. onPageSizeChange(size) {
  837. this.nzPageSize = size;
  838. this.nzPageSizeChange.emit(size);
  839. const lastIndex = this.getLastIndex(this.nzTotal, this.nzPageSize);
  840. if (this.nzPageIndex > lastIndex) {
  841. this.onPageIndexChange(lastIndex);
  842. }
  843. }
  844. onTotalChange(total) {
  845. const lastIndex = this.getLastIndex(total, this.nzPageSize);
  846. if (this.nzPageIndex > lastIndex) {
  847. Promise.resolve().then(() => {
  848. this.onPageIndexChange(lastIndex);
  849. this.cdr.markForCheck();
  850. });
  851. }
  852. }
  853. getLastIndex(total, pageSize) {
  854. return Math.ceil(total / pageSize);
  855. }
  856. constructor(i18n, cdr, breakpointService, nzConfigService, directionality) {
  857. this.i18n = i18n;
  858. this.cdr = cdr;
  859. this.breakpointService = breakpointService;
  860. this.nzConfigService = nzConfigService;
  861. this.directionality = directionality;
  862. }
  863. ngOnInit() {
  864. this.i18n.localeChange.pipe(takeUntil(this.destroy$)).subscribe(() => {
  865. this.locale = this.i18n.getLocaleData('Pagination');
  866. this.cdr.markForCheck();
  867. });
  868. this.total$.pipe(takeUntil(this.destroy$)).subscribe(total => {
  869. this.onTotalChange(total);
  870. });
  871. this.breakpointService
  872. .subscribe(gridResponsiveMap)
  873. .pipe(takeUntil(this.destroy$))
  874. .subscribe(bp => {
  875. if (this.nzResponsive) {
  876. this.size = bp === NzBreakpointEnum.xs ? 'small' : 'default';
  877. this.cdr.markForCheck();
  878. }
  879. });
  880. this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
  881. this.dir = direction;
  882. this.cdr.detectChanges();
  883. });
  884. this.dir = this.directionality.value;
  885. }
  886. ngOnDestroy() {
  887. this.destroy$.next();
  888. this.destroy$.complete();
  889. }
  890. ngOnChanges(changes) {
  891. const { nzHideOnSinglePage, nzTotal, nzPageSize, nzSize } = changes;
  892. if (nzTotal) {
  893. this.total$.next(this.nzTotal);
  894. }
  895. if (nzHideOnSinglePage || nzTotal || nzPageSize) {
  896. this.showPagination =
  897. (this.nzHideOnSinglePage && this.nzTotal > this.nzPageSize) || (this.nzTotal > 0 && !this.nzHideOnSinglePage);
  898. }
  899. if (nzSize) {
  900. this.size = nzSize.currentValue;
  901. }
  902. }
  903. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationComponent, deps: [{ token: i1$3.NzI18nService }, { token: i0.ChangeDetectorRef }, { token: i2$1.NzBreakpointService }, { token: i3.NzConfigService }, { token: i1$2.Directionality }], target: i0.ɵɵFactoryTarget.Component });
  904. static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.2", type: NzPaginationComponent, isStandalone: true, selector: "nz-pagination", inputs: { nzShowTotal: "nzShowTotal", nzItemRender: "nzItemRender", nzSize: "nzSize", nzPageSizeOptions: "nzPageSizeOptions", nzShowSizeChanger: ["nzShowSizeChanger", "nzShowSizeChanger", booleanAttribute], nzShowQuickJumper: ["nzShowQuickJumper", "nzShowQuickJumper", booleanAttribute], nzSimple: ["nzSimple", "nzSimple", booleanAttribute], nzDisabled: ["nzDisabled", "nzDisabled", booleanAttribute], nzResponsive: ["nzResponsive", "nzResponsive", booleanAttribute], nzHideOnSinglePage: ["nzHideOnSinglePage", "nzHideOnSinglePage", booleanAttribute], nzTotal: ["nzTotal", "nzTotal", numberAttribute], nzPageIndex: ["nzPageIndex", "nzPageIndex", numberAttribute], nzPageSize: ["nzPageSize", "nzPageSize", numberAttribute] }, outputs: { nzPageSizeChange: "nzPageSizeChange", nzPageIndexChange: "nzPageIndexChange" }, host: { properties: { "class.ant-pagination-simple": "nzSimple", "class.ant-pagination-disabled": "nzDisabled", "class.ant-pagination-mini": "!nzSimple && size === 'small'", "class.ant-pagination-rtl": "dir === 'rtl'" }, classAttribute: "ant-pagination" }, exportAs: ["nzPagination"], usesOnChanges: true, ngImport: i0, template: `
  905. @if (showPagination) {
  906. @if (nzSimple) {
  907. <ng-template [ngTemplateOutlet]="simplePagination.template" />
  908. } @else {
  909. <ng-template [ngTemplateOutlet]="defaultPagination.template" />
  910. }
  911. }
  912. <nz-pagination-simple
  913. #simplePagination
  914. [disabled]="nzDisabled"
  915. [itemRender]="nzItemRender"
  916. [locale]="locale"
  917. [pageSize]="nzPageSize"
  918. [total]="nzTotal"
  919. [pageIndex]="nzPageIndex"
  920. (pageIndexChange)="onPageIndexChange($event)"
  921. ></nz-pagination-simple>
  922. <nz-pagination-default
  923. #defaultPagination
  924. [nzSize]="size"
  925. [itemRender]="nzItemRender"
  926. [showTotal]="nzShowTotal"
  927. [disabled]="nzDisabled"
  928. [locale]="locale"
  929. [showSizeChanger]="nzShowSizeChanger"
  930. [showQuickJumper]="nzShowQuickJumper"
  931. [total]="nzTotal"
  932. [pageIndex]="nzPageIndex"
  933. [pageSize]="nzPageSize"
  934. [pageSizeOptions]="nzPageSizeOptions"
  935. (pageIndexChange)="onPageIndexChange($event)"
  936. (pageSizeChange)="onPageSizeChange($event)"
  937. ></nz-pagination-default>
  938. `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NzPaginationSimpleComponent, selector: "nz-pagination-simple", inputs: ["itemRender", "disabled", "locale", "total", "pageIndex", "pageSize"], outputs: ["pageIndexChange"] }, { kind: "component", type: NzPaginationDefaultComponent, selector: "nz-pagination-default", inputs: ["nzSize", "itemRender", "showTotal", "disabled", "locale", "showSizeChanger", "showQuickJumper", "total", "pageIndex", "pageSize", "pageSizeOptions"], outputs: ["pageIndexChange", "pageSizeChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
  939. };
  940. })();
  941. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationComponent, decorators: [{
  942. type: Component,
  943. args: [{
  944. selector: 'nz-pagination',
  945. exportAs: 'nzPagination',
  946. preserveWhitespaces: false,
  947. encapsulation: ViewEncapsulation.None,
  948. changeDetection: ChangeDetectionStrategy.OnPush,
  949. template: `
  950. @if (showPagination) {
  951. @if (nzSimple) {
  952. <ng-template [ngTemplateOutlet]="simplePagination.template" />
  953. } @else {
  954. <ng-template [ngTemplateOutlet]="defaultPagination.template" />
  955. }
  956. }
  957. <nz-pagination-simple
  958. #simplePagination
  959. [disabled]="nzDisabled"
  960. [itemRender]="nzItemRender"
  961. [locale]="locale"
  962. [pageSize]="nzPageSize"
  963. [total]="nzTotal"
  964. [pageIndex]="nzPageIndex"
  965. (pageIndexChange)="onPageIndexChange($event)"
  966. ></nz-pagination-simple>
  967. <nz-pagination-default
  968. #defaultPagination
  969. [nzSize]="size"
  970. [itemRender]="nzItemRender"
  971. [showTotal]="nzShowTotal"
  972. [disabled]="nzDisabled"
  973. [locale]="locale"
  974. [showSizeChanger]="nzShowSizeChanger"
  975. [showQuickJumper]="nzShowQuickJumper"
  976. [total]="nzTotal"
  977. [pageIndex]="nzPageIndex"
  978. [pageSize]="nzPageSize"
  979. [pageSizeOptions]="nzPageSizeOptions"
  980. (pageIndexChange)="onPageIndexChange($event)"
  981. (pageSizeChange)="onPageSizeChange($event)"
  982. ></nz-pagination-default>
  983. `,
  984. host: {
  985. class: 'ant-pagination',
  986. '[class.ant-pagination-simple]': 'nzSimple',
  987. '[class.ant-pagination-disabled]': 'nzDisabled',
  988. '[class.ant-pagination-mini]': `!nzSimple && size === 'small'`,
  989. '[class.ant-pagination-rtl]': `dir === 'rtl'`
  990. },
  991. imports: [NgTemplateOutlet, NzPaginationSimpleComponent, NzPaginationDefaultComponent]
  992. }]
  993. }], ctorParameters: () => [{ type: i1$3.NzI18nService }, { type: i0.ChangeDetectorRef }, { type: i2$1.NzBreakpointService }, { type: i3.NzConfigService }, { type: i1$2.Directionality }], propDecorators: { nzPageSizeChange: [{
  994. type: Output
  995. }], nzPageIndexChange: [{
  996. type: Output
  997. }], nzShowTotal: [{
  998. type: Input
  999. }], nzItemRender: [{
  1000. type: Input
  1001. }], nzSize: [{
  1002. type: Input
  1003. }], nzPageSizeOptions: [{
  1004. type: Input
  1005. }], nzShowSizeChanger: [{
  1006. type: Input,
  1007. args: [{ transform: booleanAttribute }]
  1008. }], nzShowQuickJumper: [{
  1009. type: Input,
  1010. args: [{ transform: booleanAttribute }]
  1011. }], nzSimple: [{
  1012. type: Input,
  1013. args: [{ transform: booleanAttribute }]
  1014. }], nzDisabled: [{
  1015. type: Input,
  1016. args: [{ transform: booleanAttribute }]
  1017. }], nzResponsive: [{
  1018. type: Input,
  1019. args: [{ transform: booleanAttribute }]
  1020. }], nzHideOnSinglePage: [{
  1021. type: Input,
  1022. args: [{ transform: booleanAttribute }]
  1023. }], nzTotal: [{
  1024. type: Input,
  1025. args: [{ transform: numberAttribute }]
  1026. }], nzPageIndex: [{
  1027. type: Input,
  1028. args: [{ transform: numberAttribute }]
  1029. }], nzPageSize: [{
  1030. type: Input,
  1031. args: [{ transform: numberAttribute }]
  1032. }] } });
  1033. /**
  1034. * Use of this source code is governed by an MIT-style license that can be
  1035. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  1036. */
  1037. class NzPaginationModule {
  1038. static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
  1039. static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationModule, imports: [NzPaginationComponent,
  1040. NzPaginationSimpleComponent,
  1041. NzPaginationOptionsComponent,
  1042. NzPaginationItemComponent,
  1043. NzPaginationDefaultComponent], exports: [NzPaginationComponent] });
  1044. static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationModule, imports: [NzPaginationComponent,
  1045. NzPaginationSimpleComponent,
  1046. NzPaginationOptionsComponent,
  1047. NzPaginationItemComponent,
  1048. NzPaginationDefaultComponent] });
  1049. }
  1050. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: NzPaginationModule, decorators: [{
  1051. type: NgModule,
  1052. args: [{
  1053. imports: [
  1054. NzPaginationComponent,
  1055. NzPaginationSimpleComponent,
  1056. NzPaginationOptionsComponent,
  1057. NzPaginationItemComponent,
  1058. NzPaginationDefaultComponent
  1059. ],
  1060. exports: [NzPaginationComponent]
  1061. }]
  1062. }] });
  1063. /**
  1064. * Use of this source code is governed by an MIT-style license that can be
  1065. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  1066. */
  1067. /**
  1068. * Use of this source code is governed by an MIT-style license that can be
  1069. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  1070. */
  1071. /**
  1072. * Generated bundle index. Do not edit.
  1073. */
  1074. export { NzPaginationComponent, NzPaginationDefaultComponent, NzPaginationItemComponent, NzPaginationModule, NzPaginationOptionsComponent, NzPaginationSimpleComponent };
  1075. //# sourceMappingURL=ng-zorro-antd-pagination.mjs.map