mapa-library-ui 0.0.23 → 0.0.25
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.
- package/esm2020/src/lib/components/capability/lib/components/filters/src/filters.component.mjs +2 -2
- package/esm2020/src/lib/components/filters/lib/components/filters/src/filters.component.mjs +2 -2
- package/esm2020/src/lib/components/table/lib/components/table/public-api.mjs +6 -0
- package/esm2020/src/lib/components/table/lib/components/table/src/paginator_customization.mjs +21 -0
- package/esm2020/src/lib/components/table/lib/components/table/src/table.component.mjs +121 -0
- package/esm2020/src/lib/components/table/lib/components/table/src/table.module.mjs +59 -0
- package/esm2020/src/lib/components/table/lib/core/directives/custom-paginator-legacy.directive.mjs +227 -0
- package/esm2020/src/lib/components/table/lib/core/directives/custom-paginator.directive.mjs +183 -0
- package/esm2020/src/lib/components/table/mapa-library-ui-src-lib-components-table.mjs +2 -2
- package/esm2020/src/lib/components/table/table.mjs +7 -0
- package/fesm2015/mapa-library-ui-src-lib-components-capability.mjs +2 -2
- package/fesm2015/mapa-library-ui-src-lib-components-capability.mjs.map +1 -1
- package/fesm2015/mapa-library-ui-src-lib-components-filters.mjs +2 -2
- package/fesm2015/mapa-library-ui-src-lib-components-filters.mjs.map +1 -1
- package/fesm2015/mapa-library-ui-src-lib-components-table.mjs +470 -38
- package/fesm2015/mapa-library-ui-src-lib-components-table.mjs.map +1 -1
- package/fesm2020/mapa-library-ui-src-lib-components-capability.mjs +2 -2
- package/fesm2020/mapa-library-ui-src-lib-components-capability.mjs.map +1 -1
- package/fesm2020/mapa-library-ui-src-lib-components-filters.mjs +2 -2
- package/fesm2020/mapa-library-ui-src-lib-components-filters.mjs.map +1 -1
- package/fesm2020/mapa-library-ui-src-lib-components-table.mjs +466 -38
- package/fesm2020/mapa-library-ui-src-lib-components-table.mjs.map +1 -1
- package/mapa-library-ui-0.0.25.tgz +0 -0
- package/package.json +1 -1
- package/src/lib/components/table/index.d.ts +1 -1
- package/src/lib/components/table/{src → lib/components/table/src}/table.component.d.ts +14 -8
- package/src/lib/components/table/{src → lib/components/table/src}/table.module.d.ts +4 -2
- package/src/lib/components/table/lib/core/directives/custom-paginator-legacy.directive.d.ts +27 -0
- package/src/lib/components/table/lib/core/directives/custom-paginator.directive.d.ts +33 -0
- package/src/lib/components/table/table.d.ts +3 -0
- package/esm2020/src/lib/components/table/public-api.mjs +0 -6
- package/esm2020/src/lib/components/table/src/paginator_customization.mjs +0 -9
- package/esm2020/src/lib/components/table/src/table.component.mjs +0 -120
- package/esm2020/src/lib/components/table/src/table.module.mjs +0 -49
- package/mapa-library-ui-0.0.23.tgz +0 -0
- /package/src/lib/components/table/{public-api.d.ts → lib/components/table/public-api.d.ts} +0 -0
- /package/src/lib/components/table/{src → lib/components/table/src}/paginator_customization.d.ts +0 -0
|
@@ -1,26 +1,429 @@
|
|
|
1
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { EventEmitter,
|
|
4
|
-
import
|
|
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
|
|
8
|
+
import * as i6 from '@angular/material/table';
|
|
8
9
|
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
9
|
-
import * as i1 from '@angular/
|
|
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
|
|
14
|
+
import * as i3 from '@angular/material/checkbox';
|
|
12
15
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
13
|
-
import * as
|
|
16
|
+
import * as i4 from '@angular/material/icon';
|
|
14
17
|
import { MatIconModule } from '@angular/material/icon';
|
|
15
|
-
|
|
16
|
-
|
|
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
|
+
if (!changes?.["appCustomLength"]?.firstChange) {
|
|
39
|
+
this.removeButtons();
|
|
40
|
+
this.switchPage(0);
|
|
41
|
+
this.renderButtons();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
renderButtons() {
|
|
45
|
+
this.buildButtons();
|
|
46
|
+
this.matPag.page
|
|
47
|
+
.pipe(map((e) => [e.previousPageIndex ?? 0, e.pageIndex]), startWith([0, 0]))
|
|
48
|
+
.subscribe(([prev, curr]) => {
|
|
49
|
+
this.changeActiveButtonStyles(prev, curr);
|
|
50
|
+
this.updateButtonsOnPageEvent();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
changeActiveButtonStyles(previousIndex, newIndex) {
|
|
54
|
+
const previouslyActive = this.buttonsRef[previousIndex];
|
|
55
|
+
const currentActive = this.buttonsRef[newIndex];
|
|
56
|
+
try {
|
|
57
|
+
this.ren.removeClass(previouslyActive, "g-bubble__active");
|
|
58
|
+
this.ren.addClass(currentActive, "g-bubble__active");
|
|
59
|
+
}
|
|
60
|
+
catch { }
|
|
61
|
+
this.buttonsRef.forEach((button) => this.ren.setStyle(button, "display", "none"));
|
|
62
|
+
const renderElements = this.renderButtonsNumber;
|
|
63
|
+
const endDots = newIndex < this.buttonsRef.length - renderElements - 1;
|
|
64
|
+
const startDots = newIndex - renderElements > 0;
|
|
65
|
+
const firstButton = this.buttonsRef[0];
|
|
66
|
+
const lastButton = this.buttonsRef[this.buttonsRef.length - 1];
|
|
67
|
+
try {
|
|
68
|
+
if (this.showLastButton) {
|
|
69
|
+
this.ren.setStyle(this.dotsEndRef, "display", endDots ? "block" : "none");
|
|
70
|
+
this.ren.setStyle(lastButton, "display", endDots ? "flex" : "none");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch { }
|
|
74
|
+
try {
|
|
75
|
+
if (this.showFirstButton) {
|
|
76
|
+
this.ren.setStyle(this.dotsStartRef, "display", startDots ? "block" : "none");
|
|
77
|
+
this.ren.setStyle(firstButton, "display", startDots ? "flex" : "none");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch { }
|
|
81
|
+
const startingIndex = startDots ? newIndex - renderElements : 0;
|
|
82
|
+
const endingIndex = endDots
|
|
83
|
+
? newIndex + renderElements
|
|
84
|
+
: this.buttonsRef.length - 1;
|
|
85
|
+
for (let i = startingIndex; i <= endingIndex; i++) {
|
|
86
|
+
const button = this.buttonsRef[i];
|
|
87
|
+
this.ren.setStyle(button, "display", "flex");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
styleDefaultPagination() {
|
|
91
|
+
const nativeElement = this.elementRef.nativeElement;
|
|
92
|
+
const itemsPerPage = nativeElement.querySelector(".mat-mdc-paginator-page-size");
|
|
93
|
+
const howManyDisplayedEl = nativeElement.querySelector(".mat-mdc-paginator-range-label");
|
|
94
|
+
const previousButton = nativeElement.querySelector("button.mat-mdc-paginator-navigation-previous");
|
|
95
|
+
const nextButtonDefault = nativeElement.querySelector("button.mat-mdc-paginator-navigation-next");
|
|
96
|
+
if (this.hideDefaultArrows) {
|
|
97
|
+
this.ren.setStyle(previousButton, "display", "none");
|
|
98
|
+
this.ren.setStyle(nextButtonDefault, "display", "none");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
createBubbleDivRef() {
|
|
102
|
+
const actionContainer = this.elementRef.nativeElement.querySelector("div.mat-mdc-paginator-range-actions");
|
|
103
|
+
const nextButtonDefault = this.elementRef.nativeElement.querySelector("button.mat-mdc-paginator-navigation-next");
|
|
104
|
+
this.bubbleContainerRef = this.ren.createElement("div");
|
|
105
|
+
this.ren.addClass(this.bubbleContainerRef, "g-bubble-container");
|
|
106
|
+
this.ren.insertBefore(actionContainer, this.bubbleContainerRef, nextButtonDefault);
|
|
107
|
+
}
|
|
108
|
+
buildButtons() {
|
|
109
|
+
const neededButtons = Math.ceil(this.appCustomLength / this.matPag.pageSize);
|
|
110
|
+
if (neededButtons === 1) {
|
|
111
|
+
this.ren.setStyle(this.elementRef.nativeElement, "display", "none");
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.buttonsRef = [this.createButton(0)];
|
|
115
|
+
this.dotsStartRef = this.createDotsElement();
|
|
116
|
+
for (let index = 1; index < neededButtons - 1; index++) {
|
|
117
|
+
this.buttonsRef = [...this.buttonsRef, this.createButton(index)];
|
|
118
|
+
}
|
|
119
|
+
this.dotsEndRef = this.createDotsElement();
|
|
120
|
+
this.buttonsRef = [
|
|
121
|
+
...this.buttonsRef,
|
|
122
|
+
this.createButton(neededButtons - 1),
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
removeButtons() {
|
|
126
|
+
this.bubbleContainerRef.innerHTML = '';
|
|
127
|
+
this.buttonsRef.forEach((button) => {
|
|
128
|
+
this.ren.removeChild(this.bubbleContainerRef, button);
|
|
129
|
+
});
|
|
130
|
+
this.buttonsRef = [];
|
|
131
|
+
this.buttonsRef.length = 0;
|
|
132
|
+
}
|
|
133
|
+
createButton(i) {
|
|
134
|
+
const bubbleButton = this.ren.createElement("div");
|
|
135
|
+
const text = this.ren.createText(String(i + 1));
|
|
136
|
+
this.ren.addClass(bubbleButton, "g-bubble");
|
|
137
|
+
this.ren.setStyle(bubbleButton, "margin-right", "8px");
|
|
138
|
+
this.ren.appendChild(bubbleButton, text);
|
|
139
|
+
this.ren.listen(bubbleButton, "click", () => {
|
|
140
|
+
this.switchPage(i);
|
|
141
|
+
});
|
|
142
|
+
this.ren.appendChild(this.bubbleContainerRef, bubbleButton);
|
|
143
|
+
this.ren.setStyle(bubbleButton, "display", "none");
|
|
144
|
+
return bubbleButton;
|
|
145
|
+
}
|
|
146
|
+
createDotsElement() {
|
|
147
|
+
const dotsEl = this.ren.createElement("span");
|
|
148
|
+
const dotsText = this.ren.createText(".....");
|
|
149
|
+
this.ren.setStyle(dotsEl, "font-size", "18px");
|
|
150
|
+
this.ren.setStyle(dotsEl, "margin-right", "8px");
|
|
151
|
+
this.ren.setStyle(dotsEl, "padding-top", "6px");
|
|
152
|
+
this.ren.setStyle(dotsEl, "color", "#919191");
|
|
153
|
+
this.ren.appendChild(dotsEl, dotsText);
|
|
154
|
+
this.ren.appendChild(this.bubbleContainerRef, dotsEl);
|
|
155
|
+
this.ren.setStyle(dotsEl, "display", "none");
|
|
156
|
+
return dotsEl;
|
|
157
|
+
}
|
|
158
|
+
switchPage(i) {
|
|
159
|
+
const previousPageIndex = this.matPag.pageIndex;
|
|
160
|
+
this.matPag.pageIndex = i;
|
|
161
|
+
try {
|
|
162
|
+
this.matPag["_emitPageEvent"](previousPageIndex);
|
|
163
|
+
}
|
|
164
|
+
catch { }
|
|
165
|
+
this.pageIndexChangeEmitter.emit(i);
|
|
166
|
+
}
|
|
167
|
+
updateButtonsOnPageEvent() {
|
|
168
|
+
const neededButtons = Math.ceil(this.appCustomLength / this.matPag.pageSize);
|
|
169
|
+
if (neededButtons === this.buttonsRef.length) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
this.removeButtons();
|
|
173
|
+
this.buildButtons();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
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 });
|
|
177
|
+
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 });
|
|
178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BubblePaginationDirective, decorators: [{
|
|
179
|
+
type: Directive,
|
|
180
|
+
args: [{
|
|
181
|
+
selector: "[appBubblePagination]",
|
|
182
|
+
standalone: true,
|
|
183
|
+
}]
|
|
184
|
+
}], ctorParameters: function () { return [{ type: i1.MatPaginator }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { pageIndexChangeEmitter: [{
|
|
185
|
+
type: Output
|
|
186
|
+
}], showFirstButton: [{
|
|
187
|
+
type: Input
|
|
188
|
+
}], showLastButton: [{
|
|
189
|
+
type: Input
|
|
190
|
+
}], renderButtonsNumber: [{
|
|
191
|
+
type: Input
|
|
192
|
+
}], appCustomLength: [{
|
|
193
|
+
type: Input
|
|
194
|
+
}], hideDefaultArrows: [{
|
|
195
|
+
type: Input
|
|
196
|
+
}] } });
|
|
197
|
+
|
|
198
|
+
class PaginatorLegacyDirective {
|
|
199
|
+
constructor(matPag, ViewContainer, renderer) {
|
|
200
|
+
this.matPag = matPag;
|
|
201
|
+
this.ViewContainer = ViewContainer;
|
|
202
|
+
this.renderer = renderer;
|
|
203
|
+
this.buttons = [];
|
|
204
|
+
this.buildPageNumbers = () => {
|
|
205
|
+
let dots;
|
|
206
|
+
let page;
|
|
207
|
+
let pageDifference;
|
|
208
|
+
let startIndex;
|
|
209
|
+
let totalPages;
|
|
210
|
+
totalPages = this.matPag.getNumberOfPages();
|
|
211
|
+
// Container div with paginator elements
|
|
212
|
+
const actionContainer = this.ViewContainer.element.nativeElement.querySelector('div.mat-paginator-range-actions');
|
|
213
|
+
// Button that triggers the next page action
|
|
214
|
+
const nextPageNode = this.ViewContainer.element.nativeElement.querySelector('button.mat-paginator-navigation-next');
|
|
215
|
+
// Label showing the page range
|
|
216
|
+
const pageRange = this.ViewContainer.element.nativeElement.querySelector('div.mat-paginator-range-label');
|
|
217
|
+
let prevButtonCount = this.buttons.length;
|
|
218
|
+
// Remove buttons before creating new ones
|
|
219
|
+
if (prevButtonCount > 0) {
|
|
220
|
+
this.buttons.forEach((button) => {
|
|
221
|
+
this.renderer.removeChild(actionContainer, button);
|
|
222
|
+
});
|
|
223
|
+
// Empty state array
|
|
224
|
+
prevButtonCount = 0;
|
|
225
|
+
}
|
|
226
|
+
this.renderer.addClass(pageRange, 'custom-paginator-counter');
|
|
227
|
+
this.renderer.addClass(actionContainer, 'custom-paginator-container');
|
|
228
|
+
// Initialize next page and last page buttons
|
|
229
|
+
if (prevButtonCount === 0) {
|
|
230
|
+
const nodeArray = actionContainer.childNodes;
|
|
231
|
+
setTimeout(() => {
|
|
232
|
+
for (const node of nodeArray) {
|
|
233
|
+
if (node.nodeName === 'BUTTON') {
|
|
234
|
+
// Next Button styles
|
|
235
|
+
if (node.innerHTML.length > 100 && node.disabled) {
|
|
236
|
+
this.renderer.addClass(node, 'custom-paginator-arrow-disabled');
|
|
237
|
+
this.renderer.removeClass(node, 'custom-paginator-arrow-enabled');
|
|
238
|
+
}
|
|
239
|
+
else if (node.innerHTML.length > 100 && !node.disabled) {
|
|
240
|
+
this.renderer.addClass(node, 'custom-paginator-arrow-enabled');
|
|
241
|
+
this.renderer.removeClass(node, 'custom-paginator-arrow-disabled');
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
dots = [false, false];
|
|
248
|
+
if (totalPages > 0) {
|
|
249
|
+
this.renderer.insertBefore(actionContainer, this.createButton('0', this.matPag.pageIndex), nextPageNode);
|
|
250
|
+
}
|
|
251
|
+
page = this.showTotalPages + 2;
|
|
252
|
+
pageDifference = totalPages - page;
|
|
253
|
+
startIndex = Math.max(this.currentPage - this.showTotalPages - 2, 1);
|
|
254
|
+
for (let index = startIndex; index < totalPages - 1; index = index + 1) {
|
|
255
|
+
if ((index < page && this.currentPage <= this.showTotalPages) ||
|
|
256
|
+
(index >= this.rangeStart && index <= this.rangeEnd) ||
|
|
257
|
+
(this.currentPage > pageDifference && index >= pageDifference) ||
|
|
258
|
+
totalPages < this.showTotalPages + page) {
|
|
259
|
+
this.renderer.insertBefore(actionContainer, this.createButton(`${index}`, this.matPag.pageIndex), nextPageNode);
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
if (index > this.rangeEnd && !dots[0]) {
|
|
263
|
+
this.renderer.insertBefore(actionContainer, this.createButton(this.pageGapTxt[0], this.matPag.pageIndex), nextPageNode);
|
|
264
|
+
dots[0] = true;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
if (index < this.rangeEnd && !dots[1]) {
|
|
268
|
+
this.renderer.insertBefore(actionContainer, this.createButton(this.pageGapTxt[1], this.matPag.pageIndex), nextPageNode);
|
|
269
|
+
dots[1] = true;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (totalPages > 1) {
|
|
274
|
+
this.renderer.insertBefore(actionContainer, this.createButton(`${totalPages - 1}`, this.matPag.pageIndex), nextPageNode);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
this.currentPage = 1;
|
|
278
|
+
this.pageGapTxt = ['•••', '---'];
|
|
279
|
+
this.showTotalPages = 2;
|
|
280
|
+
this.checkPage = [0, 0, 0];
|
|
281
|
+
// Display custom range label text
|
|
282
|
+
this.matPag._intl.getRangeLabel = (page, pageSize, length) => {
|
|
283
|
+
const startIndex = page * pageSize;
|
|
284
|
+
const endIndex = startIndex < length
|
|
285
|
+
? Math.min(startIndex + pageSize, length)
|
|
286
|
+
: startIndex + pageSize;
|
|
287
|
+
if (length === 0) {
|
|
288
|
+
return 'Mostrando 0 – 0 de 0 item';
|
|
289
|
+
}
|
|
290
|
+
if (length === 1) {
|
|
291
|
+
return ('Mostrando ' +
|
|
292
|
+
(startIndex + 1) +
|
|
293
|
+
' – ' +
|
|
294
|
+
endIndex +
|
|
295
|
+
' de ' +
|
|
296
|
+
length +
|
|
297
|
+
' item');
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
return ('Mostrando ' +
|
|
301
|
+
(startIndex + 1) +
|
|
302
|
+
' – ' +
|
|
303
|
+
endIndex +
|
|
304
|
+
' de ' +
|
|
305
|
+
length +
|
|
306
|
+
' itens');
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
// Subscribe to rerender buttons when next page and last page button is used
|
|
310
|
+
this.matPag.page.subscribe((paginator) => {
|
|
311
|
+
this.currentPage = paginator.pageIndex;
|
|
312
|
+
this.matPag.pageIndex = paginator.pageIndex;
|
|
313
|
+
this.initPageRange();
|
|
314
|
+
});
|
|
315
|
+
this.matPag._intl.itemsPerPageLabel = 'Itens por página';
|
|
316
|
+
const paginatorIntl = this.matPag._intl;
|
|
317
|
+
paginatorIntl.nextPageLabel = '';
|
|
318
|
+
paginatorIntl.previousPageLabel = '';
|
|
319
|
+
}
|
|
320
|
+
ngDoCheck() {
|
|
321
|
+
// Reset paginator if the pageSize, pageIndex, length changes
|
|
322
|
+
if (this.matPag?.length !== this.checkPage[0] ||
|
|
323
|
+
this.matPag?.pageSize !== this.checkPage[1] ||
|
|
324
|
+
this.matPag?.pageIndex !== this.checkPage[2]) {
|
|
325
|
+
const pageCount = this.matPag.getNumberOfPages();
|
|
326
|
+
if (this.currentPage > pageCount && pageCount !== 0) {
|
|
327
|
+
this.currentPage = 1;
|
|
328
|
+
this.matPag.pageIndex = 0;
|
|
329
|
+
}
|
|
330
|
+
this.currentPage = this.matPag.pageIndex;
|
|
331
|
+
this.initPageRange();
|
|
332
|
+
this.checkPage = [
|
|
333
|
+
this.matPag.length,
|
|
334
|
+
this.matPag.pageSize,
|
|
335
|
+
this.matPag.pageIndex,
|
|
336
|
+
];
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
createButton(index, pageIndex) {
|
|
340
|
+
const linkBtn = this.renderer.createElement('button');
|
|
341
|
+
this.renderer.setAttribute(linkBtn, 'class', 'custom-paginator-page');
|
|
342
|
+
this.renderer.addClass(linkBtn, 'custom-paginator-page-enabled');
|
|
343
|
+
if (index === this.pageGapTxt[0] || index === this.pageGapTxt[1]) {
|
|
344
|
+
this.renderer.addClass(linkBtn, 'custom-paginator-arrow-enabled');
|
|
345
|
+
}
|
|
346
|
+
const pagingTxt = isNaN(+index) ? this.pageGapTxt[0] : +index + 1;
|
|
347
|
+
const text = this.renderer.createText(pagingTxt + '');
|
|
348
|
+
this.renderer.addClass(linkBtn, 'mat-custom-page');
|
|
349
|
+
switch (index) {
|
|
350
|
+
case `${pageIndex}`:
|
|
351
|
+
this.renderer.setAttribute(linkBtn, 'disabled', 'disabled');
|
|
352
|
+
this.renderer.removeClass(linkBtn, 'custom-paginator-page-enabled');
|
|
353
|
+
this.renderer.addClass(linkBtn, 'custom-paginator-page-disabled');
|
|
354
|
+
break;
|
|
355
|
+
case this.pageGapTxt[0]:
|
|
356
|
+
this.renderer.listen(linkBtn, 'click', () => {
|
|
357
|
+
this.switchPage(this.currentPage < this.showTotalPages + 1
|
|
358
|
+
? this.showTotalPages + 2
|
|
359
|
+
: this.currentPage + this.showTotalPages - 1);
|
|
360
|
+
});
|
|
361
|
+
break;
|
|
362
|
+
case this.pageGapTxt[1]:
|
|
363
|
+
this.renderer.listen(linkBtn, 'click', () => {
|
|
364
|
+
this.switchPage(this.currentPage >
|
|
365
|
+
this.matPag.getNumberOfPages() - this.showTotalPages - 2
|
|
366
|
+
? this.matPag.getNumberOfPages() - this.showTotalPages - 3
|
|
367
|
+
: this.currentPage - this.showTotalPages + 1);
|
|
368
|
+
});
|
|
369
|
+
break;
|
|
370
|
+
default:
|
|
371
|
+
this.renderer.listen(linkBtn, 'click', () => {
|
|
372
|
+
this.switchPage(+index);
|
|
373
|
+
});
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
this.renderer.appendChild(linkBtn, text);
|
|
377
|
+
// Add button to private array for state
|
|
378
|
+
this.buttons.push(linkBtn);
|
|
379
|
+
return linkBtn;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* @description calculates the button range based on class input parameters and based on current page index value.
|
|
383
|
+
*/
|
|
384
|
+
initPageRange() {
|
|
385
|
+
this.rangeStart = this.currentPage - this.showTotalPages / 2;
|
|
386
|
+
this.rangeEnd = this.currentPage + this.showTotalPages / 2;
|
|
387
|
+
this.buildPageNumbers();
|
|
388
|
+
}
|
|
389
|
+
switchPage(index) {
|
|
390
|
+
this.matPag.pageIndex = index;
|
|
391
|
+
this.matPag.page.emit({
|
|
392
|
+
previousPageIndex: this.currentPage,
|
|
393
|
+
pageIndex: index,
|
|
394
|
+
pageSize: this.matPag.pageSize,
|
|
395
|
+
length: this.matPag.length,
|
|
396
|
+
});
|
|
397
|
+
this.currentPage = index;
|
|
398
|
+
this.initPageRange();
|
|
399
|
+
}
|
|
400
|
+
ngAfterViewInit() {
|
|
401
|
+
this.rangeStart = 0;
|
|
402
|
+
this.rangeEnd = this.showTotalPages - 1;
|
|
403
|
+
this.initPageRange();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
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 });
|
|
407
|
+
PaginatorLegacyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.10", type: PaginatorLegacyDirective, isStandalone: true, selector: "[appStylePaginator]", ngImport: i0 });
|
|
408
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PaginatorLegacyDirective, decorators: [{
|
|
409
|
+
type: Directive,
|
|
410
|
+
args: [{
|
|
411
|
+
selector: '[appStylePaginator]',
|
|
412
|
+
standalone: true,
|
|
413
|
+
}]
|
|
414
|
+
}], ctorParameters: function () { return [{ type: i1.MatPaginator, decorators: [{
|
|
415
|
+
type: Host
|
|
416
|
+
}, {
|
|
417
|
+
type: Self
|
|
418
|
+
}, {
|
|
419
|
+
type: Optional
|
|
420
|
+
}] }, { type: i0.ViewContainerRef }, { type: i0.Renderer2 }]; } });
|
|
17
421
|
|
|
18
422
|
class MapaTableComponent {
|
|
19
|
-
constructor(
|
|
20
|
-
this.
|
|
423
|
+
constructor(formBuilder) {
|
|
424
|
+
this.formBuilder = formBuilder;
|
|
21
425
|
this.columns = [];
|
|
22
426
|
this.data = [];
|
|
23
|
-
this.tableData = new EventEmitter();
|
|
24
427
|
this.rowClick = new EventEmitter();
|
|
25
428
|
this.selectedObjectsChange = new EventEmitter();
|
|
26
429
|
this.displayedColumns = [];
|
|
@@ -40,10 +443,12 @@ class MapaTableComponent {
|
|
|
40
443
|
toggleAllRows() {
|
|
41
444
|
if (this.isAllSelected()) {
|
|
42
445
|
this.selection.clear();
|
|
446
|
+
this.getSelectedValues();
|
|
43
447
|
}
|
|
44
448
|
else {
|
|
45
449
|
const dataAsPeriodicElements = this.dataSource.data;
|
|
46
450
|
dataAsPeriodicElements.forEach(row => this.selection.select(row));
|
|
451
|
+
this.getSelectedValues();
|
|
47
452
|
}
|
|
48
453
|
}
|
|
49
454
|
checkboxLabel(row) {
|
|
@@ -77,31 +482,32 @@ class MapaTableComponent {
|
|
|
77
482
|
}
|
|
78
483
|
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
|
79
484
|
}
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
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);
|
|
485
|
+
emitRowClick(row, action) {
|
|
486
|
+
const rowData = { row, action };
|
|
487
|
+
this.rowClick.emit(rowData);
|
|
93
488
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
489
|
+
toggleSelection(row) {
|
|
490
|
+
if (this.selection.isSelected(row)) {
|
|
491
|
+
this.selection.deselect(row);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
this.selection.select(row);
|
|
495
|
+
}
|
|
496
|
+
this.getSelectedValues();
|
|
497
|
+
}
|
|
498
|
+
getSelectedValues() {
|
|
499
|
+
const selectedRows = this.selection.selected.map(row => {
|
|
500
|
+
return { row };
|
|
501
|
+
});
|
|
502
|
+
console.log(selectedRows);
|
|
97
503
|
}
|
|
98
504
|
}
|
|
99
|
-
MapaTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapaTableComponent, deps: [{ token:
|
|
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: {
|
|
505
|
+
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 });
|
|
506
|
+
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:6px 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;margin:0 7px 0 0;font-size:14px;height:14px;width:12px}.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
507
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapaTableComponent, decorators: [{
|
|
102
508
|
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()
|
|
104
|
-
}], ctorParameters: function () { return [{ type:
|
|
509
|
+
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:6px 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;margin:0 7px 0 0;font-size:14px;height:14px;width:12px}.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"] }]
|
|
510
|
+
}], ctorParameters: function () { return [{ type: i1$1.FormBuilder }]; }, propDecorators: { columns: [{
|
|
105
511
|
type: Input
|
|
106
512
|
}], data: [{
|
|
107
513
|
type: Input
|
|
@@ -115,8 +521,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
115
521
|
}], sort: [{
|
|
116
522
|
type: ViewChild,
|
|
117
523
|
args: [MatSort]
|
|
118
|
-
}], tableData: [{
|
|
119
|
-
type: Output
|
|
120
524
|
}], rowClick: [{
|
|
121
525
|
type: Output
|
|
122
526
|
}], selectedObjectsChange: [{
|
|
@@ -125,9 +529,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
125
529
|
|
|
126
530
|
function CustomPaginator() {
|
|
127
531
|
const customPaginatorIntl = new MatPaginatorIntl();
|
|
532
|
+
const rangeLabel = (page, pageSize, length) => {
|
|
533
|
+
if (length == 0 || pageSize == 0) {
|
|
534
|
+
return `0 de ${length}`;
|
|
535
|
+
}
|
|
536
|
+
length = Math.max(length, 0);
|
|
537
|
+
const startIndex = page * pageSize;
|
|
538
|
+
const endIndex = startIndex < length ?
|
|
539
|
+
Math.min(startIndex + pageSize, length) :
|
|
540
|
+
startIndex + pageSize;
|
|
541
|
+
return `${startIndex + 1} - ${endIndex} de ${length}`;
|
|
542
|
+
};
|
|
128
543
|
customPaginatorIntl.itemsPerPageLabel = 'Itens por página:';
|
|
129
544
|
customPaginatorIntl.nextPageLabel = 'Próxima página';
|
|
130
545
|
customPaginatorIntl.previousPageLabel = 'Página anterior';
|
|
546
|
+
customPaginatorIntl.getRangeLabel = rangeLabel;
|
|
131
547
|
return customPaginatorIntl;
|
|
132
548
|
}
|
|
133
549
|
|
|
@@ -139,14 +555,19 @@ MapaTableModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version
|
|
|
139
555
|
MatIconModule,
|
|
140
556
|
MatPaginatorModule,
|
|
141
557
|
MatTableModule,
|
|
142
|
-
BubblePaginationDirective
|
|
558
|
+
BubblePaginationDirective,
|
|
559
|
+
PaginatorLegacyDirective,
|
|
560
|
+
FormsModule,
|
|
561
|
+
ReactiveFormsModule], exports: [MapaTableComponent] });
|
|
143
562
|
MapaTableModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapaTableModule, providers: [
|
|
144
563
|
{ provide: MatPaginatorIntl, useValue: CustomPaginator() }
|
|
145
564
|
], imports: [CommonModule,
|
|
146
565
|
MatCheckboxModule,
|
|
147
566
|
MatIconModule,
|
|
148
567
|
MatPaginatorModule,
|
|
149
|
-
MatTableModule
|
|
568
|
+
MatTableModule,
|
|
569
|
+
FormsModule,
|
|
570
|
+
ReactiveFormsModule] });
|
|
150
571
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapaTableModule, decorators: [{
|
|
151
572
|
type: NgModule,
|
|
152
573
|
args: [{
|
|
@@ -159,7 +580,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
159
580
|
MatIconModule,
|
|
160
581
|
MatPaginatorModule,
|
|
161
582
|
MatTableModule,
|
|
162
|
-
BubblePaginationDirective
|
|
583
|
+
BubblePaginationDirective,
|
|
584
|
+
PaginatorLegacyDirective,
|
|
585
|
+
FormsModule,
|
|
586
|
+
ReactiveFormsModule
|
|
163
587
|
],
|
|
164
588
|
exports: [
|
|
165
589
|
MapaTableComponent
|
|
@@ -174,9 +598,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
174
598
|
* Public API Surface of mapa-library-ui input
|
|
175
599
|
*/
|
|
176
600
|
|
|
601
|
+
/*
|
|
602
|
+
* Public API Surface of mapa-library-ui table
|
|
603
|
+
*/
|
|
604
|
+
|
|
177
605
|
/**
|
|
178
606
|
* Generated bundle index. Do not edit.
|
|
179
607
|
*/
|
|
180
608
|
|
|
181
|
-
export { MapaTableComponent, MapaTableModule };
|
|
609
|
+
export { BubblePaginationDirective, MapaTableComponent, MapaTableModule, PaginatorLegacyDirective };
|
|
182
610
|
//# sourceMappingURL=mapa-library-ui-src-lib-components-table.mjs.map
|