@slickgrid-universal/pagination-component 5.7.0 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -1,15 +1,12 @@
1
- import type { GridOption, Locale, PaginationService, PubSubService, ServicePagination, SharedService, SlickGrid, Subscription, TranslaterService } from '@slickgrid-universal/common';
1
+ import type { GridOption, Locale, BasePaginationComponent, PaginationService, PubSubService, PaginationMetadata, SlickGrid, Subscription, TranslaterService } from '@slickgrid-universal/common';
2
2
  import { BindingEventService, BindingHelper } from '@slickgrid-universal/binding';
3
- export declare class SlickPaginationComponent {
4
- protected readonly paginationService: PaginationService;
5
- protected readonly pubSubService: PubSubService;
6
- protected readonly sharedService: SharedService;
7
- protected readonly translaterService?: TranslaterService | undefined;
3
+ export declare class SlickPaginationComponent implements BasePaginationComponent {
8
4
  protected _bindingHelper: BindingHelper;
9
5
  protected _bindingEventService: BindingEventService;
10
6
  protected _paginationElement: HTMLDivElement;
11
7
  protected _enableTranslate: boolean;
12
- protected _gridParentContainerElm?: HTMLElement;
8
+ protected _grid: SlickGrid;
9
+ protected _gridContainerElm?: HTMLElement;
13
10
  protected _itemPerPageElm: HTMLSelectElement;
14
11
  protected _spanInfoFromToElm: HTMLSpanElement;
15
12
  protected _seekFirstElm: HTMLLIElement;
@@ -17,7 +14,10 @@ export declare class SlickPaginationComponent {
17
14
  protected _seekNextElm: HTMLLIElement;
18
15
  protected _seekEndElm: HTMLLIElement;
19
16
  protected _subscriptions: Subscription[];
20
- currentPagination: ServicePagination;
17
+ protected _paginationService: PaginationService;
18
+ protected _pubSubService: PubSubService;
19
+ protected _translaterService?: TranslaterService;
20
+ currentPagination: PaginationMetadata;
21
21
  firstButtonClasses: string;
22
22
  lastButtonClasses: string;
23
23
  prevButtonClasses: string;
@@ -26,7 +26,7 @@ export declare class SlickPaginationComponent {
26
26
  textItems: string;
27
27
  textOf: string;
28
28
  textPage: string;
29
- constructor(paginationService: PaginationService, pubSubService: PubSubService, sharedService: SharedService, translaterService?: TranslaterService | undefined);
29
+ constructor();
30
30
  get availablePageSizes(): number[];
31
31
  get dataFrom(): number;
32
32
  get dataTo(): number;
@@ -34,15 +34,20 @@ export declare class SlickPaginationComponent {
34
34
  set itemsPerPage(count: number);
35
35
  get pageCount(): number;
36
36
  get pageNumber(): number;
37
- get grid(): SlickGrid;
37
+ /** Getter for the Grid Options pulled through the Grid Object */
38
38
  get gridOptions(): GridOption;
39
39
  get gridUid(): string;
40
40
  get locales(): Locale;
41
41
  get totalItems(): number;
42
42
  get isLeftPaginationDisabled(): boolean;
43
43
  get isRightPaginationDisabled(): boolean;
44
+ init(grid: SlickGrid, paginationService: PaginationService, pubSubService: PubSubService, translaterService?: TranslaterService | undefined): void;
45
+ /** dispose of all Subscriptions, DOM element & bindings */
44
46
  dispose(): void;
45
- renderPagination(gridParentContainerElm: HTMLElement): void;
47
+ /** dispose of the DOM element & bindings only (regular PubSub subscription will be preserved) */
48
+ disposeDom(): void;
49
+ /** render the Pagination in the DOM with all events & bindings */
50
+ renderPagination(containerElm: HTMLElement): void;
46
51
  /** Render and fill the Page Sizes <select> element */
47
52
  renderPageSizes(): void;
48
53
  /** Add some DOM Element bindings */
@@ -1 +1 @@
1
- {"version":3,"file":"slick-pagination.component.d.ts","sourceRoot":"","sources":["../../src/slick-pagination.component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,YAAY,EACZ,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,mBAAm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M,EAAE,GAAG,CAAC;KAAE,GAAG,IAAI;IAInD,+HAA+H;IAC/H,wBAAwB,IAAI,IAAI;IAmBhC,sCAAsC;IACtC,SAAS,CAAC,yBAAyB,IAAI,cAAc;IAarD,SAAS,CAAC,uBAAuB,IAAI,cAAc;IA+BnD,SAAS,CAAC,+BAA+B,IAAI,eAAe;IAwB5D,SAAS,CAAC,0BAA0B,IAAI,IAAI;CAM7C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slickgrid-universal/pagination-component",
3
- "version": "5.7.0",
3
+ "version": "5.9.0",
4
4
  "description": "Slick Pagination Component - Vanilla Implementation of a Pagination Component",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -38,8 +38,8 @@
38
38
  "not dead"
39
39
  ],
40
40
  "dependencies": {
41
- "@slickgrid-universal/binding": "~5.7.0",
42
- "@slickgrid-universal/common": "~5.7.0"
41
+ "@slickgrid-universal/binding": "~5.9.0",
42
+ "@slickgrid-universal/common": "~5.9.0"
43
43
  },
44
- "gitHead": "f5b514677e13f20273ee6e5e4f5437648e2744b8"
44
+ "gitHead": "2f6ea0833a0fd3b59e71c5cf2e228a57afbfc53a"
45
45
  }
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './slick-pagination.component';
1
+ export * from './slick-pagination.component.js';
@@ -1,10 +1,10 @@
1
1
  import type {
2
2
  GridOption,
3
3
  Locale,
4
+ BasePaginationComponent,
4
5
  PaginationService,
5
6
  PubSubService,
6
- ServicePagination,
7
- SharedService,
7
+ PaginationMetadata,
8
8
  SlickGrid,
9
9
  Subscription,
10
10
  TranslaterService,
@@ -12,12 +12,13 @@ import type {
12
12
  import { Constants, createDomElement, getTranslationPrefix } from '@slickgrid-universal/common';
13
13
  import { BindingEventService, BindingHelper } from '@slickgrid-universal/binding';
14
14
 
15
- export class SlickPaginationComponent {
15
+ export class SlickPaginationComponent implements BasePaginationComponent {
16
16
  protected _bindingHelper: BindingHelper;
17
17
  protected _bindingEventService: BindingEventService;
18
18
  protected _paginationElement!: HTMLDivElement;
19
19
  protected _enableTranslate = false;
20
- protected _gridParentContainerElm?: HTMLElement;
20
+ protected _grid!: SlickGrid;
21
+ protected _gridContainerElm?: HTMLElement;
21
22
  protected _itemPerPageElm!: HTMLSelectElement;
22
23
  protected _spanInfoFromToElm!: HTMLSpanElement;
23
24
  protected _seekFirstElm!: HTMLLIElement;
@@ -25,7 +26,10 @@ export class SlickPaginationComponent {
25
26
  protected _seekNextElm!: HTMLLIElement;
26
27
  protected _seekEndElm!: HTMLLIElement;
27
28
  protected _subscriptions: Subscription[] = [];
28
- currentPagination: ServicePagination;
29
+ protected _paginationService!: PaginationService;
30
+ protected _pubSubService!: PubSubService;
31
+ protected _translaterService?: TranslaterService;
32
+ currentPagination = {} as PaginationMetadata;
29
33
  firstButtonClasses = '';
30
34
  lastButtonClasses = '';
31
35
  prevButtonClasses = '';
@@ -37,81 +41,45 @@ export class SlickPaginationComponent {
37
41
  textOf = 'of';
38
42
  textPage = 'Page';
39
43
 
40
- constructor(protected readonly paginationService: PaginationService, protected readonly pubSubService: PubSubService, protected readonly sharedService: SharedService, protected readonly translaterService?: TranslaterService | undefined) {
44
+ constructor() {
41
45
  this._bindingHelper = new BindingHelper();
42
46
  this._bindingEventService = new BindingEventService();
43
- this._bindingHelper.querySelectorPrefix = `.${this.gridUid} `;
44
- this.currentPagination = this.paginationService.getFullPagination();
45
- this._enableTranslate = this.gridOptions?.enableTranslate ?? false;
46
-
47
- if (this._enableTranslate && (!this.translaterService || !this.translaterService.translate)) {
48
- throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');
49
- }
50
- this.translatePaginationTexts();
51
-
52
- if (this._enableTranslate && this.pubSubService?.subscribe) {
53
- const translateEventName = this.translaterService?.eventName ?? 'onLanguageChange';
54
- this._subscriptions.push(
55
- this.pubSubService.subscribe(translateEventName, () => this.translatePaginationTexts())
56
- );
57
- }
58
-
59
- // Anytime the pagination is initialized or has changes,
60
- // we'll copy the data into a local object so that we can add binding to this local object
61
- this._subscriptions.push(
62
- this.pubSubService.subscribe<ServicePagination>('onPaginationRefreshed', paginationChanges => {
63
- for (const key of Object.keys(paginationChanges)) {
64
- (this.currentPagination as any)[key] = (paginationChanges as any)[key];
65
- }
66
- this.updatePageButtonsUsability();
67
- if (this._spanInfoFromToElm?.style) {
68
- this._spanInfoFromToElm.style.display = (this.currentPagination.totalItems === 0) ? 'none' : '';
69
- }
70
- }),
71
- this.pubSubService.subscribe('onPaginationSetCursorBased', () => {
72
- this.dispose(); // recreate pagination component, probably only used for GraphQL E2E tests
73
- this.renderPagination(this._gridParentContainerElm!);
74
- })
75
- );
76
47
  }
77
48
 
78
49
  get availablePageSizes(): number[] {
79
- return this.paginationService.availablePageSizes || [];
50
+ return this._paginationService.availablePageSizes || [];
80
51
  }
81
52
 
82
53
  get dataFrom(): number {
83
- return this.paginationService.dataFrom;
54
+ return this._paginationService.dataFrom;
84
55
  }
85
56
 
86
57
  get dataTo(): number {
87
- return this.paginationService.dataTo;
58
+ return this._paginationService.dataTo;
88
59
  }
89
60
 
90
61
  get itemsPerPage(): number {
91
- return this.paginationService.itemsPerPage;
62
+ return this._paginationService.itemsPerPage;
92
63
  }
93
64
  set itemsPerPage(count: number) {
94
- this.paginationService.changeItemPerPage(count);
65
+ this._paginationService.changeItemPerPage(count);
95
66
  }
96
67
 
97
68
  get pageCount(): number {
98
- return this.paginationService.pageCount;
69
+ return this._paginationService.pageCount;
99
70
  }
100
71
 
101
72
  get pageNumber(): number {
102
- return this.paginationService.pageNumber;
103
- }
104
-
105
- get grid(): SlickGrid {
106
- return this.sharedService.slickGrid;
73
+ return this._paginationService.pageNumber;
107
74
  }
108
75
 
76
+ /** Getter for the Grid Options pulled through the Grid Object */
109
77
  get gridOptions(): GridOption {
110
- return this.sharedService.gridOptions;
78
+ return this._grid?.getOptions() ?? {};
111
79
  }
112
80
 
113
81
  get gridUid(): string {
114
- return this.grid?.getUID() ?? '';
82
+ return this._grid?.getUID() || '';
115
83
  }
116
84
 
117
85
  get locales(): Locale {
@@ -120,7 +88,7 @@ export class SlickPaginationComponent {
120
88
  }
121
89
 
122
90
  get totalItems(): number {
123
- return this.paginationService.totalItems;
91
+ return this._paginationService.totalItems;
124
92
  }
125
93
 
126
94
  get isLeftPaginationDisabled(): boolean {
@@ -131,17 +99,60 @@ export class SlickPaginationComponent {
131
99
  return this.pageNumber === this.pageCount || this.totalItems === 0;
132
100
  }
133
101
 
102
+ init(grid: SlickGrid, paginationService: PaginationService, pubSubService: PubSubService, translaterService?: TranslaterService | undefined): void {
103
+ this._grid = grid;
104
+ this._pubSubService = pubSubService;
105
+ this._translaterService = translaterService;
106
+ this._paginationService = paginationService;
107
+ this.currentPagination = paginationService.getFullPagination();
108
+ this._bindingHelper.querySelectorPrefix = this.gridUid ? `.${this.gridUid} ` : '';
109
+ this._enableTranslate = this.gridOptions?.enableTranslate ?? false;
110
+
111
+ if (this._enableTranslate && (!this._translaterService || !this._translaterService.translate)) {
112
+ throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');
113
+ }
114
+ this.translatePaginationTexts();
115
+
116
+ if (this._enableTranslate && this._pubSubService?.subscribe) {
117
+ const translateEventName = this._translaterService?.eventName ?? 'onLanguageChange';
118
+ this._subscriptions.push(
119
+ this._pubSubService.subscribe(translateEventName, () => this.translatePaginationTexts())
120
+ );
121
+ }
122
+
123
+ // Anytime the pagination is initialized or has changes,
124
+ // we'll copy the data into a local object so that we can add binding to this local object
125
+ this._subscriptions.push(
126
+ this._pubSubService.subscribe<PaginationMetadata>('onPaginationRefreshed', paginationChanges => {
127
+ Object.keys(paginationChanges).forEach(key => (this.currentPagination as any)[key] = paginationChanges[key as keyof PaginationMetadata]);
128
+ this.updatePageButtonsUsability();
129
+ if (this._spanInfoFromToElm?.style) {
130
+ this._spanInfoFromToElm.style.display = (this.currentPagination.totalItems === 0) ? 'none' : '';
131
+ }
132
+ }),
133
+ this._pubSubService.subscribe('onPaginationSetCursorBased', () => {
134
+ this.disposeDom(); // recreate pagination component, probably only used for GraphQL E2E tests
135
+ this.renderPagination(this._gridContainerElm!);
136
+ })
137
+ );
138
+ }
139
+
140
+ /** dispose of all Subscriptions, DOM element & bindings */
134
141
  dispose(): void {
135
- // also dispose of all Subscriptions
136
- this.pubSubService.unsubscribeAll(this._subscriptions);
137
- this._bindingEventService.unbindAll();
142
+ this._pubSubService.unsubscribeAll(this._subscriptions);
143
+ this.disposeDom();
144
+ }
138
145
 
146
+ /** dispose of the DOM element & bindings only (regular PubSub subscription will be preserved) */
147
+ disposeDom(): void {
148
+ this._bindingEventService.unbindAll();
139
149
  this._bindingHelper.dispose();
140
150
  this._paginationElement.remove();
141
151
  }
142
152
 
143
- renderPagination(gridParentContainerElm: HTMLElement): void {
144
- this._gridParentContainerElm = gridParentContainerElm;
153
+ /** render the Pagination in the DOM with all events & bindings */
154
+ renderPagination(containerElm: HTMLElement): void {
155
+ this._gridContainerElm = containerElm;
145
156
  const paginationElm = this.createPaginationContainer();
146
157
  const divNavContainerElm = createDomElement('div', { className: 'slick-pagination-nav' });
147
158
 
@@ -175,8 +186,8 @@ export class SlickPaginationComponent {
175
186
  paginationElm.appendChild(divNavContainerElm);
176
187
  paginationElm.appendChild(paginationSettingsElm);
177
188
  this._paginationElement.appendChild(paginationElm);
178
- if (gridParentContainerElm?.appendChild && this._paginationElement) {
179
- gridParentContainerElm.appendChild(this._paginationElement);
189
+ if (containerElm?.appendChild && this._paginationElement) {
190
+ containerElm.appendChild(this._paginationElement);
180
191
  }
181
192
 
182
193
  this.renderPageSizes();
@@ -205,7 +216,7 @@ export class SlickPaginationComponent {
205
216
  this._bindingHelper.addElementBinding(this.currentPagination, 'totalItems', 'span.total-items', 'textContent');
206
217
  this._bindingHelper.addElementBinding(this.currentPagination, 'pageCount', 'span.page-count', 'textContent');
207
218
  this._bindingHelper.addElementBinding(this.currentPagination, 'pageSize', 'select.items-per-page', 'value');
208
- this.paginationService.isCursorBased
219
+ this._paginationService.isCursorBased
209
220
  ? this._bindingHelper.addElementBinding(this.currentPagination, 'pageNumber', 'span.page-number', 'textContent')
210
221
  : this._bindingHelper.addElementBinding(this.currentPagination, 'pageNumber', 'input.page-number', 'value', 'change', this.changeToCurrentPage.bind(this));
211
222
 
@@ -227,30 +238,30 @@ export class SlickPaginationComponent {
227
238
 
228
239
  changeToFirstPage(event: MouseEvent): void {
229
240
  if (!this.isLeftPaginationDisabled) {
230
- this.paginationService.goToFirstPage(event);
241
+ this._paginationService.goToFirstPage(event);
231
242
  }
232
243
  }
233
244
 
234
245
  changeToLastPage(event: MouseEvent): void {
235
246
  if (!this.isRightPaginationDisabled) {
236
- this.paginationService.goToLastPage(event);
247
+ this._paginationService.goToLastPage(event);
237
248
  }
238
249
  }
239
250
 
240
251
  changeToNextPage(event: MouseEvent): void {
241
252
  if (!this.isRightPaginationDisabled) {
242
- this.paginationService.goToNextPage(event);
253
+ this._paginationService.goToNextPage(event);
243
254
  }
244
255
  }
245
256
 
246
257
  changeToPreviousPage(event: MouseEvent): void {
247
258
  if (!this.isLeftPaginationDisabled) {
248
- this.paginationService.goToPreviousPage(event);
259
+ this._paginationService.goToPreviousPage(event);
249
260
  }
250
261
  }
251
262
 
252
263
  changeToCurrentPage(pageNumber: number): void {
253
- this.paginationService.goToPageNumber(+pageNumber);
264
+ this._paginationService.goToPageNumber(+pageNumber);
254
265
  }
255
266
 
256
267
  updateItemsPerPage(event: & { target: any; }): void {
@@ -259,12 +270,12 @@ export class SlickPaginationComponent {
259
270
 
260
271
  /** Translate all the texts shown in the UI, use ngx-translate service when available or custom locales when service is null */
261
272
  translatePaginationTexts(): void {
262
- if (this._enableTranslate && this.translaterService?.translate) {
273
+ if (this._enableTranslate && this._translaterService?.translate) {
263
274
  const translationPrefix = getTranslationPrefix(this.gridOptions);
264
- this.textItemsPerPage = this.translaterService.translate(`${translationPrefix}ITEMS_PER_PAGE`);
265
- this.textItems = this.translaterService.translate(`${translationPrefix}ITEMS`);
266
- this.textOf = this.translaterService.translate(`${translationPrefix}OF`);
267
- this.textPage = this.translaterService.translate(`${translationPrefix}PAGE`);
275
+ this.textItemsPerPage = this._translaterService.translate(`${translationPrefix}ITEMS_PER_PAGE`);
276
+ this.textItems = this._translaterService.translate(`${translationPrefix}ITEMS`);
277
+ this.textOf = this._translaterService.translate(`${translationPrefix}OF`);
278
+ this.textPage = this._translaterService.translate(`${translationPrefix}PAGE`);
268
279
  } else if (this.locales) {
269
280
  this.textItemsPerPage = this.locales.TEXT_ITEMS_PER_PAGE || 'TEXT_ITEMS_PER_PAGE';
270
281
  this.textItems = this.locales.TEXT_ITEMS || 'TEXT_ITEMS';
@@ -295,7 +306,7 @@ export class SlickPaginationComponent {
295
306
  const divElm = createDomElement('div', { className: 'slick-page-number' });
296
307
  createDomElement('span', { className: 'text-page', textContent: 'Page' }, divElm);
297
308
  divElm.appendChild(document.createTextNode(' '));
298
- if (this.paginationService.isCursorBased) {
309
+ if (this._paginationService.isCursorBased) {
299
310
  // cursor based navigation cannot jump to an arbitrary page. Simply display current page number.
300
311
  createDomElement('span', {
301
312
  className: 'page-number',