fix(pagination): Improve spacing for page next and first page buttons

This commit is contained in:
Joxit
2019-06-15 22:37:24 +02:00
parent 92fc37adb4
commit dbb746981a
3 changed files with 28 additions and 4 deletions
+9 -3
View File
@@ -84,11 +84,17 @@ registryUI.getPageLabels = function(page, nPages) {
var maxItems = 10;
if (nPages === 1) { return pageLabels; }
if (page !== 1 && nPages >= maxItems) {
pageLabels.push({'icon': 'first_page', page: 0});
pageLabels.push({'icon': 'first_page', page: 1});
pageLabels.push({'icon': 'chevron_left', page: page - 1});
}
for (var i = Math.max(1, page - maxItems); i <= Math.min(nPages, page + maxItems); i++) {
pageLabels.push({page: i, current: i === page});
var start = Math.round(Math.max(1, Math.min(page - maxItems / 2, nPages - maxItems + 1)));
for (var i = start; i < Math.min(nPages + 1, start + maxItems); i++) {
pageLabels.push({
page: i,
current: i === page,
'space-left': page === 1 && nPages > maxItems,
'space-right': page === nPages && nPages > maxItems
});
}
if (page !== nPages && nPages >= maxItems) {
pageLabels.push({'icon': 'chevron_right', page: page + 1});