From d39a23f342191abfc2d59a1e017e1c51a4da948d Mon Sep 17 00:00:00 2001 From: rahuljain-dev Date: Wed, 31 Jul 2024 11:43:12 +0530 Subject: [PATCH] ELEMENTS-1747: Make nuxeo-pagination-controls efficient with 50000+ pages --- ui/nuxeo-pagination-controls.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/ui/nuxeo-pagination-controls.js b/ui/nuxeo-pagination-controls.js index bf5943ab5..85892c55a 100644 --- a/ui/nuxeo-pagination-controls.js +++ b/ui/nuxeo-pagination-controls.js @@ -86,6 +86,12 @@ import { html } from '@polymer/polymer/lib/utils/html-tag.js'; .total { margin-inline-start: 2rem; + font-size: 1rem; + width: 5rem; + text-align: center; + } + + .currentPage { font-size: 1rem; width: 4rem; text-align: center; @@ -114,8 +120,11 @@ import { html } from '@polymer/polymer/lib/utils/html-tag.js'; >
- - + + [[page]] / [[numberOfPages]]
i + 1); } + + _computeLimitForOptions(numberOfPages) { + const maxItemsForNuxeoSelectPagination = + Nuxeo && + Nuxeo.UI && + Nuxeo.UI.config && + Nuxeo.UI.config.pagination && + Nuxeo.UI.config.pagination.nuxeoSelectOptions && + Nuxeo.UI.config.pagination.nuxeoSelectOptions.listingMaxItems + ? Nuxeo.UI.config.pagination.nuxeoSelectOptions.listingMaxItems + : 1000; + if (numberOfPages > maxItemsForNuxeoSelectPagination) { + return false; + } + return true; + } } customElements.define(PaginationControls.is, PaginationControls);