mapa-library-ui 0.0.22 → 0.0.24

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.
Files changed (76) hide show
  1. package/esm2020/lib/core/elements/element-base.mjs +2 -1
  2. package/esm2020/lib/core/elements/element-search.mjs +2 -0
  3. package/esm2020/public-api.mjs +2 -1
  4. package/esm2020/src/lib/components/capability/lib/components/filters/src/filters.component.mjs +2 -2
  5. package/esm2020/src/lib/components/dropdown/dropdown.mjs +8 -0
  6. package/esm2020/src/lib/components/dropdown/lib/components/dropdown/public-api.mjs +6 -0
  7. package/esm2020/src/lib/components/dropdown/lib/components/dropdown/src/dropdown.component.mjs +82 -0
  8. package/esm2020/src/lib/components/dropdown/lib/components/dropdown/src/dropdown.module.mjs +63 -0
  9. package/esm2020/src/lib/components/dropdown/lib/core/elements/dropdown.mjs +8 -0
  10. package/esm2020/src/lib/components/dropdown/lib/core/elements/element-base.mjs +22 -0
  11. package/esm2020/src/lib/components/dropdown/lib/core/elements/element-search.mjs +2 -0
  12. package/esm2020/src/lib/components/dropdown/lib/core/interfaces/option.interface.mjs +2 -0
  13. package/esm2020/src/lib/components/dropdown/mapa-library-ui-src-lib-components-dropdown.mjs +2 -2
  14. package/esm2020/src/lib/components/filters/lib/components/filters/src/filters.component.mjs +2 -2
  15. package/esm2020/src/lib/components/table/lib/components/table/public-api.mjs +6 -0
  16. package/esm2020/src/lib/components/table/lib/components/table/src/paginator_customization.mjs +21 -0
  17. package/esm2020/src/lib/components/table/lib/components/table/src/table.component.mjs +121 -0
  18. package/esm2020/src/lib/components/table/lib/components/table/src/table.module.mjs +59 -0
  19. package/esm2020/src/lib/components/table/lib/core/directives/custom-paginator-legacy.directive.mjs +227 -0
  20. package/esm2020/src/lib/components/table/lib/core/directives/custom-paginator.directive.mjs +183 -0
  21. package/esm2020/src/lib/components/table/mapa-library-ui-src-lib-components-table.mjs +2 -2
  22. package/esm2020/src/lib/components/table/table.mjs +7 -0
  23. package/fesm2015/mapa-library-ui-src-lib-components-capability.mjs +2 -2
  24. package/fesm2015/mapa-library-ui-src-lib-components-capability.mjs.map +1 -1
  25. package/fesm2015/mapa-library-ui-src-lib-components-dropdown.mjs +129 -36
  26. package/fesm2015/mapa-library-ui-src-lib-components-dropdown.mjs.map +1 -1
  27. package/fesm2015/mapa-library-ui-src-lib-components-filters.mjs +2 -2
  28. package/fesm2015/mapa-library-ui-src-lib-components-filters.mjs.map +1 -1
  29. package/fesm2015/mapa-library-ui-src-lib-components-table.mjs +470 -38
  30. package/fesm2015/mapa-library-ui-src-lib-components-table.mjs.map +1 -1
  31. package/fesm2015/mapa-library-ui.mjs +1 -0
  32. package/fesm2015/mapa-library-ui.mjs.map +1 -1
  33. package/fesm2020/mapa-library-ui-src-lib-components-capability.mjs +2 -2
  34. package/fesm2020/mapa-library-ui-src-lib-components-capability.mjs.map +1 -1
  35. package/fesm2020/mapa-library-ui-src-lib-components-dropdown.mjs +129 -34
  36. package/fesm2020/mapa-library-ui-src-lib-components-dropdown.mjs.map +1 -1
  37. package/fesm2020/mapa-library-ui-src-lib-components-filters.mjs +2 -2
  38. package/fesm2020/mapa-library-ui-src-lib-components-filters.mjs.map +1 -1
  39. package/fesm2020/mapa-library-ui-src-lib-components-table.mjs +466 -38
  40. package/fesm2020/mapa-library-ui-src-lib-components-table.mjs.map +1 -1
  41. package/fesm2020/mapa-library-ui.mjs +1 -0
  42. package/fesm2020/mapa-library-ui.mjs.map +1 -1
  43. package/lib/core/elements/element-base.d.ts +3 -0
  44. package/lib/core/elements/element-search.d.ts +6 -0
  45. package/mapa-library-ui-0.0.24.tgz +0 -0
  46. package/package.json +1 -1
  47. package/public-api.d.ts +1 -0
  48. package/src/lib/components/dropdown/dropdown.d.ts +4 -0
  49. package/src/lib/components/dropdown/index.d.ts +1 -1
  50. package/src/lib/components/dropdown/lib/components/dropdown/src/dropdown.component.d.ts +25 -0
  51. package/src/lib/components/dropdown/lib/components/dropdown/src/dropdown.module.d.ts +13 -0
  52. package/src/lib/components/dropdown/lib/core/elements/dropdown.d.ts +4 -0
  53. package/src/lib/components/dropdown/lib/core/elements/element-base.d.ts +40 -0
  54. package/src/lib/components/dropdown/lib/core/elements/element-search.d.ts +6 -0
  55. package/src/lib/components/dropdown/lib/core/interfaces/option.interface.d.ts +4 -0
  56. package/src/lib/components/table/index.d.ts +1 -1
  57. package/src/lib/components/table/{src → lib/components/table/src}/table.component.d.ts +14 -8
  58. package/src/lib/components/table/{src → lib/components/table/src}/table.module.d.ts +4 -2
  59. package/src/lib/components/table/lib/core/directives/custom-paginator-legacy.directive.d.ts +27 -0
  60. package/src/lib/components/table/lib/core/directives/custom-paginator.directive.d.ts +33 -0
  61. package/src/lib/components/table/table.d.ts +3 -0
  62. package/esm2020/src/lib/components/dropdown/public-api.mjs +0 -6
  63. package/esm2020/src/lib/components/dropdown/src/dropdown.component.mjs +0 -26
  64. package/esm2020/src/lib/components/dropdown/src/dropdown.module.mjs +0 -36
  65. package/esm2020/src/lib/components/dropdown/src/option/option.component.mjs +0 -26
  66. package/esm2020/src/lib/components/table/public-api.mjs +0 -6
  67. package/esm2020/src/lib/components/table/src/paginator_customization.mjs +0 -9
  68. package/esm2020/src/lib/components/table/src/table.component.mjs +0 -120
  69. package/esm2020/src/lib/components/table/src/table.module.mjs +0 -49
  70. package/mapa-library-ui-0.0.22.tgz +0 -0
  71. package/src/lib/components/dropdown/src/dropdown.component.d.ts +0 -12
  72. package/src/lib/components/dropdown/src/dropdown.module.d.ts +0 -12
  73. package/src/lib/components/dropdown/src/option/option.component.d.ts +0 -12
  74. /package/src/lib/components/dropdown/{public-api.d.ts → lib/components/dropdown/public-api.d.ts} +0 -0
  75. /package/src/lib/components/table/{public-api.d.ts → lib/components/table/public-api.d.ts} +0 -0
  76. /package/src/lib/components/table/{src → lib/components/table/src}/paginator_customization.d.ts +0 -0
@@ -1,26 +1,433 @@
1
- import { SelectionModel } from '@angular/cdk/collections';
2
1
  import * as i0 from '@angular/core';
3
- import { EventEmitter, Component, ViewEncapsulation, Input, ViewChild, Output, NgModule } from '@angular/core';
4
- import * as i4 from '@angular/material/paginator';
2
+ import { EventEmitter, Directive, Output, Input, Host, Self, Optional, Component, ViewEncapsulation, ViewChild, NgModule } from '@angular/core';
3
+ import { map, startWith } from 'rxjs';
4
+ import * as i1 from '@angular/material/paginator';
5
5
  import { MatPaginator, MatPaginatorIntl, MatPaginatorModule } from '@angular/material/paginator';
6
+ import { SelectionModel } from '@angular/cdk/collections';
6
7
  import { MatSort } from '@angular/material/sort';
7
- import * as i5 from '@angular/material/table';
8
+ import * as i6 from '@angular/material/table';
8
9
  import { MatTableDataSource, MatTableModule } from '@angular/material/table';
9
- import * as i1 from '@angular/common';
10
+ import * as i1$1 from '@angular/forms';
11
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
12
+ import * as i2 from '@angular/common';
10
13
  import { CommonModule } from '@angular/common';
11
- import * as i2 from '@angular/material/checkbox';
14
+ import * as i3 from '@angular/material/checkbox';
12
15
  import { MatCheckboxModule } from '@angular/material/checkbox';
13
- import * as i3 from '@angular/material/icon';
16
+ import * as i4 from '@angular/material/icon';
14
17
  import { MatIconModule } from '@angular/material/icon';
15
- import * as i6 from 'mapa-library-ui';
16
- import { BubblePaginationDirective } from 'mapa-library-ui';
18
+
19
+ class BubblePaginationDirective {
20
+ constructor(matPag, elementRef, ren) {
21
+ this.matPag = matPag;
22
+ this.elementRef = elementRef;
23
+ this.ren = ren;
24
+ this.pageIndexChangeEmitter = new EventEmitter();
25
+ this.showFirstButton = true;
26
+ this.showLastButton = true;
27
+ this.renderButtonsNumber = 2;
28
+ this.appCustomLength = 0;
29
+ this.hideDefaultArrows = false;
30
+ this.buttonsRef = [];
31
+ }
32
+ ngAfterViewInit() {
33
+ this.styleDefaultPagination();
34
+ this.createBubbleDivRef();
35
+ this.renderButtons();
36
+ }
37
+ ngOnChanges(changes) {
38
+ var _a;
39
+ if (!((_a = changes === null || changes === void 0 ? void 0 : changes["appCustomLength"]) === null || _a === void 0 ? void 0 : _a.firstChange)) {
40
+ this.removeButtons();
41
+ this.switchPage(0);
42
+ this.renderButtons();
43
+ }
44
+ }
45
+ renderButtons() {
46
+ this.buildButtons();
47
+ this.matPag.page
48
+ .pipe(map((e) => { var _a; return [(_a = e.previousPageIndex) !== null && _a !== void 0 ? _a : 0, e.pageIndex]; }), startWith([0, 0]))
49
+ .subscribe(([prev, curr]) => {
50
+ this.changeActiveButtonStyles(prev, curr);
51
+ this.updateButtonsOnPageEvent();
52
+ });
53
+ }
54
+ changeActiveButtonStyles(previousIndex, newIndex) {
55
+ const previouslyActive = this.buttonsRef[previousIndex];
56
+ const currentActive = this.buttonsRef[newIndex];
57
+ try {
58
+ this.ren.removeClass(previouslyActive, "g-bubble__active");
59
+ this.ren.addClass(currentActive, "g-bubble__active");
60
+ }
61
+ catch (_a) { }
62
+ this.buttonsRef.forEach((button) => this.ren.setStyle(button, "display", "none"));
63
+ const renderElements = this.renderButtonsNumber;
64
+ const endDots = newIndex < this.buttonsRef.length - renderElements - 1;
65
+ const startDots = newIndex - renderElements > 0;
66
+ const firstButton = this.buttonsRef[0];
67
+ const lastButton = this.buttonsRef[this.buttonsRef.length - 1];
68
+ try {
69
+ if (this.showLastButton) {
70
+ this.ren.setStyle(this.dotsEndRef, "display", endDots ? "block" : "none");
71
+ this.ren.setStyle(lastButton, "display", endDots ? "flex" : "none");
72
+ }
73
+ }
74
+ catch (_b) { }
75
+ try {
76
+ if (this.showFirstButton) {
77
+ this.ren.setStyle(this.dotsStartRef, "display", startDots ? "block" : "none");
78
+ this.ren.setStyle(firstButton, "display", startDots ? "flex" : "none");
79
+ }
80
+ }
81
+ catch (_c) { }
82
+ const startingIndex = startDots ? newIndex - renderElements : 0;
83
+ const endingIndex = endDots
84
+ ? newIndex + renderElements
85
+ : this.buttonsRef.length - 1;
86
+ for (let i = startingIndex; i <= endingIndex; i++) {
87
+ const button = this.buttonsRef[i];
88
+ this.ren.setStyle(button, "display", "flex");
89
+ }
90
+ }
91
+ styleDefaultPagination() {
92
+ const nativeElement = this.elementRef.nativeElement;
93
+ const itemsPerPage = nativeElement.querySelector(".mat-mdc-paginator-page-size");
94
+ const howManyDisplayedEl = nativeElement.querySelector(".mat-mdc-paginator-range-label");
95
+ const previousButton = nativeElement.querySelector("button.mat-mdc-paginator-navigation-previous");
96
+ const nextButtonDefault = nativeElement.querySelector("button.mat-mdc-paginator-navigation-next");
97
+ if (this.hideDefaultArrows) {
98
+ this.ren.setStyle(previousButton, "display", "none");
99
+ this.ren.setStyle(nextButtonDefault, "display", "none");
100
+ }
101
+ }
102
+ createBubbleDivRef() {
103
+ const actionContainer = this.elementRef.nativeElement.querySelector("div.mat-mdc-paginator-range-actions");
104
+ const nextButtonDefault = this.elementRef.nativeElement.querySelector("button.mat-mdc-paginator-navigation-next");
105
+ this.bubbleContainerRef = this.ren.createElement("div");
106
+ this.ren.addClass(this.bubbleContainerRef, "g-bubble-container");
107
+ this.ren.insertBefore(actionContainer, this.bubbleContainerRef, nextButtonDefault);
108
+ }
109
+ buildButtons() {
110
+ const neededButtons = Math.ceil(this.appCustomLength / this.matPag.pageSize);
111
+ if (neededButtons === 1) {
112
+ this.ren.setStyle(this.elementRef.nativeElement, "display", "none");
113
+ return;
114
+ }
115
+ this.buttonsRef = [this.createButton(0)];
116
+ this.dotsStartRef = this.createDotsElement();
117
+ for (let index = 1; index < neededButtons - 1; index++) {
118
+ this.buttonsRef = [...this.buttonsRef, this.createButton(index)];
119
+ }
120
+ this.dotsEndRef = this.createDotsElement();
121
+ this.buttonsRef = [
122
+ ...this.buttonsRef,
123
+ this.createButton(neededButtons - 1),
124
+ ];
125
+ }
126
+ removeButtons() {
127
+ this.bubbleContainerRef.innerHTML = '';
128
+ this.buttonsRef.forEach((button) => {
129
+ this.ren.removeChild(this.bubbleContainerRef, button);
130
+ });
131
+ this.buttonsRef = [];
132
+ this.buttonsRef.length = 0;
133
+ }
134
+ createButton(i) {
135
+ const bubbleButton = this.ren.createElement("div");
136
+ const text = this.ren.createText(String(i + 1));
137
+ this.ren.addClass(bubbleButton, "g-bubble");
138
+ this.ren.setStyle(bubbleButton, "margin-right", "8px");
139
+ this.ren.appendChild(bubbleButton, text);
140
+ this.ren.listen(bubbleButton, "click", () => {
141
+ this.switchPage(i);
142
+ });
143
+ this.ren.appendChild(this.bubbleContainerRef, bubbleButton);
144
+ this.ren.setStyle(bubbleButton, "display", "none");
145
+ return bubbleButton;
146
+ }
147
+ createDotsElement() {
148
+ const dotsEl = this.ren.createElement("span");
149
+ const dotsText = this.ren.createText(".....");
150
+ this.ren.setStyle(dotsEl, "font-size", "18px");
151
+ this.ren.setStyle(dotsEl, "margin-right", "8px");
152
+ this.ren.setStyle(dotsEl, "padding-top", "6px");
153
+ this.ren.setStyle(dotsEl, "color", "#919191");
154
+ this.ren.appendChild(dotsEl, dotsText);
155
+ this.ren.appendChild(this.bubbleContainerRef, dotsEl);
156
+ this.ren.setStyle(dotsEl, "display", "none");
157
+ return dotsEl;
158
+ }
159
+ switchPage(i) {
160
+ const previousPageIndex = this.matPag.pageIndex;
161
+ this.matPag.pageIndex = i;
162
+ try {
163
+ this.matPag["_emitPageEvent"](previousPageIndex);
164
+ }
165
+ catch (_a) { }
166
+ this.pageIndexChangeEmitter.emit(i);
167
+ }
168
+ updateButtonsOnPageEvent() {
169
+ const neededButtons = Math.ceil(this.appCustomLength / this.matPag.pageSize);
170
+ if (neededButtons === this.buttonsRef.length) {
171
+ return;
172
+ }
173
+ this.removeButtons();
174
+ this.buildButtons();
175
+ }
176
+ }
177
+ BubblePaginationDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BubblePaginationDirective, deps: [{ token: i1.MatPaginator }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
178
+ BubblePaginationDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: BubblePaginationDirective, isStandalone: true, selector: "[appBubblePagination]", inputs: { showFirstButton: "showFirstButton", showLastButton: "showLastButton", renderButtonsNumber: "renderButtonsNumber", appCustomLength: "appCustomLength", hideDefaultArrows: "hideDefaultArrows" }, outputs: { pageIndexChangeEmitter: "pageIndexChangeEmitter" }, usesOnChanges: true, ngImport: i0 });
179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BubblePaginationDirective, decorators: [{
180
+ type: Directive,
181
+ args: [{
182
+ selector: "[appBubblePagination]",
183
+ standalone: true,
184
+ }]
185
+ }], ctorParameters: function () { return [{ type: i1.MatPaginator }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { pageIndexChangeEmitter: [{
186
+ type: Output
187
+ }], showFirstButton: [{
188
+ type: Input
189
+ }], showLastButton: [{
190
+ type: Input
191
+ }], renderButtonsNumber: [{
192
+ type: Input
193
+ }], appCustomLength: [{
194
+ type: Input
195
+ }], hideDefaultArrows: [{
196
+ type: Input
197
+ }] } });
198
+
199
+ class PaginatorLegacyDirective {
200
+ constructor(matPag, ViewContainer, renderer) {
201
+ this.matPag = matPag;
202
+ this.ViewContainer = ViewContainer;
203
+ this.renderer = renderer;
204
+ this.buttons = [];
205
+ this.buildPageNumbers = () => {
206
+ let dots;
207
+ let page;
208
+ let pageDifference;
209
+ let startIndex;
210
+ let totalPages;
211
+ totalPages = this.matPag.getNumberOfPages();
212
+ // Container div with paginator elements
213
+ const actionContainer = this.ViewContainer.element.nativeElement.querySelector('div.mat-paginator-range-actions');
214
+ // Button that triggers the next page action
215
+ const nextPageNode = this.ViewContainer.element.nativeElement.querySelector('button.mat-paginator-navigation-next');
216
+ // Label showing the page range
217
+ const pageRange = this.ViewContainer.element.nativeElement.querySelector('div.mat-paginator-range-label');
218
+ let prevButtonCount = this.buttons.length;
219
+ // Remove buttons before creating new ones
220
+ if (prevButtonCount > 0) {
221
+ this.buttons.forEach((button) => {
222
+ this.renderer.removeChild(actionContainer, button);
223
+ });
224
+ // Empty state array
225
+ prevButtonCount = 0;
226
+ }
227
+ this.renderer.addClass(pageRange, 'custom-paginator-counter');
228
+ this.renderer.addClass(actionContainer, 'custom-paginator-container');
229
+ // Initialize next page and last page buttons
230
+ if (prevButtonCount === 0) {
231
+ const nodeArray = actionContainer.childNodes;
232
+ setTimeout(() => {
233
+ for (const node of nodeArray) {
234
+ if (node.nodeName === 'BUTTON') {
235
+ // Next Button styles
236
+ if (node.innerHTML.length > 100 && node.disabled) {
237
+ this.renderer.addClass(node, 'custom-paginator-arrow-disabled');
238
+ this.renderer.removeClass(node, 'custom-paginator-arrow-enabled');
239
+ }
240
+ else if (node.innerHTML.length > 100 && !node.disabled) {
241
+ this.renderer.addClass(node, 'custom-paginator-arrow-enabled');
242
+ this.renderer.removeClass(node, 'custom-paginator-arrow-disabled');
243
+ }
244
+ }
245
+ }
246
+ });
247
+ }
248
+ dots = [false, false];
249
+ if (totalPages > 0) {
250
+ this.renderer.insertBefore(actionContainer, this.createButton('0', this.matPag.pageIndex), nextPageNode);
251
+ }
252
+ page = this.showTotalPages + 2;
253
+ pageDifference = totalPages - page;
254
+ startIndex = Math.max(this.currentPage - this.showTotalPages - 2, 1);
255
+ for (let index = startIndex; index < totalPages - 1; index = index + 1) {
256
+ if ((index < page && this.currentPage <= this.showTotalPages) ||
257
+ (index >= this.rangeStart && index <= this.rangeEnd) ||
258
+ (this.currentPage > pageDifference && index >= pageDifference) ||
259
+ totalPages < this.showTotalPages + page) {
260
+ this.renderer.insertBefore(actionContainer, this.createButton(`${index}`, this.matPag.pageIndex), nextPageNode);
261
+ }
262
+ else {
263
+ if (index > this.rangeEnd && !dots[0]) {
264
+ this.renderer.insertBefore(actionContainer, this.createButton(this.pageGapTxt[0], this.matPag.pageIndex), nextPageNode);
265
+ dots[0] = true;
266
+ break;
267
+ }
268
+ if (index < this.rangeEnd && !dots[1]) {
269
+ this.renderer.insertBefore(actionContainer, this.createButton(this.pageGapTxt[1], this.matPag.pageIndex), nextPageNode);
270
+ dots[1] = true;
271
+ }
272
+ }
273
+ }
274
+ if (totalPages > 1) {
275
+ this.renderer.insertBefore(actionContainer, this.createButton(`${totalPages - 1}`, this.matPag.pageIndex), nextPageNode);
276
+ }
277
+ };
278
+ this.currentPage = 1;
279
+ this.pageGapTxt = ['•••', '---'];
280
+ this.showTotalPages = 2;
281
+ this.checkPage = [0, 0, 0];
282
+ // Display custom range label text
283
+ this.matPag._intl.getRangeLabel = (page, pageSize, length) => {
284
+ const startIndex = page * pageSize;
285
+ const endIndex = startIndex < length
286
+ ? Math.min(startIndex + pageSize, length)
287
+ : startIndex + pageSize;
288
+ if (length === 0) {
289
+ return 'Mostrando 0 – 0 de 0 item';
290
+ }
291
+ if (length === 1) {
292
+ return ('Mostrando ' +
293
+ (startIndex + 1) +
294
+ ' – ' +
295
+ endIndex +
296
+ ' de ' +
297
+ length +
298
+ ' item');
299
+ }
300
+ else {
301
+ return ('Mostrando ' +
302
+ (startIndex + 1) +
303
+ ' – ' +
304
+ endIndex +
305
+ ' de ' +
306
+ length +
307
+ ' itens');
308
+ }
309
+ };
310
+ // Subscribe to rerender buttons when next page and last page button is used
311
+ this.matPag.page.subscribe((paginator) => {
312
+ this.currentPage = paginator.pageIndex;
313
+ this.matPag.pageIndex = paginator.pageIndex;
314
+ this.initPageRange();
315
+ });
316
+ this.matPag._intl.itemsPerPageLabel = 'Itens por página';
317
+ const paginatorIntl = this.matPag._intl;
318
+ paginatorIntl.nextPageLabel = '';
319
+ paginatorIntl.previousPageLabel = '';
320
+ }
321
+ ngDoCheck() {
322
+ var _a, _b, _c;
323
+ // Reset paginator if the pageSize, pageIndex, length changes
324
+ if (((_a = this.matPag) === null || _a === void 0 ? void 0 : _a.length) !== this.checkPage[0] ||
325
+ ((_b = this.matPag) === null || _b === void 0 ? void 0 : _b.pageSize) !== this.checkPage[1] ||
326
+ ((_c = this.matPag) === null || _c === void 0 ? void 0 : _c.pageIndex) !== this.checkPage[2]) {
327
+ const pageCount = this.matPag.getNumberOfPages();
328
+ if (this.currentPage > pageCount && pageCount !== 0) {
329
+ this.currentPage = 1;
330
+ this.matPag.pageIndex = 0;
331
+ }
332
+ this.currentPage = this.matPag.pageIndex;
333
+ this.initPageRange();
334
+ this.checkPage = [
335
+ this.matPag.length,
336
+ this.matPag.pageSize,
337
+ this.matPag.pageIndex,
338
+ ];
339
+ }
340
+ }
341
+ createButton(index, pageIndex) {
342
+ const linkBtn = this.renderer.createElement('button');
343
+ this.renderer.setAttribute(linkBtn, 'class', 'custom-paginator-page');
344
+ this.renderer.addClass(linkBtn, 'custom-paginator-page-enabled');
345
+ if (index === this.pageGapTxt[0] || index === this.pageGapTxt[1]) {
346
+ this.renderer.addClass(linkBtn, 'custom-paginator-arrow-enabled');
347
+ }
348
+ const pagingTxt = isNaN(+index) ? this.pageGapTxt[0] : +index + 1;
349
+ const text = this.renderer.createText(pagingTxt + '');
350
+ this.renderer.addClass(linkBtn, 'mat-custom-page');
351
+ switch (index) {
352
+ case `${pageIndex}`:
353
+ this.renderer.setAttribute(linkBtn, 'disabled', 'disabled');
354
+ this.renderer.removeClass(linkBtn, 'custom-paginator-page-enabled');
355
+ this.renderer.addClass(linkBtn, 'custom-paginator-page-disabled');
356
+ break;
357
+ case this.pageGapTxt[0]:
358
+ this.renderer.listen(linkBtn, 'click', () => {
359
+ this.switchPage(this.currentPage < this.showTotalPages + 1
360
+ ? this.showTotalPages + 2
361
+ : this.currentPage + this.showTotalPages - 1);
362
+ });
363
+ break;
364
+ case this.pageGapTxt[1]:
365
+ this.renderer.listen(linkBtn, 'click', () => {
366
+ this.switchPage(this.currentPage >
367
+ this.matPag.getNumberOfPages() - this.showTotalPages - 2
368
+ ? this.matPag.getNumberOfPages() - this.showTotalPages - 3
369
+ : this.currentPage - this.showTotalPages + 1);
370
+ });
371
+ break;
372
+ default:
373
+ this.renderer.listen(linkBtn, 'click', () => {
374
+ this.switchPage(+index);
375
+ });
376
+ break;
377
+ }
378
+ this.renderer.appendChild(linkBtn, text);
379
+ // Add button to private array for state
380
+ this.buttons.push(linkBtn);
381
+ return linkBtn;
382
+ }
383
+ /**
384
+ * @description calculates the button range based on class input parameters and based on current page index value.
385
+ */
386
+ initPageRange() {
387
+ this.rangeStart = this.currentPage - this.showTotalPages / 2;
388
+ this.rangeEnd = this.currentPage + this.showTotalPages / 2;
389
+ this.buildPageNumbers();
390
+ }
391
+ switchPage(index) {
392
+ this.matPag.pageIndex = index;
393
+ this.matPag.page.emit({
394
+ previousPageIndex: this.currentPage,
395
+ pageIndex: index,
396
+ pageSize: this.matPag.pageSize,
397
+ length: this.matPag.length,
398
+ });
399
+ this.currentPage = index;
400
+ this.initPageRange();
401
+ }
402
+ ngAfterViewInit() {
403
+ this.rangeStart = 0;
404
+ this.rangeEnd = this.showTotalPages - 1;
405
+ this.initPageRange();
406
+ }
407
+ }
408
+ PaginatorLegacyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PaginatorLegacyDirective, deps: [{ token: i1.MatPaginator, host: true, optional: true, self: true }, { token: i0.ViewContainerRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
409
+ PaginatorLegacyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: PaginatorLegacyDirective, isStandalone: true, selector: "[appStylePaginator]", ngImport: i0 });
410
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PaginatorLegacyDirective, decorators: [{
411
+ type: Directive,
412
+ args: [{
413
+ selector: '[appStylePaginator]',
414
+ standalone: true,
415
+ }]
416
+ }], ctorParameters: function () {
417
+ return [{ type: i1.MatPaginator, decorators: [{
418
+ type: Host
419
+ }, {
420
+ type: Self
421
+ }, {
422
+ type: Optional
423
+ }] }, { type: i0.ViewContainerRef }, { type: i0.Renderer2 }];
424
+ } });
17
425
 
18
426
  class MapaTableComponent {
19
- constructor(cdr) {
20
- this.cdr = cdr;
427
+ constructor(formBuilder) {
428
+ this.formBuilder = formBuilder;
21
429
  this.columns = [];
22
430
  this.data = [];
23
- this.tableData = new EventEmitter();
24
431
  this.rowClick = new EventEmitter();
25
432
  this.selectedObjectsChange = new EventEmitter();
26
433
  this.displayedColumns = [];
@@ -40,10 +447,12 @@ class MapaTableComponent {
40
447
  toggleAllRows() {
41
448
  if (this.isAllSelected()) {
42
449
  this.selection.clear();
450
+ this.getSelectedValues();
43
451
  }
44
452
  else {
45
453
  const dataAsPeriodicElements = this.dataSource.data;
46
454
  dataAsPeriodicElements.forEach(row => this.selection.select(row));
455
+ this.getSelectedValues();
47
456
  }
48
457
  }
49
458
  checkboxLabel(row) {
@@ -77,31 +486,32 @@ class MapaTableComponent {
77
486
  }
78
487
  return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
79
488
  }
80
- createObjectFromSelection() {
81
- const selectedRows = this.selection.selected;
82
- const selectedObjects = [];
83
- selectedRows.forEach(row => {
84
- if (this.selection.isSelected(row)) {
85
- const obj = {};
86
- this.columns.forEach(column => {
87
- obj[column.key] = row[column.key];
88
- });
89
- selectedObjects.push(obj);
90
- }
91
- });
92
- this.selectedObjectsChange.emit(selectedObjects);
489
+ emitRowClick(row, action) {
490
+ const rowData = { row, action };
491
+ this.rowClick.emit(rowData);
93
492
  }
94
- handleRowClick(id, test) {
95
- console.log(test);
96
- this.rowClick.emit(id);
493
+ toggleSelection(row) {
494
+ if (this.selection.isSelected(row)) {
495
+ this.selection.deselect(row);
496
+ }
497
+ else {
498
+ this.selection.select(row);
499
+ }
500
+ this.getSelectedValues();
501
+ }
502
+ getSelectedValues() {
503
+ const selectedRows = this.selection.selected.map(row => {
504
+ return { row };
505
+ });
506
+ console.log(selectedRows);
97
507
  }
98
508
  }
99
- MapaTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapaTableComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
100
- MapaTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MapaTableComponent, selector: "mapa-table", inputs: { columns: "columns", data: "data", checkbox: "checkbox", actions: "actions" }, outputs: { tableData: "tableData", rowClick: "rowClick", selectedObjectsChange: "selectedObjectsChange" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }], ngImport: i0, template: "<div class=\"mapa-table\">\n <table mat-table [dataSource]=\"dataSource\" matSort>\n <ng-container\n *ngFor=\"let column of columns; let isFirst = first\"\n [matColumnDef]=\"column.key\"\n >\n <th\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header\n (click)=\"sortData(column.key)\"\n >\n <div class=\"mapa-table__header\">\n <ng-container *ngIf=\"isFirst && checkbox\">\n <mat-checkbox\n (change)=\"$event ? toggleAllRows() : null\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n (click)=\"$event.stopPropagation(); createObjectFromSelection()\"\n >\n </mat-checkbox>\n </ng-container>\n <div *ngIf=\"column.key !== 'actions'\">\n <mat-icon>filter_list</mat-icon>\n </div>\n <div class=\"mapa-table__label\">\n {{ column.label }}\n </div>\n </div>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <ng-container *ngIf=\"isFirst && checkbox\">\n <mat-checkbox\n (click)=\"$event.stopPropagation(); createObjectFromSelection()\"\n (change)=\"$event ? selection.toggle(row) : null\"\n [checked]=\"selection.isSelected(row)\"\n >\n </mat-checkbox>\n </ng-container>\n <ng-container *ngIf=\"column.key === 'actions'\">\n <div class=\"mapa-table__actions\">\n <mat-icon (click)=\"handleRowClick(row, 'edit')\">edit</mat-icon>\n <mat-icon (click)=\"handleRowClick(row, 'delete')\">delete</mat-icon>\n <mat-icon (click)=\"handleRowClick(row, 'visibility')\"\n >visibility</mat-icon\n >\n </div>\n </ng-container>\n <div class=\"mapa-table__column\" (click)=\"handleRowClick(row, '')\">\n {{ row[column.key] }}\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n\n <mat-paginator\n class=\"mapa-table__paginator\"\n appBubblePagination\n [appCustomLength]=\"dataSource ? dataSource.data.length : 0\"\n [length]=\"dataSource ? dataSource.data.length : 0\"\n [pageSizeOptions]=\"[5, 10, 25, 100]\"\n [pageSize]=\"5\"\n aria-label=\"Select page\"\n ></mat-paginator>\n</div>\n", styles: [".mapa-table__column{width:100%}.mapa-table__label{margin-top:4px}.mapa-table__header{padding-top:15px;padding-bottom:15px;align-items:center;display:flex}.mapa-table__actions{display:flex}.mapa-table__actions .mat-icon{color:#ea561d!important}.mapa-table__paginator .mat-mdc-paginator-container{display:flex;justify-content:space-between;margin-right:25vw}.mapa-table__paginator .g-bubble-container{display:flex;gap:4px}.mapa-table__paginator .g-bubble{background-color:#fff;border-radius:20%;width:24px;height:24px;display:flex;align-items:center;justify-content:center;color:#181818;font-size:14px;cursor:pointer;transition:.3s}.mapa-table__paginator .g-bubble:hover{background-color:#b6b6b6;color:#fff}.mapa-table__paginator .g-bubble__active{background-color:#ea561d;color:#fff}.mapa-table__paginator mat-paginator{background:transparent!important}.mapa-table__paginator .mat-mdc-paginator-range-actions{margin-right:12px!important}.mapa-table .mat-table{width:100%}.mapa-table .tr,.mapa-table th{padding-top:15px;padding-bottom:15px}.mapa-table .mat-mdc-cell{padding:15px}.mapa-table .mat-icon{cursor:pointer;position:relative;bottom:-6px;padding:0 5px}.mapa-table .mat-accent{--mdc-checkbox-selected-focus-icon-color: #ea561d;--mdc-checkbox-selected-hover-icon-color: #ea561d;--mdc-checkbox-selected-pressed-icon-color: transparent;--mdc-checkbox-selected-icon-color: #ea561d;--mdc-checkbox-selected-checkmark-color: #fff;--mdc-circular-progress-active-indicator-color: transparent}.mapa-table .mat-mdc-paginator-container{display:flex;justify-content:space-between}.mapa-table ::ng-deep .mat-mdc-paginator-page-size-label{display:none}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "component", type: i5.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i5.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i6.BubblePaginationDirective, selector: "[appBubblePagination]", inputs: ["showFirstButton", "showLastButton", "renderButtonsNumber", "appCustomLength", "hideDefaultArrows"], outputs: ["pageIndexChangeEmitter"] }], encapsulation: i0.ViewEncapsulation.None });
509
+ MapaTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapaTableComponent, deps: [{ token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
510
+ MapaTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MapaTableComponent, selector: "mapa-table", inputs: { columns: "columns", data: "data", checkbox: "checkbox", actions: "actions" }, outputs: { rowClick: "rowClick", selectedObjectsChange: "selectedObjectsChange" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }], ngImport: i0, template: "<div class=\"mapa-table\">\n <table mat-table [dataSource]=\"dataSource\" matSort>\n <ng-container\n *ngFor=\"let column of columns; let isFirst = first\"\n [matColumnDef]=\"column.key\"\n >\n <th\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header\n (click)=\"sortData(column.key)\"\n >\n <div class=\"mapa-table__header\">\n <ng-container *ngIf=\"isFirst && checkbox\">\n <mat-checkbox\n (change)=\"$event ? toggleAllRows() : null\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n (click)=\"$event.stopPropagation()\"\n >\n </mat-checkbox>\n </ng-container>\n <div *ngIf=\"column.key !== 'actions'\">\n <mat-icon>filter_list</mat-icon>\n </div>\n <div class=\"mapa-table__label\">\n {{ column.label }}\n </div>\n </div>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <div class=\"header\">\n <ng-container *ngIf=\"isFirst && checkbox\">\n <mat-checkbox\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null; getSelectedValues()\"\n [checked]=\"selection.isSelected(row)\"\n >\n </mat-checkbox>\n </ng-container>\n <ng-container *ngIf=\"column.key === 'actions'\">\n <div class=\"actions\">\n <mat-icon (click)=\"emitRowClick(row, 'edit')\">edit</mat-icon>\n <mat-icon (click)=\"emitRowClick(row, 'delete')\">delete</mat-icon>\n <mat-icon (click)=\"emitRowClick(row, 'visibility')\"\n >visibility</mat-icon\n >\n </div>\n </ng-container>\n <div class=\"table__column\" (click)=\"emitRowClick(row, '')\">\n {{ row[column.key] }}\n </div>\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n\n <!--\n <mat-paginator\n class=\"mapa-table__paginator paginator\"\n appBubblePagination\n [appCustomLength]=\"dataSource ? dataSource.data.length : 0\"\n [length]=\"dataSource ? dataSource.data.length : 0\"\n [pageSizeOptions]=\"[5, 10, 25, 100]\"\n [pageSize]=\"5\"\n aria-label=\"Select page\"\n ></mat-paginator>\n -->\n <mat-paginator\n class=\"mapa-table__paginator-legacy\"\n itemsPerPageLabel=\"Item por p\u00E1gina\"\n appStylePaginator\n [length]=\"dataSource ? dataSource.data.length : 0\"\n [pageSize]=\"5\"\n [pageSizeOptions]=\"[5, 10, 25, 100]\"\n >\n </mat-paginator>\n <!-- (page)=\"pageEvent = $event; onPaginateChange($event)\" -->\n</div>\n", styles: [".mapa-table .mat-table{font-family:SF-Pro;width:100%}.mapa-table .mat-table .mat-checkbox{margin:0 8px 0 0;padding:0}.mapa-table .mat-table .mat-row .mat-cell{font-family:SF-Pro;font-size:16px;font-style:normal;font-weight:400;color:#50575e}.mapa-table .mat-table .mat-header-cell{border:none;font-family:SF-Pro;font-size:16px;font-style:normal;font-weight:600;color:#50575e}.mapa-table .mat-icon{cursor:pointer;position:relative;bottom:-3px;padding:0 5px 0 0}.mapa-table .mat-mdc-row,.mapa-table .mdc-data-table__content,.mapa-table .mat-mdc-header-cell{--mat-table-row-item-label-text-font: \"SF-Pro\"}.mapa-table .mat-checkbox.mat-accent .mat-checkbox-frame{border-color:#b6b6b6}.mapa-table .mat-checkbox.mat-accent.mat-checkbox-checked .mat-checkbox-frame{border-color:#ea561d}.mapa-table .mat-checkbox.mat-accent .mat-checkbox-background{background-color:transparent}.mapa-table .mat-checkbox.mat-accent.mat-checkbox-checked .mat-checkbox-background{background-color:#ea561d}.mapa-table .mat-mdc-paginator-container{display:flex;justify-content:space-between}.mapa-table ::ng-deep .mat-mdc-paginator-page-size-label{display:none}.mapa-table__paginator-legacy .custom-paginator-container{justify-content:flex-end}.mapa-table__paginator-legacy .custom-paginator-counter{white-space:nowrap;margin:0 4px 0 10px!important}.mapa-table__paginator-legacy .custom-paginator-page{border-radius:4px;outline:none;border:none;margin:.4em;font-size:14px;min-width:24px;width:auto;min-height:24px;max-height:24px;padding:1px 6px}.mapa-table__paginator-legacy .custom-paginator-page-enabled{color:#333;background:transparent;cursor:pointer}.mapa-table__paginator-legacy .custom-paginator-page-enabled:hover{background-color:#dfe3e6}.mapa-table__paginator-legacy .custom-paginator-page-disabled{background-color:#cf482b;color:#fff}.mapa-table__paginator-legacy .custom-paginator-arrow-disabled{color:#dfe3e6}.mapa-table__paginator-legacy .custom-paginator-arrow-enabled{color:#999}.mapa-table__label{margin-top:4px}.mapa-table__header{padding-top:15px;padding-bottom:15px;align-items:center;display:flex}.mapa-table .actions{display:flex}.mapa-table .actions .mat-icon{color:#ea561d!important}.mapa-table .header{align-items:center;display:flex}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i1.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "component", type: i6.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i6.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: PaginatorLegacyDirective, selector: "[appStylePaginator]" }], encapsulation: i0.ViewEncapsulation.None });
101
511
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapaTableComponent, decorators: [{
102
512
  type: Component,
103
- args: [{ selector: 'mapa-table', encapsulation: ViewEncapsulation.None, template: "<div class=\"mapa-table\">\n <table mat-table [dataSource]=\"dataSource\" matSort>\n <ng-container\n *ngFor=\"let column of columns; let isFirst = first\"\n [matColumnDef]=\"column.key\"\n >\n <th\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header\n (click)=\"sortData(column.key)\"\n >\n <div class=\"mapa-table__header\">\n <ng-container *ngIf=\"isFirst && checkbox\">\n <mat-checkbox\n (change)=\"$event ? toggleAllRows() : null\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n (click)=\"$event.stopPropagation(); createObjectFromSelection()\"\n >\n </mat-checkbox>\n </ng-container>\n <div *ngIf=\"column.key !== 'actions'\">\n <mat-icon>filter_list</mat-icon>\n </div>\n <div class=\"mapa-table__label\">\n {{ column.label }}\n </div>\n </div>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <ng-container *ngIf=\"isFirst && checkbox\">\n <mat-checkbox\n (click)=\"$event.stopPropagation(); createObjectFromSelection()\"\n (change)=\"$event ? selection.toggle(row) : null\"\n [checked]=\"selection.isSelected(row)\"\n >\n </mat-checkbox>\n </ng-container>\n <ng-container *ngIf=\"column.key === 'actions'\">\n <div class=\"mapa-table__actions\">\n <mat-icon (click)=\"handleRowClick(row, 'edit')\">edit</mat-icon>\n <mat-icon (click)=\"handleRowClick(row, 'delete')\">delete</mat-icon>\n <mat-icon (click)=\"handleRowClick(row, 'visibility')\"\n >visibility</mat-icon\n >\n </div>\n </ng-container>\n <div class=\"mapa-table__column\" (click)=\"handleRowClick(row, '')\">\n {{ row[column.key] }}\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n\n <mat-paginator\n class=\"mapa-table__paginator\"\n appBubblePagination\n [appCustomLength]=\"dataSource ? dataSource.data.length : 0\"\n [length]=\"dataSource ? dataSource.data.length : 0\"\n [pageSizeOptions]=\"[5, 10, 25, 100]\"\n [pageSize]=\"5\"\n aria-label=\"Select page\"\n ></mat-paginator>\n</div>\n", styles: [".mapa-table__column{width:100%}.mapa-table__label{margin-top:4px}.mapa-table__header{padding-top:15px;padding-bottom:15px;align-items:center;display:flex}.mapa-table__actions{display:flex}.mapa-table__actions .mat-icon{color:#ea561d!important}.mapa-table__paginator .mat-mdc-paginator-container{display:flex;justify-content:space-between;margin-right:25vw}.mapa-table__paginator .g-bubble-container{display:flex;gap:4px}.mapa-table__paginator .g-bubble{background-color:#fff;border-radius:20%;width:24px;height:24px;display:flex;align-items:center;justify-content:center;color:#181818;font-size:14px;cursor:pointer;transition:.3s}.mapa-table__paginator .g-bubble:hover{background-color:#b6b6b6;color:#fff}.mapa-table__paginator .g-bubble__active{background-color:#ea561d;color:#fff}.mapa-table__paginator mat-paginator{background:transparent!important}.mapa-table__paginator .mat-mdc-paginator-range-actions{margin-right:12px!important}.mapa-table .mat-table{width:100%}.mapa-table .tr,.mapa-table th{padding-top:15px;padding-bottom:15px}.mapa-table .mat-mdc-cell{padding:15px}.mapa-table .mat-icon{cursor:pointer;position:relative;bottom:-6px;padding:0 5px}.mapa-table .mat-accent{--mdc-checkbox-selected-focus-icon-color: #ea561d;--mdc-checkbox-selected-hover-icon-color: #ea561d;--mdc-checkbox-selected-pressed-icon-color: transparent;--mdc-checkbox-selected-icon-color: #ea561d;--mdc-checkbox-selected-checkmark-color: #fff;--mdc-circular-progress-active-indicator-color: transparent}.mapa-table .mat-mdc-paginator-container{display:flex;justify-content:space-between}.mapa-table ::ng-deep .mat-mdc-paginator-page-size-label{display:none}\n"] }]
104
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { columns: [{
513
+ args: [{ selector: 'mapa-table', encapsulation: ViewEncapsulation.None, template: "<div class=\"mapa-table\">\n <table mat-table [dataSource]=\"dataSource\" matSort>\n <ng-container\n *ngFor=\"let column of columns; let isFirst = first\"\n [matColumnDef]=\"column.key\"\n >\n <th\n mat-header-cell\n *matHeaderCellDef\n mat-sort-header\n (click)=\"sortData(column.key)\"\n >\n <div class=\"mapa-table__header\">\n <ng-container *ngIf=\"isFirst && checkbox\">\n <mat-checkbox\n (change)=\"$event ? toggleAllRows() : null\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n (click)=\"$event.stopPropagation()\"\n >\n </mat-checkbox>\n </ng-container>\n <div *ngIf=\"column.key !== 'actions'\">\n <mat-icon>filter_list</mat-icon>\n </div>\n <div class=\"mapa-table__label\">\n {{ column.label }}\n </div>\n </div>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <div class=\"header\">\n <ng-container *ngIf=\"isFirst && checkbox\">\n <mat-checkbox\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null; getSelectedValues()\"\n [checked]=\"selection.isSelected(row)\"\n >\n </mat-checkbox>\n </ng-container>\n <ng-container *ngIf=\"column.key === 'actions'\">\n <div class=\"actions\">\n <mat-icon (click)=\"emitRowClick(row, 'edit')\">edit</mat-icon>\n <mat-icon (click)=\"emitRowClick(row, 'delete')\">delete</mat-icon>\n <mat-icon (click)=\"emitRowClick(row, 'visibility')\"\n >visibility</mat-icon\n >\n </div>\n </ng-container>\n <div class=\"table__column\" (click)=\"emitRowClick(row, '')\">\n {{ row[column.key] }}\n </div>\n </div>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n </table>\n\n <!--\n <mat-paginator\n class=\"mapa-table__paginator paginator\"\n appBubblePagination\n [appCustomLength]=\"dataSource ? dataSource.data.length : 0\"\n [length]=\"dataSource ? dataSource.data.length : 0\"\n [pageSizeOptions]=\"[5, 10, 25, 100]\"\n [pageSize]=\"5\"\n aria-label=\"Select page\"\n ></mat-paginator>\n -->\n <mat-paginator\n class=\"mapa-table__paginator-legacy\"\n itemsPerPageLabel=\"Item por p\u00E1gina\"\n appStylePaginator\n [length]=\"dataSource ? dataSource.data.length : 0\"\n [pageSize]=\"5\"\n [pageSizeOptions]=\"[5, 10, 25, 100]\"\n >\n </mat-paginator>\n <!-- (page)=\"pageEvent = $event; onPaginateChange($event)\" -->\n</div>\n", styles: [".mapa-table .mat-table{font-family:SF-Pro;width:100%}.mapa-table .mat-table .mat-checkbox{margin:0 8px 0 0;padding:0}.mapa-table .mat-table .mat-row .mat-cell{font-family:SF-Pro;font-size:16px;font-style:normal;font-weight:400;color:#50575e}.mapa-table .mat-table .mat-header-cell{border:none;font-family:SF-Pro;font-size:16px;font-style:normal;font-weight:600;color:#50575e}.mapa-table .mat-icon{cursor:pointer;position:relative;bottom:-3px;padding:0 5px 0 0}.mapa-table .mat-mdc-row,.mapa-table .mdc-data-table__content,.mapa-table .mat-mdc-header-cell{--mat-table-row-item-label-text-font: \"SF-Pro\"}.mapa-table .mat-checkbox.mat-accent .mat-checkbox-frame{border-color:#b6b6b6}.mapa-table .mat-checkbox.mat-accent.mat-checkbox-checked .mat-checkbox-frame{border-color:#ea561d}.mapa-table .mat-checkbox.mat-accent .mat-checkbox-background{background-color:transparent}.mapa-table .mat-checkbox.mat-accent.mat-checkbox-checked .mat-checkbox-background{background-color:#ea561d}.mapa-table .mat-mdc-paginator-container{display:flex;justify-content:space-between}.mapa-table ::ng-deep .mat-mdc-paginator-page-size-label{display:none}.mapa-table__paginator-legacy .custom-paginator-container{justify-content:flex-end}.mapa-table__paginator-legacy .custom-paginator-counter{white-space:nowrap;margin:0 4px 0 10px!important}.mapa-table__paginator-legacy .custom-paginator-page{border-radius:4px;outline:none;border:none;margin:.4em;font-size:14px;min-width:24px;width:auto;min-height:24px;max-height:24px;padding:1px 6px}.mapa-table__paginator-legacy .custom-paginator-page-enabled{color:#333;background:transparent;cursor:pointer}.mapa-table__paginator-legacy .custom-paginator-page-enabled:hover{background-color:#dfe3e6}.mapa-table__paginator-legacy .custom-paginator-page-disabled{background-color:#cf482b;color:#fff}.mapa-table__paginator-legacy .custom-paginator-arrow-disabled{color:#dfe3e6}.mapa-table__paginator-legacy .custom-paginator-arrow-enabled{color:#999}.mapa-table__label{margin-top:4px}.mapa-table__header{padding-top:15px;padding-bottom:15px;align-items:center;display:flex}.mapa-table .actions{display:flex}.mapa-table .actions .mat-icon{color:#ea561d!important}.mapa-table .header{align-items:center;display:flex}\n"] }]
514
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }]; }, propDecorators: { columns: [{
105
515
  type: Input
106
516
  }], data: [{
107
517
  type: Input
@@ -115,8 +525,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
115
525
  }], sort: [{
116
526
  type: ViewChild,
117
527
  args: [MatSort]
118
- }], tableData: [{
119
- type: Output
120
528
  }], rowClick: [{
121
529
  type: Output
122
530
  }], selectedObjectsChange: [{
@@ -125,9 +533,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
125
533
 
126
534
  function CustomPaginator() {
127
535
  const customPaginatorIntl = new MatPaginatorIntl();
536
+ const rangeLabel = (page, pageSize, length) => {
537
+ if (length == 0 || pageSize == 0) {
538
+ return `0 de ${length}`;
539
+ }
540
+ length = Math.max(length, 0);
541
+ const startIndex = page * pageSize;
542
+ const endIndex = startIndex < length ?
543
+ Math.min(startIndex + pageSize, length) :
544
+ startIndex + pageSize;
545
+ return `${startIndex + 1} - ${endIndex} de ${length}`;
546
+ };
128
547
  customPaginatorIntl.itemsPerPageLabel = 'Itens por página:';
129
548
  customPaginatorIntl.nextPageLabel = 'Próxima página';
130
549
  customPaginatorIntl.previousPageLabel = 'Página anterior';
550
+ customPaginatorIntl.getRangeLabel = rangeLabel;
131
551
  return customPaginatorIntl;
132
552
  }
133
553
 
@@ -139,14 +559,19 @@ MapaTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version
139
559
  MatIconModule,
140
560
  MatPaginatorModule,
141
561
  MatTableModule,
142
- BubblePaginationDirective], exports: [MapaTableComponent] });
562
+ BubblePaginationDirective,
563
+ PaginatorLegacyDirective,
564
+ FormsModule,
565
+ ReactiveFormsModule], exports: [MapaTableComponent] });
143
566
  MapaTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapaTableModule, providers: [
144
567
  { provide: MatPaginatorIntl, useValue: CustomPaginator() }
145
568
  ], imports: [CommonModule,
146
569
  MatCheckboxModule,
147
570
  MatIconModule,
148
571
  MatPaginatorModule,
149
- MatTableModule] });
572
+ MatTableModule,
573
+ FormsModule,
574
+ ReactiveFormsModule] });
150
575
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapaTableModule, decorators: [{
151
576
  type: NgModule,
152
577
  args: [{
@@ -159,7 +584,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
159
584
  MatIconModule,
160
585
  MatPaginatorModule,
161
586
  MatTableModule,
162
- BubblePaginationDirective
587
+ BubblePaginationDirective,
588
+ PaginatorLegacyDirective,
589
+ FormsModule,
590
+ ReactiveFormsModule
163
591
  ],
164
592
  exports: [
165
593
  MapaTableComponent
@@ -174,9 +602,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
174
602
  * Public API Surface of mapa-library-ui input
175
603
  */
176
604
 
605
+ /*
606
+ * Public API Surface of mapa-library-ui table
607
+ */
608
+
177
609
  /**
178
610
  * Generated bundle index. Do not edit.
179
611
  */
180
612
 
181
- export { MapaTableComponent, MapaTableModule };
613
+ export { BubblePaginationDirective, MapaTableComponent, MapaTableModule, PaginatorLegacyDirective };
182
614
  //# sourceMappingURL=mapa-library-ui-src-lib-components-table.mjs.map