@slickgrid-universal/pagination-component
Advanced tools
Comparing version 5.11.0 to 5.12.0
@@ -82,7 +82,7 @@ "use strict"; | ||
// we'll copy the data into a local object so that we can add binding to this local object | ||
this._subscriptions.push(this._pubSubService.subscribe('onPaginationRefreshed', paginationChanges => { | ||
Object.keys(paginationChanges).forEach(key => this.currentPagination[key] = paginationChanges[key]); | ||
this._subscriptions.push(this._pubSubService.subscribe('onPaginationRefreshed', (paginationChanges) => { | ||
Object.keys(paginationChanges).forEach((key) => (this.currentPagination[key] = paginationChanges[key])); | ||
this.updatePageButtonsUsability(); | ||
if (this._spanInfoFromToElm?.style) { | ||
this._spanInfoFromToElm.style.display = (this.currentPagination.totalItems === 0) ? 'none' : ''; | ||
this._spanInfoFromToElm.style.display = this.currentPagination.totalItems === 0 ? 'none' : ''; | ||
} | ||
@@ -228,3 +228,4 @@ }), this._pubSubService.subscribe('onPaginationSetCursorBased', () => { | ||
const paginationContainerElm = (0, common_1.createDomElement)('div', { | ||
id: 'pager', className: `slick-pagination-container ${this.gridUid} pager`, | ||
id: 'pager', | ||
className: `slick-pagination-container ${this.gridUid} pager`, | ||
style: { width: '100%' }, | ||
@@ -256,3 +257,4 @@ }); | ||
ariaLabel: 'Page Number', | ||
value: '1', size: 1, | ||
value: '1', | ||
size: 1, | ||
dataset: { test: 'page-number-input' }, | ||
@@ -259,0 +261,0 @@ }, divElm); |
@@ -79,7 +79,7 @@ import { Constants, createDomElement, getTranslationPrefix } from '@slickgrid-universal/common'; | ||
// we'll copy the data into a local object so that we can add binding to this local object | ||
this._subscriptions.push(this._pubSubService.subscribe('onPaginationRefreshed', paginationChanges => { | ||
Object.keys(paginationChanges).forEach(key => this.currentPagination[key] = paginationChanges[key]); | ||
this._subscriptions.push(this._pubSubService.subscribe('onPaginationRefreshed', (paginationChanges) => { | ||
Object.keys(paginationChanges).forEach((key) => (this.currentPagination[key] = paginationChanges[key])); | ||
this.updatePageButtonsUsability(); | ||
if (this._spanInfoFromToElm?.style) { | ||
this._spanInfoFromToElm.style.display = (this.currentPagination.totalItems === 0) ? 'none' : ''; | ||
this._spanInfoFromToElm.style.display = this.currentPagination.totalItems === 0 ? 'none' : ''; | ||
} | ||
@@ -225,3 +225,4 @@ }), this._pubSubService.subscribe('onPaginationSetCursorBased', () => { | ||
const paginationContainerElm = createDomElement('div', { | ||
id: 'pager', className: `slick-pagination-container ${this.gridUid} pager`, | ||
id: 'pager', | ||
className: `slick-pagination-container ${this.gridUid} pager`, | ||
style: { width: '100%' }, | ||
@@ -253,3 +254,4 @@ }); | ||
ariaLabel: 'Page Number', | ||
value: '1', size: 1, | ||
value: '1', | ||
size: 1, | ||
dataset: { test: 'page-number-input' }, | ||
@@ -256,0 +258,0 @@ }, divElm); |
{ | ||
"name": "@slickgrid-universal/pagination-component", | ||
"version": "5.11.0", | ||
"version": "5.12.0", | ||
"description": "Slick Pagination Component - Vanilla Implementation of a Pagination Component", | ||
@@ -41,6 +41,6 @@ "main": "./dist/cjs/index.js", | ||
"dependencies": { | ||
"@slickgrid-universal/binding": "~5.10.2", | ||
"@slickgrid-universal/common": "~5.11.0" | ||
"@slickgrid-universal/binding": "~5.12.0", | ||
"@slickgrid-universal/common": "~5.12.0" | ||
}, | ||
"gitHead": "894ab0a2783d6f7c4cb9d28d4b81421eb9e05a89" | ||
"gitHead": "d7e892ebc1727d7c83cc1e5cc80db8302eef4f63" | ||
} |
@@ -102,3 +102,8 @@ import type { | ||
init(grid: SlickGrid, paginationService: PaginationService, pubSubService: PubSubService, translaterService?: TranslaterService | undefined): void { | ||
init( | ||
grid: SlickGrid, | ||
paginationService: PaginationService, | ||
pubSubService: PubSubService, | ||
translaterService?: TranslaterService | undefined | ||
): void { | ||
this._grid = grid; | ||
@@ -113,3 +118,5 @@ this._pubSubService = pubSubService; | ||
if (this._enableTranslate && (!this._translaterService || !this._translaterService.translate)) { | ||
throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.'); | ||
throw new Error( | ||
'[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.' | ||
); | ||
} | ||
@@ -120,5 +127,3 @@ this.translatePaginationTexts(); | ||
const translateEventName = this._translaterService?.eventName ?? 'onLanguageChange'; | ||
this._subscriptions.push( | ||
this._pubSubService.subscribe(translateEventName, () => this.translatePaginationTexts()) | ||
); | ||
this._subscriptions.push(this._pubSubService.subscribe(translateEventName, () => this.translatePaginationTexts())); | ||
} | ||
@@ -129,7 +134,9 @@ | ||
this._subscriptions.push( | ||
this._pubSubService.subscribe<PaginationMetadata>('onPaginationRefreshed', paginationChanges => { | ||
Object.keys(paginationChanges).forEach(key => (this.currentPagination as any)[key] = paginationChanges[key as keyof PaginationMetadata]); | ||
this._pubSubService.subscribe<PaginationMetadata>('onPaginationRefreshed', (paginationChanges) => { | ||
Object.keys(paginationChanges).forEach( | ||
(key) => ((this.currentPagination as any)[key] = paginationChanges[key as keyof PaginationMetadata]) | ||
); | ||
this.updatePageButtonsUsability(); | ||
if (this._spanInfoFromToElm?.style) { | ||
this._spanInfoFromToElm.style.display = (this.currentPagination.totalItems === 0) ? 'none' : ''; | ||
this._spanInfoFromToElm.style.display = this.currentPagination.totalItems === 0 ? 'none' : ''; | ||
} | ||
@@ -167,5 +174,9 @@ }), | ||
this._seekFirstElm = createDomElement('li', { className: 'page-item seek-first' }, leftUlElm); | ||
this._seekFirstElm.appendChild(createDomElement('a', { className: 'page-link icon-seek-first', ariaLabel: 'First Page', role: 'button' })); | ||
this._seekFirstElm.appendChild( | ||
createDomElement('a', { className: 'page-link icon-seek-first', ariaLabel: 'First Page', role: 'button' }) | ||
); | ||
this._seekPrevElm = createDomElement('li', { className: 'page-item seek-prev' }, leftUlElm); | ||
this._seekPrevElm.appendChild(createDomElement('a', { className: 'page-link icon-seek-prev', ariaLabel: 'Previous Page', role: 'button' })); | ||
this._seekPrevElm.appendChild( | ||
createDomElement('a', { className: 'page-link icon-seek-prev', ariaLabel: 'Previous Page', role: 'button' }) | ||
); | ||
leftNavElm.appendChild(leftUlElm); | ||
@@ -226,3 +237,10 @@ | ||
? this._bindingHelper.addElementBinding(this.currentPagination, 'pageNumber', 'span.page-number', 'textContent') | ||
: this._bindingHelper.addElementBinding(this.currentPagination, 'pageNumber', 'input.page-number', 'value', 'change', this.changeToCurrentPage.bind(this)); | ||
: this._bindingHelper.addElementBinding( | ||
this.currentPagination, | ||
'pageNumber', | ||
'input.page-number', | ||
'value', | ||
'change', | ||
this.changeToCurrentPage.bind(this) | ||
); | ||
@@ -273,3 +291,3 @@ // locale text changes | ||
updateItemsPerPage(event: & { target: any; }): void { | ||
updateItemsPerPage(event: { target: any }): void { | ||
this.itemsPerPage = +(event?.target?.value ?? 0); | ||
@@ -301,3 +319,4 @@ } | ||
const paginationContainerElm = createDomElement('div', { | ||
id: 'pager', className: `slick-pagination-container ${this.gridUid} pager`, | ||
id: 'pager', | ||
className: `slick-pagination-container ${this.gridUid} pager`, | ||
style: { width: '100%' }, | ||
@@ -319,17 +338,26 @@ }); | ||
// cursor based navigation cannot jump to an arbitrary page. Simply display current page number. | ||
createDomElement('span', { | ||
className: 'page-number', | ||
ariaLabel: 'Page Number', | ||
dataset: { test: 'page-number-label' }, | ||
textContent: '1', | ||
}, divElm); | ||
createDomElement( | ||
'span', | ||
{ | ||
className: 'page-number', | ||
ariaLabel: 'Page Number', | ||
dataset: { test: 'page-number-label' }, | ||
textContent: '1', | ||
}, | ||
divElm | ||
); | ||
} else { | ||
// offset based navigation can jump to any page. Allow editing of current page number. | ||
createDomElement('input', { | ||
type: 'text', | ||
className: 'form-control page-number', | ||
ariaLabel: 'Page Number', | ||
value: '1', size: 1, | ||
dataset: { test: 'page-number-input' }, | ||
}, divElm); | ||
createDomElement( | ||
'input', | ||
{ | ||
type: 'text', | ||
className: 'form-control page-number', | ||
ariaLabel: 'Page Number', | ||
value: '1', | ||
size: 1, | ||
dataset: { test: 'page-number-input' }, | ||
}, | ||
divElm | ||
); | ||
} | ||
@@ -347,3 +375,7 @@ | ||
const spanContainerElm = createDomElement('span', { className: 'slick-pagination-settings' }); | ||
this._itemPerPageElm = createDomElement('select', { id: 'items-per-page-label', ariaLabel: 'Items per Page', className: 'items-per-page' }, spanContainerElm); | ||
this._itemPerPageElm = createDomElement( | ||
'select', | ||
{ id: 'items-per-page-label', ariaLabel: 'Items per Page', className: 'items-per-page' }, | ||
spanContainerElm | ||
); | ||
spanContainerElm.appendChild(document.createTextNode(' ')); | ||
@@ -355,3 +387,7 @@ createDomElement('span', { className: 'text-item-per-page', textContent: 'items per page' }, spanContainerElm); | ||
this._spanInfoFromToElm = createDomElement('span', { className: 'page-info-from-to' }, spanPaginationCount); | ||
createDomElement('span', { className: 'item-from', ariaLabel: 'Page Item From', dataset: { test: 'item-from' } }, this._spanInfoFromToElm); | ||
createDomElement( | ||
'span', | ||
{ className: 'item-from', ariaLabel: 'Page Item From', dataset: { test: 'item-from' } }, | ||
this._spanInfoFromToElm | ||
); | ||
this._spanInfoFromToElm.appendChild(document.createTextNode('-')); | ||
@@ -358,0 +394,0 @@ createDomElement('span', { className: 'item-to', ariaLabel: 'Page Item To', dataset: { test: 'item-to' } }, this._spanInfoFromToElm); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
183174
1028
+ Added@slickgrid-universal/binding@5.12.2(transitive)
+ Added@slickgrid-universal/common@5.12.2(transitive)
+ Added@slickgrid-universal/event-pub-sub@5.12.2(transitive)
+ Added@slickgrid-universal/utils@5.12.0(transitive)
- Removed@slickgrid-universal/binding@5.10.2(transitive)
- Removed@slickgrid-universal/common@5.11.0(transitive)
- Removed@slickgrid-universal/event-pub-sub@5.10.2(transitive)
- Removed@slickgrid-universal/utils@5.10.2(transitive)