ng-firebase-table-kxp 1.2.4 → 1.2.6
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/lib/components/table/table.component.mjs +1557 -0
- package/esm2020/lib/components/table-tabs/table-tabs.component.mjs +129 -0
- package/esm2020/lib/components/table-tooltip/table-tooltip.component.mjs +49 -0
- package/esm2020/lib/ng-firebase-table-kxp.component.mjs +15 -0
- package/esm2020/lib/ng-firebase-table-kxp.module.mjs +103 -0
- package/esm2020/lib/ng-firebase-table-kxp.service.mjs +14 -0
- package/esm2020/lib/services/filter.service.mjs +416 -0
- package/esm2020/lib/services/pagination.service.mjs +115 -0
- package/esm2020/lib/services/table.service.mjs +1140 -0
- package/esm2020/lib/services/tooltip.service.mjs +141 -0
- package/esm2020/lib/types/Table.mjs +9 -0
- package/esm2020/lib/utils/table.utils.mjs +75 -0
- package/esm2020/ng-firebase-table-kxp.mjs +5 -0
- package/esm2020/public-api.mjs +22 -0
- package/fesm2015/ng-firebase-table-kxp.mjs +4026 -0
- package/fesm2015/ng-firebase-table-kxp.mjs.map +1 -0
- package/{fesm2022 → fesm2020}/ng-firebase-table-kxp.mjs +3666 -3659
- package/fesm2020/ng-firebase-table-kxp.mjs.map +1 -0
- package/index.d.ts +5 -666
- package/lib/components/table/table.component.d.ts +135 -0
- package/lib/components/table-tabs/table-tabs.component.d.ts +34 -0
- package/lib/components/table-tooltip/table-tooltip.component.d.ts +18 -0
- package/lib/ng-firebase-table-kxp.component.d.ts +5 -0
- package/lib/ng-firebase-table-kxp.module.d.ts +24 -0
- package/lib/ng-firebase-table-kxp.service.d.ts +6 -0
- package/lib/services/filter.service.d.ts +88 -0
- package/lib/services/pagination.service.d.ts +34 -0
- package/lib/services/table.service.d.ts +80 -0
- package/lib/services/tooltip.service.d.ts +73 -0
- package/lib/types/Table.d.ts +162 -0
- package/lib/utils/table.utils.d.ts +25 -0
- package/package.json +11 -3
- package/public-api.d.ts +12 -0
- package/fesm2022/ng-firebase-table-kxp.mjs.map +0 -1
|
@@ -0,0 +1,4026 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, Injectable, Optional, EventEmitter, ChangeDetectionStrategy, Input, Output, ViewChild, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1$1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i8 from '@angular/forms';
|
|
6
|
+
import { FormGroup, FormControl, FormArray, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
7
|
+
import * as i1$2 from '@angular/router';
|
|
8
|
+
import { RouterModule } from '@angular/router';
|
|
9
|
+
import * as i9 from '@angular/material/table';
|
|
10
|
+
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
11
|
+
import * as i10 from '@angular/material/paginator';
|
|
12
|
+
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
13
|
+
import * as i11 from '@angular/material/sort';
|
|
14
|
+
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
15
|
+
import * as i12 from '@angular/material/form-field';
|
|
16
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
17
|
+
import * as i13 from '@angular/material/input';
|
|
18
|
+
import { MatInputModule } from '@angular/material/input';
|
|
19
|
+
import * as i14 from '@angular/material/core';
|
|
20
|
+
import { MatOptionModule } from '@angular/material/core';
|
|
21
|
+
import * as i15 from '@angular/material/select';
|
|
22
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
23
|
+
import * as i16 from '@angular/material/tooltip';
|
|
24
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
25
|
+
import * as i17 from '@angular/material/progress-spinner';
|
|
26
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
27
|
+
import * as i18 from '@angular/material/icon';
|
|
28
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
29
|
+
import * as i2 from '@angular/material/dialog';
|
|
30
|
+
import { MatDialogModule } from '@angular/material/dialog';
|
|
31
|
+
import { __awaiter } from 'tslib';
|
|
32
|
+
import { firstValueFrom, BehaviorSubject, Subject, debounceTime, takeUntil } from 'rxjs';
|
|
33
|
+
import firebase from 'firebase/compat/app';
|
|
34
|
+
import * as moment from 'moment';
|
|
35
|
+
import * as i1 from '@angular/fire/compat/firestore';
|
|
36
|
+
import * as i3 from 'ngx-toastr';
|
|
37
|
+
|
|
38
|
+
class NgFirebaseTableKxpComponent {
|
|
39
|
+
}
|
|
40
|
+
NgFirebaseTableKxpComponent.ɵfac = function NgFirebaseTableKxpComponent_Factory(t) { return new (t || NgFirebaseTableKxpComponent)(); };
|
|
41
|
+
NgFirebaseTableKxpComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: NgFirebaseTableKxpComponent, selectors: [["lib-ng-firebase-table-kxp"]], decls: 2, vars: 0, template: function NgFirebaseTableKxpComponent_Template(rf, ctx) {
|
|
42
|
+
if (rf & 1) {
|
|
43
|
+
i0.ɵɵelementStart(0, "p");
|
|
44
|
+
i0.ɵɵtext(1, "ng-firebase-table-kxp works!");
|
|
45
|
+
i0.ɵɵelementEnd();
|
|
46
|
+
}
|
|
47
|
+
}, encapsulation: 2 });
|
|
48
|
+
(function () {
|
|
49
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgFirebaseTableKxpComponent, [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{ selector: 'lib-ng-firebase-table-kxp', standalone: false, template: ` <p>ng-firebase-table-kxp works!</p> ` }]
|
|
52
|
+
}], null, null);
|
|
53
|
+
})();
|
|
54
|
+
|
|
55
|
+
const TABLE_DEFAULTS = {
|
|
56
|
+
SORT_FIELD: 'createdAt',
|
|
57
|
+
SORT_ORDER: 'desc',
|
|
58
|
+
PAGE_SIZE: 25,
|
|
59
|
+
DEBOUNCE_TIME_MS: 500,
|
|
60
|
+
DEFAULT_BG_COLOR: '#1976d2',
|
|
61
|
+
DEFAULT_TEXT_COLOR: '#ffffff',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Obtém o valor aninhado de um objeto dado um caminho (ex: 'user.address.city')
|
|
66
|
+
*/
|
|
67
|
+
function getNestedValue(obj, path) {
|
|
68
|
+
if (!path)
|
|
69
|
+
return undefined;
|
|
70
|
+
const properties = path.split('.');
|
|
71
|
+
return properties.reduce((acc, currentPart) => acc && acc[currentPart], obj);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Formata um array de objetos em uma string com valores separados por vírgula
|
|
75
|
+
*/
|
|
76
|
+
function formatArrayValue(array, field) {
|
|
77
|
+
if (!Array.isArray(array) || array.length === 0) {
|
|
78
|
+
return '';
|
|
79
|
+
}
|
|
80
|
+
const values = array
|
|
81
|
+
.map((item) => {
|
|
82
|
+
if (typeof item === 'object' && item !== null) {
|
|
83
|
+
return item[field] || '';
|
|
84
|
+
}
|
|
85
|
+
return String(item);
|
|
86
|
+
})
|
|
87
|
+
.filter((value) => value !== '' && value !== null && value !== undefined);
|
|
88
|
+
return values.join(', ');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Obtém o valor de exibição para uma célula da tabela
|
|
92
|
+
*/
|
|
93
|
+
function getDisplayValue(col, row, withinLimit = false) {
|
|
94
|
+
let value;
|
|
95
|
+
if (col.calculateValue) {
|
|
96
|
+
value = col.calculateValue(row);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
value = getNestedValue(row, col.property);
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(value) && col.arrayField) {
|
|
102
|
+
value = formatArrayValue(value, col.arrayField);
|
|
103
|
+
}
|
|
104
|
+
if (col.queryLength && row[col.property]) {
|
|
105
|
+
value = row[col.property];
|
|
106
|
+
}
|
|
107
|
+
value = col.pipe ? col.pipe.transform(value) : value;
|
|
108
|
+
if (value === null || value === undefined) {
|
|
109
|
+
value = '';
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
value = String(value);
|
|
113
|
+
}
|
|
114
|
+
if (withinLimit || !col.charLimit || value.length <= col.charLimit) {
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
return value.substring(0, col.charLimit) + '...';
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Verifica se um valor é string
|
|
121
|
+
*/
|
|
122
|
+
function isString(value) {
|
|
123
|
+
return typeof value === 'string';
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* TrackBy function para colunas
|
|
127
|
+
*/
|
|
128
|
+
function trackByProperty(_index, col) {
|
|
129
|
+
return col.property;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Gera uma chave única para identificar uma imagem em carregamento
|
|
133
|
+
*/
|
|
134
|
+
function getImageKey(row, col) {
|
|
135
|
+
const rowId = row.id || row._id || JSON.stringify(row);
|
|
136
|
+
return `${rowId}-${col.property}`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
class TableService {
|
|
140
|
+
constructor(ngFire, dialog, toastr) {
|
|
141
|
+
this.ngFire = ngFire;
|
|
142
|
+
this.dialog = dialog;
|
|
143
|
+
this.toastr = toastr;
|
|
144
|
+
this.operators = {
|
|
145
|
+
'==': (a, b) => a === b,
|
|
146
|
+
'!=': (a, b) => a !== b,
|
|
147
|
+
'>': (a, b) => a > b,
|
|
148
|
+
'<': (a, b) => a < b,
|
|
149
|
+
'>=': (a, b) => a >= b,
|
|
150
|
+
'<=': (a, b) => a <= b,
|
|
151
|
+
in: (a, b) => Array.isArray(b) && b.includes(a),
|
|
152
|
+
'not-in': (a, b) => Array.isArray(b) && !b.includes(a),
|
|
153
|
+
'array-contains': (a, b) => Array.isArray(a) && a.includes(b),
|
|
154
|
+
'array-contains-any': (a, b) => Array.isArray(a) &&
|
|
155
|
+
Array.isArray(b) &&
|
|
156
|
+
b.some((item) => a.includes(item)),
|
|
157
|
+
includes: (a, b) => {
|
|
158
|
+
if (typeof a === 'string' && typeof b === 'string') {
|
|
159
|
+
return a.includes(b);
|
|
160
|
+
}
|
|
161
|
+
if (Array.isArray(a)) {
|
|
162
|
+
return a.includes(b);
|
|
163
|
+
}
|
|
164
|
+
return false;
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
getItems(collection) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
try {
|
|
171
|
+
const querySnapshot = yield collection.get();
|
|
172
|
+
return querySnapshot.docs.map((doc) => {
|
|
173
|
+
const data = doc.data();
|
|
174
|
+
return Object.assign(Object.assign({}, (data !== null && data !== void 0 ? data : {})), { id: doc.id });
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
console.warn('Collection não encontrada:', error);
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
executeQuery(params) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
if (params.filterFn) {
|
|
186
|
+
// Lógica com filtro no cliente (filterFn)
|
|
187
|
+
const BATCH_FETCH_SIZE = params.batchSize;
|
|
188
|
+
const GOAL_SIZE = params.batchSize + 1;
|
|
189
|
+
if (params.navigation === 'forward' || params.navigation === 'reload') {
|
|
190
|
+
if (params.navigation === 'reload' && params.doc) {
|
|
191
|
+
params.doc.lastDoc = null;
|
|
192
|
+
}
|
|
193
|
+
let lastDocCursor = params.doc ? params.doc.lastDoc : null;
|
|
194
|
+
let pageResults = [];
|
|
195
|
+
let allFetchedDocs = [];
|
|
196
|
+
let hasMoreDocsInDb = true;
|
|
197
|
+
while (pageResults.length < GOAL_SIZE && hasMoreDocsInDb) {
|
|
198
|
+
let query = this.ngFire.collection(params.collection).ref;
|
|
199
|
+
query = this.applyFilters(query, params.arrange, params.conditions);
|
|
200
|
+
if (lastDocCursor) {
|
|
201
|
+
query = query.startAfter(lastDocCursor);
|
|
202
|
+
}
|
|
203
|
+
query = query.limit(BATCH_FETCH_SIZE);
|
|
204
|
+
const snapshot = yield query.get();
|
|
205
|
+
if (snapshot.empty) {
|
|
206
|
+
hasMoreDocsInDb = false;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
lastDocCursor = snapshot.docs[snapshot.docs.length - 1];
|
|
210
|
+
allFetchedDocs.push(...snapshot.docs);
|
|
211
|
+
const batchUsers = snapshot.docs
|
|
212
|
+
.map((doc) => {
|
|
213
|
+
const data = doc.data();
|
|
214
|
+
return Object.assign({ id: doc.id }, (data !== null && data !== void 0 ? data : {}));
|
|
215
|
+
})
|
|
216
|
+
.filter(params.filterFn);
|
|
217
|
+
pageResults.push(...batchUsers);
|
|
218
|
+
if (snapshot.size < BATCH_FETCH_SIZE) {
|
|
219
|
+
hasMoreDocsInDb = false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const hasNextPage = pageResults.length > params.batchSize;
|
|
223
|
+
const finalItems = pageResults.slice(0, params.batchSize);
|
|
224
|
+
const firstDocOfPage = allFetchedDocs.find((doc) => { var _a; return doc.id === ((_a = finalItems[0]) === null || _a === void 0 ? void 0 : _a.id); }) || null;
|
|
225
|
+
const lastDocOfPage = allFetchedDocs.find((doc) => { var _a; return doc.id === ((_a = finalItems[finalItems.length - 1]) === null || _a === void 0 ? void 0 : _a.id); }) || null;
|
|
226
|
+
return {
|
|
227
|
+
items: finalItems,
|
|
228
|
+
filterLength: null,
|
|
229
|
+
firstDoc: firstDocOfPage,
|
|
230
|
+
lastDoc: lastDocOfPage,
|
|
231
|
+
hasNextPage: hasNextPage,
|
|
232
|
+
hasPreviousPage: !!(params.doc && params.doc.lastDoc) &&
|
|
233
|
+
params.navigation !== 'reload',
|
|
234
|
+
currentClientPageIndex: undefined,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
// Lógica para trás (backward)
|
|
238
|
+
else if (params.navigation === 'backward') {
|
|
239
|
+
if (!params.doc || !params.doc.firstDoc) {
|
|
240
|
+
return {
|
|
241
|
+
items: [],
|
|
242
|
+
filterLength: null,
|
|
243
|
+
firstDoc: null,
|
|
244
|
+
lastDoc: null,
|
|
245
|
+
hasNextPage: true,
|
|
246
|
+
hasPreviousPage: false,
|
|
247
|
+
currentClientPageIndex: undefined,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
let pageResults = [];
|
|
251
|
+
let allFetchedDocs = [];
|
|
252
|
+
let hasMoreDocsInDb = true;
|
|
253
|
+
let boundaryDoc = params.doc.firstDoc;
|
|
254
|
+
while (pageResults.length < GOAL_SIZE && hasMoreDocsInDb) {
|
|
255
|
+
if (!boundaryDoc)
|
|
256
|
+
break;
|
|
257
|
+
let query = this.ngFire.collection(params.collection).ref;
|
|
258
|
+
query = this.applyFilters(query, params.arrange, params.conditions);
|
|
259
|
+
query = query.endBefore(boundaryDoc);
|
|
260
|
+
query = query.limitToLast(BATCH_FETCH_SIZE);
|
|
261
|
+
const snapshot = yield query.get();
|
|
262
|
+
if (snapshot.empty) {
|
|
263
|
+
hasMoreDocsInDb = false;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
boundaryDoc = snapshot
|
|
267
|
+
.docs[0];
|
|
268
|
+
allFetchedDocs = [...snapshot.docs, ...allFetchedDocs];
|
|
269
|
+
const batchUsers = snapshot.docs
|
|
270
|
+
.map((doc) => {
|
|
271
|
+
const data = doc.data();
|
|
272
|
+
return Object.assign({ id: doc.id }, (data !== null && data !== void 0 ? data : {}));
|
|
273
|
+
})
|
|
274
|
+
.filter(params.filterFn);
|
|
275
|
+
pageResults = [...batchUsers, ...pageResults];
|
|
276
|
+
if (snapshot.size < BATCH_FETCH_SIZE) {
|
|
277
|
+
hasMoreDocsInDb = false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const finalItems = pageResults.slice(0, params.batchSize);
|
|
281
|
+
const firstDocOfPage = allFetchedDocs.find((doc) => { var _a; return doc.id === ((_a = finalItems[0]) === null || _a === void 0 ? void 0 : _a.id); }) || null;
|
|
282
|
+
const lastDocOfPage = allFetchedDocs.find((doc) => { var _a; return doc.id === ((_a = finalItems[finalItems.length - 1]) === null || _a === void 0 ? void 0 : _a.id); }) || null;
|
|
283
|
+
return {
|
|
284
|
+
items: finalItems,
|
|
285
|
+
filterLength: null,
|
|
286
|
+
firstDoc: firstDocOfPage,
|
|
287
|
+
lastDoc: lastDocOfPage,
|
|
288
|
+
hasNextPage: true,
|
|
289
|
+
currentClientPageIndex: undefined,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
let items = [];
|
|
295
|
+
let docs = [];
|
|
296
|
+
let hasNextPage = false;
|
|
297
|
+
let filterLength = null;
|
|
298
|
+
let query = this.ngFire.collection(params.collection).ref;
|
|
299
|
+
if (params.conditions) {
|
|
300
|
+
params.conditions.forEach((c) => {
|
|
301
|
+
if (c.operator === '!=') {
|
|
302
|
+
query = query.orderBy(c.firestoreProperty);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
query = this.applyFilters(query, params.arrange, params.conditions);
|
|
307
|
+
if (params.navigation === 'reload') {
|
|
308
|
+
query = query.limit(params.batchSize + 1);
|
|
309
|
+
if (params.doc && params.doc.firstDoc) {
|
|
310
|
+
query = query.startAt(params.doc.firstDoc);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else if (params.navigation === 'forward') {
|
|
314
|
+
query = query.limit(params.batchSize + 1);
|
|
315
|
+
if (params.doc && params.doc.lastDoc) {
|
|
316
|
+
query = query.startAfter(params.doc.lastDoc);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
// backward
|
|
321
|
+
query = query.limitToLast(params.batchSize + 1);
|
|
322
|
+
if (params.doc && params.doc.firstDoc) {
|
|
323
|
+
query = query.endBefore(params.doc.firstDoc);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const itemCol = yield query.get();
|
|
327
|
+
itemCol.docs.forEach((doc) => docs.push(doc));
|
|
328
|
+
const itemPromises = docs.map((item) => __awaiter(this, void 0, void 0, function* () {
|
|
329
|
+
const itemData = item.data();
|
|
330
|
+
items.push(Object.assign({ id: item.id }, (itemData !== null && itemData !== void 0 ? itemData : {})));
|
|
331
|
+
}));
|
|
332
|
+
let lastDoc = docs[docs.length - 1] || null;
|
|
333
|
+
let firstDoc = docs[0];
|
|
334
|
+
if ((items.length > params.batchSize && params.navigation === 'forward') ||
|
|
335
|
+
(params.navigation === 'reload' && items.length > params.batchSize)) {
|
|
336
|
+
lastDoc = docs[docs.length - 2] || null;
|
|
337
|
+
items.pop();
|
|
338
|
+
hasNextPage = true;
|
|
339
|
+
}
|
|
340
|
+
if (items.length > params.batchSize && params.navigation === 'backward') {
|
|
341
|
+
firstDoc = docs[1];
|
|
342
|
+
items.shift();
|
|
343
|
+
hasNextPage = true;
|
|
344
|
+
}
|
|
345
|
+
yield Promise.all(itemPromises);
|
|
346
|
+
return {
|
|
347
|
+
items,
|
|
348
|
+
filterLength,
|
|
349
|
+
lastDoc,
|
|
350
|
+
firstDoc,
|
|
351
|
+
hasNextPage,
|
|
352
|
+
currentClientPageIndex: undefined,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
// Fallback para garantir que sempre retornamos algo
|
|
356
|
+
return {
|
|
357
|
+
items: [],
|
|
358
|
+
filterLength: null,
|
|
359
|
+
firstDoc: null,
|
|
360
|
+
lastDoc: null,
|
|
361
|
+
hasNextPage: false,
|
|
362
|
+
currentClientPageIndex: undefined,
|
|
363
|
+
};
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
applyFilters(query, arrange, conditions) {
|
|
367
|
+
if (conditions) {
|
|
368
|
+
conditions.map((cond) => {
|
|
369
|
+
query = query.where(cond.firestoreProperty, cond.operator, cond.dashProperty);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
let hasFilterSpecificOrderBy = false;
|
|
373
|
+
let appliedOrderByField = null;
|
|
374
|
+
const equalsFilters = arrange.filters.filter((f) => f.arrange === 'equals' && !!f.filter);
|
|
375
|
+
const otherFilters = arrange.filters.filter((f) => f.arrange !== 'equals');
|
|
376
|
+
const equalsGroupedByProperty = equalsFilters.reduce((acc, current) => {
|
|
377
|
+
const prop = current.filter.property;
|
|
378
|
+
if (!acc[prop]) {
|
|
379
|
+
acc[prop] = [];
|
|
380
|
+
}
|
|
381
|
+
acc[prop].push(current.filter.filtering);
|
|
382
|
+
return acc;
|
|
383
|
+
}, {});
|
|
384
|
+
for (const prop in equalsGroupedByProperty) {
|
|
385
|
+
const values = equalsGroupedByProperty[prop];
|
|
386
|
+
if (values.length > 0) {
|
|
387
|
+
query = query.where(prop, 'in', values);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
otherFilters.forEach((filterItem) => {
|
|
391
|
+
var _a, _b;
|
|
392
|
+
// Aplicar filtragem por busca
|
|
393
|
+
if (((_a = filterItem.filter) === null || _a === void 0 ? void 0 : _a.filtering) &&
|
|
394
|
+
((_b = filterItem.filter) === null || _b === void 0 ? void 0 : _b.property) !== '' &&
|
|
395
|
+
filterItem.arrange === 'filter') {
|
|
396
|
+
query = query
|
|
397
|
+
.where(filterItem.filter.property, '>=', filterItem.filter.filtering.trim().toUpperCase())
|
|
398
|
+
.where(filterItem.filter.property, '<=', filterItem.filter.filtering.trim().toUpperCase() + '\uf8ff');
|
|
399
|
+
if (!hasFilterSpecificOrderBy) {
|
|
400
|
+
query = query.orderBy(filterItem.filter.property);
|
|
401
|
+
hasFilterSpecificOrderBy = true;
|
|
402
|
+
appliedOrderByField = filterItem.filter.property;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
// Aplicar filtro do tipo "filterByDate"
|
|
406
|
+
if (filterItem.dateFilter && filterItem.arrange === 'filterByDate') {
|
|
407
|
+
query = query
|
|
408
|
+
.where(arrange.sortBy.field, '>=', filterItem.dateFilter.initial)
|
|
409
|
+
.where(arrange.sortBy.field, '<=', filterItem.dateFilter.final);
|
|
410
|
+
if (!hasFilterSpecificOrderBy) {
|
|
411
|
+
query = query.orderBy(arrange.sortBy.field);
|
|
412
|
+
hasFilterSpecificOrderBy = true;
|
|
413
|
+
appliedOrderByField = arrange.sortBy.field;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
// Aplicar sortBy
|
|
418
|
+
if (arrange.sortBy && arrange.sortBy.field && arrange.sortBy.order) {
|
|
419
|
+
if (appliedOrderByField !== arrange.sortBy.field) {
|
|
420
|
+
query = query.orderBy(arrange.sortBy.field, arrange.sortBy.order);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return query;
|
|
424
|
+
}
|
|
425
|
+
getIdFilter(params) {
|
|
426
|
+
var _a, _b, _c;
|
|
427
|
+
if (!((_a = params.arrange) === null || _a === void 0 ? void 0 : _a.filters))
|
|
428
|
+
return null;
|
|
429
|
+
const idFilter = params.arrange.filters.find((f) => f.arrange === 'filter' &&
|
|
430
|
+
!!f.filter &&
|
|
431
|
+
f.filter.property === 'id' &&
|
|
432
|
+
!!f.filter.filtering);
|
|
433
|
+
return ((_c = (_b = idFilter === null || idFilter === void 0 ? void 0 : idFilter.filter) === null || _b === void 0 ? void 0 : _b.filtering) === null || _c === void 0 ? void 0 : _c.trim()) || null;
|
|
434
|
+
}
|
|
435
|
+
getDocumentById(collection, docId) {
|
|
436
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
437
|
+
try {
|
|
438
|
+
const docRef = this.ngFire.collection(collection).doc(docId);
|
|
439
|
+
const docSnapshot = yield docRef.get().toPromise();
|
|
440
|
+
if (docSnapshot && docSnapshot.exists) {
|
|
441
|
+
const data = docSnapshot.data();
|
|
442
|
+
return Object.assign({ id: docSnapshot.id }, (data !== null && data !== void 0 ? data : {}));
|
|
443
|
+
}
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
catch (error) {
|
|
447
|
+
console.warn('Erro ao buscar documento por ID:', error);
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
searchByIdPartial(params, searchTerm) {
|
|
453
|
+
var _a, _b, _c, _d;
|
|
454
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
455
|
+
const exactMatch = yield this.getDocumentById(params.collection, searchTerm);
|
|
456
|
+
if (exactMatch) {
|
|
457
|
+
if (params.conditions) {
|
|
458
|
+
const operators = this.operators;
|
|
459
|
+
const passesConditions = params.conditions.every((cond) => {
|
|
460
|
+
const operatorFn = operators[cond.operator];
|
|
461
|
+
return operatorFn
|
|
462
|
+
? operatorFn(exactMatch[cond.firestoreProperty], cond.dashProperty)
|
|
463
|
+
: false;
|
|
464
|
+
});
|
|
465
|
+
if (!passesConditions) {
|
|
466
|
+
return {
|
|
467
|
+
items: [],
|
|
468
|
+
filterLength: 0,
|
|
469
|
+
firstDoc: null,
|
|
470
|
+
lastDoc: null,
|
|
471
|
+
hasNextPage: false,
|
|
472
|
+
hasPreviousPage: false,
|
|
473
|
+
currentClientPageIndex: 0,
|
|
474
|
+
totalPages: 0,
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (params.filterFn && !params.filterFn(exactMatch)) {
|
|
479
|
+
return {
|
|
480
|
+
items: [],
|
|
481
|
+
filterLength: 0,
|
|
482
|
+
firstDoc: null,
|
|
483
|
+
lastDoc: null,
|
|
484
|
+
hasNextPage: false,
|
|
485
|
+
hasPreviousPage: false,
|
|
486
|
+
currentClientPageIndex: 0,
|
|
487
|
+
totalPages: 0,
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
return {
|
|
491
|
+
items: [exactMatch],
|
|
492
|
+
filterLength: 1,
|
|
493
|
+
firstDoc: null,
|
|
494
|
+
lastDoc: null,
|
|
495
|
+
hasNextPage: false,
|
|
496
|
+
hasPreviousPage: false,
|
|
497
|
+
currentClientPageIndex: 0,
|
|
498
|
+
totalPages: 1,
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
const searchTermLower = searchTerm.toLowerCase();
|
|
502
|
+
const paramsWithoutIdFilter = Object.assign(Object.assign({}, params), { arrange: Object.assign(Object.assign({}, params.arrange), { filters: params.arrange.filters.filter((f) => { var _a; return !(f.arrange === 'filter' && ((_a = f.filter) === null || _a === void 0 ? void 0 : _a.property) === 'id'); }) }) });
|
|
503
|
+
let query = this.ngFire.collection(params.collection).ref;
|
|
504
|
+
// Aplicar conditions
|
|
505
|
+
if (params.conditions) {
|
|
506
|
+
params.conditions.forEach((cond) => {
|
|
507
|
+
query = query.where(cond.firestoreProperty, cond.operator, cond.dashProperty);
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
// Aplicar sortBy
|
|
511
|
+
if (((_b = (_a = params.arrange) === null || _a === void 0 ? void 0 : _a.sortBy) === null || _b === void 0 ? void 0 : _b.field) && ((_d = (_c = params.arrange) === null || _c === void 0 ? void 0 : _c.sortBy) === null || _d === void 0 ? void 0 : _d.order)) {
|
|
512
|
+
query = query.orderBy(params.arrange.sortBy.field, params.arrange.sortBy.order);
|
|
513
|
+
}
|
|
514
|
+
const snapshot = yield query.get();
|
|
515
|
+
let items = snapshot.docs
|
|
516
|
+
.map((doc) => {
|
|
517
|
+
const data = doc.data();
|
|
518
|
+
return Object.assign({ id: doc.id }, (data !== null && data !== void 0 ? data : {}));
|
|
519
|
+
})
|
|
520
|
+
.filter((item) => item.id.toLowerCase().includes(searchTermLower));
|
|
521
|
+
// Separar equals filters e outros filtros
|
|
522
|
+
const equalsFilters = paramsWithoutIdFilter.arrange.filters.filter((f) => f.arrange === 'equals' && !!f.filter);
|
|
523
|
+
const otherFilters = paramsWithoutIdFilter.arrange.filters.filter((f) => {
|
|
524
|
+
var _a;
|
|
525
|
+
return f.arrange !== 'equals' &&
|
|
526
|
+
(f.arrange !== 'filter' || ((_a = f.filter) === null || _a === void 0 ? void 0 : _a.property) !== 'id');
|
|
527
|
+
});
|
|
528
|
+
// Aplicar equals filters com lógica OR dentro de cada propriedade
|
|
529
|
+
if (equalsFilters.length > 0) {
|
|
530
|
+
// Agrupar por propriedade para aplicar OR
|
|
531
|
+
const groupedByProperty = equalsFilters.reduce((acc, f) => {
|
|
532
|
+
const prop = f.filter.property;
|
|
533
|
+
if (!acc[prop]) {
|
|
534
|
+
acc[prop] = [];
|
|
535
|
+
}
|
|
536
|
+
acc[prop].push(f.filter.filtering);
|
|
537
|
+
return acc;
|
|
538
|
+
}, {});
|
|
539
|
+
// Filtrar: item deve ter pelo menos um valor de CADA propriedade
|
|
540
|
+
items = items.filter((item) => {
|
|
541
|
+
return Object.entries(groupedByProperty).every(([prop, values]) => {
|
|
542
|
+
const itemValue = item[prop];
|
|
543
|
+
return values.includes(itemValue);
|
|
544
|
+
});
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
// Aplicar outros filtros
|
|
548
|
+
otherFilters.forEach((filterItem) => {
|
|
549
|
+
var _a, _b;
|
|
550
|
+
if (filterItem.arrange === 'filter' &&
|
|
551
|
+
((_a = filterItem.filter) === null || _a === void 0 ? void 0 : _a.filtering) &&
|
|
552
|
+
((_b = filterItem.filter) === null || _b === void 0 ? void 0 : _b.property)) {
|
|
553
|
+
const filterValue = String(filterItem.filter.filtering)
|
|
554
|
+
.trim()
|
|
555
|
+
.toLowerCase();
|
|
556
|
+
items = items.filter((item) => {
|
|
557
|
+
var _a;
|
|
558
|
+
const itemValue = String((_a = item[filterItem.filter.property]) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
559
|
+
return itemValue.includes(filterValue);
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
// Aplicar filterFn se existir
|
|
564
|
+
if (params.filterFn) {
|
|
565
|
+
items = items.filter(params.filterFn);
|
|
566
|
+
}
|
|
567
|
+
// Paginação
|
|
568
|
+
const pageSize = params.batchSize;
|
|
569
|
+
let currentClientPageIndex = 0;
|
|
570
|
+
if (params.navigation === 'reload') {
|
|
571
|
+
currentClientPageIndex = 0;
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
// Usar o índice passado pelo componente sem incrementar/decrementar
|
|
575
|
+
currentClientPageIndex = params.clientPageIndex || 0;
|
|
576
|
+
}
|
|
577
|
+
const startIndex = currentClientPageIndex * pageSize;
|
|
578
|
+
const endIndex = startIndex + pageSize;
|
|
579
|
+
const paginatedItems = items.slice(startIndex, endIndex);
|
|
580
|
+
const totalPages = Math.ceil(items.length / pageSize);
|
|
581
|
+
const hasNextPage = currentClientPageIndex < totalPages - 1;
|
|
582
|
+
const hasPreviousPage = currentClientPageIndex > 0;
|
|
583
|
+
return {
|
|
584
|
+
items: paginatedItems,
|
|
585
|
+
filterLength: items.length,
|
|
586
|
+
firstDoc: null,
|
|
587
|
+
lastDoc: null,
|
|
588
|
+
hasNextPage,
|
|
589
|
+
hasPreviousPage,
|
|
590
|
+
currentClientPageIndex,
|
|
591
|
+
totalPages,
|
|
592
|
+
};
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
shouldUseClientSideFallback(params) {
|
|
596
|
+
var _a, _b, _c;
|
|
597
|
+
const hasConditions = params.conditions && params.conditions.length > 0;
|
|
598
|
+
const hasArrangeFilters = ((_a = params.arrange) === null || _a === void 0 ? void 0 : _a.filters) && params.arrange.filters.length > 0;
|
|
599
|
+
const hasSortBy = (_c = (_b = params.arrange) === null || _b === void 0 ? void 0 : _b.sortBy) === null || _c === void 0 ? void 0 : _c.field;
|
|
600
|
+
if (params.filterFn) {
|
|
601
|
+
return false;
|
|
602
|
+
}
|
|
603
|
+
if (hasArrangeFilters) {
|
|
604
|
+
const equalsFilters = params.arrange.filters.filter((f) => f.arrange === 'equals' && !!f.filter);
|
|
605
|
+
if (equalsFilters.length > 0) {
|
|
606
|
+
const propertiesSet = new Set(equalsFilters.map((f) => f.filter.property));
|
|
607
|
+
if (propertiesSet.size > 1) {
|
|
608
|
+
return true;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (hasConditions && hasArrangeFilters && hasSortBy) {
|
|
613
|
+
return true;
|
|
614
|
+
}
|
|
615
|
+
if (hasConditions && hasArrangeFilters) {
|
|
616
|
+
return true;
|
|
617
|
+
}
|
|
618
|
+
if (hasArrangeFilters && params.arrange.filters.length > 1 && hasSortBy) {
|
|
619
|
+
const equalsFilters = params.arrange.filters.filter((f) => f.arrange === 'equals' && !!f.filter);
|
|
620
|
+
if (equalsFilters.length > 0) {
|
|
621
|
+
const propertiesSet = new Set(equalsFilters.map((f) => f.filter.property));
|
|
622
|
+
if (propertiesSet.size === 1 &&
|
|
623
|
+
equalsFilters.length === params.arrange.filters.length) {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
return true;
|
|
628
|
+
}
|
|
629
|
+
return false;
|
|
630
|
+
}
|
|
631
|
+
getPaginated(params) {
|
|
632
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
633
|
+
const idFilterValue = this.getIdFilter(params);
|
|
634
|
+
if (idFilterValue) {
|
|
635
|
+
const result = yield this.searchByIdPartial(params, idFilterValue);
|
|
636
|
+
return result;
|
|
637
|
+
}
|
|
638
|
+
// Detectar preventivamente se deve usar fallback
|
|
639
|
+
if (this.shouldUseClientSideFallback(params)) {
|
|
640
|
+
yield this.trackMissingIndexPreventive(params.collection, params.arrange, params.conditions);
|
|
641
|
+
const result = yield this.executeClientSideQuery(params);
|
|
642
|
+
return result;
|
|
643
|
+
}
|
|
644
|
+
try {
|
|
645
|
+
const result = yield this.executeQuery(params);
|
|
646
|
+
return result;
|
|
647
|
+
}
|
|
648
|
+
catch (error) {
|
|
649
|
+
if (error &&
|
|
650
|
+
typeof error === 'object' &&
|
|
651
|
+
'code' in error &&
|
|
652
|
+
error.code === 'failed-precondition') {
|
|
653
|
+
yield this.trackMissingIndex(error, params.collection, params.arrange, params.conditions);
|
|
654
|
+
const result = yield this.executeClientSideQuery(params);
|
|
655
|
+
return result;
|
|
656
|
+
}
|
|
657
|
+
else if (error &&
|
|
658
|
+
typeof error === 'object' &&
|
|
659
|
+
'code' in error &&
|
|
660
|
+
error.code === 'invalid-argument') {
|
|
661
|
+
yield this.trackMissingIndex(error, params.collection, params.arrange, params.conditions);
|
|
662
|
+
const result = yield this.executeClientSideQuery(params);
|
|
663
|
+
return result;
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
throw error;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
executeClientSideQuery(params) {
|
|
672
|
+
var _a, _b, _c;
|
|
673
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
674
|
+
// Otimizar usando pelo menos uma cláusula .where() quando possível
|
|
675
|
+
let query = this.ngFire.collection(params.collection).ref;
|
|
676
|
+
let appliedCondition = null;
|
|
677
|
+
let hasAppliedWhereClause = false;
|
|
678
|
+
// Primeiro, tenta aplicar condições simples
|
|
679
|
+
if (params.conditions && params.conditions.length > 0) {
|
|
680
|
+
const simpleCondition = params.conditions.find((cond) => ['==', '>', '<', '>=', '<=', 'in', 'array-contains'].includes(cond.operator));
|
|
681
|
+
if (simpleCondition) {
|
|
682
|
+
query = query.where(simpleCondition.firestoreProperty, simpleCondition.operator, simpleCondition.dashProperty);
|
|
683
|
+
appliedCondition = simpleCondition;
|
|
684
|
+
hasAppliedWhereClause = true;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
// Se não há condições disponíveis, tenta aplicar filtros do arrange
|
|
688
|
+
let appliedFirestoreFilter = null;
|
|
689
|
+
if (!hasAppliedWhereClause && ((_a = params.arrange) === null || _a === void 0 ? void 0 : _a.filters)) {
|
|
690
|
+
// Agrupar equals filters por propriedade
|
|
691
|
+
const equalsFilters = params.arrange.filters.filter((f) => f.arrange === 'equals' && !!f.filter);
|
|
692
|
+
const equalsGroupedByProperty = equalsFilters.reduce((acc, current) => {
|
|
693
|
+
const prop = current.filter.property;
|
|
694
|
+
if (!acc[prop]) {
|
|
695
|
+
acc[prop] = [];
|
|
696
|
+
}
|
|
697
|
+
acc[prop].push(current.filter.filtering);
|
|
698
|
+
return acc;
|
|
699
|
+
}, {});
|
|
700
|
+
// Se há apenas UMA propriedade com múltiplos valores, aplicar no Firestore com 'in'
|
|
701
|
+
const properties = Object.keys(equalsGroupedByProperty);
|
|
702
|
+
if (properties.length === 1 && equalsFilters.length > 0) {
|
|
703
|
+
const prop = properties[0];
|
|
704
|
+
const values = equalsGroupedByProperty[prop];
|
|
705
|
+
query = query.where(prop, 'in', values);
|
|
706
|
+
hasAppliedWhereClause = true;
|
|
707
|
+
// Marcar TODOS os equals filters dessa propriedade como aplicados
|
|
708
|
+
appliedFirestoreFilter = 'all-equals';
|
|
709
|
+
}
|
|
710
|
+
else if (properties.length === 0) {
|
|
711
|
+
const otherFilter = params.arrange.filters.find((f) => {
|
|
712
|
+
var _a, _b, _c, _d;
|
|
713
|
+
return (f.arrange === 'filter' &&
|
|
714
|
+
!!((_a = f.filter) === null || _a === void 0 ? void 0 : _a.filtering) &&
|
|
715
|
+
!!((_b = f.filter) === null || _b === void 0 ? void 0 : _b.property)) ||
|
|
716
|
+
(f.arrange === 'filterByDate' &&
|
|
717
|
+
!!((_c = f.dateFilter) === null || _c === void 0 ? void 0 : _c.initial) &&
|
|
718
|
+
!!((_d = f.dateFilter) === null || _d === void 0 ? void 0 : _d.final));
|
|
719
|
+
});
|
|
720
|
+
if (otherFilter) {
|
|
721
|
+
if (otherFilter.arrange === 'filter' && otherFilter.filter) {
|
|
722
|
+
const filterValue = otherFilter.filter.filtering
|
|
723
|
+
.trim()
|
|
724
|
+
.toUpperCase();
|
|
725
|
+
query = query
|
|
726
|
+
.where(otherFilter.filter.property, '>=', filterValue)
|
|
727
|
+
.where(otherFilter.filter.property, '<=', filterValue + '\uf8ff');
|
|
728
|
+
hasAppliedWhereClause = true;
|
|
729
|
+
appliedFirestoreFilter = otherFilter;
|
|
730
|
+
}
|
|
731
|
+
else if (otherFilter.arrange === 'filterByDate' &&
|
|
732
|
+
otherFilter.dateFilter &&
|
|
733
|
+
((_b = params.arrange.sortBy) === null || _b === void 0 ? void 0 : _b.field)) {
|
|
734
|
+
query = query
|
|
735
|
+
.where(params.arrange.sortBy.field, '>=', otherFilter.dateFilter.initial)
|
|
736
|
+
.where(params.arrange.sortBy.field, '<=', otherFilter.dateFilter.final);
|
|
737
|
+
hasAppliedWhereClause = true;
|
|
738
|
+
appliedFirestoreFilter = otherFilter;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
const allDocsSnapshot = yield query.get();
|
|
744
|
+
let items = allDocsSnapshot.docs.map((doc) => {
|
|
745
|
+
const data = doc.data();
|
|
746
|
+
return Object.assign({ id: doc.id }, (data !== null && data !== void 0 ? data : {}));
|
|
747
|
+
});
|
|
748
|
+
// Aplicar condições restantes
|
|
749
|
+
if (params.conditions) {
|
|
750
|
+
const remainingConditions = params.conditions.filter((cond) => cond !== appliedCondition);
|
|
751
|
+
if (remainingConditions.length > 0) {
|
|
752
|
+
const operators = this.operators;
|
|
753
|
+
items = items.filter((item) => {
|
|
754
|
+
return remainingConditions.every((cond) => {
|
|
755
|
+
const operatorFn = operators[cond.operator];
|
|
756
|
+
return operatorFn
|
|
757
|
+
? operatorFn(item[cond.firestoreProperty], cond.dashProperty)
|
|
758
|
+
: false;
|
|
759
|
+
});
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
const { filters, sortBy } = params.arrange;
|
|
764
|
+
// Track which filter was already applied in Firestore to avoid double filtering
|
|
765
|
+
if (hasAppliedWhereClause && !appliedCondition && ((_c = params.arrange) === null || _c === void 0 ? void 0 : _c.filters)) {
|
|
766
|
+
const equalsFilter = params.arrange.filters.find((f) => { var _a; return f.arrange === 'equals' && !!((_a = f.filter) === null || _a === void 0 ? void 0 : _a.filtering); });
|
|
767
|
+
if (equalsFilter) {
|
|
768
|
+
appliedFirestoreFilter = equalsFilter;
|
|
769
|
+
}
|
|
770
|
+
else {
|
|
771
|
+
const foundFilter = params.arrange.filters.find((f) => {
|
|
772
|
+
var _a, _b, _c, _d;
|
|
773
|
+
return (f.arrange === 'filter' &&
|
|
774
|
+
!!((_a = f.filter) === null || _a === void 0 ? void 0 : _a.filtering) &&
|
|
775
|
+
!!((_b = f.filter) === null || _b === void 0 ? void 0 : _b.property)) ||
|
|
776
|
+
(f.arrange === 'filterByDate' &&
|
|
777
|
+
!!((_c = f.dateFilter) === null || _c === void 0 ? void 0 : _c.initial) &&
|
|
778
|
+
!!((_d = f.dateFilter) === null || _d === void 0 ? void 0 : _d.final));
|
|
779
|
+
});
|
|
780
|
+
if (foundFilter) {
|
|
781
|
+
appliedFirestoreFilter = foundFilter;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
const equalsFilters = filters.filter((f) => f.arrange === 'equals');
|
|
786
|
+
const otherFilters = filters.filter((f) => f.arrange !== 'equals');
|
|
787
|
+
// Aplicar equals filters no client-side apenas se não foram aplicados no Firestore
|
|
788
|
+
if (appliedFirestoreFilter !== 'all-equals' && equalsFilters.length > 0) {
|
|
789
|
+
// Agrupar por propriedade para aplicar OR dentro de cada propriedade
|
|
790
|
+
const groupedByProperty = equalsFilters.reduce((acc, f) => {
|
|
791
|
+
if (f.filter) {
|
|
792
|
+
const prop = f.filter.property;
|
|
793
|
+
if (!acc[prop]) {
|
|
794
|
+
acc[prop] = [];
|
|
795
|
+
}
|
|
796
|
+
acc[prop].push(f.filter.filtering);
|
|
797
|
+
}
|
|
798
|
+
return acc;
|
|
799
|
+
}, {});
|
|
800
|
+
// Filtrar: item deve ter pelo menos um valor de CADA propriedade
|
|
801
|
+
// (AND entre propriedades, OR dentro de cada propriedade)
|
|
802
|
+
items = items.filter((item) => {
|
|
803
|
+
return Object.entries(groupedByProperty).every(([prop, values]) => {
|
|
804
|
+
const itemValue = item[prop];
|
|
805
|
+
return values.includes(itemValue);
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
otherFilters.forEach((filterItem) => {
|
|
810
|
+
var _a, _b, _c, _d;
|
|
811
|
+
if (appliedFirestoreFilter === filterItem) {
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
814
|
+
if (filterItem.arrange === 'filter' &&
|
|
815
|
+
((_a = filterItem.filter) === null || _a === void 0 ? void 0 : _a.filtering) &&
|
|
816
|
+
((_b = filterItem.filter) === null || _b === void 0 ? void 0 : _b.property)) {
|
|
817
|
+
const filterValue = String(filterItem.filter.filtering)
|
|
818
|
+
.trim()
|
|
819
|
+
.toLowerCase();
|
|
820
|
+
items = items.filter((item) => {
|
|
821
|
+
var _a;
|
|
822
|
+
const itemValue = String((_a = item[filterItem.filter.property]) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
823
|
+
return itemValue.includes(filterValue);
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
if (filterItem.arrange === 'filterByDate' &&
|
|
827
|
+
((_c = filterItem.dateFilter) === null || _c === void 0 ? void 0 : _c.initial) &&
|
|
828
|
+
((_d = filterItem.dateFilter) === null || _d === void 0 ? void 0 : _d.final) &&
|
|
829
|
+
sortBy.field) {
|
|
830
|
+
items = items.filter((item) => {
|
|
831
|
+
try {
|
|
832
|
+
const fieldValue = item[sortBy.field];
|
|
833
|
+
if (!fieldValue) {
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
let itemDate;
|
|
837
|
+
const fieldValueObj = fieldValue;
|
|
838
|
+
if (fieldValueObj &&
|
|
839
|
+
typeof fieldValueObj === 'object' &&
|
|
840
|
+
'toDate' in fieldValueObj &&
|
|
841
|
+
typeof fieldValueObj.toDate === 'function') {
|
|
842
|
+
itemDate = fieldValueObj.toDate();
|
|
843
|
+
}
|
|
844
|
+
else if (fieldValueObj instanceof Date) {
|
|
845
|
+
itemDate = fieldValueObj;
|
|
846
|
+
}
|
|
847
|
+
else if (typeof fieldValueObj === 'string') {
|
|
848
|
+
itemDate = new Date(fieldValueObj);
|
|
849
|
+
if (isNaN(itemDate.getTime())) {
|
|
850
|
+
return false;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
else if (typeof fieldValueObj === 'number') {
|
|
854
|
+
itemDate = new Date(fieldValueObj);
|
|
855
|
+
}
|
|
856
|
+
else {
|
|
857
|
+
return false;
|
|
858
|
+
}
|
|
859
|
+
if (!filterItem.dateFilter) {
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
return (itemDate >= filterItem.dateFilter.initial &&
|
|
863
|
+
itemDate <= filterItem.dateFilter.final);
|
|
864
|
+
}
|
|
865
|
+
catch (error) {
|
|
866
|
+
console.warn('Erro ao processar filtro de data para o item:', item.id, error);
|
|
867
|
+
return false;
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
// Aplicar filterFn se existir
|
|
873
|
+
if (params.filterFn) {
|
|
874
|
+
items = items.filter(params.filterFn);
|
|
875
|
+
}
|
|
876
|
+
if (sortBy && sortBy.field && sortBy.order) {
|
|
877
|
+
items.sort((a, b) => {
|
|
878
|
+
const valA = a[sortBy.field];
|
|
879
|
+
const valB = b[sortBy.field];
|
|
880
|
+
if (valA === null || valA === undefined)
|
|
881
|
+
return 1;
|
|
882
|
+
if (valB === null || valB === undefined)
|
|
883
|
+
return -1;
|
|
884
|
+
if (valA < valB) {
|
|
885
|
+
return sortBy.order === 'asc' ? -1 : 1;
|
|
886
|
+
}
|
|
887
|
+
if (valA > valB) {
|
|
888
|
+
return sortBy.order === 'asc' ? 1 : -1;
|
|
889
|
+
}
|
|
890
|
+
return 0;
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
// Implementação adequada da paginação
|
|
894
|
+
let currentClientPageIndex = 0;
|
|
895
|
+
// Determinar a página atual baseada na navegação
|
|
896
|
+
if (params.navigation === 'reload') {
|
|
897
|
+
currentClientPageIndex = 0;
|
|
898
|
+
}
|
|
899
|
+
else {
|
|
900
|
+
currentClientPageIndex = params.clientPageIndex || 0;
|
|
901
|
+
}
|
|
902
|
+
const pageSize = params.batchSize;
|
|
903
|
+
const startIndex = currentClientPageIndex * pageSize;
|
|
904
|
+
const endIndex = startIndex + pageSize;
|
|
905
|
+
const paginatedItems = items.slice(startIndex, endIndex);
|
|
906
|
+
const totalPages = Math.ceil(items.length / pageSize);
|
|
907
|
+
const hasNextPage = currentClientPageIndex < totalPages - 1;
|
|
908
|
+
const hasPreviousPage = currentClientPageIndex > 0;
|
|
909
|
+
return {
|
|
910
|
+
items: paginatedItems,
|
|
911
|
+
filterLength: items.length,
|
|
912
|
+
lastDoc: null,
|
|
913
|
+
firstDoc: null,
|
|
914
|
+
hasNextPage: hasNextPage,
|
|
915
|
+
hasPreviousPage: hasPreviousPage,
|
|
916
|
+
currentClientPageIndex: currentClientPageIndex,
|
|
917
|
+
totalPages: totalPages,
|
|
918
|
+
};
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
getItemsData(collection, arrange, conditions = undefined) {
|
|
922
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
923
|
+
try {
|
|
924
|
+
let query = this.ngFire.collection(collection).ref;
|
|
925
|
+
query = this.applyFilters(query, arrange, conditions);
|
|
926
|
+
const snapshot = yield query.get();
|
|
927
|
+
return yield Promise.all(snapshot.docs.map((doc) => __awaiter(this, void 0, void 0, function* () {
|
|
928
|
+
const data = doc.data();
|
|
929
|
+
const id = doc.id;
|
|
930
|
+
return Object.assign({ id }, (data !== null && data !== void 0 ? data : {}));
|
|
931
|
+
})));
|
|
932
|
+
}
|
|
933
|
+
catch (e) {
|
|
934
|
+
throw e;
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
deleteIndex(id, col) {
|
|
939
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
940
|
+
try {
|
|
941
|
+
const batch = this.ngFire.firestore.batch();
|
|
942
|
+
const docRef = this.ngFire.collection(col).doc(id);
|
|
943
|
+
const docSnapshot = (yield firstValueFrom(docRef.get()));
|
|
944
|
+
const doc = docSnapshot.data();
|
|
945
|
+
batch.delete(docRef.ref);
|
|
946
|
+
if (doc && typeof doc['index'] === 'number') {
|
|
947
|
+
yield this.reindex(doc['index'], col, batch);
|
|
948
|
+
}
|
|
949
|
+
yield batch.commit();
|
|
950
|
+
this.toastr.success('Item excluído com sucesso!');
|
|
951
|
+
return true;
|
|
952
|
+
}
|
|
953
|
+
catch (e) {
|
|
954
|
+
const error = e;
|
|
955
|
+
console.error('Erro ao deletar item:', error);
|
|
956
|
+
this.toastr.error('Erro ao deletar item.');
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
reindex(index, col, batch) {
|
|
962
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
963
|
+
try {
|
|
964
|
+
const snapshot = (yield firstValueFrom(this.ngFire.collection(col).get()));
|
|
965
|
+
const docs = snapshot.docs;
|
|
966
|
+
for (let doc of docs) {
|
|
967
|
+
const data = doc.data();
|
|
968
|
+
if (data &&
|
|
969
|
+
typeof data['index'] === 'number' &&
|
|
970
|
+
data['index'] > index) {
|
|
971
|
+
data['index'] = (data['index'] - 1);
|
|
972
|
+
const docRef = this.ngFire.collection(col).doc(doc.id).ref;
|
|
973
|
+
batch.update(docRef, data);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
catch (error) {
|
|
978
|
+
console.error('Erro ao reindexar:', error);
|
|
979
|
+
}
|
|
980
|
+
return;
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
dateFormatValidator() {
|
|
984
|
+
return (control) => {
|
|
985
|
+
if (!control.value) {
|
|
986
|
+
return null;
|
|
987
|
+
}
|
|
988
|
+
const dateStr = control.value.trim();
|
|
989
|
+
const datePattern = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
|
|
990
|
+
if (!datePattern.test(dateStr)) {
|
|
991
|
+
return { invalidFormat: true };
|
|
992
|
+
}
|
|
993
|
+
const parts = dateStr.split('/');
|
|
994
|
+
const day = parts[0].padStart(2, '0');
|
|
995
|
+
const month = parts[1].padStart(2, '0');
|
|
996
|
+
const year = parts[2];
|
|
997
|
+
const normalizedDate = `${day}/${month}/${year}`;
|
|
998
|
+
const date = moment(normalizedDate, 'DD/MM/YYYY', true);
|
|
999
|
+
if (!date.isValid()) {
|
|
1000
|
+
return { invalidDate: true };
|
|
1001
|
+
}
|
|
1002
|
+
return null;
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
updateIndex(index, id, col) {
|
|
1006
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1007
|
+
yield this.ngFire.collection(col).doc(id).update({ index });
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Extrai o link de criação de índice da mensagem de erro do Firestore
|
|
1012
|
+
*/
|
|
1013
|
+
extractIndexLink(error) {
|
|
1014
|
+
if (!error ||
|
|
1015
|
+
typeof error !== 'object' ||
|
|
1016
|
+
!('message' in error) ||
|
|
1017
|
+
typeof error.message !== 'string')
|
|
1018
|
+
return null;
|
|
1019
|
+
const linkMatch = error.message.match(/(https:\/\/console\.firebase\.google\.com\/[^\s]+)/);
|
|
1020
|
+
return linkMatch ? linkMatch[1] : null;
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Rastreia índices ausentes ao usar fallback preventivo
|
|
1024
|
+
*/
|
|
1025
|
+
trackMissingIndexPreventive(collection, arrange, conditions = undefined) {
|
|
1026
|
+
var _a;
|
|
1027
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1028
|
+
try {
|
|
1029
|
+
const querySignature = this.generateQuerySignature(collection, arrange, conditions);
|
|
1030
|
+
const docId = `${collection}_${querySignature}`;
|
|
1031
|
+
const indexLink = this.generateIndexLink(collection, arrange, conditions);
|
|
1032
|
+
const indexInstructions = this.generateIndexInstructions(collection, arrange, conditions);
|
|
1033
|
+
const trackingData = {
|
|
1034
|
+
collection,
|
|
1035
|
+
indexLink,
|
|
1036
|
+
indexInstructions,
|
|
1037
|
+
arrange: {
|
|
1038
|
+
sortBy: arrange.sortBy,
|
|
1039
|
+
filters: ((_a = arrange.filters) === null || _a === void 0 ? void 0 : _a.map((f) => {
|
|
1040
|
+
var _a, _b;
|
|
1041
|
+
return ({
|
|
1042
|
+
arrange: f.arrange,
|
|
1043
|
+
property: ((_a = f.filter) === null || _a === void 0 ? void 0 : _a.property) || null,
|
|
1044
|
+
dateField: f.arrange === 'filterByDate' ? (_b = arrange.sortBy) === null || _b === void 0 ? void 0 : _b.field : null,
|
|
1045
|
+
});
|
|
1046
|
+
})) || [],
|
|
1047
|
+
},
|
|
1048
|
+
conditions: (conditions === null || conditions === void 0 ? void 0 : conditions.map((c) => ({
|
|
1049
|
+
property: c.firestoreProperty,
|
|
1050
|
+
operator: c.operator,
|
|
1051
|
+
}))) || [],
|
|
1052
|
+
errorMessage: `Fallback preventivo usado para a collection ${collection}. A query exigiria índice composto.`,
|
|
1053
|
+
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
|
|
1054
|
+
};
|
|
1055
|
+
const docRef = this.ngFire.collection('missingIndexes').doc(docId);
|
|
1056
|
+
const doc = yield docRef.get().toPromise();
|
|
1057
|
+
if (doc && doc.exists) {
|
|
1058
|
+
yield docRef.update({
|
|
1059
|
+
count: firebase.firestore.FieldValue.increment(1),
|
|
1060
|
+
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
|
|
1061
|
+
lastError: trackingData['errorMessage'],
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
else {
|
|
1065
|
+
yield docRef.set(Object.assign(Object.assign({}, trackingData), { count: 1, createdAt: firebase.firestore.FieldValue.serverTimestamp() }));
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
catch (trackingError) {
|
|
1069
|
+
console.warn('Falha ao rastrear fallback preventivo:', trackingError);
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Gera uma assinatura única para uma query
|
|
1075
|
+
*/
|
|
1076
|
+
generateQuerySignature(collection, arrange, conditions = undefined) {
|
|
1077
|
+
var _a;
|
|
1078
|
+
const signature = {
|
|
1079
|
+
collection,
|
|
1080
|
+
sortBy: arrange.sortBy,
|
|
1081
|
+
filters: ((_a = arrange.filters) === null || _a === void 0 ? void 0 : _a.map((f) => {
|
|
1082
|
+
var _a;
|
|
1083
|
+
return ({
|
|
1084
|
+
arrange: f.arrange,
|
|
1085
|
+
property: ((_a = f.filter) === null || _a === void 0 ? void 0 : _a.property) || null,
|
|
1086
|
+
});
|
|
1087
|
+
})) || [],
|
|
1088
|
+
conditions: (conditions === null || conditions === void 0 ? void 0 : conditions.map((c) => ({
|
|
1089
|
+
property: c.firestoreProperty,
|
|
1090
|
+
operator: c.operator,
|
|
1091
|
+
}))) || [],
|
|
1092
|
+
};
|
|
1093
|
+
return btoa(JSON.stringify(signature))
|
|
1094
|
+
.replace(/[^a-zA-Z0-9]/g, '')
|
|
1095
|
+
.substring(0, 20);
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Gera instruções claras para criar o índice manualmente
|
|
1099
|
+
*/
|
|
1100
|
+
generateIndexInstructions(collection, arrange, conditions = undefined) {
|
|
1101
|
+
var _a;
|
|
1102
|
+
const instructions = {
|
|
1103
|
+
summary: '',
|
|
1104
|
+
collection: collection,
|
|
1105
|
+
fields: [],
|
|
1106
|
+
queryExample: '',
|
|
1107
|
+
stepByStep: [],
|
|
1108
|
+
notes: [],
|
|
1109
|
+
};
|
|
1110
|
+
const fields = [];
|
|
1111
|
+
if (conditions && conditions.length > 0) {
|
|
1112
|
+
conditions.forEach((condition) => {
|
|
1113
|
+
if (condition.firestoreProperty) {
|
|
1114
|
+
fields.push({
|
|
1115
|
+
field: condition.firestoreProperty,
|
|
1116
|
+
order: 'Ascending',
|
|
1117
|
+
type: 'WHERE clause',
|
|
1118
|
+
operator: condition.operator,
|
|
1119
|
+
description: `Filtrar por ${condition.firestoreProperty} usando operador ${condition.operator}`,
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
if (arrange.filters && arrange.filters.length > 0) {
|
|
1125
|
+
arrange.filters.forEach((filter) => {
|
|
1126
|
+
var _a;
|
|
1127
|
+
if ((_a = filter.filter) === null || _a === void 0 ? void 0 : _a.property) {
|
|
1128
|
+
fields.push({
|
|
1129
|
+
field: filter.filter.property,
|
|
1130
|
+
order: 'Ascending',
|
|
1131
|
+
type: 'WHERE clause (filter)',
|
|
1132
|
+
operator: filter.arrange === 'filter' ? 'CONTAINS' : 'RANGE',
|
|
1133
|
+
description: `Filtrar por ${filter.filter.property} usando filtro ${filter.arrange}`,
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
if ((_a = arrange.sortBy) === null || _a === void 0 ? void 0 : _a.field) {
|
|
1139
|
+
fields.push({
|
|
1140
|
+
field: arrange.sortBy.field,
|
|
1141
|
+
order: arrange.sortBy.order === 'desc' ? 'Descending' : 'Ascending',
|
|
1142
|
+
type: 'ORDER BY clause',
|
|
1143
|
+
operator: 'N/A',
|
|
1144
|
+
description: `Ordenar resultados por ${arrange.sortBy.field} em ordem ${arrange.sortBy.order}`,
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
instructions.fields = fields;
|
|
1148
|
+
const fieldNames = fields.map((f) => f.field).join(' + ');
|
|
1149
|
+
instructions.summary = `Criar índice composto para ${collection}: ${fieldNames}`;
|
|
1150
|
+
let queryExample = `db.collection('${collection}')`;
|
|
1151
|
+
fields.forEach((field, index) => {
|
|
1152
|
+
if (field.type.includes('WHERE')) {
|
|
1153
|
+
if (field.operator === '==') {
|
|
1154
|
+
queryExample += `\n .where('${field.field}', '==', 'value')`;
|
|
1155
|
+
}
|
|
1156
|
+
else if (field.operator === 'CONTAINS') {
|
|
1157
|
+
queryExample += `\n .where('${field.field}', '>=', 'searchText')`;
|
|
1158
|
+
}
|
|
1159
|
+
else {
|
|
1160
|
+
queryExample += `\n .where('${field.field}', '${field.operator}', 'value')`;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
const orderByField = fields.find((f) => f.type.includes('ORDER BY'));
|
|
1165
|
+
if (orderByField) {
|
|
1166
|
+
queryExample += `\n .orderBy('${orderByField.field}', '${orderByField.order.toLowerCase()}')`;
|
|
1167
|
+
}
|
|
1168
|
+
instructions.queryExample = queryExample;
|
|
1169
|
+
instructions.stepByStep = [
|
|
1170
|
+
'1. Ir para Firebase Console → Firestore → Indexes',
|
|
1171
|
+
'2. Clicar em "Create Index"',
|
|
1172
|
+
`3. Definir Collection ID: ${collection}`,
|
|
1173
|
+
'4. Configurar campos nesta ORDEM EXATA:',
|
|
1174
|
+
...fields.map((field, index) => ` ${index + 1}. Campo: ${field.field}, Order: ${field.order}, Array: No`),
|
|
1175
|
+
'5. Definir Query scopes: Collection',
|
|
1176
|
+
'6. Clicar em "Create" e aguardar conclusão',
|
|
1177
|
+
];
|
|
1178
|
+
instructions.notes = [
|
|
1179
|
+
'⚠️ A ordem dos campos é CRÍTICA - deve corresponder exatamente à ordem da query',
|
|
1180
|
+
'⚠️ As cláusulas WHERE devem vir ANTES do campo ORDER BY',
|
|
1181
|
+
'⚠️ Este índice só funcionará para queries com esta combinação EXATA de campos',
|
|
1182
|
+
'⚠️ A criação do índice pode levar vários minutos',
|
|
1183
|
+
];
|
|
1184
|
+
return instructions;
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Gera um link de índice baseado na estrutura da query
|
|
1188
|
+
*/
|
|
1189
|
+
generateIndexLink(collection, arrange, conditions = undefined) {
|
|
1190
|
+
var _a, _b, _c, _d;
|
|
1191
|
+
try {
|
|
1192
|
+
const indexFields = [];
|
|
1193
|
+
if (conditions && conditions.length > 0) {
|
|
1194
|
+
conditions.forEach((condition) => {
|
|
1195
|
+
if (condition.firestoreProperty) {
|
|
1196
|
+
indexFields.push(condition.firestoreProperty);
|
|
1197
|
+
}
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
if (arrange.filters && arrange.filters.length > 0) {
|
|
1201
|
+
arrange.filters.forEach((filter) => {
|
|
1202
|
+
var _a;
|
|
1203
|
+
if ((_a = filter.filter) === null || _a === void 0 ? void 0 : _a.property) {
|
|
1204
|
+
indexFields.push(filter.filter.property);
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
if ((_a = arrange.sortBy) === null || _a === void 0 ? void 0 : _a.field) {
|
|
1209
|
+
indexFields.push(arrange.sortBy.field);
|
|
1210
|
+
}
|
|
1211
|
+
if (indexFields.length > 1) {
|
|
1212
|
+
// Obter o projectId dinamicamente do Firebase
|
|
1213
|
+
const options = (_d = (_c = (_b = this.ngFire) === null || _b === void 0 ? void 0 : _b.firestore) === null || _c === void 0 ? void 0 : _c.app) === null || _d === void 0 ? void 0 : _d.options;
|
|
1214
|
+
const projectId = options === null || options === void 0 ? void 0 : options['projectId'];
|
|
1215
|
+
if (!projectId) {
|
|
1216
|
+
console.warn('Não foi possível obter o projectId do Firebase');
|
|
1217
|
+
return null;
|
|
1218
|
+
}
|
|
1219
|
+
const baseUrl = `https://console.firebase.google.com/project/${projectId}/firestore/indexes`;
|
|
1220
|
+
const queryParams = new URLSearchParams({
|
|
1221
|
+
create_composite: `collection=${collection}&fields=${indexFields.join(',')}`,
|
|
1222
|
+
});
|
|
1223
|
+
const finalLink = `${baseUrl}?${queryParams.toString()}`;
|
|
1224
|
+
return finalLink;
|
|
1225
|
+
}
|
|
1226
|
+
return null;
|
|
1227
|
+
}
|
|
1228
|
+
catch (error) {
|
|
1229
|
+
console.warn('Falha ao gerar link de índice:', error);
|
|
1230
|
+
return null;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
trackMissingIndex(error, collection, arrange, conditions = undefined) {
|
|
1234
|
+
var _a;
|
|
1235
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1236
|
+
try {
|
|
1237
|
+
const indexLink = this.extractIndexLink(error);
|
|
1238
|
+
if (!indexLink)
|
|
1239
|
+
return;
|
|
1240
|
+
const linkHash = btoa(indexLink)
|
|
1241
|
+
.replace(/[^a-zA-Z0-9]/g, '')
|
|
1242
|
+
.substring(0, 20);
|
|
1243
|
+
const docId = `${collection}_${linkHash}`;
|
|
1244
|
+
const indexInstructions = this.generateIndexInstructions(collection, arrange, conditions);
|
|
1245
|
+
const trackingData = {
|
|
1246
|
+
collection,
|
|
1247
|
+
indexLink,
|
|
1248
|
+
indexInstructions,
|
|
1249
|
+
arrange: {
|
|
1250
|
+
sortBy: arrange.sortBy,
|
|
1251
|
+
filters: ((_a = arrange.filters) === null || _a === void 0 ? void 0 : _a.map((f) => {
|
|
1252
|
+
var _a, _b;
|
|
1253
|
+
return ({
|
|
1254
|
+
arrange: f.arrange,
|
|
1255
|
+
property: ((_a = f.filter) === null || _a === void 0 ? void 0 : _a.property) || null,
|
|
1256
|
+
dateField: f.arrange === 'filterByDate' ? (_b = arrange.sortBy) === null || _b === void 0 ? void 0 : _b.field : null,
|
|
1257
|
+
});
|
|
1258
|
+
})) || [],
|
|
1259
|
+
},
|
|
1260
|
+
conditions: (conditions === null || conditions === void 0 ? void 0 : conditions.map((c) => ({
|
|
1261
|
+
property: c.firestoreProperty,
|
|
1262
|
+
operator: c.operator,
|
|
1263
|
+
}))) || [],
|
|
1264
|
+
errorMessage: error &&
|
|
1265
|
+
typeof error === 'object' &&
|
|
1266
|
+
'message' in error &&
|
|
1267
|
+
typeof error.message === 'string'
|
|
1268
|
+
? error.message
|
|
1269
|
+
: String(error),
|
|
1270
|
+
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
|
|
1271
|
+
};
|
|
1272
|
+
const docRef = this.ngFire.collection('missingIndexes').doc(docId);
|
|
1273
|
+
const doc = yield docRef.get().toPromise();
|
|
1274
|
+
const errorMessage = error &&
|
|
1275
|
+
typeof error === 'object' &&
|
|
1276
|
+
'message' in error &&
|
|
1277
|
+
typeof error.message === 'string'
|
|
1278
|
+
? error.message
|
|
1279
|
+
: String(error);
|
|
1280
|
+
if (doc && doc.exists) {
|
|
1281
|
+
yield docRef.update({
|
|
1282
|
+
count: firebase.firestore.FieldValue.increment(1),
|
|
1283
|
+
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
|
|
1284
|
+
lastError: errorMessage,
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
else {
|
|
1288
|
+
yield docRef.set(Object.assign(Object.assign({}, trackingData), { count: 1, createdAt: firebase.firestore.FieldValue.serverTimestamp() }));
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
catch (trackingError) {
|
|
1292
|
+
console.warn('Falha ao rastrear índice ausente:', trackingError);
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
TableService.ɵfac = function TableService_Factory(t) { return new (t || TableService)(i0.ɵɵinject(i1.AngularFirestore, 8), i0.ɵɵinject(i2.MatDialog, 8), i0.ɵɵinject(i3.ToastrService, 8)); };
|
|
1298
|
+
TableService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TableService, factory: TableService.ɵfac });
|
|
1299
|
+
(function () {
|
|
1300
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableService, [{
|
|
1301
|
+
type: Injectable
|
|
1302
|
+
}], function () {
|
|
1303
|
+
return [{ type: i1.AngularFirestore, decorators: [{
|
|
1304
|
+
type: Optional
|
|
1305
|
+
}] }, { type: i2.MatDialog, decorators: [{
|
|
1306
|
+
type: Optional
|
|
1307
|
+
}] }, { type: i3.ToastrService, decorators: [{
|
|
1308
|
+
type: Optional
|
|
1309
|
+
}] }];
|
|
1310
|
+
}, null);
|
|
1311
|
+
})();
|
|
1312
|
+
|
|
1313
|
+
class FilterService {
|
|
1314
|
+
constructor(tableService) {
|
|
1315
|
+
this.tableService = tableService;
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Cria um novo FormGroup para um filtro
|
|
1319
|
+
*/
|
|
1320
|
+
createFilterGroup() {
|
|
1321
|
+
const dateValidator = this.tableService.dateFormatValidator();
|
|
1322
|
+
return new FormGroup({
|
|
1323
|
+
selectFilter: new FormControl(''),
|
|
1324
|
+
typeFilter: new FormControl(''),
|
|
1325
|
+
selectItem: new FormControl(''),
|
|
1326
|
+
initialDate: new FormControl('', [dateValidator]),
|
|
1327
|
+
finalDate: new FormControl('', [dateValidator]),
|
|
1328
|
+
});
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Adiciona um novo filtro ao FormArray
|
|
1332
|
+
*/
|
|
1333
|
+
addFilter(filtersForm, isPaginated, filterData) {
|
|
1334
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1335
|
+
if (isPaginated &&
|
|
1336
|
+
this.hasActiveDateFilter(filtersForm) &&
|
|
1337
|
+
((_a = filterData === null || filterData === void 0 ? void 0 : filterData.selectFilter) === null || _a === void 0 ? void 0 : _a.arrange) === 'filterByDate') {
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
const newFilterGroup = this.createFilterGroup();
|
|
1341
|
+
if (filterData) {
|
|
1342
|
+
if (filterData.selectFilter) {
|
|
1343
|
+
(_b = newFilterGroup.get('selectFilter')) === null || _b === void 0 ? void 0 : _b.setValue(filterData.selectFilter);
|
|
1344
|
+
}
|
|
1345
|
+
if (filterData.typeFilter) {
|
|
1346
|
+
(_c = newFilterGroup.get('typeFilter')) === null || _c === void 0 ? void 0 : _c.setValue(filterData.typeFilter);
|
|
1347
|
+
}
|
|
1348
|
+
if (filterData.selectItem) {
|
|
1349
|
+
(_d = newFilterGroup.get('selectItem')) === null || _d === void 0 ? void 0 : _d.setValue(filterData.selectItem);
|
|
1350
|
+
}
|
|
1351
|
+
if (filterData.initialDate) {
|
|
1352
|
+
(_e = newFilterGroup.get('initialDate')) === null || _e === void 0 ? void 0 : _e.setValue(filterData.initialDate);
|
|
1353
|
+
}
|
|
1354
|
+
if (filterData.finalDate) {
|
|
1355
|
+
(_f = newFilterGroup.get('finalDate')) === null || _f === void 0 ? void 0 : _f.setValue(filterData.finalDate);
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
filtersForm.push(newFilterGroup);
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Verifica se há um filtro de data ativo
|
|
1362
|
+
*/
|
|
1363
|
+
hasActiveDateFilter(filtersForm) {
|
|
1364
|
+
return filtersForm.controls.some((control) => {
|
|
1365
|
+
var _a;
|
|
1366
|
+
const group = control;
|
|
1367
|
+
const selectedFilter = (_a = group.get('selectFilter')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1368
|
+
return (selectedFilter === null || selectedFilter === void 0 ? void 0 : selectedFilter.arrange) === 'filterByDate';
|
|
1369
|
+
});
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Retorna as opções de filtro disponíveis
|
|
1373
|
+
*/
|
|
1374
|
+
getAvailableFilterOptions(dropdownItems, isPaginated, filtersForm) {
|
|
1375
|
+
if (isPaginated && this.hasActiveDateFilter(filtersForm)) {
|
|
1376
|
+
return dropdownItems.filter((item) => item.arrange !== 'filterByDate');
|
|
1377
|
+
}
|
|
1378
|
+
return dropdownItems;
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Remove um filtro do FormArray
|
|
1382
|
+
*/
|
|
1383
|
+
removeFilter(filtersForm, index) {
|
|
1384
|
+
filtersForm.removeAt(index);
|
|
1385
|
+
if (filtersForm.length === 0) {
|
|
1386
|
+
this.addFilter(filtersForm, false);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Remove todos os filtros do FormArray
|
|
1391
|
+
*/
|
|
1392
|
+
removeAllFilters(filtersForm) {
|
|
1393
|
+
filtersForm.clear();
|
|
1394
|
+
this.addFilter(filtersForm, false);
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Aplica máscara de data (DD/MM/AAAA)
|
|
1398
|
+
*/
|
|
1399
|
+
applyDateMask(event, controlName, filterGroup) {
|
|
1400
|
+
var _a;
|
|
1401
|
+
const input = event.target;
|
|
1402
|
+
let value = input.value.replace(/\D/g, '');
|
|
1403
|
+
if (value.length > 8) {
|
|
1404
|
+
value = value.slice(0, 8);
|
|
1405
|
+
}
|
|
1406
|
+
if (value.length <= 2) {
|
|
1407
|
+
// mantém como está
|
|
1408
|
+
}
|
|
1409
|
+
else if (value.length <= 4) {
|
|
1410
|
+
value = value.slice(0, 2) + '/' + value.slice(2);
|
|
1411
|
+
}
|
|
1412
|
+
else {
|
|
1413
|
+
value =
|
|
1414
|
+
value.slice(0, 2) + '/' + value.slice(2, 4) + '/' + value.slice(4, 8);
|
|
1415
|
+
}
|
|
1416
|
+
(_a = filterGroup.get(controlName)) === null || _a === void 0 ? void 0 : _a.setValue(value, { emitEvent: false });
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Aplica filtros client-side aos itens
|
|
1420
|
+
*/
|
|
1421
|
+
applyClientSideFilters(items, filtersForm, sortBy) {
|
|
1422
|
+
let filteredItems = [...items];
|
|
1423
|
+
const dateFiltersByProperty = {};
|
|
1424
|
+
const otherFilters = [];
|
|
1425
|
+
filtersForm.controls.forEach((control) => {
|
|
1426
|
+
var _a, _b, _c;
|
|
1427
|
+
const group = control;
|
|
1428
|
+
const selectedFilter = (_a = group.get('selectFilter')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1429
|
+
if (!selectedFilter)
|
|
1430
|
+
return;
|
|
1431
|
+
const arrange = selectedFilter.arrange;
|
|
1432
|
+
if (arrange === 'filterByDate') {
|
|
1433
|
+
const initial = (_b = group.get('initialDate')) === null || _b === void 0 ? void 0 : _b.value;
|
|
1434
|
+
const final = (_c = group.get('finalDate')) === null || _c === void 0 ? void 0 : _c.value;
|
|
1435
|
+
if (initial && final && initial.trim() && final.trim()) {
|
|
1436
|
+
try {
|
|
1437
|
+
const datePattern = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
|
|
1438
|
+
if (!datePattern.test(initial) || !datePattern.test(final)) {
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
const [dayI, monthI, yearI] = initial.split('/');
|
|
1442
|
+
const initialDate = new Date(`${monthI}/${dayI}/${yearI}`);
|
|
1443
|
+
const [dayF, monthF, yearF] = final.split('/');
|
|
1444
|
+
const finalDate = new Date(`${monthF}/${dayF}/${yearF}`);
|
|
1445
|
+
finalDate.setHours(23, 59, 59);
|
|
1446
|
+
if (isNaN(initialDate.getTime()) || isNaN(finalDate.getTime())) {
|
|
1447
|
+
return;
|
|
1448
|
+
}
|
|
1449
|
+
const dateField = selectedFilter.property || sortBy.field;
|
|
1450
|
+
if (!dateFiltersByProperty[dateField]) {
|
|
1451
|
+
dateFiltersByProperty[dateField] = [];
|
|
1452
|
+
}
|
|
1453
|
+
dateFiltersByProperty[dateField].push({
|
|
1454
|
+
initial: initialDate,
|
|
1455
|
+
final: finalDate,
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
catch (error) {
|
|
1459
|
+
console.warn('Erro ao processar datas do filtro:', error);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
else {
|
|
1464
|
+
otherFilters.push({ group, selectedFilter, arrange });
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
// Aplicar filtros de data
|
|
1468
|
+
Object.keys(dateFiltersByProperty).forEach((dateField) => {
|
|
1469
|
+
const intervals = dateFiltersByProperty[dateField];
|
|
1470
|
+
filteredItems = filteredItems.filter((item) => {
|
|
1471
|
+
try {
|
|
1472
|
+
const fieldValue = item[dateField];
|
|
1473
|
+
if (!fieldValue) {
|
|
1474
|
+
return false;
|
|
1475
|
+
}
|
|
1476
|
+
let itemDate;
|
|
1477
|
+
if (typeof fieldValue.toDate === 'function') {
|
|
1478
|
+
itemDate = fieldValue.toDate();
|
|
1479
|
+
}
|
|
1480
|
+
else if (fieldValue instanceof Date) {
|
|
1481
|
+
itemDate = fieldValue;
|
|
1482
|
+
}
|
|
1483
|
+
else if (typeof fieldValue === 'string') {
|
|
1484
|
+
itemDate = new Date(fieldValue);
|
|
1485
|
+
if (isNaN(itemDate.getTime())) {
|
|
1486
|
+
return false;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
else if (typeof fieldValue === 'number') {
|
|
1490
|
+
itemDate = new Date(fieldValue);
|
|
1491
|
+
}
|
|
1492
|
+
else {
|
|
1493
|
+
return false;
|
|
1494
|
+
}
|
|
1495
|
+
return intervals.some((interval) => itemDate >= interval.initial && itemDate <= interval.final);
|
|
1496
|
+
}
|
|
1497
|
+
catch (error) {
|
|
1498
|
+
console.warn('Erro ao processar filtro de data para o item:', item.id, error);
|
|
1499
|
+
return false;
|
|
1500
|
+
}
|
|
1501
|
+
});
|
|
1502
|
+
});
|
|
1503
|
+
// Aplicar outros filtros
|
|
1504
|
+
otherFilters.forEach(({ group, selectedFilter, arrange }) => {
|
|
1505
|
+
var _a, _b;
|
|
1506
|
+
if (arrange === 'filter') {
|
|
1507
|
+
const filterValue = (_a = group.get('typeFilter')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1508
|
+
if (filterValue && filterValue.trim()) {
|
|
1509
|
+
const property = selectedFilter.property;
|
|
1510
|
+
filteredItems = filteredItems.filter((item) => {
|
|
1511
|
+
const value = String(item[property] || '')
|
|
1512
|
+
.trim()
|
|
1513
|
+
.toLocaleLowerCase();
|
|
1514
|
+
return value.includes(filterValue.trim().toLocaleLowerCase());
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
else if (selectedFilter.hasOwnProperty('items') &&
|
|
1519
|
+
arrange === 'equals') {
|
|
1520
|
+
const selectedItems = (_b = group.get('selectItem')) === null || _b === void 0 ? void 0 : _b.value;
|
|
1521
|
+
if (Array.isArray(selectedItems) && selectedItems.length > 0) {
|
|
1522
|
+
filteredItems = filteredItems.filter((item) => {
|
|
1523
|
+
return selectedItems.some((selectedItem) => {
|
|
1524
|
+
const itemValue = item[selectedItem.property];
|
|
1525
|
+
return itemValue === selectedItem.value;
|
|
1526
|
+
});
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
return filteredItems;
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Constrói o objeto Arrange a partir dos filtros ativos
|
|
1535
|
+
*/
|
|
1536
|
+
buildArrangeFromFilters(filtersForm, sortBy) {
|
|
1537
|
+
const activeFilters = filtersForm.controls
|
|
1538
|
+
.flatMap((control) => {
|
|
1539
|
+
var _a, _b, _c, _d, _e;
|
|
1540
|
+
const group = control;
|
|
1541
|
+
const selectedFilter = (_a = group.get('selectFilter')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1542
|
+
if (!selectedFilter)
|
|
1543
|
+
return [];
|
|
1544
|
+
const arrange = selectedFilter.arrange;
|
|
1545
|
+
if (arrange === 'filter') {
|
|
1546
|
+
const filterValue = (_b = group.get('typeFilter')) === null || _b === void 0 ? void 0 : _b.value;
|
|
1547
|
+
if (!filterValue)
|
|
1548
|
+
return [];
|
|
1549
|
+
return {
|
|
1550
|
+
arrange,
|
|
1551
|
+
filter: {
|
|
1552
|
+
property: selectedFilter.property,
|
|
1553
|
+
filtering: filterValue,
|
|
1554
|
+
},
|
|
1555
|
+
dateFilter: undefined,
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
if (arrange === 'filterByDate') {
|
|
1559
|
+
const initial = (_c = group.get('initialDate')) === null || _c === void 0 ? void 0 : _c.value;
|
|
1560
|
+
const final = (_d = group.get('finalDate')) === null || _d === void 0 ? void 0 : _d.value;
|
|
1561
|
+
if (initial && final) {
|
|
1562
|
+
try {
|
|
1563
|
+
const [dayI, monthI, yearI] = initial.split('/');
|
|
1564
|
+
const initialDate = new Date(`${monthI}/${dayI}/${yearI}`);
|
|
1565
|
+
const [dayF, monthF, yearF] = final.split('/');
|
|
1566
|
+
const finalDate = new Date(`${monthF}/${dayF}/${yearF}`);
|
|
1567
|
+
finalDate.setHours(23, 59, 59);
|
|
1568
|
+
return {
|
|
1569
|
+
arrange,
|
|
1570
|
+
filter: undefined,
|
|
1571
|
+
dateFilter: {
|
|
1572
|
+
initial: initialDate,
|
|
1573
|
+
final: finalDate,
|
|
1574
|
+
},
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
catch (error) {
|
|
1578
|
+
return [];
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
return [];
|
|
1582
|
+
}
|
|
1583
|
+
if (selectedFilter.hasOwnProperty('items') && arrange === 'equals') {
|
|
1584
|
+
const selectedItems = (_e = group.get('selectItem')) === null || _e === void 0 ? void 0 : _e.value;
|
|
1585
|
+
if (Array.isArray(selectedItems) && selectedItems.length > 0) {
|
|
1586
|
+
return selectedItems.map((item) => ({
|
|
1587
|
+
arrange,
|
|
1588
|
+
filter: {
|
|
1589
|
+
property: item.property,
|
|
1590
|
+
filtering: item.value,
|
|
1591
|
+
},
|
|
1592
|
+
dateFilter: undefined,
|
|
1593
|
+
}));
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return [];
|
|
1597
|
+
})
|
|
1598
|
+
.filter((f) => { var _a; return f && (((_a = f.filter) === null || _a === void 0 ? void 0 : _a.filtering) !== undefined || f.dateFilter); });
|
|
1599
|
+
return {
|
|
1600
|
+
filters: activeFilters,
|
|
1601
|
+
sortBy: sortBy,
|
|
1602
|
+
};
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Extrai filtros ativos para paginação
|
|
1606
|
+
*/
|
|
1607
|
+
extractActiveFilters(filtersForm) {
|
|
1608
|
+
return filtersForm.controls
|
|
1609
|
+
.flatMap((control) => {
|
|
1610
|
+
var _a, _b, _c, _d, _e;
|
|
1611
|
+
const group = control;
|
|
1612
|
+
const selectedFilter = (_a = group.get('selectFilter')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1613
|
+
if (!selectedFilter)
|
|
1614
|
+
return [];
|
|
1615
|
+
const arrange = selectedFilter.arrange;
|
|
1616
|
+
if (arrange === 'filter') {
|
|
1617
|
+
const filterValue = (_b = group.get('typeFilter')) === null || _b === void 0 ? void 0 : _b.value;
|
|
1618
|
+
if (!filterValue)
|
|
1619
|
+
return [];
|
|
1620
|
+
return {
|
|
1621
|
+
arrange,
|
|
1622
|
+
filter: {
|
|
1623
|
+
property: selectedFilter.property,
|
|
1624
|
+
filtering: filterValue,
|
|
1625
|
+
},
|
|
1626
|
+
dateFilter: undefined,
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1629
|
+
if (arrange === 'filterByDate') {
|
|
1630
|
+
const initial = (_c = group.get('initialDate')) === null || _c === void 0 ? void 0 : _c.value;
|
|
1631
|
+
const final = (_d = group.get('finalDate')) === null || _d === void 0 ? void 0 : _d.value;
|
|
1632
|
+
if (initial && final) {
|
|
1633
|
+
const [dayI, monthI, yearI] = initial.split('/');
|
|
1634
|
+
const initialDate = new Date(`${monthI}/${dayI}/${yearI}`);
|
|
1635
|
+
const [dayF, monthF, yearF] = final.split('/');
|
|
1636
|
+
const finalDate = new Date(`${monthF}/${dayF}/${yearF}`);
|
|
1637
|
+
finalDate.setHours(23, 59, 59);
|
|
1638
|
+
return {
|
|
1639
|
+
arrange,
|
|
1640
|
+
filter: undefined,
|
|
1641
|
+
dateFilter: {
|
|
1642
|
+
initial: initialDate,
|
|
1643
|
+
final: finalDate,
|
|
1644
|
+
},
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
return [];
|
|
1648
|
+
}
|
|
1649
|
+
if (selectedFilter.hasOwnProperty('items') && arrange === 'equals') {
|
|
1650
|
+
const selectedItems = (_e = group.get('selectItem')) === null || _e === void 0 ? void 0 : _e.value;
|
|
1651
|
+
if (Array.isArray(selectedItems) && selectedItems.length > 0) {
|
|
1652
|
+
return selectedItems.map((item) => ({
|
|
1653
|
+
arrange,
|
|
1654
|
+
filter: {
|
|
1655
|
+
property: item.property,
|
|
1656
|
+
filtering: item.value,
|
|
1657
|
+
},
|
|
1658
|
+
dateFilter: undefined,
|
|
1659
|
+
}));
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
return [];
|
|
1663
|
+
})
|
|
1664
|
+
.filter((f) => { var _a; return f && (((_a = f.filter) === null || _a === void 0 ? void 0 : _a.filtering) !== undefined || f.dateFilter); });
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Inicializa os dropdownItems baseado nas colunas
|
|
1668
|
+
*/
|
|
1669
|
+
initializeDropdownItems(displayedColumns) {
|
|
1670
|
+
const dropdownItems = [];
|
|
1671
|
+
const sortableDropdownItems = [];
|
|
1672
|
+
let hasFilterableColumn = false;
|
|
1673
|
+
let hasSortableColumn = false;
|
|
1674
|
+
displayedColumns.forEach((col) => {
|
|
1675
|
+
if (col.isFilterable) {
|
|
1676
|
+
hasFilterableColumn = true;
|
|
1677
|
+
dropdownItems.push(Object.assign(Object.assign({}, col), { arrange: 'filter', title: col.title }));
|
|
1678
|
+
}
|
|
1679
|
+
if (col.isSortable) {
|
|
1680
|
+
hasSortableColumn = true;
|
|
1681
|
+
sortableDropdownItems.push(Object.assign(Object.assign({}, col), { arrange: 'ascending', title: col.title + ': crescente' }));
|
|
1682
|
+
sortableDropdownItems.push(Object.assign(Object.assign({}, col), { arrange: 'descending', title: col.title + ': decrescente' }));
|
|
1683
|
+
}
|
|
1684
|
+
if (col.isFilterableByDate) {
|
|
1685
|
+
dropdownItems.push(Object.assign(Object.assign({}, col), { arrange: 'filterByDate', title: col.title + ': filtro por data' }));
|
|
1686
|
+
}
|
|
1687
|
+
});
|
|
1688
|
+
return {
|
|
1689
|
+
dropdownItems,
|
|
1690
|
+
sortableDropdownItems,
|
|
1691
|
+
hasFilterableColumn,
|
|
1692
|
+
hasSortableColumn,
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
* Adiciona opções de filtro customizadas
|
|
1697
|
+
*/
|
|
1698
|
+
addFilterableOptions(dropdownItems, filterableOptions) {
|
|
1699
|
+
if (filterableOptions &&
|
|
1700
|
+
Array.isArray(filterableOptions) &&
|
|
1701
|
+
filterableOptions.length > 0) {
|
|
1702
|
+
filterableOptions.forEach((option) => dropdownItems.push(Object.assign(Object.assign({}, option), { arrange: 'equals' })));
|
|
1703
|
+
}
|
|
1704
|
+
return dropdownItems;
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
FilterService.ɵfac = function FilterService_Factory(t) { return new (t || FilterService)(i0.ɵɵinject(TableService)); };
|
|
1708
|
+
FilterService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: FilterService, factory: FilterService.ɵfac, providedIn: 'root' });
|
|
1709
|
+
(function () {
|
|
1710
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FilterService, [{
|
|
1711
|
+
type: Injectable,
|
|
1712
|
+
args: [{
|
|
1713
|
+
providedIn: 'root',
|
|
1714
|
+
}]
|
|
1715
|
+
}], function () { return [{ type: TableService }]; }, null);
|
|
1716
|
+
})();
|
|
1717
|
+
|
|
1718
|
+
class TooltipService {
|
|
1719
|
+
constructor() {
|
|
1720
|
+
this.tooltipTimeout = null;
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* Cria um estado inicial para o tooltip
|
|
1724
|
+
*/
|
|
1725
|
+
createInitialState() {
|
|
1726
|
+
return {
|
|
1727
|
+
hoveredCell: null,
|
|
1728
|
+
showTooltip: false,
|
|
1729
|
+
tooltipContent: '',
|
|
1730
|
+
tooltipPosition: { x: 0, y: 0 },
|
|
1731
|
+
tooltipBgColor: 'bg-gray-800',
|
|
1732
|
+
tooltipBgStyle: null,
|
|
1733
|
+
tooltipTextColor: 'text-white',
|
|
1734
|
+
tooltipTextStyle: null,
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* Processa as cores do tooltip
|
|
1739
|
+
*/
|
|
1740
|
+
processTooltipColors(config) {
|
|
1741
|
+
const result = {
|
|
1742
|
+
bgColor: 'bg-gray-800',
|
|
1743
|
+
bgStyle: null,
|
|
1744
|
+
textColor: 'text-white',
|
|
1745
|
+
textStyle: null,
|
|
1746
|
+
};
|
|
1747
|
+
const tooltipBgColor = (config === null || config === void 0 ? void 0 : config.color) || 'bg-gray-800';
|
|
1748
|
+
if (tooltipBgColor.startsWith('#') || tooltipBgColor.startsWith('rgb')) {
|
|
1749
|
+
result.bgColor = '';
|
|
1750
|
+
result.bgStyle = { 'background-color': tooltipBgColor };
|
|
1751
|
+
}
|
|
1752
|
+
else {
|
|
1753
|
+
result.bgColor = tooltipBgColor;
|
|
1754
|
+
result.bgStyle = null;
|
|
1755
|
+
}
|
|
1756
|
+
const tooltipTextColor = (config === null || config === void 0 ? void 0 : config.text) || 'text-white';
|
|
1757
|
+
if (tooltipTextColor.startsWith('#') ||
|
|
1758
|
+
tooltipTextColor.startsWith('rgb')) {
|
|
1759
|
+
result.textColor = '';
|
|
1760
|
+
result.textStyle = { color: tooltipTextColor };
|
|
1761
|
+
}
|
|
1762
|
+
else {
|
|
1763
|
+
result.textColor = tooltipTextColor;
|
|
1764
|
+
result.textStyle = null;
|
|
1765
|
+
}
|
|
1766
|
+
return result;
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Manipula o evento de mouse enter na célula
|
|
1770
|
+
*/
|
|
1771
|
+
handleMouseEnter(event, row, col, getDisplayValue, onShow) {
|
|
1772
|
+
// Só mostrar tooltip se a coluna tiver charLimit definido
|
|
1773
|
+
if (!col.charLimit) {
|
|
1774
|
+
return;
|
|
1775
|
+
}
|
|
1776
|
+
const fullValue = getDisplayValue(col, row, true);
|
|
1777
|
+
// Só mostrar tooltip se o valor completo for maior que o limite
|
|
1778
|
+
if (fullValue.length <= col.charLimit) {
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
const colors = this.processTooltipColors(col.tooltip);
|
|
1782
|
+
const state = {
|
|
1783
|
+
hoveredCell: { row, col },
|
|
1784
|
+
tooltipContent: fullValue,
|
|
1785
|
+
tooltipBgColor: colors.bgColor,
|
|
1786
|
+
tooltipBgStyle: colors.bgStyle,
|
|
1787
|
+
tooltipTextColor: colors.textColor,
|
|
1788
|
+
tooltipTextStyle: colors.textStyle,
|
|
1789
|
+
tooltipPosition: {
|
|
1790
|
+
x: event.clientX + 10,
|
|
1791
|
+
y: event.clientY - 10,
|
|
1792
|
+
},
|
|
1793
|
+
};
|
|
1794
|
+
onShow(state);
|
|
1795
|
+
// Limpar timeout anterior se existir
|
|
1796
|
+
if (this.tooltipTimeout) {
|
|
1797
|
+
clearTimeout(this.tooltipTimeout);
|
|
1798
|
+
}
|
|
1799
|
+
// Timeout para mostrar o tooltip
|
|
1800
|
+
this.tooltipTimeout = setTimeout(() => {
|
|
1801
|
+
onShow({ showTooltip: true });
|
|
1802
|
+
}, 500);
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Manipula o evento de mouse leave na célula
|
|
1806
|
+
*/
|
|
1807
|
+
handleMouseLeave(onHide) {
|
|
1808
|
+
if (this.tooltipTimeout) {
|
|
1809
|
+
clearTimeout(this.tooltipTimeout);
|
|
1810
|
+
this.tooltipTimeout = null;
|
|
1811
|
+
}
|
|
1812
|
+
onHide(this.createInitialState());
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* Manipula o movimento do mouse
|
|
1816
|
+
*/
|
|
1817
|
+
handleMouseMove(event, showTooltip, onMove) {
|
|
1818
|
+
if (showTooltip) {
|
|
1819
|
+
onMove({
|
|
1820
|
+
x: event.clientX + 10,
|
|
1821
|
+
y: event.clientY - 10,
|
|
1822
|
+
});
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Combina estilos do tooltip para aplicação
|
|
1827
|
+
*/
|
|
1828
|
+
getTooltipStyles(state) {
|
|
1829
|
+
const styles = {};
|
|
1830
|
+
if (state.tooltipBgStyle) {
|
|
1831
|
+
Object.assign(styles, state.tooltipBgStyle);
|
|
1832
|
+
}
|
|
1833
|
+
if (state.tooltipTextStyle) {
|
|
1834
|
+
Object.assign(styles, state.tooltipTextStyle);
|
|
1835
|
+
}
|
|
1836
|
+
return styles;
|
|
1837
|
+
}
|
|
1838
|
+
/**
|
|
1839
|
+
* Limpa recursos ao destruir
|
|
1840
|
+
*/
|
|
1841
|
+
destroy() {
|
|
1842
|
+
if (this.tooltipTimeout) {
|
|
1843
|
+
clearTimeout(this.tooltipTimeout);
|
|
1844
|
+
this.tooltipTimeout = null;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
TooltipService.ɵfac = function TooltipService_Factory(t) { return new (t || TooltipService)(); };
|
|
1849
|
+
TooltipService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TooltipService, factory: TooltipService.ɵfac, providedIn: 'root' });
|
|
1850
|
+
(function () {
|
|
1851
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TooltipService, [{
|
|
1852
|
+
type: Injectable,
|
|
1853
|
+
args: [{
|
|
1854
|
+
providedIn: 'root',
|
|
1855
|
+
}]
|
|
1856
|
+
}], null, null);
|
|
1857
|
+
})();
|
|
1858
|
+
|
|
1859
|
+
class PaginationService {
|
|
1860
|
+
calculateNavigation(event, currentState) {
|
|
1861
|
+
var _a;
|
|
1862
|
+
const previousPageIndex = (_a = event.previousPageIndex) !== null && _a !== void 0 ? _a : 0;
|
|
1863
|
+
const pageIndex = event.pageIndex;
|
|
1864
|
+
const eventPageSize = event.pageSize;
|
|
1865
|
+
const totalItems = currentState.totalItems;
|
|
1866
|
+
const currentComponentPageSize = currentState.pageSize;
|
|
1867
|
+
let navigationDirection = 'reload';
|
|
1868
|
+
let resetDocs = false;
|
|
1869
|
+
let originalPageSize = null;
|
|
1870
|
+
let shouldNavigate = true;
|
|
1871
|
+
let newClientPageIndex = pageIndex;
|
|
1872
|
+
let newPageNumber = currentState.currentPageNumber;
|
|
1873
|
+
const lastPageIndex = Math.max(0, Math.ceil(totalItems / eventPageSize) - 1);
|
|
1874
|
+
// Atualizar número da página
|
|
1875
|
+
if (previousPageIndex !== undefined && pageIndex > previousPageIndex) {
|
|
1876
|
+
newPageNumber++;
|
|
1877
|
+
}
|
|
1878
|
+
else if (previousPageIndex !== undefined &&
|
|
1879
|
+
pageIndex < previousPageIndex) {
|
|
1880
|
+
newPageNumber = Math.max(1, newPageNumber - 1);
|
|
1881
|
+
}
|
|
1882
|
+
// Mudança de tamanho de página
|
|
1883
|
+
if (eventPageSize !== currentComponentPageSize) {
|
|
1884
|
+
navigationDirection = 'forward';
|
|
1885
|
+
resetDocs = true;
|
|
1886
|
+
newClientPageIndex = 0;
|
|
1887
|
+
}
|
|
1888
|
+
// Indo para primeira página
|
|
1889
|
+
else if (pageIndex === 0 &&
|
|
1890
|
+
previousPageIndex !== undefined &&
|
|
1891
|
+
pageIndex < previousPageIndex) {
|
|
1892
|
+
navigationDirection = 'forward';
|
|
1893
|
+
newPageNumber = 1;
|
|
1894
|
+
newClientPageIndex = 0;
|
|
1895
|
+
resetDocs = true;
|
|
1896
|
+
}
|
|
1897
|
+
// Indo para última página (salto)
|
|
1898
|
+
else if (pageIndex === lastPageIndex &&
|
|
1899
|
+
previousPageIndex !== undefined &&
|
|
1900
|
+
pageIndex > previousPageIndex &&
|
|
1901
|
+
pageIndex - previousPageIndex > 1) {
|
|
1902
|
+
navigationDirection = 'backward';
|
|
1903
|
+
resetDocs = true;
|
|
1904
|
+
const itemsExpectedInLastPage = totalItems - lastPageIndex * eventPageSize;
|
|
1905
|
+
if (itemsExpectedInLastPage > 0 &&
|
|
1906
|
+
itemsExpectedInLastPage < eventPageSize) {
|
|
1907
|
+
originalPageSize = currentComponentPageSize;
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
// Próxima página
|
|
1911
|
+
else if (previousPageIndex !== undefined && pageIndex > previousPageIndex) {
|
|
1912
|
+
navigationDirection = 'forward';
|
|
1913
|
+
resetDocs = false;
|
|
1914
|
+
}
|
|
1915
|
+
// Página anterior
|
|
1916
|
+
else if (previousPageIndex !== undefined && pageIndex < previousPageIndex) {
|
|
1917
|
+
navigationDirection = 'backward';
|
|
1918
|
+
resetDocs = false;
|
|
1919
|
+
}
|
|
1920
|
+
// Mesma página (reload)
|
|
1921
|
+
else if (previousPageIndex !== undefined &&
|
|
1922
|
+
pageIndex === previousPageIndex) {
|
|
1923
|
+
navigationDirection = 'reload';
|
|
1924
|
+
resetDocs = false;
|
|
1925
|
+
}
|
|
1926
|
+
// Caso inicial (primeira carga)
|
|
1927
|
+
else if (previousPageIndex === undefined && pageIndex === 0) {
|
|
1928
|
+
shouldNavigate = false;
|
|
1929
|
+
}
|
|
1930
|
+
// Caso não tratado
|
|
1931
|
+
else {
|
|
1932
|
+
console.warn('Condição de navegação não tratada:', event);
|
|
1933
|
+
shouldNavigate = false;
|
|
1934
|
+
}
|
|
1935
|
+
return {
|
|
1936
|
+
direction: navigationDirection,
|
|
1937
|
+
resetDocs,
|
|
1938
|
+
originalPageSize,
|
|
1939
|
+
shouldNavigate,
|
|
1940
|
+
newClientPageIndex,
|
|
1941
|
+
newPageNumber,
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
/**
|
|
1945
|
+
* Calcula o número de itens esperados na última página
|
|
1946
|
+
*/
|
|
1947
|
+
calculateLastPageItemCount(totalItems, pageSize) {
|
|
1948
|
+
const lastPageIndex = Math.max(0, Math.ceil(totalItems / pageSize) - 1);
|
|
1949
|
+
return totalItems - lastPageIndex * pageSize;
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Calcula o índice da última página
|
|
1953
|
+
*/
|
|
1954
|
+
calculateLastPageIndex(totalItems, pageSize) {
|
|
1955
|
+
return Math.max(0, Math.ceil(totalItems / pageSize) - 1);
|
|
1956
|
+
}
|
|
1957
|
+
/**
|
|
1958
|
+
* Verifica se deve mostrar o botão de próxima página
|
|
1959
|
+
*/
|
|
1960
|
+
shouldShowNextButton(hasNextPage, isPaginated) {
|
|
1961
|
+
return hasNextPage || !isPaginated;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
PaginationService.ɵfac = function PaginationService_Factory(t) { return new (t || PaginationService)(); };
|
|
1965
|
+
PaginationService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: PaginationService, factory: PaginationService.ɵfac, providedIn: 'root' });
|
|
1966
|
+
(function () {
|
|
1967
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PaginationService, [{
|
|
1968
|
+
type: Injectable,
|
|
1969
|
+
args: [{
|
|
1970
|
+
providedIn: 'root',
|
|
1971
|
+
}]
|
|
1972
|
+
}], null, null);
|
|
1973
|
+
})();
|
|
1974
|
+
|
|
1975
|
+
function TableTabsComponent_div_0_ng_container_1_ng_container_2_span_3_Template(rf, ctx) {
|
|
1976
|
+
if (rf & 1) {
|
|
1977
|
+
i0.ɵɵelementStart(0, "span", 6);
|
|
1978
|
+
i0.ɵɵtext(1);
|
|
1979
|
+
i0.ɵɵelementEnd();
|
|
1980
|
+
}
|
|
1981
|
+
if (rf & 2) {
|
|
1982
|
+
const tab_r5 = i0.ɵɵnextContext().$implicit;
|
|
1983
|
+
i0.ɵɵproperty("ngClass", tab_r5.counterClass);
|
|
1984
|
+
i0.ɵɵadvance(1);
|
|
1985
|
+
i0.ɵɵtextInterpolate1(" ", tab_r5.counter, " ");
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
function TableTabsComponent_div_0_ng_container_1_ng_container_2_Template(rf, ctx) {
|
|
1989
|
+
if (rf & 1) {
|
|
1990
|
+
const _r11 = i0.ɵɵgetCurrentView();
|
|
1991
|
+
i0.ɵɵelementContainerStart(0);
|
|
1992
|
+
i0.ɵɵelementStart(1, "button", 4);
|
|
1993
|
+
i0.ɵɵlistener("click", function TableTabsComponent_div_0_ng_container_1_ng_container_2_Template_button_click_1_listener() { const restoredCtx = i0.ɵɵrestoreView(_r11); const j_r6 = restoredCtx.index; const i_r3 = i0.ɵɵnextContext().index; const ctx_r9 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r9.onTabSelected(i_r3, j_r6)); });
|
|
1994
|
+
i0.ɵɵtext(2);
|
|
1995
|
+
i0.ɵɵtemplate(3, TableTabsComponent_div_0_ng_container_1_ng_container_2_span_3_Template, 2, 2, "span", 5);
|
|
1996
|
+
i0.ɵɵelementEnd();
|
|
1997
|
+
i0.ɵɵelementContainerEnd();
|
|
1998
|
+
}
|
|
1999
|
+
if (rf & 2) {
|
|
2000
|
+
const tab_r5 = ctx.$implicit;
|
|
2001
|
+
const j_r6 = ctx.index;
|
|
2002
|
+
const i_r3 = i0.ɵɵnextContext().index;
|
|
2003
|
+
const ctx_r4 = i0.ɵɵnextContext(2);
|
|
2004
|
+
i0.ɵɵadvance(1);
|
|
2005
|
+
i0.ɵɵproperty("ngClass", ctx_r4.isTabSelected(ctx_r4.getRealTabIndex(i_r3, j_r6)) ? "border-b-0 brightness-110" : "");
|
|
2006
|
+
i0.ɵɵadvance(1);
|
|
2007
|
+
i0.ɵɵtextInterpolate1(" ", tab_r5.label, " ");
|
|
2008
|
+
i0.ɵɵadvance(1);
|
|
2009
|
+
i0.ɵɵproperty("ngIf", tab_r5.counter !== undefined);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
function TableTabsComponent_div_0_ng_container_1_Template(rf, ctx) {
|
|
2013
|
+
if (rf & 1) {
|
|
2014
|
+
i0.ɵɵelementContainerStart(0);
|
|
2015
|
+
i0.ɵɵelementStart(1, "div", 3);
|
|
2016
|
+
i0.ɵɵtemplate(2, TableTabsComponent_div_0_ng_container_1_ng_container_2_Template, 4, 3, "ng-container", 2);
|
|
2017
|
+
i0.ɵɵelementEnd();
|
|
2018
|
+
i0.ɵɵelementContainerEnd();
|
|
2019
|
+
}
|
|
2020
|
+
if (rf & 2) {
|
|
2021
|
+
const groupIndex_r2 = ctx.$implicit;
|
|
2022
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
2023
|
+
i0.ɵɵadvance(2);
|
|
2024
|
+
i0.ɵɵproperty("ngForOf", ctx_r1.getTabGroup(groupIndex_r2));
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
function TableTabsComponent_div_0_Template(rf, ctx) {
|
|
2028
|
+
if (rf & 1) {
|
|
2029
|
+
i0.ɵɵelementStart(0, "div", 1);
|
|
2030
|
+
i0.ɵɵtemplate(1, TableTabsComponent_div_0_ng_container_1_Template, 3, 1, "ng-container", 2);
|
|
2031
|
+
i0.ɵɵelementEnd();
|
|
2032
|
+
}
|
|
2033
|
+
if (rf & 2) {
|
|
2034
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
2035
|
+
i0.ɵɵadvance(1);
|
|
2036
|
+
i0.ɵɵproperty("ngForOf", ctx_r0.getTabGroups());
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
class TableTabsComponent {
|
|
2040
|
+
constructor() {
|
|
2041
|
+
this.tabsData = [];
|
|
2042
|
+
this.selectedTab = 0;
|
|
2043
|
+
this.tabSelected = new EventEmitter();
|
|
2044
|
+
this.TABS_PER_GROUP = 6;
|
|
2045
|
+
}
|
|
2046
|
+
/**
|
|
2047
|
+
* Retorna os índices dos grupos de tabs (invertidos para exibição vertical)
|
|
2048
|
+
*/
|
|
2049
|
+
getTabGroups() {
|
|
2050
|
+
if (!this.tabsData || this.tabsData.length === 0)
|
|
2051
|
+
return [];
|
|
2052
|
+
const totalGroups = Math.ceil(this.tabsData.length / this.TABS_PER_GROUP);
|
|
2053
|
+
const groups = [];
|
|
2054
|
+
for (let i = totalGroups - 1; i >= 0; i--) {
|
|
2055
|
+
groups.push(i);
|
|
2056
|
+
}
|
|
2057
|
+
return groups;
|
|
2058
|
+
}
|
|
2059
|
+
/**
|
|
2060
|
+
* Retorna os tabs de um grupo específico
|
|
2061
|
+
*/
|
|
2062
|
+
getTabGroup(groupIndex) {
|
|
2063
|
+
if (!this.tabsData || this.tabsData.length === 0)
|
|
2064
|
+
return [];
|
|
2065
|
+
const startIndex = groupIndex * this.TABS_PER_GROUP;
|
|
2066
|
+
const endIndex = Math.min(startIndex + this.TABS_PER_GROUP, this.tabsData.length);
|
|
2067
|
+
return this.tabsData.slice(startIndex, endIndex);
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Calcula o índice real do tab considerando a inversão vertical
|
|
2071
|
+
*/
|
|
2072
|
+
getRealTabIndex(groupDisplayIndex, tabIndexInGroup) {
|
|
2073
|
+
if (!this.tabsData)
|
|
2074
|
+
return 0;
|
|
2075
|
+
const totalGroups = Math.ceil(this.tabsData.length / this.TABS_PER_GROUP);
|
|
2076
|
+
const realGroupIndex = totalGroups - 1 - groupDisplayIndex;
|
|
2077
|
+
return realGroupIndex * this.TABS_PER_GROUP + tabIndexInGroup;
|
|
2078
|
+
}
|
|
2079
|
+
/**
|
|
2080
|
+
* Manipula a seleção de um tab
|
|
2081
|
+
*/
|
|
2082
|
+
onTabSelected(groupDisplayIndex, tabIndexInGroup) {
|
|
2083
|
+
const realIndex = this.getRealTabIndex(groupDisplayIndex, tabIndexInGroup);
|
|
2084
|
+
const tab = this.tabsData[realIndex];
|
|
2085
|
+
if (tab) {
|
|
2086
|
+
this.tabSelected.emit({ tab, index: realIndex });
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
/**
|
|
2090
|
+
* Verifica se um tab está selecionado
|
|
2091
|
+
*/
|
|
2092
|
+
isTabSelected(originalIndex) {
|
|
2093
|
+
return this.selectedTab === originalIndex;
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
TableTabsComponent.ɵfac = function TableTabsComponent_Factory(t) { return new (t || TableTabsComponent)(); };
|
|
2097
|
+
TableTabsComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TableTabsComponent, selectors: [["lib-table-tabs"]], inputs: { tabsData: "tabsData", selectedTab: "selectedTab" }, outputs: { tabSelected: "tabSelected" }, decls: 1, vars: 1, consts: [["class", "mx-auto flex flex-col", 4, "ngIf"], [1, "mx-auto", "flex", "flex-col"], [4, "ngFor", "ngForOf"], [1, "mx-auto", "flex", "flex-row"], [1, "border-2", "border-gray-300", "bg-gray-200", "px-4", "py-2", "font-medium", "transition", "hover:brightness-95", 3, "ngClass", "click"], ["class", "ml-2 text-xs font-bold", 3, "ngClass", 4, "ngIf"], [1, "ml-2", "text-xs", "font-bold", 3, "ngClass"]], template: function TableTabsComponent_Template(rf, ctx) {
|
|
2098
|
+
if (rf & 1) {
|
|
2099
|
+
i0.ɵɵtemplate(0, TableTabsComponent_div_0_Template, 2, 1, "div", 0);
|
|
2100
|
+
}
|
|
2101
|
+
if (rf & 2) {
|
|
2102
|
+
i0.ɵɵproperty("ngIf", ctx.tabsData && ctx.tabsData.length > 0);
|
|
2103
|
+
}
|
|
2104
|
+
}, dependencies: [i1$1.NgClass, i1$1.NgForOf, i1$1.NgIf], encapsulation: 2, changeDetection: 0 });
|
|
2105
|
+
(function () {
|
|
2106
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableTabsComponent, [{
|
|
2107
|
+
type: Component,
|
|
2108
|
+
args: [{ selector: 'lib-table-tabs', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mx-auto flex flex-col\" *ngIf=\"tabsData && tabsData.length > 0\">\r\n <ng-container *ngFor=\"let groupIndex of getTabGroups(); let i = index\">\r\n <div class=\"mx-auto flex flex-row\">\r\n <ng-container *ngFor=\"let tab of getTabGroup(groupIndex); let j = index\">\r\n <button\r\n class=\"border-2 border-gray-300 bg-gray-200 px-4 py-2 font-medium transition hover:brightness-95\"\r\n [ngClass]=\"\r\n isTabSelected(getRealTabIndex(i, j))\r\n ? 'border-b-0 brightness-110'\r\n : ''\r\n \"\r\n (click)=\"onTabSelected(i, j)\"\r\n >\r\n {{ tab.label }}\r\n <span\r\n *ngIf=\"tab.counter !== undefined\"\r\n class=\"ml-2 text-xs font-bold\"\r\n [ngClass]=\"tab.counterClass\"\r\n >\r\n {{ tab.counter }}\r\n </span>\r\n </button>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n</div>\r\n\r\n\r\n" }]
|
|
2109
|
+
}], null, { tabsData: [{
|
|
2110
|
+
type: Input
|
|
2111
|
+
}], selectedTab: [{
|
|
2112
|
+
type: Input
|
|
2113
|
+
}], tabSelected: [{
|
|
2114
|
+
type: Output
|
|
2115
|
+
}] });
|
|
2116
|
+
})();
|
|
2117
|
+
|
|
2118
|
+
function TableTooltipComponent_div_0_Template(rf, ctx) {
|
|
2119
|
+
if (rf & 1) {
|
|
2120
|
+
i0.ɵɵelementStart(0, "div", 1);
|
|
2121
|
+
i0.ɵɵtext(1);
|
|
2122
|
+
i0.ɵɵelementEnd();
|
|
2123
|
+
}
|
|
2124
|
+
if (rf & 2) {
|
|
2125
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
2126
|
+
i0.ɵɵstyleProp("left", ctx_r0.tooltipPosition.x, "px")("top", ctx_r0.tooltipPosition.y, "px")("pointer-events", "none");
|
|
2127
|
+
i0.ɵɵproperty("ngClass", (ctx_r0.tooltipBgColor || "bg-gray-800") + " " + (ctx_r0.tooltipTextColor || "text-white"))("ngStyle", ctx_r0.styles);
|
|
2128
|
+
i0.ɵɵadvance(1);
|
|
2129
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.tooltipContent, "\n");
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
class TableTooltipComponent {
|
|
2133
|
+
constructor() {
|
|
2134
|
+
this.styles = {};
|
|
2135
|
+
}
|
|
2136
|
+
get showTooltip() {
|
|
2137
|
+
var _a, _b;
|
|
2138
|
+
return (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.showTooltip) !== null && _b !== void 0 ? _b : false;
|
|
2139
|
+
}
|
|
2140
|
+
get tooltipContent() {
|
|
2141
|
+
var _a, _b;
|
|
2142
|
+
return (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.tooltipContent) !== null && _b !== void 0 ? _b : '';
|
|
2143
|
+
}
|
|
2144
|
+
get tooltipPosition() {
|
|
2145
|
+
var _a, _b;
|
|
2146
|
+
return (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.tooltipPosition) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
2147
|
+
}
|
|
2148
|
+
get tooltipBgColor() {
|
|
2149
|
+
var _a, _b;
|
|
2150
|
+
return (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.tooltipBgColor) !== null && _b !== void 0 ? _b : 'bg-gray-800';
|
|
2151
|
+
}
|
|
2152
|
+
get tooltipTextColor() {
|
|
2153
|
+
var _a, _b;
|
|
2154
|
+
return (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.tooltipTextColor) !== null && _b !== void 0 ? _b : 'text-white';
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
TableTooltipComponent.ɵfac = function TableTooltipComponent_Factory(t) { return new (t || TableTooltipComponent)(); };
|
|
2158
|
+
TableTooltipComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TableTooltipComponent, selectors: [["lib-table-tooltip"]], inputs: { state: "state", styles: "styles" }, decls: 1, vars: 1, consts: [["class", "fixed z-50 max-w-md break-words rounded-lg px-3 py-2 text-sm shadow-lg", 3, "ngClass", "ngStyle", "left", "top", "pointer-events", 4, "ngIf"], [1, "fixed", "z-50", "max-w-md", "break-words", "rounded-lg", "px-3", "py-2", "text-sm", "shadow-lg", 3, "ngClass", "ngStyle"]], template: function TableTooltipComponent_Template(rf, ctx) {
|
|
2159
|
+
if (rf & 1) {
|
|
2160
|
+
i0.ɵɵtemplate(0, TableTooltipComponent_div_0_Template, 2, 9, "div", 0);
|
|
2161
|
+
}
|
|
2162
|
+
if (rf & 2) {
|
|
2163
|
+
i0.ɵɵproperty("ngIf", ctx.showTooltip);
|
|
2164
|
+
}
|
|
2165
|
+
}, dependencies: [i1$1.NgClass, i1$1.NgIf, i1$1.NgStyle], encapsulation: 2, changeDetection: 0 });
|
|
2166
|
+
(function () {
|
|
2167
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableTooltipComponent, [{
|
|
2168
|
+
type: Component,
|
|
2169
|
+
args: [{ selector: 'lib-table-tooltip', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\r\n *ngIf=\"showTooltip\"\r\n class=\"fixed z-50 max-w-md break-words rounded-lg px-3 py-2 text-sm shadow-lg\"\r\n [ngClass]=\"\r\n (tooltipBgColor || 'bg-gray-800') + ' ' + (tooltipTextColor || 'text-white')\r\n \"\r\n [ngStyle]=\"styles\"\r\n [style.left.px]=\"tooltipPosition.x\"\r\n [style.top.px]=\"tooltipPosition.y\"\r\n [style.pointer-events]=\"'none'\"\r\n>\r\n {{ tooltipContent }}\r\n</div>\r\n" }]
|
|
2170
|
+
}], null, { state: [{
|
|
2171
|
+
type: Input
|
|
2172
|
+
}], styles: [{
|
|
2173
|
+
type: Input
|
|
2174
|
+
}] });
|
|
2175
|
+
})();
|
|
2176
|
+
|
|
2177
|
+
function TableComponent_div_0_div_2_button_7_i_1_Template(rf, ctx) {
|
|
2178
|
+
if (rf & 1) {
|
|
2179
|
+
i0.ɵɵelement(0, "i");
|
|
2180
|
+
}
|
|
2181
|
+
if (rf & 2) {
|
|
2182
|
+
const ctx_r16 = i0.ɵɵnextContext(4);
|
|
2183
|
+
i0.ɵɵclassMap(ctx_r16.data.actionButton.icon);
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
function TableComponent_div_0_div_2_button_7_Template(rf, ctx) {
|
|
2187
|
+
if (rf & 1) {
|
|
2188
|
+
const _r18 = i0.ɵɵgetCurrentView();
|
|
2189
|
+
i0.ɵɵelementStart(0, "button", 30);
|
|
2190
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_2_button_7_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r18); const ctx_r17 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r17.data.actionButton.method ? ctx_r17.data.actionButton.method($event) : null); });
|
|
2191
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_div_2_button_7_i_1_Template, 1, 2, "i", 31);
|
|
2192
|
+
i0.ɵɵtext(2);
|
|
2193
|
+
i0.ɵɵelementEnd();
|
|
2194
|
+
}
|
|
2195
|
+
if (rf & 2) {
|
|
2196
|
+
const ctx_r11 = i0.ɵɵnextContext(3);
|
|
2197
|
+
i0.ɵɵproperty("ngClass", ctx_r11.getActionButtonClass())("routerLink", ctx_r11.data.actionButton.routerLink);
|
|
2198
|
+
i0.ɵɵadvance(1);
|
|
2199
|
+
i0.ɵɵproperty("ngIf", ctx_r11.data.actionButton.icon);
|
|
2200
|
+
i0.ɵɵadvance(1);
|
|
2201
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r11.data.actionButton.label, " ");
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
function TableComponent_div_0_div_2_div_8_mat_option_9_Template(rf, ctx) {
|
|
2205
|
+
if (rf & 1) {
|
|
2206
|
+
i0.ɵɵelementStart(0, "mat-option", 39)(1, "div", 21);
|
|
2207
|
+
i0.ɵɵelement(2, "i", 36);
|
|
2208
|
+
i0.ɵɵelementStart(3, "span");
|
|
2209
|
+
i0.ɵɵtext(4);
|
|
2210
|
+
i0.ɵɵelementEnd()()();
|
|
2211
|
+
}
|
|
2212
|
+
if (rf & 2) {
|
|
2213
|
+
const item_r20 = ctx.$implicit;
|
|
2214
|
+
i0.ɵɵproperty("value", item_r20);
|
|
2215
|
+
i0.ɵɵadvance(4);
|
|
2216
|
+
i0.ɵɵtextInterpolate(item_r20.title);
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
function TableComponent_div_0_div_2_div_8_Template(rf, ctx) {
|
|
2220
|
+
if (rf & 1) {
|
|
2221
|
+
i0.ɵɵelementStart(0, "div", 32)(1, "div", 33)(2, "div", 34)(3, "mat-form-field", 35)(4, "mat-label", 21);
|
|
2222
|
+
i0.ɵɵelement(5, "i", 36);
|
|
2223
|
+
i0.ɵɵelementStart(6, "span");
|
|
2224
|
+
i0.ɵɵtext(7, "Ordenar por");
|
|
2225
|
+
i0.ɵɵelementEnd()();
|
|
2226
|
+
i0.ɵɵelementStart(8, "mat-select", 37);
|
|
2227
|
+
i0.ɵɵtemplate(9, TableComponent_div_0_div_2_div_8_mat_option_9_Template, 5, 2, "mat-option", 38);
|
|
2228
|
+
i0.ɵɵelementEnd()()()()();
|
|
2229
|
+
}
|
|
2230
|
+
if (rf & 2) {
|
|
2231
|
+
const ctx_r12 = i0.ɵɵnextContext(3);
|
|
2232
|
+
i0.ɵɵadvance(8);
|
|
2233
|
+
i0.ɵɵproperty("formControl", ctx_r12.selectSort);
|
|
2234
|
+
i0.ɵɵadvance(1);
|
|
2235
|
+
i0.ɵɵproperty("ngForOf", ctx_r12.sortableDropdownItems);
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
function TableComponent_div_0_div_2_div_9_div_1_div_1_mat_option_5_Template(rf, ctx) {
|
|
2239
|
+
if (rf & 1) {
|
|
2240
|
+
i0.ɵɵelementStart(0, "mat-option", 39)(1, "div", 21);
|
|
2241
|
+
i0.ɵɵelement(2, "i", 47);
|
|
2242
|
+
i0.ɵɵelementStart(3, "span");
|
|
2243
|
+
i0.ɵɵtext(4);
|
|
2244
|
+
i0.ɵɵelementEnd()()();
|
|
2245
|
+
}
|
|
2246
|
+
if (rf & 2) {
|
|
2247
|
+
const item_r30 = ctx.$implicit;
|
|
2248
|
+
i0.ɵɵproperty("value", item_r30);
|
|
2249
|
+
i0.ɵɵadvance(2);
|
|
2250
|
+
i0.ɵɵclassMap(item_r30.icon || "fa fa-filter");
|
|
2251
|
+
i0.ɵɵadvance(2);
|
|
2252
|
+
i0.ɵɵtextInterpolate(item_r30.title);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
function TableComponent_div_0_div_2_div_9_div_1_div_1_Template(rf, ctx) {
|
|
2256
|
+
if (rf & 1) {
|
|
2257
|
+
const _r32 = i0.ɵɵgetCurrentView();
|
|
2258
|
+
i0.ɵɵelementStart(0, "div", 34)(1, "mat-form-field", 35)(2, "mat-label");
|
|
2259
|
+
i0.ɵɵtext(3, "Tipo de filtro");
|
|
2260
|
+
i0.ɵɵelementEnd();
|
|
2261
|
+
i0.ɵɵelementStart(4, "mat-select", 46);
|
|
2262
|
+
i0.ɵɵlistener("selectionChange", function TableComponent_div_0_div_2_div_9_div_1_div_1_Template_mat_select_selectionChange_4_listener() { i0.ɵɵrestoreView(_r32); const ctx_r31 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r31.onSelectFilterChange()); });
|
|
2263
|
+
i0.ɵɵtemplate(5, TableComponent_div_0_div_2_div_9_div_1_div_1_mat_option_5_Template, 5, 4, "mat-option", 38);
|
|
2264
|
+
i0.ɵɵelementEnd()()();
|
|
2265
|
+
}
|
|
2266
|
+
if (rf & 2) {
|
|
2267
|
+
const ctx_r24 = i0.ɵɵnextContext(5);
|
|
2268
|
+
i0.ɵɵadvance(5);
|
|
2269
|
+
i0.ɵɵproperty("ngForOf", ctx_r24.getAvailableFilterOptions());
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
function TableComponent_div_0_div_2_div_9_div_1_div_2_Template(rf, ctx) {
|
|
2273
|
+
if (rf & 1) {
|
|
2274
|
+
const _r35 = i0.ɵɵgetCurrentView();
|
|
2275
|
+
i0.ɵɵelementStart(0, "div", 34)(1, "mat-form-field", 35)(2, "mat-label", 21);
|
|
2276
|
+
i0.ɵɵelement(3, "i", 48);
|
|
2277
|
+
i0.ɵɵelementStart(4, "span");
|
|
2278
|
+
i0.ɵɵtext(5);
|
|
2279
|
+
i0.ɵɵelementEnd()();
|
|
2280
|
+
i0.ɵɵelementStart(6, "input", 49, 50);
|
|
2281
|
+
i0.ɵɵlistener("keyup.enter", function TableComponent_div_0_div_2_div_9_div_1_div_2_Template_input_keyup_enter_6_listener($event) { i0.ɵɵrestoreView(_r35); const ctx_r34 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r34.search($event)); });
|
|
2282
|
+
i0.ɵɵelementEnd()()();
|
|
2283
|
+
}
|
|
2284
|
+
if (rf & 2) {
|
|
2285
|
+
const filterGroup_r22 = i0.ɵɵnextContext().$implicit;
|
|
2286
|
+
let tmp_0_0;
|
|
2287
|
+
i0.ɵɵadvance(5);
|
|
2288
|
+
i0.ɵɵtextInterpolate(((tmp_0_0 = filterGroup_r22.get("selectFilter")) == null ? null : tmp_0_0.value == null ? null : tmp_0_0.value.title) || "Filtrar");
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
function TableComponent_div_0_div_2_div_9_div_1_div_3_mat_option_5_Template(rf, ctx) {
|
|
2292
|
+
if (rf & 1) {
|
|
2293
|
+
i0.ɵɵelementStart(0, "mat-option", 39);
|
|
2294
|
+
i0.ɵɵtext(1);
|
|
2295
|
+
i0.ɵɵelementEnd();
|
|
2296
|
+
}
|
|
2297
|
+
if (rf & 2) {
|
|
2298
|
+
const item_r38 = ctx.$implicit;
|
|
2299
|
+
i0.ɵɵproperty("value", item_r38);
|
|
2300
|
+
i0.ɵɵadvance(1);
|
|
2301
|
+
i0.ɵɵtextInterpolate1(" ", item_r38.label, " ");
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
function TableComponent_div_0_div_2_div_9_div_1_div_3_Template(rf, ctx) {
|
|
2305
|
+
if (rf & 1) {
|
|
2306
|
+
i0.ɵɵelementStart(0, "div", 34)(1, "mat-form-field", 35)(2, "mat-label");
|
|
2307
|
+
i0.ɵɵtext(3);
|
|
2308
|
+
i0.ɵɵelementEnd();
|
|
2309
|
+
i0.ɵɵelementStart(4, "mat-select", 51);
|
|
2310
|
+
i0.ɵɵtemplate(5, TableComponent_div_0_div_2_div_9_div_1_div_3_mat_option_5_Template, 2, 2, "mat-option", 38);
|
|
2311
|
+
i0.ɵɵelementEnd()()();
|
|
2312
|
+
}
|
|
2313
|
+
if (rf & 2) {
|
|
2314
|
+
const filterGroup_r22 = i0.ɵɵnextContext().$implicit;
|
|
2315
|
+
let tmp_0_0;
|
|
2316
|
+
let tmp_1_0;
|
|
2317
|
+
i0.ɵɵadvance(3);
|
|
2318
|
+
i0.ɵɵtextInterpolate(((tmp_0_0 = filterGroup_r22.get("selectFilter")) == null ? null : tmp_0_0.value == null ? null : tmp_0_0.value.title) || "Selecione");
|
|
2319
|
+
i0.ɵɵadvance(2);
|
|
2320
|
+
i0.ɵɵproperty("ngForOf", (tmp_1_0 = filterGroup_r22.get("selectFilter")) == null ? null : tmp_1_0.value.items);
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
function TableComponent_div_0_div_2_div_9_div_1_div_4_Template(rf, ctx) {
|
|
2324
|
+
if (rf & 1) {
|
|
2325
|
+
const _r41 = i0.ɵɵgetCurrentView();
|
|
2326
|
+
i0.ɵɵelementStart(0, "div", 52)(1, "div", 53)(2, "mat-form-field", 54)(3, "mat-label", 21);
|
|
2327
|
+
i0.ɵɵelement(4, "i", 55);
|
|
2328
|
+
i0.ɵɵelementStart(5, "span");
|
|
2329
|
+
i0.ɵɵtext(6, "Data Inicial");
|
|
2330
|
+
i0.ɵɵelementEnd()();
|
|
2331
|
+
i0.ɵɵelementStart(7, "input", 56);
|
|
2332
|
+
i0.ɵɵlistener("keydown.enter", function TableComponent_div_0_div_2_div_9_div_1_div_4_Template_input_keydown_enter_7_listener($event) { i0.ɵɵrestoreView(_r41); const ctx_r40 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r40.search($event)); })("input", function TableComponent_div_0_div_2_div_9_div_1_div_4_Template_input_input_7_listener($event) { i0.ɵɵrestoreView(_r41); const i_r23 = i0.ɵɵnextContext().index; const ctx_r42 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r42.onDateInput($event, "initialDate", i_r23)); });
|
|
2333
|
+
i0.ɵɵelementEnd()();
|
|
2334
|
+
i0.ɵɵelementStart(8, "mat-form-field", 54)(9, "mat-label", 21);
|
|
2335
|
+
i0.ɵɵelement(10, "i", 55);
|
|
2336
|
+
i0.ɵɵelementStart(11, "span");
|
|
2337
|
+
i0.ɵɵtext(12, "Data Final");
|
|
2338
|
+
i0.ɵɵelementEnd()();
|
|
2339
|
+
i0.ɵɵelementStart(13, "input", 57);
|
|
2340
|
+
i0.ɵɵlistener("keydown.enter", function TableComponent_div_0_div_2_div_9_div_1_div_4_Template_input_keydown_enter_13_listener($event) { i0.ɵɵrestoreView(_r41); const ctx_r44 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r44.search($event)); })("input", function TableComponent_div_0_div_2_div_9_div_1_div_4_Template_input_input_13_listener($event) { i0.ɵɵrestoreView(_r41); const i_r23 = i0.ɵɵnextContext().index; const ctx_r45 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r45.onDateInput($event, "finalDate", i_r23)); });
|
|
2341
|
+
i0.ɵɵelementEnd()()()();
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
function TableComponent_div_0_div_2_div_9_div_1_div_5_Template(rf, ctx) {
|
|
2345
|
+
if (rf & 1) {
|
|
2346
|
+
const _r49 = i0.ɵɵgetCurrentView();
|
|
2347
|
+
i0.ɵɵelementStart(0, "div", 58)(1, "button", 59);
|
|
2348
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_2_div_9_div_1_div_5_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r49); const i_r23 = i0.ɵɵnextContext().index; const ctx_r47 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r47.removeFilter(i_r23)); });
|
|
2349
|
+
i0.ɵɵelement(2, "i", 60);
|
|
2350
|
+
i0.ɵɵelementEnd()();
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
function TableComponent_div_0_div_2_div_9_div_1_Template(rf, ctx) {
|
|
2354
|
+
if (rf & 1) {
|
|
2355
|
+
i0.ɵɵelementStart(0, "div", 42);
|
|
2356
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_div_2_div_9_div_1_div_1_Template, 6, 1, "div", 43);
|
|
2357
|
+
i0.ɵɵtemplate(2, TableComponent_div_0_div_2_div_9_div_1_div_2_Template, 8, 1, "div", 43);
|
|
2358
|
+
i0.ɵɵtemplate(3, TableComponent_div_0_div_2_div_9_div_1_div_3_Template, 6, 2, "div", 43);
|
|
2359
|
+
i0.ɵɵtemplate(4, TableComponent_div_0_div_2_div_9_div_1_div_4_Template, 14, 0, "div", 44);
|
|
2360
|
+
i0.ɵɵtemplate(5, TableComponent_div_0_div_2_div_9_div_1_div_5_Template, 3, 0, "div", 45);
|
|
2361
|
+
i0.ɵɵelementEnd();
|
|
2362
|
+
}
|
|
2363
|
+
if (rf & 2) {
|
|
2364
|
+
const filterGroup_r22 = ctx.$implicit;
|
|
2365
|
+
const ctx_r21 = i0.ɵɵnextContext(4);
|
|
2366
|
+
let tmp_2_0;
|
|
2367
|
+
let tmp_3_0;
|
|
2368
|
+
let tmp_4_0;
|
|
2369
|
+
i0.ɵɵproperty("formGroup", filterGroup_r22);
|
|
2370
|
+
i0.ɵɵadvance(1);
|
|
2371
|
+
i0.ɵɵproperty("ngIf", ctx_r21.dropdownItems.length > 0);
|
|
2372
|
+
i0.ɵɵadvance(1);
|
|
2373
|
+
i0.ɵɵproperty("ngIf", ((tmp_2_0 = filterGroup_r22.get("selectFilter")) == null ? null : tmp_2_0.value == null ? null : tmp_2_0.value.arrange) === "filter");
|
|
2374
|
+
i0.ɵɵadvance(1);
|
|
2375
|
+
i0.ɵɵproperty("ngIf", ((tmp_3_0 = filterGroup_r22.get("selectFilter")) == null ? null : tmp_3_0.value) && ((tmp_3_0 = filterGroup_r22.get("selectFilter")) == null ? null : tmp_3_0.value.hasOwnProperty("items")));
|
|
2376
|
+
i0.ɵɵadvance(1);
|
|
2377
|
+
i0.ɵɵproperty("ngIf", ((tmp_4_0 = filterGroup_r22.get("selectFilter")) == null ? null : tmp_4_0.value == null ? null : tmp_4_0.value.arrange) === "filterByDate");
|
|
2378
|
+
i0.ɵɵadvance(1);
|
|
2379
|
+
i0.ɵɵproperty("ngIf", ctx_r21.filtersForm.length > 1);
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
function TableComponent_div_0_div_2_div_9_Template(rf, ctx) {
|
|
2383
|
+
if (rf & 1) {
|
|
2384
|
+
i0.ɵɵelementStart(0, "div", 40);
|
|
2385
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_div_2_div_9_div_1_Template, 6, 6, "div", 41);
|
|
2386
|
+
i0.ɵɵelementEnd();
|
|
2387
|
+
}
|
|
2388
|
+
if (rf & 2) {
|
|
2389
|
+
const ctx_r13 = i0.ɵɵnextContext(3);
|
|
2390
|
+
i0.ɵɵadvance(1);
|
|
2391
|
+
i0.ɵɵproperty("ngForOf", ctx_r13.filtersForm.controls);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
function TableComponent_div_0_div_2_div_11_Template(rf, ctx) {
|
|
2395
|
+
if (rf & 1) {
|
|
2396
|
+
const _r51 = i0.ɵɵgetCurrentView();
|
|
2397
|
+
i0.ɵɵelementStart(0, "div")(1, "button", 61);
|
|
2398
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_2_div_11_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r51); const ctx_r50 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r50.addFilter()); });
|
|
2399
|
+
i0.ɵɵelement(2, "i", 62);
|
|
2400
|
+
i0.ɵɵtext(3, " Adicionar Filtro ");
|
|
2401
|
+
i0.ɵɵelementEnd()();
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
function TableComponent_div_0_div_2_div_12_button_7_Template(rf, ctx) {
|
|
2405
|
+
if (rf & 1) {
|
|
2406
|
+
const _r54 = i0.ɵɵgetCurrentView();
|
|
2407
|
+
i0.ɵɵelementStart(0, "button", 69);
|
|
2408
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_2_div_12_button_7_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r54); const ctx_r53 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r53.arrange && ctx_r53.downloadTable !== undefined ? ctx_r53.downloadTable(ctx_r53.arrange, ctx_r53.data.conditions || []) : null); });
|
|
2409
|
+
i0.ɵɵelement(1, "i", 70);
|
|
2410
|
+
i0.ɵɵtext(2, " Exportar ");
|
|
2411
|
+
i0.ɵɵelementEnd();
|
|
2412
|
+
}
|
|
2413
|
+
if (rf & 2) {
|
|
2414
|
+
const ctx_r52 = i0.ɵɵnextContext(4);
|
|
2415
|
+
i0.ɵɵproperty("disabled", ctx_r52.dataSource && ctx_r52.dataSource.filteredData.length <= 0);
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
function TableComponent_div_0_div_2_div_12_Template(rf, ctx) {
|
|
2419
|
+
if (rf & 1) {
|
|
2420
|
+
const _r56 = i0.ɵɵgetCurrentView();
|
|
2421
|
+
i0.ɵɵelementStart(0, "div", 63)(1, "button", 64);
|
|
2422
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_2_div_12_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r56); const ctx_r55 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r55.search()); });
|
|
2423
|
+
i0.ɵɵelement(2, "i", 65);
|
|
2424
|
+
i0.ɵɵtext(3, " Pesquisar ");
|
|
2425
|
+
i0.ɵɵelementEnd();
|
|
2426
|
+
i0.ɵɵelementStart(4, "button", 66);
|
|
2427
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_2_div_12_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r56); const ctx_r57 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r57.resetFilter()); });
|
|
2428
|
+
i0.ɵɵelement(5, "i", 67);
|
|
2429
|
+
i0.ɵɵtext(6, " Resetar ");
|
|
2430
|
+
i0.ɵɵelementEnd();
|
|
2431
|
+
i0.ɵɵtemplate(7, TableComponent_div_0_div_2_div_12_button_7_Template, 3, 1, "button", 68);
|
|
2432
|
+
i0.ɵɵelementEnd();
|
|
2433
|
+
}
|
|
2434
|
+
if (rf & 2) {
|
|
2435
|
+
const ctx_r15 = i0.ɵɵnextContext(3);
|
|
2436
|
+
i0.ɵɵadvance(7);
|
|
2437
|
+
i0.ɵɵproperty("ngIf", ctx_r15.data.download !== false && ctx_r15.downloadTable);
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
function TableComponent_div_0_div_2_Template(rf, ctx) {
|
|
2441
|
+
if (rf & 1) {
|
|
2442
|
+
i0.ɵɵelementStart(0, "div", 18)(1, "div", 19)(2, "div", 20)(3, "div", 21);
|
|
2443
|
+
i0.ɵɵelement(4, "i", 22);
|
|
2444
|
+
i0.ɵɵelementStart(5, "span", 23);
|
|
2445
|
+
i0.ɵɵtext(6, "Filtros e A\u00E7\u00F5es");
|
|
2446
|
+
i0.ɵɵelementEnd()();
|
|
2447
|
+
i0.ɵɵtemplate(7, TableComponent_div_0_div_2_button_7_Template, 3, 4, "button", 24);
|
|
2448
|
+
i0.ɵɵelementEnd()();
|
|
2449
|
+
i0.ɵɵtemplate(8, TableComponent_div_0_div_2_div_8_Template, 10, 2, "div", 25);
|
|
2450
|
+
i0.ɵɵtemplate(9, TableComponent_div_0_div_2_div_9_Template, 2, 1, "div", 26);
|
|
2451
|
+
i0.ɵɵelementStart(10, "div", 27);
|
|
2452
|
+
i0.ɵɵtemplate(11, TableComponent_div_0_div_2_div_11_Template, 4, 0, "div", 28);
|
|
2453
|
+
i0.ɵɵtemplate(12, TableComponent_div_0_div_2_div_12_Template, 8, 1, "div", 29);
|
|
2454
|
+
i0.ɵɵelementEnd()();
|
|
2455
|
+
}
|
|
2456
|
+
if (rf & 2) {
|
|
2457
|
+
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
2458
|
+
i0.ɵɵadvance(7);
|
|
2459
|
+
i0.ɵɵproperty("ngIf", ctx_r1.data.actionButton && ctx_r1.data.actionButton.condition);
|
|
2460
|
+
i0.ɵɵadvance(1);
|
|
2461
|
+
i0.ɵɵproperty("ngIf", ctx_r1.sortableDropdownItems.length > 0);
|
|
2462
|
+
i0.ɵɵadvance(1);
|
|
2463
|
+
i0.ɵɵproperty("ngIf", ctx_r1.filtersForm.controls.length > 0);
|
|
2464
|
+
i0.ɵɵadvance(2);
|
|
2465
|
+
i0.ɵɵproperty("ngIf", ctx_r1.dropdownItems.length > 0);
|
|
2466
|
+
i0.ɵɵadvance(1);
|
|
2467
|
+
i0.ɵɵproperty("ngIf", ctx_r1.hasFilterableColumn === true || ctx_r1.hasSortableColumn === true);
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
function TableComponent_div_0_div_3_button_7_i_1_Template(rf, ctx) {
|
|
2471
|
+
if (rf & 1) {
|
|
2472
|
+
i0.ɵɵelement(0, "i");
|
|
2473
|
+
}
|
|
2474
|
+
if (rf & 2) {
|
|
2475
|
+
const ctx_r61 = i0.ɵɵnextContext(4);
|
|
2476
|
+
i0.ɵɵclassMap(ctx_r61.data.actionButton.icon);
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
function TableComponent_div_0_div_3_button_7_Template(rf, ctx) {
|
|
2480
|
+
if (rf & 1) {
|
|
2481
|
+
const _r63 = i0.ɵɵgetCurrentView();
|
|
2482
|
+
i0.ɵɵelementStart(0, "button", 30);
|
|
2483
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_3_button_7_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r63); const ctx_r62 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r62.data.actionButton.method ? ctx_r62.data.actionButton.method($event) : null); });
|
|
2484
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_div_3_button_7_i_1_Template, 1, 2, "i", 31);
|
|
2485
|
+
i0.ɵɵtext(2);
|
|
2486
|
+
i0.ɵɵelementEnd();
|
|
2487
|
+
}
|
|
2488
|
+
if (rf & 2) {
|
|
2489
|
+
const ctx_r58 = i0.ɵɵnextContext(3);
|
|
2490
|
+
i0.ɵɵproperty("ngClass", ctx_r58.getActionButtonClass())("routerLink", ctx_r58.data.actionButton.routerLink);
|
|
2491
|
+
i0.ɵɵadvance(1);
|
|
2492
|
+
i0.ɵɵproperty("ngIf", ctx_r58.data.actionButton.icon);
|
|
2493
|
+
i0.ɵɵadvance(1);
|
|
2494
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r58.data.actionButton.label, " ");
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
function TableComponent_div_0_div_3_div_8_Template(rf, ctx) {
|
|
2498
|
+
if (rf & 1) {
|
|
2499
|
+
const _r66 = i0.ɵɵgetCurrentView();
|
|
2500
|
+
i0.ɵɵelementStart(0, "div", 32)(1, "mat-form-field", 35)(2, "mat-label", 21);
|
|
2501
|
+
i0.ɵɵelement(3, "i", 71);
|
|
2502
|
+
i0.ɵɵtext(4, " Buscar ");
|
|
2503
|
+
i0.ɵɵelementEnd();
|
|
2504
|
+
i0.ɵɵelementStart(5, "input", 72, 73);
|
|
2505
|
+
i0.ɵɵlistener("keyup.enter", function TableComponent_div_0_div_3_div_8_Template_input_keyup_enter_5_listener($event) { i0.ɵɵrestoreView(_r66); const ctx_r65 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r65.search($event)); })("keyup", function TableComponent_div_0_div_3_div_8_Template_input_keyup_5_listener() { i0.ɵɵrestoreView(_r66); const _r64 = i0.ɵɵreference(6); const ctx_r67 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r67.applyFilter(_r64.value)); });
|
|
2506
|
+
i0.ɵɵelementEnd();
|
|
2507
|
+
i0.ɵɵelementStart(7, "mat-icon", 74);
|
|
2508
|
+
i0.ɵɵtext(8, "search");
|
|
2509
|
+
i0.ɵɵelementEnd()()();
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
function TableComponent_div_0_div_3_div_9_div_1_div_1_div_1_mat_option_5_Template(rf, ctx) {
|
|
2513
|
+
if (rf & 1) {
|
|
2514
|
+
i0.ɵɵelementStart(0, "mat-option", 39)(1, "div", 21);
|
|
2515
|
+
i0.ɵɵelement(2, "i", 47);
|
|
2516
|
+
i0.ɵɵelementStart(3, "span");
|
|
2517
|
+
i0.ɵɵtext(4);
|
|
2518
|
+
i0.ɵɵelementEnd()()();
|
|
2519
|
+
}
|
|
2520
|
+
if (rf & 2) {
|
|
2521
|
+
const item_r80 = ctx.$implicit;
|
|
2522
|
+
i0.ɵɵproperty("value", item_r80);
|
|
2523
|
+
i0.ɵɵadvance(2);
|
|
2524
|
+
i0.ɵɵclassMap(item_r80.icon || "fa fa-filter");
|
|
2525
|
+
i0.ɵɵadvance(2);
|
|
2526
|
+
i0.ɵɵtextInterpolate(item_r80.title);
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
function TableComponent_div_0_div_3_div_9_div_1_div_1_div_1_Template(rf, ctx) {
|
|
2530
|
+
if (rf & 1) {
|
|
2531
|
+
const _r82 = i0.ɵɵgetCurrentView();
|
|
2532
|
+
i0.ɵɵelementStart(0, "div", 34)(1, "mat-form-field", 35)(2, "mat-label");
|
|
2533
|
+
i0.ɵɵtext(3, "Tipo de filtro");
|
|
2534
|
+
i0.ɵɵelementEnd();
|
|
2535
|
+
i0.ɵɵelementStart(4, "mat-select", 46);
|
|
2536
|
+
i0.ɵɵlistener("selectionChange", function TableComponent_div_0_div_3_div_9_div_1_div_1_div_1_Template_mat_select_selectionChange_4_listener() { i0.ɵɵrestoreView(_r82); const ctx_r81 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r81.onSelectFilterChange()); });
|
|
2537
|
+
i0.ɵɵtemplate(5, TableComponent_div_0_div_3_div_9_div_1_div_1_div_1_mat_option_5_Template, 5, 4, "mat-option", 38);
|
|
2538
|
+
i0.ɵɵelementEnd()()();
|
|
2539
|
+
}
|
|
2540
|
+
if (rf & 2) {
|
|
2541
|
+
const ctx_r74 = i0.ɵɵnextContext(6);
|
|
2542
|
+
i0.ɵɵadvance(5);
|
|
2543
|
+
i0.ɵɵproperty("ngForOf", ctx_r74.getAvailableFilterOptions());
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
function TableComponent_div_0_div_3_div_9_div_1_div_1_div_2_Template(rf, ctx) {
|
|
2547
|
+
if (rf & 1) {
|
|
2548
|
+
const _r85 = i0.ɵɵgetCurrentView();
|
|
2549
|
+
i0.ɵɵelementStart(0, "div", 34)(1, "mat-form-field", 35)(2, "mat-label", 21);
|
|
2550
|
+
i0.ɵɵelement(3, "i", 48);
|
|
2551
|
+
i0.ɵɵelementStart(4, "span");
|
|
2552
|
+
i0.ɵɵtext(5);
|
|
2553
|
+
i0.ɵɵelementEnd()();
|
|
2554
|
+
i0.ɵɵelementStart(6, "input", 49, 50);
|
|
2555
|
+
i0.ɵɵlistener("keyup.enter", function TableComponent_div_0_div_3_div_9_div_1_div_1_div_2_Template_input_keyup_enter_6_listener($event) { i0.ɵɵrestoreView(_r85); const ctx_r84 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r84.search($event)); });
|
|
2556
|
+
i0.ɵɵelementEnd()()();
|
|
2557
|
+
}
|
|
2558
|
+
if (rf & 2) {
|
|
2559
|
+
const filterGroup_r72 = i0.ɵɵnextContext().$implicit;
|
|
2560
|
+
let tmp_0_0;
|
|
2561
|
+
i0.ɵɵadvance(5);
|
|
2562
|
+
i0.ɵɵtextInterpolate(((tmp_0_0 = filterGroup_r72.get("selectFilter")) == null ? null : tmp_0_0.value == null ? null : tmp_0_0.value.title) || "Filtrar");
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
function TableComponent_div_0_div_3_div_9_div_1_div_1_div_3_mat_option_5_Template(rf, ctx) {
|
|
2566
|
+
if (rf & 1) {
|
|
2567
|
+
i0.ɵɵelementStart(0, "mat-option", 39);
|
|
2568
|
+
i0.ɵɵtext(1);
|
|
2569
|
+
i0.ɵɵelementEnd();
|
|
2570
|
+
}
|
|
2571
|
+
if (rf & 2) {
|
|
2572
|
+
const item_r88 = ctx.$implicit;
|
|
2573
|
+
i0.ɵɵproperty("value", item_r88);
|
|
2574
|
+
i0.ɵɵadvance(1);
|
|
2575
|
+
i0.ɵɵtextInterpolate1(" ", item_r88.label, " ");
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
function TableComponent_div_0_div_3_div_9_div_1_div_1_div_3_Template(rf, ctx) {
|
|
2579
|
+
if (rf & 1) {
|
|
2580
|
+
i0.ɵɵelementStart(0, "div", 34)(1, "mat-form-field", 35)(2, "mat-label");
|
|
2581
|
+
i0.ɵɵtext(3);
|
|
2582
|
+
i0.ɵɵelementEnd();
|
|
2583
|
+
i0.ɵɵelementStart(4, "mat-select", 51);
|
|
2584
|
+
i0.ɵɵtemplate(5, TableComponent_div_0_div_3_div_9_div_1_div_1_div_3_mat_option_5_Template, 2, 2, "mat-option", 38);
|
|
2585
|
+
i0.ɵɵelementEnd()()();
|
|
2586
|
+
}
|
|
2587
|
+
if (rf & 2) {
|
|
2588
|
+
const filterGroup_r72 = i0.ɵɵnextContext().$implicit;
|
|
2589
|
+
let tmp_0_0;
|
|
2590
|
+
let tmp_1_0;
|
|
2591
|
+
i0.ɵɵadvance(3);
|
|
2592
|
+
i0.ɵɵtextInterpolate(((tmp_0_0 = filterGroup_r72.get("selectFilter")) == null ? null : tmp_0_0.value == null ? null : tmp_0_0.value.title) || "Selecione");
|
|
2593
|
+
i0.ɵɵadvance(2);
|
|
2594
|
+
i0.ɵɵproperty("ngForOf", (tmp_1_0 = filterGroup_r72.get("selectFilter")) == null ? null : tmp_1_0.value.items);
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
function TableComponent_div_0_div_3_div_9_div_1_div_1_div_4_Template(rf, ctx) {
|
|
2598
|
+
if (rf & 1) {
|
|
2599
|
+
const _r91 = i0.ɵɵgetCurrentView();
|
|
2600
|
+
i0.ɵɵelementStart(0, "div", 52)(1, "div", 53)(2, "mat-form-field", 54)(3, "mat-label", 21);
|
|
2601
|
+
i0.ɵɵelement(4, "i", 55);
|
|
2602
|
+
i0.ɵɵelementStart(5, "span");
|
|
2603
|
+
i0.ɵɵtext(6, "Data Inicial");
|
|
2604
|
+
i0.ɵɵelementEnd()();
|
|
2605
|
+
i0.ɵɵelementStart(7, "input", 77);
|
|
2606
|
+
i0.ɵɵlistener("keydown.enter", function TableComponent_div_0_div_3_div_9_div_1_div_1_div_4_Template_input_keydown_enter_7_listener($event) { i0.ɵɵrestoreView(_r91); const ctx_r90 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r90.search($event)); })("input", function TableComponent_div_0_div_3_div_9_div_1_div_1_div_4_Template_input_input_7_listener($event) { i0.ɵɵrestoreView(_r91); const i_r73 = i0.ɵɵnextContext().index; const ctx_r92 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r92.onDateInput($event, "initialDate", i_r73)); })("blur", function TableComponent_div_0_div_3_div_9_div_1_div_1_div_4_Template_input_blur_7_listener() { i0.ɵɵrestoreView(_r91); const ctx_r94 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r94.onDateFilterChange()); });
|
|
2607
|
+
i0.ɵɵelementEnd()();
|
|
2608
|
+
i0.ɵɵelementStart(8, "mat-form-field", 54)(9, "mat-label", 21);
|
|
2609
|
+
i0.ɵɵelement(10, "i", 55);
|
|
2610
|
+
i0.ɵɵelementStart(11, "span");
|
|
2611
|
+
i0.ɵɵtext(12, "Data Final");
|
|
2612
|
+
i0.ɵɵelementEnd()();
|
|
2613
|
+
i0.ɵɵelementStart(13, "input", 78);
|
|
2614
|
+
i0.ɵɵlistener("keydown.enter", function TableComponent_div_0_div_3_div_9_div_1_div_1_div_4_Template_input_keydown_enter_13_listener($event) { i0.ɵɵrestoreView(_r91); const ctx_r95 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r95.search($event)); })("input", function TableComponent_div_0_div_3_div_9_div_1_div_1_div_4_Template_input_input_13_listener($event) { i0.ɵɵrestoreView(_r91); const i_r73 = i0.ɵɵnextContext().index; const ctx_r96 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r96.onDateInput($event, "finalDate", i_r73)); })("blur", function TableComponent_div_0_div_3_div_9_div_1_div_1_div_4_Template_input_blur_13_listener() { i0.ɵɵrestoreView(_r91); const ctx_r98 = i0.ɵɵnextContext(6); return i0.ɵɵresetView(ctx_r98.onDateFilterChange()); });
|
|
2615
|
+
i0.ɵɵelementEnd()()()();
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
function TableComponent_div_0_div_3_div_9_div_1_div_1_div_5_Template(rf, ctx) {
|
|
2619
|
+
if (rf & 1) {
|
|
2620
|
+
const _r101 = i0.ɵɵgetCurrentView();
|
|
2621
|
+
i0.ɵɵelementStart(0, "div", 58)(1, "button", 59);
|
|
2622
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_3_div_9_div_1_div_1_div_5_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r101); const i_r73 = i0.ɵɵnextContext().index; const ctx_r99 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r99.removeFilter(i_r73)); });
|
|
2623
|
+
i0.ɵɵelement(2, "i", 60);
|
|
2624
|
+
i0.ɵɵelementEnd()();
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
function TableComponent_div_0_div_3_div_9_div_1_div_1_Template(rf, ctx) {
|
|
2628
|
+
if (rf & 1) {
|
|
2629
|
+
i0.ɵɵelementStart(0, "div", 76);
|
|
2630
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_div_3_div_9_div_1_div_1_div_1_Template, 6, 1, "div", 43);
|
|
2631
|
+
i0.ɵɵtemplate(2, TableComponent_div_0_div_3_div_9_div_1_div_1_div_2_Template, 8, 1, "div", 43);
|
|
2632
|
+
i0.ɵɵtemplate(3, TableComponent_div_0_div_3_div_9_div_1_div_1_div_3_Template, 6, 2, "div", 43);
|
|
2633
|
+
i0.ɵɵtemplate(4, TableComponent_div_0_div_3_div_9_div_1_div_1_div_4_Template, 14, 0, "div", 44);
|
|
2634
|
+
i0.ɵɵtemplate(5, TableComponent_div_0_div_3_div_9_div_1_div_1_div_5_Template, 3, 0, "div", 45);
|
|
2635
|
+
i0.ɵɵelementEnd();
|
|
2636
|
+
}
|
|
2637
|
+
if (rf & 2) {
|
|
2638
|
+
const filterGroup_r72 = ctx.$implicit;
|
|
2639
|
+
const ctx_r71 = i0.ɵɵnextContext(5);
|
|
2640
|
+
let tmp_2_0;
|
|
2641
|
+
let tmp_3_0;
|
|
2642
|
+
let tmp_4_0;
|
|
2643
|
+
i0.ɵɵproperty("formGroup", filterGroup_r72);
|
|
2644
|
+
i0.ɵɵadvance(1);
|
|
2645
|
+
i0.ɵɵproperty("ngIf", ctx_r71.dropdownItems.length > 0);
|
|
2646
|
+
i0.ɵɵadvance(1);
|
|
2647
|
+
i0.ɵɵproperty("ngIf", ((tmp_2_0 = filterGroup_r72.get("selectFilter")) == null ? null : tmp_2_0.value == null ? null : tmp_2_0.value.arrange) === "filter");
|
|
2648
|
+
i0.ɵɵadvance(1);
|
|
2649
|
+
i0.ɵɵproperty("ngIf", ((tmp_3_0 = filterGroup_r72.get("selectFilter")) == null ? null : tmp_3_0.value) && ((tmp_3_0 = filterGroup_r72.get("selectFilter")) == null ? null : tmp_3_0.value.hasOwnProperty("items")));
|
|
2650
|
+
i0.ɵɵadvance(1);
|
|
2651
|
+
i0.ɵɵproperty("ngIf", ((tmp_4_0 = filterGroup_r72.get("selectFilter")) == null ? null : tmp_4_0.value == null ? null : tmp_4_0.value.arrange) === "filterByDate");
|
|
2652
|
+
i0.ɵɵadvance(1);
|
|
2653
|
+
i0.ɵɵproperty("ngIf", ctx_r71.filtersForm.length > 1);
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
function TableComponent_div_0_div_3_div_9_div_1_Template(rf, ctx) {
|
|
2657
|
+
if (rf & 1) {
|
|
2658
|
+
i0.ɵɵelementStart(0, "div", 40);
|
|
2659
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_div_3_div_9_div_1_div_1_Template, 6, 6, "div", 75);
|
|
2660
|
+
i0.ɵɵelementEnd();
|
|
2661
|
+
}
|
|
2662
|
+
if (rf & 2) {
|
|
2663
|
+
const ctx_r68 = i0.ɵɵnextContext(4);
|
|
2664
|
+
i0.ɵɵadvance(1);
|
|
2665
|
+
i0.ɵɵproperty("ngForOf", ctx_r68.filtersForm.controls);
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
function TableComponent_div_0_div_3_div_9_div_3_Template(rf, ctx) {
|
|
2669
|
+
if (rf & 1) {
|
|
2670
|
+
const _r103 = i0.ɵɵgetCurrentView();
|
|
2671
|
+
i0.ɵɵelementStart(0, "div")(1, "button", 61);
|
|
2672
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_3_div_9_div_3_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r103); const ctx_r102 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r102.addFilter()); });
|
|
2673
|
+
i0.ɵɵelement(2, "i", 62);
|
|
2674
|
+
i0.ɵɵtext(3, " Adicionar Filtro ");
|
|
2675
|
+
i0.ɵɵelementEnd()();
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
function TableComponent_div_0_div_3_div_9_div_4_button_7_Template(rf, ctx) {
|
|
2679
|
+
if (rf & 1) {
|
|
2680
|
+
const _r106 = i0.ɵɵgetCurrentView();
|
|
2681
|
+
i0.ɵɵelementStart(0, "button", 69);
|
|
2682
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_3_div_9_div_4_button_7_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r106); const ctx_r105 = i0.ɵɵnextContext(5); return i0.ɵɵresetView(ctx_r105.handleDownload()); });
|
|
2683
|
+
i0.ɵɵelement(1, "i", 70);
|
|
2684
|
+
i0.ɵɵtext(2, " Exportar ");
|
|
2685
|
+
i0.ɵɵelementEnd();
|
|
2686
|
+
}
|
|
2687
|
+
if (rf & 2) {
|
|
2688
|
+
const ctx_r104 = i0.ɵɵnextContext(5);
|
|
2689
|
+
i0.ɵɵproperty("disabled", ctx_r104.dataSource && ctx_r104.dataSource.filteredData.length <= 0);
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
function TableComponent_div_0_div_3_div_9_div_4_Template(rf, ctx) {
|
|
2693
|
+
if (rf & 1) {
|
|
2694
|
+
const _r108 = i0.ɵɵgetCurrentView();
|
|
2695
|
+
i0.ɵɵelementStart(0, "div", 63)(1, "button", 64);
|
|
2696
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_3_div_9_div_4_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r108); const ctx_r107 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r107.search()); });
|
|
2697
|
+
i0.ɵɵelement(2, "i", 65);
|
|
2698
|
+
i0.ɵɵtext(3, " Pesquisar ");
|
|
2699
|
+
i0.ɵɵelementEnd();
|
|
2700
|
+
i0.ɵɵelementStart(4, "button", 66);
|
|
2701
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_div_3_div_9_div_4_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r108); const ctx_r109 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r109.resetFilter()); });
|
|
2702
|
+
i0.ɵɵelement(5, "i", 67);
|
|
2703
|
+
i0.ɵɵtext(6, " Resetar ");
|
|
2704
|
+
i0.ɵɵelementEnd();
|
|
2705
|
+
i0.ɵɵtemplate(7, TableComponent_div_0_div_3_div_9_div_4_button_7_Template, 3, 1, "button", 68);
|
|
2706
|
+
i0.ɵɵelementEnd();
|
|
2707
|
+
}
|
|
2708
|
+
if (rf & 2) {
|
|
2709
|
+
const ctx_r70 = i0.ɵɵnextContext(4);
|
|
2710
|
+
i0.ɵɵadvance(7);
|
|
2711
|
+
i0.ɵɵproperty("ngIf", ctx_r70.data.download !== false && ctx_r70.downloadTable);
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
function TableComponent_div_0_div_3_div_9_Template(rf, ctx) {
|
|
2715
|
+
if (rf & 1) {
|
|
2716
|
+
i0.ɵɵelementStart(0, "div");
|
|
2717
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_div_3_div_9_div_1_Template, 2, 1, "div", 26);
|
|
2718
|
+
i0.ɵɵelementStart(2, "div", 27);
|
|
2719
|
+
i0.ɵɵtemplate(3, TableComponent_div_0_div_3_div_9_div_3_Template, 4, 0, "div", 28);
|
|
2720
|
+
i0.ɵɵtemplate(4, TableComponent_div_0_div_3_div_9_div_4_Template, 8, 1, "div", 29);
|
|
2721
|
+
i0.ɵɵelementEnd()();
|
|
2722
|
+
}
|
|
2723
|
+
if (rf & 2) {
|
|
2724
|
+
const ctx_r60 = i0.ɵɵnextContext(3);
|
|
2725
|
+
i0.ɵɵadvance(1);
|
|
2726
|
+
i0.ɵɵproperty("ngIf", ctx_r60.filtersForm.controls.length > 0);
|
|
2727
|
+
i0.ɵɵadvance(2);
|
|
2728
|
+
i0.ɵɵproperty("ngIf", ctx_r60.dropdownItems.length > 0);
|
|
2729
|
+
i0.ɵɵadvance(1);
|
|
2730
|
+
i0.ɵɵproperty("ngIf", ctx_r60.hasFilterableColumn === true || ctx_r60.hasSortableColumn === true);
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
function TableComponent_div_0_div_3_Template(rf, ctx) {
|
|
2734
|
+
if (rf & 1) {
|
|
2735
|
+
i0.ɵɵelementStart(0, "div", 18)(1, "div", 19)(2, "div", 20)(3, "div", 21);
|
|
2736
|
+
i0.ɵɵelement(4, "i", 22);
|
|
2737
|
+
i0.ɵɵelementStart(5, "span", 23);
|
|
2738
|
+
i0.ɵɵtext(6, "Filtros e A\u00E7\u00F5es");
|
|
2739
|
+
i0.ɵɵelementEnd()();
|
|
2740
|
+
i0.ɵɵtemplate(7, TableComponent_div_0_div_3_button_7_Template, 3, 4, "button", 24);
|
|
2741
|
+
i0.ɵɵelementEnd()();
|
|
2742
|
+
i0.ɵɵtemplate(8, TableComponent_div_0_div_3_div_8_Template, 9, 0, "div", 25);
|
|
2743
|
+
i0.ɵɵtemplate(9, TableComponent_div_0_div_3_div_9_Template, 5, 3, "div", 28);
|
|
2744
|
+
i0.ɵɵelementEnd();
|
|
2745
|
+
}
|
|
2746
|
+
if (rf & 2) {
|
|
2747
|
+
const ctx_r2 = i0.ɵɵnextContext(2);
|
|
2748
|
+
i0.ɵɵadvance(7);
|
|
2749
|
+
i0.ɵɵproperty("ngIf", ctx_r2.data.actionButton && ctx_r2.data.actionButton.condition);
|
|
2750
|
+
i0.ɵɵadvance(1);
|
|
2751
|
+
i0.ɵɵproperty("ngIf", ctx_r2.hasFilterableColumn === true && ctx_r2.data.showSimpleSearch !== false);
|
|
2752
|
+
i0.ɵɵadvance(1);
|
|
2753
|
+
i0.ɵɵproperty("ngIf", ctx_r2.dropdownItems.length > 0);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
function TableComponent_div_0_lib_table_tabs_5_Template(rf, ctx) {
|
|
2757
|
+
if (rf & 1) {
|
|
2758
|
+
const _r111 = i0.ɵɵgetCurrentView();
|
|
2759
|
+
i0.ɵɵelementStart(0, "lib-table-tabs", 79);
|
|
2760
|
+
i0.ɵɵlistener("tabSelected", function TableComponent_div_0_lib_table_tabs_5_Template_lib_table_tabs_tabSelected_0_listener($event) { i0.ɵɵrestoreView(_r111); const ctx_r110 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r110.onTabSelected($event)); });
|
|
2761
|
+
i0.ɵɵelementEnd();
|
|
2762
|
+
}
|
|
2763
|
+
if (rf & 2) {
|
|
2764
|
+
const ctx_r3 = i0.ɵɵnextContext(2);
|
|
2765
|
+
i0.ɵɵproperty("tabsData", ctx_r3.data.tabs.tabsData)("selectedTab", ctx_r3.selectedTab);
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_th_1_Template(rf, ctx) {
|
|
2769
|
+
if (rf & 1) {
|
|
2770
|
+
i0.ɵɵelementStart(0, "th", 85);
|
|
2771
|
+
i0.ɵɵtext(1);
|
|
2772
|
+
i0.ɵɵelementEnd();
|
|
2773
|
+
}
|
|
2774
|
+
if (rf & 2) {
|
|
2775
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2776
|
+
i0.ɵɵadvance(1);
|
|
2777
|
+
i0.ɵɵtextInterpolate1(" ", col_r112.title, " ");
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_th_2_Template(rf, ctx) {
|
|
2781
|
+
if (rf & 1) {
|
|
2782
|
+
i0.ɵɵelementStart(0, "th", 86);
|
|
2783
|
+
i0.ɵɵtext(1);
|
|
2784
|
+
i0.ɵɵelementEnd();
|
|
2785
|
+
}
|
|
2786
|
+
if (rf & 2) {
|
|
2787
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2788
|
+
i0.ɵɵadvance(1);
|
|
2789
|
+
i0.ɵɵtextInterpolate1(" ", col_r112.title, " ");
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_span_2_a_1_Template(rf, ctx) {
|
|
2793
|
+
if (rf & 1) {
|
|
2794
|
+
i0.ɵɵelementStart(0, "a", 92);
|
|
2795
|
+
i0.ɵɵtext(1);
|
|
2796
|
+
i0.ɵɵelementEnd();
|
|
2797
|
+
}
|
|
2798
|
+
if (rf & 2) {
|
|
2799
|
+
const row_r119 = i0.ɵɵnextContext(3).$implicit;
|
|
2800
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2801
|
+
const ctx_r127 = i0.ɵɵnextContext(2);
|
|
2802
|
+
i0.ɵɵproperty("href", row_r119[col_r112.property], i0.ɵɵsanitizeUrl);
|
|
2803
|
+
i0.ɵɵadvance(1);
|
|
2804
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r127.getDisplayValue(col_r112, row_r119), " ");
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_span_2_a_2_Template(rf, ctx) {
|
|
2808
|
+
if (rf & 1) {
|
|
2809
|
+
i0.ɵɵelementStart(0, "a", 92);
|
|
2810
|
+
i0.ɵɵtext(1);
|
|
2811
|
+
i0.ɵɵelementEnd();
|
|
2812
|
+
}
|
|
2813
|
+
if (rf & 2) {
|
|
2814
|
+
const row_r119 = i0.ɵɵnextContext(3).$implicit;
|
|
2815
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2816
|
+
const ctx_r128 = i0.ɵɵnextContext(2);
|
|
2817
|
+
i0.ɵɵproperty("href", col_r112.hasLink, i0.ɵɵsanitizeUrl);
|
|
2818
|
+
i0.ɵɵadvance(1);
|
|
2819
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r128.getDisplayValue(col_r112, row_r119), " ");
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_span_2_span_3_Template(rf, ctx) {
|
|
2823
|
+
if (rf & 1) {
|
|
2824
|
+
i0.ɵɵelementStart(0, "span");
|
|
2825
|
+
i0.ɵɵtext(1);
|
|
2826
|
+
i0.ɵɵelementEnd();
|
|
2827
|
+
}
|
|
2828
|
+
if (rf & 2) {
|
|
2829
|
+
const row_r119 = i0.ɵɵnextContext(3).$implicit;
|
|
2830
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2831
|
+
const ctx_r129 = i0.ɵɵnextContext(2);
|
|
2832
|
+
i0.ɵɵadvance(1);
|
|
2833
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r129.getDisplayValue(col_r112, row_r119), " ");
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_span_2_Template(rf, ctx) {
|
|
2837
|
+
if (rf & 1) {
|
|
2838
|
+
i0.ɵɵelementStart(0, "span");
|
|
2839
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_span_2_a_1_Template, 2, 2, "a", 91);
|
|
2840
|
+
i0.ɵɵtemplate(2, TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_span_2_a_2_Template, 2, 2, "a", 91);
|
|
2841
|
+
i0.ɵɵtemplate(3, TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_span_2_span_3_Template, 2, 1, "span", 28);
|
|
2842
|
+
i0.ɵɵelementEnd();
|
|
2843
|
+
}
|
|
2844
|
+
if (rf & 2) {
|
|
2845
|
+
const col_r112 = i0.ɵɵnextContext(4).$implicit;
|
|
2846
|
+
const ctx_r124 = i0.ɵɵnextContext(2);
|
|
2847
|
+
i0.ɵɵadvance(1);
|
|
2848
|
+
i0.ɵɵproperty("ngIf", col_r112.hasLink === true);
|
|
2849
|
+
i0.ɵɵadvance(1);
|
|
2850
|
+
i0.ɵɵproperty("ngIf", col_r112.hasLink && ctx_r124.isString(col_r112.hasLink));
|
|
2851
|
+
i0.ɵɵadvance(1);
|
|
2852
|
+
i0.ɵɵproperty("ngIf", col_r112.hasLink !== true && !ctx_r124.isString(col_r112.hasLink));
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_ng_template_3_a_0_Template(rf, ctx) {
|
|
2856
|
+
if (rf & 1) {
|
|
2857
|
+
i0.ɵɵelementStart(0, "a", 92);
|
|
2858
|
+
i0.ɵɵtext(1);
|
|
2859
|
+
i0.ɵɵelementEnd();
|
|
2860
|
+
}
|
|
2861
|
+
if (rf & 2) {
|
|
2862
|
+
const row_r119 = i0.ɵɵnextContext(3).$implicit;
|
|
2863
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2864
|
+
const ctx_r137 = i0.ɵɵnextContext(2);
|
|
2865
|
+
i0.ɵɵproperty("href", row_r119[col_r112.property], i0.ɵɵsanitizeUrl);
|
|
2866
|
+
i0.ɵɵadvance(1);
|
|
2867
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r137.getDisplayValue(col_r112, row_r119, true), " ");
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_ng_template_3_a_1_Template(rf, ctx) {
|
|
2871
|
+
if (rf & 1) {
|
|
2872
|
+
i0.ɵɵelementStart(0, "a", 92);
|
|
2873
|
+
i0.ɵɵtext(1);
|
|
2874
|
+
i0.ɵɵelementEnd();
|
|
2875
|
+
}
|
|
2876
|
+
if (rf & 2) {
|
|
2877
|
+
const row_r119 = i0.ɵɵnextContext(3).$implicit;
|
|
2878
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2879
|
+
const ctx_r138 = i0.ɵɵnextContext(2);
|
|
2880
|
+
i0.ɵɵproperty("href", col_r112.hasLink, i0.ɵɵsanitizeUrl);
|
|
2881
|
+
i0.ɵɵadvance(1);
|
|
2882
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r138.getDisplayValue(col_r112, row_r119, true), " ");
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_ng_template_3_span_2_Template(rf, ctx) {
|
|
2886
|
+
if (rf & 1) {
|
|
2887
|
+
i0.ɵɵelementStart(0, "span");
|
|
2888
|
+
i0.ɵɵtext(1);
|
|
2889
|
+
i0.ɵɵelementEnd();
|
|
2890
|
+
}
|
|
2891
|
+
if (rf & 2) {
|
|
2892
|
+
const row_r119 = i0.ɵɵnextContext(3).$implicit;
|
|
2893
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2894
|
+
const ctx_r139 = i0.ɵɵnextContext(2);
|
|
2895
|
+
i0.ɵɵadvance(1);
|
|
2896
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r139.getDisplayValue(col_r112, row_r119, true), " ");
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_ng_template_3_Template(rf, ctx) {
|
|
2900
|
+
if (rf & 1) {
|
|
2901
|
+
i0.ɵɵtemplate(0, TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_ng_template_3_a_0_Template, 2, 2, "a", 91);
|
|
2902
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_ng_template_3_a_1_Template, 2, 2, "a", 91);
|
|
2903
|
+
i0.ɵɵtemplate(2, TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_ng_template_3_span_2_Template, 2, 1, "span", 28);
|
|
2904
|
+
}
|
|
2905
|
+
if (rf & 2) {
|
|
2906
|
+
const col_r112 = i0.ɵɵnextContext(4).$implicit;
|
|
2907
|
+
const ctx_r126 = i0.ɵɵnextContext(2);
|
|
2908
|
+
i0.ɵɵproperty("ngIf", col_r112.hasLink === true);
|
|
2909
|
+
i0.ɵɵadvance(1);
|
|
2910
|
+
i0.ɵɵproperty("ngIf", col_r112.hasLink && ctx_r126.isString(col_r112.hasLink));
|
|
2911
|
+
i0.ɵɵadvance(1);
|
|
2912
|
+
i0.ɵɵproperty("ngIf", col_r112.hasLink !== true && !ctx_r126.isString(col_r112.hasLink));
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_Template(rf, ctx) {
|
|
2916
|
+
if (rf & 1) {
|
|
2917
|
+
i0.ɵɵelementStart(0, "span");
|
|
2918
|
+
i0.ɵɵelementContainerStart(1);
|
|
2919
|
+
i0.ɵɵtemplate(2, TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_span_2_Template, 4, 3, "span", 89);
|
|
2920
|
+
i0.ɵɵelementContainerEnd();
|
|
2921
|
+
i0.ɵɵtemplate(3, TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_ng_template_3_Template, 3, 3, "ng-template", null, 90, i0.ɵɵtemplateRefExtractor);
|
|
2922
|
+
i0.ɵɵelementEnd();
|
|
2923
|
+
}
|
|
2924
|
+
if (rf & 2) {
|
|
2925
|
+
const _r125 = i0.ɵɵreference(4);
|
|
2926
|
+
const row_r119 = i0.ɵɵnextContext().$implicit;
|
|
2927
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2928
|
+
i0.ɵɵadvance(2);
|
|
2929
|
+
i0.ɵɵproperty("ngIf", col_r112.charLimit && row_r119[col_r112.property] && row_r119[col_r112.property].length > col_r112.charLimit)("ngIfElse", _r125);
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_2_mat_spinner_1_Template(rf, ctx) {
|
|
2933
|
+
if (rf & 1) {
|
|
2934
|
+
i0.ɵɵelement(0, "mat-spinner", 96);
|
|
2935
|
+
}
|
|
2936
|
+
if (rf & 2) {
|
|
2937
|
+
i0.ɵɵproperty("diameter", 32);
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_2_Template(rf, ctx) {
|
|
2941
|
+
if (rf & 1) {
|
|
2942
|
+
const _r152 = i0.ɵɵgetCurrentView();
|
|
2943
|
+
i0.ɵɵelementStart(0, "div", 93);
|
|
2944
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_2_mat_spinner_1_Template, 1, 1, "mat-spinner", 94);
|
|
2945
|
+
i0.ɵɵelementStart(2, "img", 95);
|
|
2946
|
+
i0.ɵɵlistener("load", function TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_2_Template_img_load_2_listener() { i0.ɵɵrestoreView(_r152); const row_r119 = i0.ɵɵnextContext().$implicit; const col_r112 = i0.ɵɵnextContext(2).$implicit; const ctx_r150 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r150.onImageLoad(row_r119, col_r112)); })("error", function TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_2_Template_img_error_2_listener($event) { i0.ɵɵrestoreView(_r152); const row_r119 = i0.ɵɵnextContext().$implicit; const col_r112 = i0.ɵɵnextContext(2).$implicit; const ctx_r154 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r154.onImageError($event, row_r119, col_r112, col_r112.image.default)); });
|
|
2947
|
+
i0.ɵɵelementEnd()();
|
|
2948
|
+
}
|
|
2949
|
+
if (rf & 2) {
|
|
2950
|
+
const row_r119 = i0.ɵɵnextContext().$implicit;
|
|
2951
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2952
|
+
const ctx_r121 = i0.ɵɵnextContext(2);
|
|
2953
|
+
i0.ɵɵadvance(1);
|
|
2954
|
+
i0.ɵɵproperty("ngIf", ctx_r121.isImageLoading(row_r119, col_r112));
|
|
2955
|
+
i0.ɵɵadvance(1);
|
|
2956
|
+
i0.ɵɵclassProp("opacity-0", ctx_r121.isImageLoading(row_r119, col_r112));
|
|
2957
|
+
i0.ɵɵproperty("src", col_r112.image.path + "/" + row_r119[col_r112.property], i0.ɵɵsanitizeUrl)("ngClass", col_r112.image.class);
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_3_mat_spinner_1_Template(rf, ctx) {
|
|
2961
|
+
if (rf & 1) {
|
|
2962
|
+
i0.ɵɵelement(0, "mat-spinner", 96);
|
|
2963
|
+
}
|
|
2964
|
+
if (rf & 2) {
|
|
2965
|
+
i0.ɵɵproperty("diameter", 32);
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_3_Template(rf, ctx) {
|
|
2969
|
+
if (rf & 1) {
|
|
2970
|
+
const _r162 = i0.ɵɵgetCurrentView();
|
|
2971
|
+
i0.ɵɵelementStart(0, "div", 93);
|
|
2972
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_3_mat_spinner_1_Template, 1, 1, "mat-spinner", 94);
|
|
2973
|
+
i0.ɵɵelementStart(2, "img", 95);
|
|
2974
|
+
i0.ɵɵlistener("load", function TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_3_Template_img_load_2_listener() { i0.ɵɵrestoreView(_r162); const row_r119 = i0.ɵɵnextContext().$implicit; const col_r112 = i0.ɵɵnextContext(2).$implicit; const ctx_r160 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r160.onImageLoad(row_r119, col_r112)); })("error", function TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_3_Template_img_error_2_listener($event) { i0.ɵɵrestoreView(_r162); const row_r119 = i0.ɵɵnextContext().$implicit; const col_r112 = i0.ɵɵnextContext(2).$implicit; const ctx_r164 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r164.onImageError($event, row_r119, col_r112, col_r112.image.default)); });
|
|
2975
|
+
i0.ɵɵelementEnd()();
|
|
2976
|
+
}
|
|
2977
|
+
if (rf & 2) {
|
|
2978
|
+
const row_r119 = i0.ɵɵnextContext().$implicit;
|
|
2979
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
2980
|
+
const ctx_r122 = i0.ɵɵnextContext(2);
|
|
2981
|
+
i0.ɵɵadvance(1);
|
|
2982
|
+
i0.ɵɵproperty("ngIf", ctx_r122.isImageLoading(row_r119, col_r112));
|
|
2983
|
+
i0.ɵɵadvance(1);
|
|
2984
|
+
i0.ɵɵclassProp("opacity-0", ctx_r122.isImageLoading(row_r119, col_r112));
|
|
2985
|
+
i0.ɵɵproperty("src", row_r119[col_r112.property], i0.ɵɵsanitizeUrl)("ngClass", col_r112.image.class);
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_ng_container_4_button_1_span_1_Template(rf, ctx) {
|
|
2989
|
+
if (rf & 1) {
|
|
2990
|
+
i0.ɵɵelementStart(0, "span", 100);
|
|
2991
|
+
i0.ɵɵtext(1);
|
|
2992
|
+
i0.ɵɵelementEnd();
|
|
2993
|
+
}
|
|
2994
|
+
if (rf & 2) {
|
|
2995
|
+
const iconClass_r170 = i0.ɵɵnextContext().$implicit;
|
|
2996
|
+
i0.ɵɵproperty("ngClass", iconClass_r170.class);
|
|
2997
|
+
i0.ɵɵadvance(1);
|
|
2998
|
+
i0.ɵɵtextInterpolate(iconClass_r170.text);
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_ng_container_4_button_1_Template(rf, ctx) {
|
|
3002
|
+
if (rf & 1) {
|
|
3003
|
+
const _r174 = i0.ɵɵgetCurrentView();
|
|
3004
|
+
i0.ɵɵelementStart(0, "button", 98);
|
|
3005
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_ng_container_9_ng_container_1_td_3_ng_container_4_button_1_Template_button_click_0_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r174); const iconClass_r170 = restoredCtx.$implicit; const row_r119 = i0.ɵɵnextContext(2).$implicit; return i0.ɵɵresetView(iconClass_r170.buttonMethod ? iconClass_r170.buttonMethod(row_r119, $event) : $event.stopPropagation()); });
|
|
3006
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_ng_container_9_ng_container_1_td_3_ng_container_4_button_1_span_1_Template, 2, 2, "span", 99);
|
|
3007
|
+
i0.ɵɵelementEnd();
|
|
3008
|
+
}
|
|
3009
|
+
if (rf & 2) {
|
|
3010
|
+
const iconClass_r170 = ctx.$implicit;
|
|
3011
|
+
const row_r119 = i0.ɵɵnextContext(2).$implicit;
|
|
3012
|
+
i0.ɵɵadvance(1);
|
|
3013
|
+
i0.ɵɵproperty("ngIf", iconClass_r170.condition === undefined || iconClass_r170.condition !== undefined && iconClass_r170.condition(row_r119));
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_ng_container_4_Template(rf, ctx) {
|
|
3017
|
+
if (rf & 1) {
|
|
3018
|
+
i0.ɵɵelementContainerStart(0);
|
|
3019
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_ng_container_9_ng_container_1_td_3_ng_container_4_button_1_Template, 2, 1, "button", 97);
|
|
3020
|
+
i0.ɵɵelementContainerEnd();
|
|
3021
|
+
}
|
|
3022
|
+
if (rf & 2) {
|
|
3023
|
+
const col_r112 = i0.ɵɵnextContext(3).$implicit;
|
|
3024
|
+
i0.ɵɵadvance(1);
|
|
3025
|
+
i0.ɵɵproperty("ngForOf", col_r112.iconClass);
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_td_3_Template(rf, ctx) {
|
|
3029
|
+
if (rf & 1) {
|
|
3030
|
+
const _r180 = i0.ɵɵgetCurrentView();
|
|
3031
|
+
i0.ɵɵelementStart(0, "td", 87);
|
|
3032
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_ng_container_9_ng_container_1_td_3_Template_td_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r180); const row_r119 = restoredCtx.$implicit; const col_r112 = i0.ɵɵnextContext(2).$implicit; return i0.ɵɵresetView(col_r112.method ? col_r112.method(row_r119) : null); })("mouseenter", function TableComponent_div_0_ng_container_9_ng_container_1_td_3_Template_td_mouseenter_0_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r180); const row_r119 = restoredCtx.$implicit; const col_r112 = i0.ɵɵnextContext(2).$implicit; const ctx_r181 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r181.onCellMouseEnter($event, row_r119, col_r112)); })("mouseleave", function TableComponent_div_0_ng_container_9_ng_container_1_td_3_Template_td_mouseleave_0_listener() { i0.ɵɵrestoreView(_r180); const ctx_r183 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r183.onCellMouseLeave()); })("mousemove", function TableComponent_div_0_ng_container_9_ng_container_1_td_3_Template_td_mousemove_0_listener($event) { i0.ɵɵrestoreView(_r180); const ctx_r184 = i0.ɵɵnextContext(4); return i0.ɵɵresetView(ctx_r184.onCellMouseMove($event)); });
|
|
3033
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_ng_container_9_ng_container_1_td_3_span_1_Template, 5, 2, "span", 28);
|
|
3034
|
+
i0.ɵɵtemplate(2, TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_2_Template, 3, 5, "div", 88);
|
|
3035
|
+
i0.ɵɵtemplate(3, TableComponent_div_0_ng_container_9_ng_container_1_td_3_div_3_Template, 3, 5, "div", 88);
|
|
3036
|
+
i0.ɵɵtemplate(4, TableComponent_div_0_ng_container_9_ng_container_1_td_3_ng_container_4_Template, 2, 1, "ng-container", 28);
|
|
3037
|
+
i0.ɵɵelementEnd();
|
|
3038
|
+
}
|
|
3039
|
+
if (rf & 2) {
|
|
3040
|
+
const col_r112 = i0.ɵɵnextContext(2).$implicit;
|
|
3041
|
+
i0.ɵɵadvance(1);
|
|
3042
|
+
i0.ɵɵproperty("ngIf", !col_r112.image && !col_r112.iconClass && !col_r112.method);
|
|
3043
|
+
i0.ɵɵadvance(1);
|
|
3044
|
+
i0.ɵɵproperty("ngIf", col_r112.image && col_r112.image.path && !col_r112.iconClass && !col_r112.method);
|
|
3045
|
+
i0.ɵɵadvance(1);
|
|
3046
|
+
i0.ɵɵproperty("ngIf", col_r112.image && col_r112.image.url && !col_r112.iconClass && !col_r112.method);
|
|
3047
|
+
i0.ɵɵadvance(1);
|
|
3048
|
+
i0.ɵɵproperty("ngIf", col_r112.iconClass);
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
function TableComponent_div_0_ng_container_9_ng_container_1_Template(rf, ctx) {
|
|
3052
|
+
if (rf & 1) {
|
|
3053
|
+
i0.ɵɵelementContainerStart(0);
|
|
3054
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_ng_container_9_ng_container_1_th_1_Template, 2, 1, "th", 82);
|
|
3055
|
+
i0.ɵɵtemplate(2, TableComponent_div_0_ng_container_9_ng_container_1_th_2_Template, 2, 1, "th", 83);
|
|
3056
|
+
i0.ɵɵtemplate(3, TableComponent_div_0_ng_container_9_ng_container_1_td_3_Template, 5, 4, "td", 84);
|
|
3057
|
+
i0.ɵɵelementContainerEnd();
|
|
3058
|
+
}
|
|
3059
|
+
if (rf & 2) {
|
|
3060
|
+
const col_r112 = i0.ɵɵnextContext().$implicit;
|
|
3061
|
+
const ctx_r113 = i0.ɵɵnextContext(2);
|
|
3062
|
+
i0.ɵɵadvance(1);
|
|
3063
|
+
i0.ɵɵproperty("ngIf", !col_r112.isSortable || ctx_r113.data.pagination === true);
|
|
3064
|
+
i0.ɵɵadvance(1);
|
|
3065
|
+
i0.ɵɵproperty("ngIf", col_r112.isSortable && ctx_r113.data.pagination === false);
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
function TableComponent_div_0_ng_container_9_Template(rf, ctx) {
|
|
3069
|
+
if (rf & 1) {
|
|
3070
|
+
i0.ɵɵelementContainerStart(0, 80);
|
|
3071
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_ng_container_9_ng_container_1_Template, 4, 2, "ng-container", 81);
|
|
3072
|
+
i0.ɵɵelementContainerEnd();
|
|
3073
|
+
}
|
|
3074
|
+
if (rf & 2) {
|
|
3075
|
+
const col_r112 = ctx.$implicit;
|
|
3076
|
+
i0.ɵɵpropertyInterpolate("matColumnDef", col_r112.property);
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
function TableComponent_div_0_tr_10_Template(rf, ctx) {
|
|
3080
|
+
if (rf & 1) {
|
|
3081
|
+
i0.ɵɵelement(0, "tr", 101);
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
function TableComponent_div_0_tr_11_Template(rf, ctx) {
|
|
3085
|
+
if (rf & 1) {
|
|
3086
|
+
const _r189 = i0.ɵɵgetCurrentView();
|
|
3087
|
+
i0.ɵɵelementStart(0, "tr", 102);
|
|
3088
|
+
i0.ɵɵlistener("click", function TableComponent_div_0_tr_11_Template_tr_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r189); const row_r187 = restoredCtx.$implicit; const ctx_r188 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r188.goToDetails(row_r187)); });
|
|
3089
|
+
i0.ɵɵelementEnd();
|
|
3090
|
+
}
|
|
3091
|
+
if (rf & 2) {
|
|
3092
|
+
const ctx_r7 = i0.ɵɵnextContext(2);
|
|
3093
|
+
i0.ɵɵproperty("ngClass", ctx_r7.getTableRowNgClass());
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
function TableComponent_div_0_tr_12_td_1_Template(rf, ctx) {
|
|
3097
|
+
if (rf & 1) {
|
|
3098
|
+
i0.ɵɵelementStart(0, "td", 105);
|
|
3099
|
+
i0.ɵɵtext(1, " Nenhum resultado encontrado para a busca ");
|
|
3100
|
+
i0.ɵɵelementEnd();
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
function TableComponent_div_0_tr_12_Template(rf, ctx) {
|
|
3104
|
+
if (rf & 1) {
|
|
3105
|
+
i0.ɵɵelementStart(0, "tr", 103);
|
|
3106
|
+
i0.ɵɵtemplate(1, TableComponent_div_0_tr_12_td_1_Template, 2, 0, "td", 104);
|
|
3107
|
+
i0.ɵɵpipe(2, "async");
|
|
3108
|
+
i0.ɵɵelementEnd();
|
|
3109
|
+
}
|
|
3110
|
+
if (rf & 2) {
|
|
3111
|
+
const ctx_r8 = i0.ɵɵnextContext(2);
|
|
3112
|
+
i0.ɵɵadvance(1);
|
|
3113
|
+
i0.ɵɵproperty("ngIf", !i0.ɵɵpipeBind1(2, 1, ctx_r8.isLoading$));
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
function TableComponent_div_0_div_13_Template(rf, ctx) {
|
|
3117
|
+
if (rf & 1) {
|
|
3118
|
+
i0.ɵɵelementStart(0, "div", 106);
|
|
3119
|
+
i0.ɵɵelement(1, "mat-spinner");
|
|
3120
|
+
i0.ɵɵelementEnd();
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
const _c0 = function () { return [25, 50, 100]; };
|
|
3124
|
+
function TableComponent_div_0_Template(rf, ctx) {
|
|
3125
|
+
if (rf & 1) {
|
|
3126
|
+
const _r192 = i0.ɵɵgetCurrentView();
|
|
3127
|
+
i0.ɵɵelementStart(0, "div", 1)(1, "div", 2);
|
|
3128
|
+
i0.ɵɵtemplate(2, TableComponent_div_0_div_2_Template, 13, 5, "div", 3);
|
|
3129
|
+
i0.ɵɵtemplate(3, TableComponent_div_0_div_3_Template, 10, 3, "div", 3);
|
|
3130
|
+
i0.ɵɵelementStart(4, "div", 4);
|
|
3131
|
+
i0.ɵɵtemplate(5, TableComponent_div_0_lib_table_tabs_5_Template, 1, 2, "lib-table-tabs", 5);
|
|
3132
|
+
i0.ɵɵelementStart(6, "div", 6)(7, "table", 7, 8);
|
|
3133
|
+
i0.ɵɵtemplate(9, TableComponent_div_0_ng_container_9_Template, 2, 1, "ng-container", 9);
|
|
3134
|
+
i0.ɵɵtemplate(10, TableComponent_div_0_tr_10_Template, 1, 0, "tr", 10);
|
|
3135
|
+
i0.ɵɵtemplate(11, TableComponent_div_0_tr_11_Template, 1, 1, "tr", 11);
|
|
3136
|
+
i0.ɵɵtemplate(12, TableComponent_div_0_tr_12_Template, 3, 3, "tr", 12);
|
|
3137
|
+
i0.ɵɵelementEnd();
|
|
3138
|
+
i0.ɵɵtemplate(13, TableComponent_div_0_div_13_Template, 2, 0, "div", 13);
|
|
3139
|
+
i0.ɵɵpipe(14, "async");
|
|
3140
|
+
i0.ɵɵelementStart(15, "div", 14)(16, "mat-paginator", 15, 16);
|
|
3141
|
+
i0.ɵɵlistener("page", function TableComponent_div_0_Template_mat_paginator_page_16_listener($event) { i0.ɵɵrestoreView(_r192); const ctx_r191 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r191.onPageChange($event)); });
|
|
3142
|
+
i0.ɵɵelementEnd()()()()();
|
|
3143
|
+
i0.ɵɵelement(18, "lib-table-tooltip", 17);
|
|
3144
|
+
i0.ɵɵelementEnd();
|
|
3145
|
+
}
|
|
3146
|
+
if (rf & 2) {
|
|
3147
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
3148
|
+
i0.ɵɵadvance(2);
|
|
3149
|
+
i0.ɵɵproperty("ngIf", ctx_r0.data.pagination === true && (ctx_r0.dropdownItems.length > 0 || ctx_r0.sortableDropdownItems.length > 0 || ctx_r0.data.actionButton));
|
|
3150
|
+
i0.ɵɵadvance(1);
|
|
3151
|
+
i0.ɵɵproperty("ngIf", ctx_r0.data.pagination === false && (ctx_r0.hasFilterableColumn === true || ctx_r0.dropdownItems.length > 0 || ctx_r0.data.actionButton));
|
|
3152
|
+
i0.ɵɵadvance(2);
|
|
3153
|
+
i0.ɵɵproperty("ngIf", ctx_r0.data.tabs && ctx_r0.data.tabs.tabsData && ctx_r0.data.tabs.tabsData.length > 0);
|
|
3154
|
+
i0.ɵɵadvance(2);
|
|
3155
|
+
i0.ɵɵproperty("dataSource", ctx_r0.dataSource);
|
|
3156
|
+
i0.ɵɵadvance(2);
|
|
3157
|
+
i0.ɵɵproperty("ngForOf", ctx_r0.data.displayedColumns)("ngForTrackBy", ctx_r0.trackByProperty);
|
|
3158
|
+
i0.ɵɵadvance(1);
|
|
3159
|
+
i0.ɵɵproperty("matHeaderRowDef", ctx_r0.columnProperties);
|
|
3160
|
+
i0.ɵɵadvance(1);
|
|
3161
|
+
i0.ɵɵproperty("matRowDefColumns", ctx_r0.columnProperties);
|
|
3162
|
+
i0.ɵɵadvance(2);
|
|
3163
|
+
i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind1(14, 15, ctx_r0.isLoading$));
|
|
3164
|
+
i0.ɵɵadvance(3);
|
|
3165
|
+
i0.ɵɵproperty("pageSizeOptions", i0.ɵɵpureFunction0(17, _c0))("pageSize", ctx_r0.pageSize)("length", ctx_r0.totalItems)("ngClass", ctx_r0.getPaginatorNgClass());
|
|
3166
|
+
i0.ɵɵadvance(2);
|
|
3167
|
+
i0.ɵɵproperty("state", ctx_r0.tooltipState)("styles", ctx_r0.getTooltipStyles());
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
class TableComponent {
|
|
3171
|
+
// CONSTRUCTOR
|
|
3172
|
+
constructor(router, tableService, filterService, tooltipService, paginationService, firestore, el, cdr) {
|
|
3173
|
+
this.router = router;
|
|
3174
|
+
this.tableService = tableService;
|
|
3175
|
+
this.filterService = filterService;
|
|
3176
|
+
this.tooltipService = tooltipService;
|
|
3177
|
+
this.paginationService = paginationService;
|
|
3178
|
+
this.firestore = firestore;
|
|
3179
|
+
this.el = el;
|
|
3180
|
+
this.cdr = cdr;
|
|
3181
|
+
this.arrange = null;
|
|
3182
|
+
this.currentPageNumber = 1;
|
|
3183
|
+
this.currentClientPageIndex = 0;
|
|
3184
|
+
this.isLoading$ = new BehaviorSubject(false);
|
|
3185
|
+
this.items = [];
|
|
3186
|
+
this.filteredItems = [];
|
|
3187
|
+
this.lastDoc = null;
|
|
3188
|
+
this.firstDoc = null;
|
|
3189
|
+
this.sortBy = {
|
|
3190
|
+
field: TABLE_DEFAULTS.SORT_FIELD,
|
|
3191
|
+
order: TABLE_DEFAULTS.SORT_ORDER,
|
|
3192
|
+
};
|
|
3193
|
+
this.columnProperties = [];
|
|
3194
|
+
this.selectSort = new FormControl('');
|
|
3195
|
+
this.currentArrange = '';
|
|
3196
|
+
this.hasNextPage = false;
|
|
3197
|
+
this.dropdownItems = [];
|
|
3198
|
+
this.sortableDropdownItems = [];
|
|
3199
|
+
this.pageSize = TABLE_DEFAULTS.PAGE_SIZE;
|
|
3200
|
+
this.totalItems = 0;
|
|
3201
|
+
this.filterValue = null;
|
|
3202
|
+
this.hasFilterableColumn = false;
|
|
3203
|
+
this.hasSortableColumn = false;
|
|
3204
|
+
this.filterSubject = new Subject();
|
|
3205
|
+
this.debounceTimeMs = TABLE_DEFAULTS.DEBOUNCE_TIME_MS;
|
|
3206
|
+
this.selectedTab = 0;
|
|
3207
|
+
// Controle de loading de imagens
|
|
3208
|
+
this.imageLoadingState = new Map();
|
|
3209
|
+
this.destroy$ = new Subject();
|
|
3210
|
+
this.filtersForm = new FormArray([this.filterService.createFilterGroup()]);
|
|
3211
|
+
this.tooltipState = this.tooltipService.createInitialState();
|
|
3212
|
+
}
|
|
3213
|
+
getActionButtonClass() {
|
|
3214
|
+
var _a, _b;
|
|
3215
|
+
return ((((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.actionButton) === null || _b === void 0 ? void 0 : _b.colorClass) || 'bg-blue-500') +
|
|
3216
|
+
' flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white hover:opacity-70');
|
|
3217
|
+
}
|
|
3218
|
+
getTableRowNgClass() {
|
|
3219
|
+
var _a, _b;
|
|
3220
|
+
return {
|
|
3221
|
+
'example-element-row': ((_a = this.data) === null || _a === void 0 ? void 0 : _a.isNotClickable) === true,
|
|
3222
|
+
'example-element-row cursor-pointer': !((_b = this.data) === null || _b === void 0 ? void 0 : _b.isNotClickable),
|
|
3223
|
+
};
|
|
3224
|
+
}
|
|
3225
|
+
getPaginatorNgClass() {
|
|
3226
|
+
var _a, _b, _c, _d;
|
|
3227
|
+
return {
|
|
3228
|
+
'hide-length': ['filter', 'filterByDate', 'equals'].includes(this.currentArrange) ||
|
|
3229
|
+
!!((_a = this.data) === null || _a === void 0 ? void 0 : _a.filterFn),
|
|
3230
|
+
'hide-next-button': !this.hasNextPage && ((_b = this.data) === null || _b === void 0 ? void 0 : _b.pagination) === true,
|
|
3231
|
+
'hide-last-button': (!this.hasNextPage && ((_c = this.data) === null || _c === void 0 ? void 0 : _c.pagination) === true) ||
|
|
3232
|
+
!!((_d = this.data) === null || _d === void 0 ? void 0 : _d.filterFn),
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3235
|
+
// FILTER METHODS (delegados ao FilterService)
|
|
3236
|
+
createFilterGroup() {
|
|
3237
|
+
return this.filterService.createFilterGroup();
|
|
3238
|
+
}
|
|
3239
|
+
addFilter(filterData) {
|
|
3240
|
+
this.filterService.addFilter(this.filtersForm, this.data.pagination === true, filterData);
|
|
3241
|
+
}
|
|
3242
|
+
hasActiveDateFilter() {
|
|
3243
|
+
return this.filterService.hasActiveDateFilter(this.filtersForm);
|
|
3244
|
+
}
|
|
3245
|
+
getAvailableFilterOptions() {
|
|
3246
|
+
return this.filterService.getAvailableFilterOptions(this.dropdownItems, this.data.pagination === true, this.filtersForm);
|
|
3247
|
+
}
|
|
3248
|
+
onSelectFilterChange() {
|
|
3249
|
+
var _a;
|
|
3250
|
+
const lastIndex = this.filtersForm.length - 1;
|
|
3251
|
+
const lastFilter = this.filtersForm.at(lastIndex);
|
|
3252
|
+
const selectedFilter = (_a = lastFilter.get('selectFilter')) === null || _a === void 0 ? void 0 : _a.value;
|
|
3253
|
+
if (selectedFilter) {
|
|
3254
|
+
if (selectedFilter.arrange === 'filterByDate' &&
|
|
3255
|
+
this.data.pagination === true) {
|
|
3256
|
+
return;
|
|
3257
|
+
}
|
|
3258
|
+
this.addFilter();
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
removeFilter(index) {
|
|
3262
|
+
this.filterService.removeFilter(this.filtersForm, index);
|
|
3263
|
+
}
|
|
3264
|
+
removeAllFilters() {
|
|
3265
|
+
this.filterService.removeAllFilters(this.filtersForm);
|
|
3266
|
+
this.resetFilter();
|
|
3267
|
+
}
|
|
3268
|
+
onDateInput(event, controlName, filterIndex) {
|
|
3269
|
+
const filterGroup = this.filtersForm.at(filterIndex);
|
|
3270
|
+
this.filterService.applyDateMask(event, controlName, filterGroup);
|
|
3271
|
+
}
|
|
3272
|
+
onDateFilterChange() {
|
|
3273
|
+
if (this.data.pagination === false) {
|
|
3274
|
+
this.arrange = this.filterService.buildArrangeFromFilters(this.filtersForm, this.sortBy);
|
|
3275
|
+
this.applyFiltersToDataSource();
|
|
3276
|
+
this.cdr.markForCheck();
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
applyFiltersToDataSource() {
|
|
3280
|
+
if (!this.dataSource)
|
|
3281
|
+
return;
|
|
3282
|
+
let filteredItems = this.filterService.applyClientSideFilters([...this.items], this.filtersForm, this.sortBy);
|
|
3283
|
+
this.dataSource.data = filteredItems;
|
|
3284
|
+
this.filteredItems = filteredItems;
|
|
3285
|
+
this.totalItems = filteredItems.length;
|
|
3286
|
+
this.cdr.markForCheck();
|
|
3287
|
+
}
|
|
3288
|
+
applyClientSideFilters(items) {
|
|
3289
|
+
return this.filterService.applyClientSideFilters(items, this.filtersForm, this.sortBy);
|
|
3290
|
+
}
|
|
3291
|
+
buildArrangeFromFilters() {
|
|
3292
|
+
return this.filterService.buildArrangeFromFilters(this.filtersForm, this.sortBy);
|
|
3293
|
+
}
|
|
3294
|
+
// TOOLTIP METHODS (delegados ao TooltipService)
|
|
3295
|
+
getTooltipStyles() {
|
|
3296
|
+
return this.tooltipService.getTooltipStyles(this.tooltipState);
|
|
3297
|
+
}
|
|
3298
|
+
onCellMouseEnter(event, row, col) {
|
|
3299
|
+
this.tooltipService.handleMouseEnter(event, row, col, (c, r, w) => this.getDisplayValue(c, r, w), (state) => {
|
|
3300
|
+
this.tooltipState = Object.assign(Object.assign({}, this.tooltipState), state);
|
|
3301
|
+
this.cdr.markForCheck();
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
onCellMouseLeave() {
|
|
3305
|
+
this.tooltipService.handleMouseLeave((state) => {
|
|
3306
|
+
this.tooltipState = state;
|
|
3307
|
+
this.cdr.markForCheck();
|
|
3308
|
+
});
|
|
3309
|
+
}
|
|
3310
|
+
onCellMouseMove(event) {
|
|
3311
|
+
this.tooltipService.handleMouseMove(event, this.tooltipState.showTooltip, (position) => {
|
|
3312
|
+
this.tooltipState = Object.assign(Object.assign({}, this.tooltipState), { tooltipPosition: position });
|
|
3313
|
+
this.cdr.markForCheck();
|
|
3314
|
+
});
|
|
3315
|
+
}
|
|
3316
|
+
// TAB METHODS
|
|
3317
|
+
onTabSelected(event) {
|
|
3318
|
+
var _a;
|
|
3319
|
+
if (!((_a = this.data.tabs) === null || _a === void 0 ? void 0 : _a.method))
|
|
3320
|
+
return;
|
|
3321
|
+
this.selectedTab = event.index;
|
|
3322
|
+
this.data.tabs.method(event.tab, event.index);
|
|
3323
|
+
this.cdr.markForCheck();
|
|
3324
|
+
}
|
|
3325
|
+
// UTILITY METHODS (delegados aos utils)
|
|
3326
|
+
getDisplayValue(col, row, withinLimit = false) {
|
|
3327
|
+
return getDisplayValue(col, row, withinLimit);
|
|
3328
|
+
}
|
|
3329
|
+
getNestedValue(obj, path) {
|
|
3330
|
+
return getNestedValue(obj, path);
|
|
3331
|
+
}
|
|
3332
|
+
isString(value) {
|
|
3333
|
+
return isString(value);
|
|
3334
|
+
}
|
|
3335
|
+
trackByProperty(_index, col) {
|
|
3336
|
+
return trackByProperty(_index, col);
|
|
3337
|
+
}
|
|
3338
|
+
// IMAGE LOADING METHODS
|
|
3339
|
+
getImageKey(row, col) {
|
|
3340
|
+
return getImageKey(row, col);
|
|
3341
|
+
}
|
|
3342
|
+
isImageLoading(row, col) {
|
|
3343
|
+
const key = this.getImageKey(row, col);
|
|
3344
|
+
return !this.imageLoadingState.has(key);
|
|
3345
|
+
}
|
|
3346
|
+
onImageLoad(row, col) {
|
|
3347
|
+
const key = this.getImageKey(row, col);
|
|
3348
|
+
this.imageLoadingState.set(key, true);
|
|
3349
|
+
this.cdr.markForCheck();
|
|
3350
|
+
}
|
|
3351
|
+
onImageError(event, row, col, defaultImage) {
|
|
3352
|
+
const key = this.getImageKey(row, col);
|
|
3353
|
+
this.imageLoadingState.set(key, true);
|
|
3354
|
+
const target = event.target;
|
|
3355
|
+
if (target) {
|
|
3356
|
+
if (defaultImage) {
|
|
3357
|
+
target.src = defaultImage;
|
|
3358
|
+
target.onerror = null;
|
|
3359
|
+
}
|
|
3360
|
+
else {
|
|
3361
|
+
target.style.display = 'none';
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
this.cdr.markForCheck();
|
|
3365
|
+
}
|
|
3366
|
+
// LIFECYCLE METHODS
|
|
3367
|
+
ngOnChanges(changes) {
|
|
3368
|
+
if (changes['data']) {
|
|
3369
|
+
setTimeout(() => this.applyCustomColors(), 0);
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
ngAfterViewInit() {
|
|
3373
|
+
this.applyCustomColors();
|
|
3374
|
+
}
|
|
3375
|
+
ngOnDestroy() {
|
|
3376
|
+
this.tooltipService.destroy();
|
|
3377
|
+
this.destroy$.next();
|
|
3378
|
+
this.destroy$.complete();
|
|
3379
|
+
}
|
|
3380
|
+
applyCustomColors() {
|
|
3381
|
+
var _a, _b, _c;
|
|
3382
|
+
const hostElement = (_a = this.el) === null || _a === void 0 ? void 0 : _a.nativeElement;
|
|
3383
|
+
if (!hostElement || !this.data)
|
|
3384
|
+
return;
|
|
3385
|
+
if ((_b = this.data.color) === null || _b === void 0 ? void 0 : _b.bg) {
|
|
3386
|
+
hostElement.style.setProperty('--table-color', this.data.color.bg);
|
|
3387
|
+
hostElement.style.setProperty('--table-header-bg', this.data.color.bg);
|
|
3388
|
+
}
|
|
3389
|
+
if ((_c = this.data.color) === null || _c === void 0 ? void 0 : _c.text) {
|
|
3390
|
+
hostElement.style.setProperty('--table-text-color', this.data.color.text);
|
|
3391
|
+
hostElement.style.setProperty('--table-header-text', this.data.color.text);
|
|
3392
|
+
}
|
|
3393
|
+
setTimeout(() => {
|
|
3394
|
+
const headerCells = hostElement.querySelectorAll('.mat-header-cell, .mat-mdc-header-cell, th.mat-header-cell, th.mat-mdc-header-cell');
|
|
3395
|
+
headerCells.forEach((cell) => {
|
|
3396
|
+
var _a, _b;
|
|
3397
|
+
if ((_a = this.data.color) === null || _a === void 0 ? void 0 : _a.bg) {
|
|
3398
|
+
cell.style.backgroundColor = this.data.color.bg;
|
|
3399
|
+
}
|
|
3400
|
+
if ((_b = this.data.color) === null || _b === void 0 ? void 0 : _b.text) {
|
|
3401
|
+
cell.style.color = this.data.color.text;
|
|
3402
|
+
}
|
|
3403
|
+
});
|
|
3404
|
+
}, 100);
|
|
3405
|
+
}
|
|
3406
|
+
ngOnInit() {
|
|
3407
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3408
|
+
if (!this.data.color) {
|
|
3409
|
+
this.data.color = {
|
|
3410
|
+
bg: TABLE_DEFAULTS.DEFAULT_BG_COLOR,
|
|
3411
|
+
text: TABLE_DEFAULTS.DEFAULT_TEXT_COLOR,
|
|
3412
|
+
};
|
|
3413
|
+
}
|
|
3414
|
+
if (this.data.showSimpleSearch === undefined) {
|
|
3415
|
+
this.data.showSimpleSearch = true;
|
|
3416
|
+
}
|
|
3417
|
+
this.columnProperties = this.data.displayedColumns.map((column) => column.property);
|
|
3418
|
+
this.cdr.markForCheck();
|
|
3419
|
+
if (this.data.actionButton && !this.data.actionButton.condition) {
|
|
3420
|
+
this.data.actionButton.condition = (_row) => true;
|
|
3421
|
+
}
|
|
3422
|
+
// Inicializar dropdownItems usando FilterService
|
|
3423
|
+
const filterConfig = this.filterService.initializeDropdownItems(this.data.displayedColumns);
|
|
3424
|
+
this.dropdownItems = filterConfig.dropdownItems;
|
|
3425
|
+
this.sortableDropdownItems = filterConfig.sortableDropdownItems;
|
|
3426
|
+
this.hasFilterableColumn = filterConfig.hasFilterableColumn;
|
|
3427
|
+
this.hasSortableColumn = filterConfig.hasSortableColumn;
|
|
3428
|
+
if (this.data.filterableOptions) {
|
|
3429
|
+
this.dropdownItems = this.filterService.addFilterableOptions(this.dropdownItems, this.data.filterableOptions);
|
|
3430
|
+
}
|
|
3431
|
+
// Sem paginação
|
|
3432
|
+
if (this.data.pagination === false) {
|
|
3433
|
+
yield this.loadItems();
|
|
3434
|
+
this.cdr.markForCheck();
|
|
3435
|
+
}
|
|
3436
|
+
// Com paginação
|
|
3437
|
+
if (this.data.pagination === true) {
|
|
3438
|
+
if (this.data.sortBy) {
|
|
3439
|
+
this.sortBy = {
|
|
3440
|
+
field: this.data.sortBy.field,
|
|
3441
|
+
order: this.data.sortBy.order,
|
|
3442
|
+
};
|
|
3443
|
+
}
|
|
3444
|
+
this.filterSubject
|
|
3445
|
+
.pipe(debounceTime(this.debounceTimeMs), takeUntil(this.destroy$))
|
|
3446
|
+
.subscribe(() => {
|
|
3447
|
+
this.loadItemsPaginated('reload', true);
|
|
3448
|
+
});
|
|
3449
|
+
this.isLoading$.next(true);
|
|
3450
|
+
this.cdr.markForCheck();
|
|
3451
|
+
yield this.loadItemsPaginated('reload', true);
|
|
3452
|
+
this.sort.active = 'createdAt';
|
|
3453
|
+
this.sort.direction = 'desc';
|
|
3454
|
+
this.dataSource.paginator = this.paginator;
|
|
3455
|
+
this.dataSource.sort = this.sort;
|
|
3456
|
+
this.totalItems = 0;
|
|
3457
|
+
if (this.data.totalRef) {
|
|
3458
|
+
for (const totalRef of this.data.totalRef) {
|
|
3459
|
+
const totalRefDoc = yield totalRef.ref.get();
|
|
3460
|
+
const docData = totalRefDoc.data();
|
|
3461
|
+
if (docData && docData[totalRef.field]) {
|
|
3462
|
+
const fieldValue = docData[totalRef.field];
|
|
3463
|
+
this.totalItems = (this.totalItems +
|
|
3464
|
+
(typeof fieldValue === 'number' ? fieldValue : 0));
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
this.isLoading$.next(false);
|
|
3469
|
+
this.cdr.markForCheck();
|
|
3470
|
+
}
|
|
3471
|
+
});
|
|
3472
|
+
}
|
|
3473
|
+
// DATA LOADING METHODS
|
|
3474
|
+
loadItems() {
|
|
3475
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3476
|
+
this.imageLoadingState.clear();
|
|
3477
|
+
this.items = (yield this.tableService.getItems(this.data.collectionRef));
|
|
3478
|
+
if (this.data.conditions) {
|
|
3479
|
+
this.filterItems();
|
|
3480
|
+
}
|
|
3481
|
+
yield this.loadRelations();
|
|
3482
|
+
yield this.loadQueryLengths();
|
|
3483
|
+
this.totalItems = this.items.length;
|
|
3484
|
+
this.arrange = {
|
|
3485
|
+
filters: [],
|
|
3486
|
+
sortBy: this.data.sortBy || {
|
|
3487
|
+
field: TABLE_DEFAULTS.SORT_FIELD,
|
|
3488
|
+
order: TABLE_DEFAULTS.SORT_ORDER,
|
|
3489
|
+
},
|
|
3490
|
+
};
|
|
3491
|
+
this.sortBy = this.data.sortBy || {
|
|
3492
|
+
field: TABLE_DEFAULTS.SORT_FIELD,
|
|
3493
|
+
order: TABLE_DEFAULTS.SORT_ORDER,
|
|
3494
|
+
};
|
|
3495
|
+
let itemsToDisplay = [...this.items];
|
|
3496
|
+
itemsToDisplay = this.applyClientSideFilters(itemsToDisplay);
|
|
3497
|
+
this.filteredItems = itemsToDisplay;
|
|
3498
|
+
this.dataSource = new MatTableDataSource(itemsToDisplay);
|
|
3499
|
+
this.dataSource.paginator = this.paginator;
|
|
3500
|
+
this.dataSource.sort = this.sort;
|
|
3501
|
+
if (this.data.sortBy) {
|
|
3502
|
+
this.dataSource.sort.active = this.data.sortBy.field;
|
|
3503
|
+
this.dataSource.sort.direction = this.data.sortBy.order;
|
|
3504
|
+
this.dataSource.sort.sortChange.emit();
|
|
3505
|
+
}
|
|
3506
|
+
this.dataSource.filterPredicate = (data, filter) => {
|
|
3507
|
+
const item = data;
|
|
3508
|
+
return this.data.displayedColumns.some((col) => {
|
|
3509
|
+
if (col.filterPredicates) {
|
|
3510
|
+
return col.filterPredicates.some((predicate) => {
|
|
3511
|
+
const propertyValue = item[col.property];
|
|
3512
|
+
if (!propertyValue || typeof propertyValue !== 'object') {
|
|
3513
|
+
return false;
|
|
3514
|
+
}
|
|
3515
|
+
const propertyRecord = propertyValue;
|
|
3516
|
+
const predicateValue = propertyRecord[predicate];
|
|
3517
|
+
if (predicateValue === null || predicateValue === undefined) {
|
|
3518
|
+
return false;
|
|
3519
|
+
}
|
|
3520
|
+
return String(predicateValue)
|
|
3521
|
+
.trim()
|
|
3522
|
+
.toLocaleLowerCase()
|
|
3523
|
+
.includes(filter);
|
|
3524
|
+
});
|
|
3525
|
+
}
|
|
3526
|
+
if (col.property && col.isFilterable) {
|
|
3527
|
+
const propertyValue = item[col.property];
|
|
3528
|
+
if (propertyValue === null || propertyValue === undefined) {
|
|
3529
|
+
return false;
|
|
3530
|
+
}
|
|
3531
|
+
return String(propertyValue)
|
|
3532
|
+
.trim()
|
|
3533
|
+
.toLocaleLowerCase()
|
|
3534
|
+
.includes(filter);
|
|
3535
|
+
}
|
|
3536
|
+
return false;
|
|
3537
|
+
});
|
|
3538
|
+
};
|
|
3539
|
+
this.filterPredicate = this.dataSource.filterPredicate;
|
|
3540
|
+
this.cdr.markForCheck();
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
loadItemsPaginated(navigation = 'reload', reset = false) {
|
|
3544
|
+
var _a;
|
|
3545
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3546
|
+
this.imageLoadingState.clear();
|
|
3547
|
+
if (reset && ['forward', 'reload'].includes(navigation)) {
|
|
3548
|
+
this.lastDoc = null;
|
|
3549
|
+
this.currentClientPageIndex = 0;
|
|
3550
|
+
}
|
|
3551
|
+
if (reset && ['backward', 'reload'].includes(navigation)) {
|
|
3552
|
+
this.firstDoc = null;
|
|
3553
|
+
this.currentClientPageIndex = 0;
|
|
3554
|
+
}
|
|
3555
|
+
const activeFilters = this.filterService.extractActiveFilters(this.filtersForm);
|
|
3556
|
+
this.arrange = {
|
|
3557
|
+
filters: activeFilters,
|
|
3558
|
+
sortBy: this.sortBy,
|
|
3559
|
+
};
|
|
3560
|
+
const paginated = {
|
|
3561
|
+
batchSize: this.pageSize,
|
|
3562
|
+
collection: this.data.collection,
|
|
3563
|
+
doc: { lastDoc: this.lastDoc, firstDoc: this.firstDoc },
|
|
3564
|
+
navigation,
|
|
3565
|
+
arrange: this.arrange,
|
|
3566
|
+
conditions: this.data.conditions,
|
|
3567
|
+
size: this.totalItems,
|
|
3568
|
+
filterFn: this.data.filterFn,
|
|
3569
|
+
clientPageIndex: this.currentClientPageIndex,
|
|
3570
|
+
};
|
|
3571
|
+
const result = yield this.tableService.getPaginated(paginated);
|
|
3572
|
+
this.items = result.items;
|
|
3573
|
+
yield this.loadRelations();
|
|
3574
|
+
yield this.loadQueryLengths();
|
|
3575
|
+
this.lastDoc = result.lastDoc;
|
|
3576
|
+
this.firstDoc = result.firstDoc;
|
|
3577
|
+
if (result.currentClientPageIndex !== undefined) {
|
|
3578
|
+
this.currentClientPageIndex = result.currentClientPageIndex;
|
|
3579
|
+
}
|
|
3580
|
+
let sum = 0;
|
|
3581
|
+
if (this.data.totalRef) {
|
|
3582
|
+
for (const totalRef of this.data.totalRef) {
|
|
3583
|
+
const totalRefDoc = yield totalRef.ref.get();
|
|
3584
|
+
const docData = totalRefDoc.data();
|
|
3585
|
+
if (docData || result.filterLength) {
|
|
3586
|
+
const fieldValue = docData ? docData[totalRef.field] : undefined;
|
|
3587
|
+
const numericValue = typeof fieldValue === 'number' ? fieldValue : 0;
|
|
3588
|
+
sum = (_a = result.filterLength) !== null && _a !== void 0 ? _a : (sum + numericValue);
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
this.totalItems = sum;
|
|
3592
|
+
}
|
|
3593
|
+
this.hasNextPage = result.hasNextPage;
|
|
3594
|
+
this.dataSource = new MatTableDataSource(this.items);
|
|
3595
|
+
this.filterPredicate = this.dataSource.filterPredicate;
|
|
3596
|
+
this.cdr.markForCheck();
|
|
3597
|
+
});
|
|
3598
|
+
}
|
|
3599
|
+
// PAGINATION METHODS
|
|
3600
|
+
onPageChange(event) {
|
|
3601
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3602
|
+
if (this.data.pagination !== true || !event)
|
|
3603
|
+
return;
|
|
3604
|
+
this.isLoading$.next(true);
|
|
3605
|
+
const currentState = {
|
|
3606
|
+
currentPageNumber: this.currentPageNumber,
|
|
3607
|
+
currentClientPageIndex: this.currentClientPageIndex,
|
|
3608
|
+
pageSize: this.pageSize,
|
|
3609
|
+
totalItems: this.totalItems,
|
|
3610
|
+
hasNextPage: this.hasNextPage,
|
|
3611
|
+
};
|
|
3612
|
+
const navigation = this.paginationService.calculateNavigation(event, currentState);
|
|
3613
|
+
if (!navigation.shouldNavigate) {
|
|
3614
|
+
this.isLoading$.next(false);
|
|
3615
|
+
this.pageEvent = event;
|
|
3616
|
+
return;
|
|
3617
|
+
}
|
|
3618
|
+
// Atualizar estado local
|
|
3619
|
+
this.currentClientPageIndex = navigation.newClientPageIndex;
|
|
3620
|
+
this.currentPageNumber = navigation.newPageNumber;
|
|
3621
|
+
// Atualizar pageSize se mudou
|
|
3622
|
+
if (event.pageSize !== this.pageSize) {
|
|
3623
|
+
this.pageSize = event.pageSize;
|
|
3624
|
+
}
|
|
3625
|
+
// Ajustar pageSize temporariamente para última página se necessário
|
|
3626
|
+
const lastPageIndex = this.paginationService.calculateLastPageIndex(this.totalItems, event.pageSize);
|
|
3627
|
+
let originalPageSize = null;
|
|
3628
|
+
if (event.pageIndex === lastPageIndex &&
|
|
3629
|
+
navigation.direction === 'backward' &&
|
|
3630
|
+
navigation.resetDocs) {
|
|
3631
|
+
const itemsExpectedInLastPage = this.paginationService.calculateLastPageItemCount(this.totalItems, event.pageSize);
|
|
3632
|
+
if (itemsExpectedInLastPage > 0 &&
|
|
3633
|
+
itemsExpectedInLastPage < event.pageSize) {
|
|
3634
|
+
originalPageSize = this.pageSize;
|
|
3635
|
+
this.pageSize = itemsExpectedInLastPage;
|
|
3636
|
+
}
|
|
3637
|
+
}
|
|
3638
|
+
try {
|
|
3639
|
+
yield this.loadItemsPaginated(navigation.direction, navigation.resetDocs);
|
|
3640
|
+
}
|
|
3641
|
+
catch (error) {
|
|
3642
|
+
console.error('Erro ao carregar itens paginados:', error);
|
|
3643
|
+
}
|
|
3644
|
+
finally {
|
|
3645
|
+
if (originalPageSize !== null) {
|
|
3646
|
+
this.pageSize = originalPageSize;
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
this.pageEvent = event;
|
|
3650
|
+
this.isLoading$.next(false);
|
|
3651
|
+
this.cdr.markForCheck();
|
|
3652
|
+
});
|
|
3653
|
+
}
|
|
3654
|
+
// FILTER/SEARCH METHODS
|
|
3655
|
+
applyFilter(value) {
|
|
3656
|
+
if (this.data.pagination === false) {
|
|
3657
|
+
this.dataSource.filter = String(value).trim().toLowerCase();
|
|
3658
|
+
}
|
|
3659
|
+
if (this.data.pagination === true) {
|
|
3660
|
+
this.filterValue = value;
|
|
3661
|
+
this.filterSubject.next(this.filterValue);
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
search(event) {
|
|
3665
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3666
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3667
|
+
if (event) {
|
|
3668
|
+
event.preventDefault();
|
|
3669
|
+
event.stopPropagation();
|
|
3670
|
+
}
|
|
3671
|
+
if (this.selectSort.value) {
|
|
3672
|
+
if (this.selectSort.value.arrange === 'ascending') {
|
|
3673
|
+
this.sortBy = {
|
|
3674
|
+
field: this.selectSort.value.property,
|
|
3675
|
+
order: 'asc',
|
|
3676
|
+
};
|
|
3677
|
+
}
|
|
3678
|
+
if (this.selectSort.value.arrange === 'descending') {
|
|
3679
|
+
this.sortBy = {
|
|
3680
|
+
field: this.selectSort.value.property,
|
|
3681
|
+
order: 'desc',
|
|
3682
|
+
};
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
if (this.data.pagination === false) {
|
|
3686
|
+
this.arrange = this.buildArrangeFromFilters();
|
|
3687
|
+
this.applyFiltersToDataSource();
|
|
3688
|
+
this.currentArrange =
|
|
3689
|
+
this.filtersForm.length > 0
|
|
3690
|
+
? ((_c = (_b = (_a = this.filtersForm.at(0).get('selectFilter')) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.arrange) !== null && _c !== void 0 ? _c : '')
|
|
3691
|
+
: '';
|
|
3692
|
+
this.cdr.markForCheck();
|
|
3693
|
+
}
|
|
3694
|
+
else {
|
|
3695
|
+
yield this.loadItemsPaginated('reload', true);
|
|
3696
|
+
this.currentArrange =
|
|
3697
|
+
this.filtersForm.length > 0
|
|
3698
|
+
? ((_f = (_e = (_d = this.filtersForm.at(0).get('selectFilter')) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.arrange) !== null && _f !== void 0 ? _f : '')
|
|
3699
|
+
: '';
|
|
3700
|
+
this.paginator.firstPage();
|
|
3701
|
+
this.cdr.markForCheck();
|
|
3702
|
+
}
|
|
3703
|
+
});
|
|
3704
|
+
}
|
|
3705
|
+
resetFilter() {
|
|
3706
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3707
|
+
this.dataSource.filter = '';
|
|
3708
|
+
if (this.filterPredicate) {
|
|
3709
|
+
this.dataSource.filterPredicate = this.filterPredicate;
|
|
3710
|
+
}
|
|
3711
|
+
this.filtersForm.clear();
|
|
3712
|
+
this.addFilter();
|
|
3713
|
+
this.selectSort.patchValue('');
|
|
3714
|
+
this.sortBy = {
|
|
3715
|
+
order: this.data.sortBy ? this.data.sortBy.order : 'desc',
|
|
3716
|
+
field: this.data.sortBy ? this.data.sortBy.field : 'createdAt',
|
|
3717
|
+
};
|
|
3718
|
+
if (this.data.pagination === false) {
|
|
3719
|
+
this.arrange = {
|
|
3720
|
+
filters: [],
|
|
3721
|
+
sortBy: this.sortBy,
|
|
3722
|
+
};
|
|
3723
|
+
this.dataSource.data = [...this.items];
|
|
3724
|
+
this.totalItems = this.items.length;
|
|
3725
|
+
this.currentArrange = '';
|
|
3726
|
+
this.cdr.markForCheck();
|
|
3727
|
+
}
|
|
3728
|
+
else {
|
|
3729
|
+
yield this.loadItemsPaginated('reload', true);
|
|
3730
|
+
this.currentArrange = '';
|
|
3731
|
+
this.paginator.firstPage();
|
|
3732
|
+
this.cdr.markForCheck();
|
|
3733
|
+
}
|
|
3734
|
+
});
|
|
3735
|
+
}
|
|
3736
|
+
// NAVIGATION METHODS
|
|
3737
|
+
goToDetails(row) {
|
|
3738
|
+
if (this.data.isNotClickable) {
|
|
3739
|
+
return;
|
|
3740
|
+
}
|
|
3741
|
+
const urlPath = this.data.url || this.data.name;
|
|
3742
|
+
const rowWithId = row;
|
|
3743
|
+
const url = this.router.serializeUrl(this.router.createUrlTree([`/${urlPath}`, rowWithId.id]));
|
|
3744
|
+
window.open(url, '_blank');
|
|
3745
|
+
}
|
|
3746
|
+
// RELATION METHODS
|
|
3747
|
+
getRelation(params) {
|
|
3748
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3749
|
+
try {
|
|
3750
|
+
let snapshot;
|
|
3751
|
+
if (params.id !== '' &&
|
|
3752
|
+
params.id !== undefined &&
|
|
3753
|
+
params.collection !== undefined &&
|
|
3754
|
+
params.collection !== '') {
|
|
3755
|
+
snapshot = yield firstValueFrom(this.firestore.collection(params.collection).doc(params.id).get());
|
|
3756
|
+
}
|
|
3757
|
+
if (snapshot && snapshot.exists) {
|
|
3758
|
+
const data = snapshot.data();
|
|
3759
|
+
const value = data === null || data === void 0 ? void 0 : data[params.newProperty];
|
|
3760
|
+
return typeof value === 'string' ? value : '';
|
|
3761
|
+
}
|
|
3762
|
+
return '';
|
|
3763
|
+
}
|
|
3764
|
+
catch (e) {
|
|
3765
|
+
console.error(e);
|
|
3766
|
+
return '';
|
|
3767
|
+
}
|
|
3768
|
+
});
|
|
3769
|
+
}
|
|
3770
|
+
loadRelations() {
|
|
3771
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3772
|
+
const relationPromises = this.data.displayedColumns
|
|
3773
|
+
.filter((col) => col.relation)
|
|
3774
|
+
.flatMap((col) => this.items.map((item) => __awaiter(this, void 0, void 0, function* () {
|
|
3775
|
+
var _a;
|
|
3776
|
+
if (col.relation) {
|
|
3777
|
+
const itemRecord = item;
|
|
3778
|
+
itemRecord[col.property] = yield this.getRelation({
|
|
3779
|
+
id: String((_a = itemRecord[col.relation.sourceProperty]) !== null && _a !== void 0 ? _a : ''),
|
|
3780
|
+
collection: col.relation.targetedCollection,
|
|
3781
|
+
newProperty: col.relation.targetedProperty || col.property,
|
|
3782
|
+
});
|
|
3783
|
+
}
|
|
3784
|
+
})));
|
|
3785
|
+
yield Promise.all(relationPromises);
|
|
3786
|
+
});
|
|
3787
|
+
}
|
|
3788
|
+
getQueryLength(params) {
|
|
3789
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3790
|
+
const itemRecord = params.item;
|
|
3791
|
+
const snapshot = yield this.firestore
|
|
3792
|
+
.collection(params.relation.collection)
|
|
3793
|
+
.ref.where(params.relation.property, params.relation.operator, itemRecord[params.relation.value])
|
|
3794
|
+
.get();
|
|
3795
|
+
return snapshot.size;
|
|
3796
|
+
});
|
|
3797
|
+
}
|
|
3798
|
+
loadQueryLengths() {
|
|
3799
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3800
|
+
const lengthPromises = this.data.displayedColumns
|
|
3801
|
+
.filter((col) => col.queryLength)
|
|
3802
|
+
.flatMap((col) => this.items.map((item) => __awaiter(this, void 0, void 0, function* () {
|
|
3803
|
+
if (col.queryLength) {
|
|
3804
|
+
const itemRecord = item;
|
|
3805
|
+
itemRecord[col.property] = yield this.getQueryLength({
|
|
3806
|
+
item: item,
|
|
3807
|
+
relation: col.queryLength,
|
|
3808
|
+
});
|
|
3809
|
+
}
|
|
3810
|
+
})));
|
|
3811
|
+
yield Promise.all(lengthPromises);
|
|
3812
|
+
});
|
|
3813
|
+
}
|
|
3814
|
+
filterItems() {
|
|
3815
|
+
if (this.data.conditions) {
|
|
3816
|
+
this.data.conditions.forEach((cond) => {
|
|
3817
|
+
this.items = this.items.filter((item) => {
|
|
3818
|
+
const operatorFunction = this.tableService.operators[cond.operator];
|
|
3819
|
+
if (operatorFunction) {
|
|
3820
|
+
const itemRecord = item;
|
|
3821
|
+
return operatorFunction(itemRecord[cond.firestoreProperty], cond.dashProperty);
|
|
3822
|
+
}
|
|
3823
|
+
return false;
|
|
3824
|
+
});
|
|
3825
|
+
});
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
// PUBLIC METHODS
|
|
3829
|
+
reloadTable() {
|
|
3830
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3831
|
+
if (this.data.pagination) {
|
|
3832
|
+
yield this.loadItemsPaginated('reload', true);
|
|
3833
|
+
this.paginator.firstPage();
|
|
3834
|
+
this.cdr.markForCheck();
|
|
3835
|
+
}
|
|
3836
|
+
else {
|
|
3837
|
+
yield this.loadItems();
|
|
3838
|
+
}
|
|
3839
|
+
});
|
|
3840
|
+
}
|
|
3841
|
+
updateDisplayedColumns() {
|
|
3842
|
+
if (this.dataSource) {
|
|
3843
|
+
this.dataSource = new MatTableDataSource([]);
|
|
3844
|
+
}
|
|
3845
|
+
this.columnProperties = this.data.displayedColumns.map((column) => column.property);
|
|
3846
|
+
const filterConfig = this.filterService.initializeDropdownItems(this.data.displayedColumns);
|
|
3847
|
+
this.dropdownItems = filterConfig.dropdownItems;
|
|
3848
|
+
this.sortableDropdownItems = filterConfig.sortableDropdownItems;
|
|
3849
|
+
if (this.data.filterableOptions) {
|
|
3850
|
+
this.dropdownItems = this.filterService.addFilterableOptions(this.dropdownItems, this.data.filterableOptions);
|
|
3851
|
+
}
|
|
3852
|
+
this.cdr.markForCheck();
|
|
3853
|
+
}
|
|
3854
|
+
shouldShowActionButton() {
|
|
3855
|
+
var _a, _b;
|
|
3856
|
+
if (!((_a = this.data) === null || _a === void 0 ? void 0 : _a.actionButton)) {
|
|
3857
|
+
return false;
|
|
3858
|
+
}
|
|
3859
|
+
if (!this.data.actionButton.condition) {
|
|
3860
|
+
return true;
|
|
3861
|
+
}
|
|
3862
|
+
try {
|
|
3863
|
+
return (_b = this.data.actionButton.condition(null)) !== null && _b !== void 0 ? _b : true;
|
|
3864
|
+
}
|
|
3865
|
+
catch (_c) {
|
|
3866
|
+
return true;
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
handleDownload() {
|
|
3870
|
+
if (!this.downloadTable)
|
|
3871
|
+
return;
|
|
3872
|
+
if (this.data.pagination === false) {
|
|
3873
|
+
if (this.dataSource && this.dataSource.filteredData) {
|
|
3874
|
+
this.filteredItems = [...this.dataSource.filteredData];
|
|
3875
|
+
}
|
|
3876
|
+
const arrange = this.buildArrangeFromFilters();
|
|
3877
|
+
this.downloadTable(arrange, this.data.conditions || []);
|
|
3878
|
+
}
|
|
3879
|
+
else {
|
|
3880
|
+
if (this.arrange) {
|
|
3881
|
+
this.downloadTable(this.arrange, this.data.conditions || []);
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
TableComponent.ɵfac = function TableComponent_Factory(t) { return new (t || TableComponent)(i0.ɵɵdirectiveInject(i1$2.Router), i0.ɵɵdirectiveInject(TableService), i0.ɵɵdirectiveInject(FilterService), i0.ɵɵdirectiveInject(TooltipService), i0.ɵɵdirectiveInject(PaginationService), i0.ɵɵdirectiveInject(i1.AngularFirestore), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
|
|
3887
|
+
TableComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TableComponent, selectors: [["lib-table"]], viewQuery: function TableComponent_Query(rf, ctx) {
|
|
3888
|
+
if (rf & 1) {
|
|
3889
|
+
i0.ɵɵviewQuery(MatPaginator, 5);
|
|
3890
|
+
i0.ɵɵviewQuery(MatSort, 5);
|
|
3891
|
+
}
|
|
3892
|
+
if (rf & 2) {
|
|
3893
|
+
let _t;
|
|
3894
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.paginator = _t.first);
|
|
3895
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.sort = _t.first);
|
|
3896
|
+
}
|
|
3897
|
+
}, inputs: { data: "data", downloadTable: "downloadTable" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [["class", "card-body", 4, "ngIf"], [1, "card-body"], [1, "flex", "flex-col", "justify-between", "gap-6"], ["class", "rounded-xl border border-gray-200 bg-white p-4 shadow-lg", 4, "ngIf"], [1, "flex", "flex-col"], [3, "tabsData", "selectedTab", "tabSelected", 4, "ngIf"], [1, "mat-elevation-z8", "w-full", "overflow-x-auto", "rounded-xl", "table-container"], ["mat-table", "", "matSort", "", "matSortActive", "createdAt", "matSortDirection", "desc", 3, "dataSource"], ["sort", "matSort"], [3, "matColumnDef", 4, "ngFor", "ngForOf", "ngForTrackBy"], ["mat-header-row", "", 4, "matHeaderRowDef"], ["mat-row", "", 3, "ngClass", "click", 4, "matRowDef", "matRowDefColumns"], ["class", "mat-row", 4, "matNoDataRow"], ["class", "flex justify-center", 4, "ngIf"], [1, "paginator-container"], ["showFirstLastButtons", "", "aria-label", "Select page of periodic elements", 3, "pageSizeOptions", "pageSize", "length", "ngClass", "page"], ["paginator", ""], [3, "state", "styles"], [1, "rounded-xl", "border", "border-gray-200", "bg-white", "p-4", "shadow-lg"], [1, "mb-4", "flex", "flex-col", "items-start", "justify-between", "gap-4", "border-b-2", "border-gray-200", "pb-4", "md:flex-row", "md:items-center"], [1, "flex", "flex-wrap", "items-center", "gap-4"], [1, "flex", "items-center", "gap-2"], [1, "fa", "fa-filter", "text-xl", "text-blue-500"], [1, "text-lg", "font-semibold", "text-gray-700"], [3, "ngClass", "routerLink", "click", 4, "ngIf"], ["class", "mb-4", 4, "ngIf"], ["class", "mb-4 space-y-3", 4, "ngIf"], [1, "-mb-2", "flex", "items-start", "justify-between", "gap-4", "border-t", "border-gray-200", "pt-4"], [4, "ngIf"], ["class", "flex flex-wrap gap-3 self-start sm:self-auto", 4, "ngIf"], [3, "ngClass", "routerLink", "click"], [3, "class", 4, "ngIf"], [1, "mb-4"], [1, "flex", "flex-wrap", "items-center", "gap-3", "p-2"], [1, "min-w-[200px]", "flex-1"], ["appearance", "outline", 1, "w-full"], [1, "fa", "fa-sort-alpha-down", "text-cyan-600"], ["placeholder", "Selecione...", 3, "formControl"], [3, "value", 4, "ngFor", "ngForOf"], [3, "value"], [1, "mb-4", "space-y-3"], ["class", "flex flex-wrap items-center gap-3 p-2", 3, "formGroup", 4, "ngFor", "ngForOf"], [1, "flex", "flex-wrap", "items-center", "gap-3", "p-2", 3, "formGroup"], ["class", "min-w-[200px] flex-1", 4, "ngIf"], ["class", "min-w-[340px] flex-auto", 4, "ngIf"], ["class", "ml-auto flex-shrink-0", 4, "ngIf"], ["placeholder", "Selecione o tipo...", "formControlName", "selectFilter", 3, "selectionChange"], [1, "text-sm", "text-blue-500"], [1, "fa", "fa-search", "text-gray-400"], ["formControlName", "typeFilter", "matInput", "", "placeholder", "Digite para filtrar...", 3, "keyup.enter"], ["input", ""], ["placeholder", "Selecione...", "formControlName", "selectItem", "multiple", ""], [1, "min-w-[340px]", "flex-auto"], [1, "flex", "flex-col", "items-stretch", "gap-3", "sm:flex-row", "sm:items-center"], ["appearance", "outline", 1, "flex-1"], [1, "fa", "fa-calendar", "text-gray-400"], ["type", "text", "matInput", "", "formControlName", "initialDate", "placeholder", "DD/MM/AAAA", "maxlength", "10", 3, "keydown.enter", "input"], ["type", "text", "matInput", "", "formControlName", "finalDate", "placeholder", "DD/MM/AAAA", "maxlength", "10", 3, "keydown.enter", "input"], [1, "ml-auto", "flex-shrink-0"], ["matTooltip", "Remover filtro", 1, "flex", "h-10", "w-10", "items-center", "justify-center", "rounded-full", "transition-colors", "duration-300", "hover:bg-red-100", 3, "click"], [1, "fa", "fa-trash", "text-red-500", "hover:text-red-600"], ["matTooltip", "Adicionar novo filtro", 1, "transform", "rounded-full", "border-2", "border-blue-300", "bg-blue-50", "px-6", "py-2", "text-sm", "font-medium", "text-blue-600", "transition-all", "duration-300", "hover:-translate-y-0.5", "hover:border-blue-400", "hover:bg-blue-100", "hover:shadow-md", 3, "click"], [1, "fa", "fa-plus", "mr-2"], [1, "flex", "flex-wrap", "gap-3", "self-start", "sm:self-auto"], ["type", "button", "matTooltip", "Aplicar filtros", 1, "flex", "items-center", "gap-2", "rounded-lg", "bg-green-600", "px-5", "py-2", "text-sm", "font-medium", "text-white", "transition-colors", "hover:bg-green-700", 3, "click"], [1, "fa", "fa-search"], ["matTooltip", "Limpar filtros", 1, "flex", "items-center", "gap-2", "rounded-lg", "bg-red-500", "px-5", "py-2", "text-sm", "font-medium", "text-white", "transition-colors", "hover:bg-red-600", 3, "click"], [1, "fas", "fa-redo-alt"], ["class", "flex items-center gap-2 rounded-lg bg-orange-500 px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-orange-600", "matTooltipPosition", "above", "matTooltip", "Exportar Tabela", 3, "disabled", "click", 4, "ngIf"], ["matTooltipPosition", "above", "matTooltip", "Exportar Tabela", 1, "flex", "items-center", "gap-2", "rounded-lg", "bg-orange-500", "px-5", "py-2", "text-sm", "font-medium", "text-white", "transition-colors", "hover:bg-orange-600", 3, "disabled", "click"], [1, "fa", "fa-download"], [1, "fa", "fa-search", "text-blue-500"], ["matInput", "", "placeholder", "Digite para filtrar...", 3, "keyup.enter", "keyup"], ["filterInput", ""], ["matSuffix", "", 1, "text-gray-500"], ["class", "flex flex-wrap items-center gap-3", 3, "formGroup", 4, "ngFor", "ngForOf"], [1, "flex", "flex-wrap", "items-center", "gap-3", 3, "formGroup"], ["type", "text", "matInput", "", "formControlName", "initialDate", "placeholder", "DD/MM/AAAA", "maxlength", "10", 3, "keydown.enter", "input", "blur"], ["type", "text", "matInput", "", "formControlName", "finalDate", "placeholder", "DD/MM/AAAA", "maxlength", "10", 3, "keydown.enter", "input", "blur"], [3, "tabsData", "selectedTab", "tabSelected"], [3, "matColumnDef"], [4, "matHeaderCellDef"], ["mat-header-cell", "", 4, "ngIf"], ["mat-header-cell", "", "mat-sort-header", "", 4, "ngIf"], ["mat-cell", "", 3, "click", "mouseenter", "mouseleave", "mousemove", 4, "matCellDef"], ["mat-header-cell", ""], ["mat-header-cell", "", "mat-sort-header", ""], ["mat-cell", "", 3, "click", "mouseenter", "mouseleave", "mousemove"], ["class", "relative inline-block", 4, "ngIf"], [4, "ngIf", "ngIfElse"], ["withinLimit", ""], ["target", "_blank", 3, "href", 4, "ngIf"], ["target", "_blank", 3, "href"], [1, "relative", "inline-block"], ["class", "absolute inset-0 m-auto", 3, "diameter", 4, "ngIf"], ["alt", "", 3, "src", "ngClass", "load", "error"], [1, "absolute", "inset-0", "m-auto", 3, "diameter"], [3, "click", 4, "ngFor", "ngForOf"], [3, "click"], [3, "ngClass", 4, "ngIf"], [3, "ngClass"], ["mat-header-row", ""], ["mat-row", "", 3, "ngClass", "click"], [1, "mat-row"], ["class", "mat-cell p-4", "colspan", "4", 4, "ngIf"], ["colspan", "4", 1, "mat-cell", "p-4"], [1, "flex", "justify-center"]], template: function TableComponent_Template(rf, ctx) {
|
|
3898
|
+
if (rf & 1) {
|
|
3899
|
+
i0.ɵɵtemplate(0, TableComponent_div_0_Template, 19, 18, "div", 0);
|
|
3900
|
+
}
|
|
3901
|
+
if (rf & 2) {
|
|
3902
|
+
i0.ɵɵproperty("ngIf", ctx.data);
|
|
3903
|
+
}
|
|
3904
|
+
}, dependencies: [i1$1.NgClass, i1$1.NgForOf, i1$1.NgIf, i8.DefaultValueAccessor, i8.NgControlStatus, i8.NgControlStatusGroup, i8.MaxLengthValidator, i8.FormControlDirective, i8.FormGroupDirective, i8.FormControlName, i1$2.RouterLink, i9.MatTable, i9.MatHeaderCellDef, i9.MatHeaderRowDef, i9.MatColumnDef, i9.MatCellDef, i9.MatRowDef, i9.MatHeaderCell, i9.MatCell, i9.MatHeaderRow, i9.MatRow, i9.MatNoDataRow, i10.MatPaginator, i11.MatSort, i11.MatSortHeader, i12.MatFormField, i12.MatLabel, i12.MatSuffix, i13.MatInput, i14.MatOption, i15.MatSelect, i16.MatTooltip, i17.MatProgressSpinner, i18.MatIcon, TableTabsComponent, TableTooltipComponent, i1$1.AsyncPipe], styles: ["@charset \"UTF-8\";[_nghost-%COMP%]{--table-color: #1976d2;--table-text-color: white;--table-header-bg: #1976d2;--table-header-text: white;--table-scrollbar-bg: #f5f5f5;--table-scrollbar-thumb: var(--table-color)}.table-container[_ngcontent-%COMP%]::-webkit-scrollbar{width:10px;height:10px;background-color:var(--table-scrollbar-bg, #f5f5f5)}.table-container[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:var(--table-scrollbar-thumb, var(--table-color, #1976d2));border-radius:5px}.table-container[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background-color:var(--table-scrollbar-thumb, var(--table-color, #1976d2));opacity:.8}.overflow-x-auto[_ngcontent-%COMP%]::-webkit-scrollbar, .overflow-y-auto[_ngcontent-%COMP%]::-webkit-scrollbar, .overflow-auto[_ngcontent-%COMP%]::-webkit-scrollbar{width:10px;height:10px;background-color:var(--table-scrollbar-bg, #f5f5f5)}.overflow-x-auto[_ngcontent-%COMP%]::-webkit-scrollbar-thumb, .overflow-y-auto[_ngcontent-%COMP%]::-webkit-scrollbar-thumb, .overflow-auto[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:var(--table-scrollbar-thumb, var(--table-color, #1976d2));border-radius:5px}.overflow-x-auto[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover, .overflow-y-auto[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover, .overflow-auto[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background-color:var(--table-scrollbar-thumb, var(--table-color, #1976d2));opacity:.8}[_nghost-%COMP%] .mat-table .mat-header-cell, [_nghost-%COMP%] .mat-header-cell, [_nghost-%COMP%] th.mat-header-cell, [_nghost-%COMP%] .mat-mdc-table .mat-mdc-header-cell, [_nghost-%COMP%] .mat-mdc-header-cell, [_nghost-%COMP%] th.mat-mdc-header-cell{background-color:var(--table-header-bg, #1976d2)!important;color:var(--table-header-text, white)!important;font-weight:600} .fa-filter, i.fa-filter{color:var(--table-color, #1976d2)!important} .rounded-xl.border{border-color:var(--table-color, #1976d2)!important} .border-gray-200.rounded-xl{border-color:var(--table-color, #1976d2)!important} .mdc-notched-outline__notch{border-right:none!important}.mat-mdc-text-field-wrapper.mdc-text-field--outlined[_ngcontent-%COMP%] .mat-mdc-form-field-infix[_ngcontent-%COMP%]{padding-bottom:0} .mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{padding-bottom:0}.mat-mdc-text-field-wrapper.mdc-text-field--outlined.mdc-text-field--disabled[_ngcontent-%COMP%]{background:rgba(0,0,0,.15);background-size:1px 100%!important;background-repeat:repeat-x!important}.mdc-text-field--disabled[_ngcontent-%COMP%] .mdc-text-field__input[_ngcontent-%COMP%]{color:#525252}button[_ngcontent-%COMP%]:not([matTooltip=\"Adicionar novo filtro\"]):not([matTooltip=\"Aplicar filtros\"]):not([matTooltip=\"Limpar filtros\"]):not([matTooltip=\"Exportar Tabela\"]):not(:has(i.fa-plus)):not(:has(i.fa-search)):not(:has(i.fas.fa-redo-alt)):not(:has(i.fa-download)){transition:all .2s ease;cursor:pointer}button[_ngcontent-%COMP%]:not([matTooltip=\"Adicionar novo filtro\"]):not([matTooltip=\"Aplicar filtros\"]):not([matTooltip=\"Limpar filtros\"]):not([matTooltip=\"Exportar Tabela\"]):not(:has(i.fa-plus)):not(:has(i.fa-search)):not(:has(i.fas.fa-redo-alt)):not(:has(i.fa-download)):hover:not(:disabled){opacity:.9;transform:scale(1.02)}button[_ngcontent-%COMP%]:not([matTooltip=\"Adicionar novo filtro\"]):not([matTooltip=\"Aplicar filtros\"]):not([matTooltip=\"Limpar filtros\"]):not([matTooltip=\"Exportar Tabela\"]):not(:has(i.fa-plus)):not(:has(i.fa-search)):not(:has(i.fas.fa-redo-alt)):not(:has(i.fa-download)):disabled{opacity:.5;cursor:not-allowed;transform:none} .hide-length .mat-mdc-paginator-range-label{display:none} .hide-next-button .mat-mdc-tooltip-trigger.mat-mdc-paginator-navigation-next.mdc-icon-button.mat-mdc-icon-button.mat-unthemed.mat-mdc-button-base{visibility:hidden} .hide-next-button .mat-mdc-tooltip-trigger.mat-mdc-paginator-navigation-last.mdc-icon-button.mat-mdc-icon-button.mat-unthemed.mat-mdc-button-base.ng-star-inserted{visibility:hidden} .mat-mdc-text-field-wrapper.mdc-text-field.ng-tns-c162-1.mdc-text-field--filled{width:25dvw} .custom-filter .mat-mdc-text-field-wrapper{width:20dvw;max-width:300px}button[matTooltip=\"Adicionar novo filtro\"][_ngcontent-%COMP%], button[_ngcontent-%COMP%]:has(i.fa-plus){display:inline-flex;align-items:center;gap:.5rem;border-radius:9999px;border:2px solid #93c5fd;background-color:#dbeafe;padding:.5rem 1.5rem;font-size:.875rem;font-weight:500;color:#2563eb;transition:all .3s;cursor:pointer;transform:translateY(0)}button[matTooltip=\"Adicionar novo filtro\"][_ngcontent-%COMP%]:hover, button[_ngcontent-%COMP%]:has(i.fa-plus):hover{transform:translateY(-2px);border-color:#60a5fa;background-color:#bfdbfe;box-shadow:0 4px 6px #0000001a}button[matTooltip=\"Aplicar filtros\"][_ngcontent-%COMP%], button[_ngcontent-%COMP%]:has(i.fa-search){display:inline-flex;align-items:center;gap:.5rem;border-radius:.5rem;background-color:#16a34a;padding:.5rem 1.25rem;font-size:.875rem;font-weight:500;color:#fff;transition:background-color .2s;cursor:pointer;border:none}button[matTooltip=\"Aplicar filtros\"][_ngcontent-%COMP%]:hover, button[_ngcontent-%COMP%]:has(i.fa-search):hover{background-color:#15803d}button[matTooltip=\"Aplicar filtros\"][_ngcontent-%COMP%]:disabled, button[_ngcontent-%COMP%]:has(i.fa-search):disabled{opacity:.5;cursor:not-allowed}button[matTooltip=\"Limpar filtros\"][_ngcontent-%COMP%], button[_ngcontent-%COMP%]:has(i.fas.fa-redo-alt){display:inline-flex;align-items:center;gap:.5rem;border-radius:.5rem;background-color:#ef4444;padding:.5rem 1.25rem;font-size:.875rem;font-weight:500;color:#fff;transition:background-color .2s;cursor:pointer;border:none}button[matTooltip=\"Limpar filtros\"][_ngcontent-%COMP%]:hover, button[_ngcontent-%COMP%]:has(i.fas.fa-redo-alt):hover{background-color:#dc2626}button[matTooltip=\"Exportar Tabela\"][_ngcontent-%COMP%], button[_ngcontent-%COMP%]:has(i.fa-download){display:inline-flex;align-items:center;gap:.5rem;border-radius:.5rem;background-color:#f97316;padding:.5rem 1.25rem;font-size:.875rem;font-weight:500;color:#fff;transition:background-color .2s;cursor:pointer;border:none}button[matTooltip=\"Exportar Tabela\"][_ngcontent-%COMP%]:hover:not(:disabled), button[_ngcontent-%COMP%]:has(i.fa-download):hover:not(:disabled){background-color:#ea580c}button[matTooltip=\"Exportar Tabela\"][_ngcontent-%COMP%]:disabled, button[_ngcontent-%COMP%]:has(i.fa-download):disabled{opacity:.5;cursor:not-allowed}"], changeDetection: 0 });
|
|
3905
|
+
(function () {
|
|
3906
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TableComponent, [{
|
|
3907
|
+
type: Component,
|
|
3908
|
+
args: [{ selector: 'lib-table', standalone: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"data\" class=\"card-body\">\n <div class=\"flex flex-col justify-between gap-6\">\n <!-- UNIFIED CONTROL PANEL: FILTERS, SORT & ACTIONS -->\n <div\n class=\"rounded-xl border border-gray-200 bg-white p-4 shadow-lg\"\n *ngIf=\"\n data.pagination === true &&\n (dropdownItems.length > 0 ||\n sortableDropdownItems.length > 0 ||\n data.actionButton)\n \"\n >\n <!-- PANEL HEADER: Title and Custom Action -->\n <div\n class=\"mb-4 flex flex-col items-start justify-between gap-4 border-b-2 border-gray-200 pb-4 md:flex-row md:items-center\"\n >\n <!-- Left Side: Title & Main Action Button -->\n <div class=\"flex flex-wrap items-center gap-4\">\n <div class=\"flex items-center gap-2\">\n <i class=\"fa fa-filter text-xl text-blue-500\"></i>\n <span class=\"text-lg font-semibold text-gray-700\"\n >Filtros e A\u00E7\u00F5es</span\n >\n </div>\n <button\n *ngIf=\"data.actionButton && data.actionButton.condition\"\n [ngClass]=\"getActionButtonClass()\"\n [routerLink]=\"data.actionButton.routerLink\"\n (click)=\"\n data.actionButton.method ? data.actionButton.method($event) : null\n \"\n >\n <i\n *ngIf=\"data.actionButton.icon\"\n [class]=\"data.actionButton.icon\"\n ></i>\n {{ data.actionButton.label }}\n </button>\n </div>\n </div>\n\n <!-- SORT FIELD (Integrated with filters) -->\n <div class=\"mb-4\" *ngIf=\"sortableDropdownItems.length > 0\">\n <div class=\"flex flex-wrap items-center gap-3 p-2\">\n <div class=\"min-w-[200px] flex-1\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label class=\"flex items-center gap-2\">\n <i class=\"fa fa-sort-alpha-down text-cyan-600\"></i>\n <span>Ordenar por</span>\n </mat-label>\n <mat-select placeholder=\"Selecione...\" [formControl]=\"selectSort\">\n <mat-option\n *ngFor=\"let item of sortableDropdownItems\"\n [value]=\"item\"\n >\n <div class=\"flex items-center gap-2\">\n <i class=\"fa fa-sort-alpha-down text-cyan-600\"></i>\n <span>{{ item.title }}</span>\n </div>\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n </div>\n </div>\n\n <!-- FILTERS CONTENT (WITH REFINEMENTS) -->\n <div class=\"mb-4 space-y-3\" *ngIf=\"filtersForm.controls.length > 0\">\n <div\n [formGroup]=\"$any(filterGroup)\"\n *ngFor=\"let filterGroup of filtersForm.controls; let i = index\"\n class=\"flex flex-wrap items-center gap-3 p-2\"\n >\n <!-- FILTER TYPE SELECTOR -->\n <div class=\"min-w-[200px] flex-1\" *ngIf=\"dropdownItems.length > 0\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label>Tipo de filtro</mat-label>\n <mat-select\n placeholder=\"Selecione o tipo...\"\n formControlName=\"selectFilter\"\n (selectionChange)=\"onSelectFilterChange()\"\n >\n <mat-option\n *ngFor=\"let item of getAvailableFilterOptions()\"\n [value]=\"item\"\n >\n <div class=\"flex items-center gap-2\">\n <i\n [class]=\"item.icon || 'fa fa-filter'\"\n class=\"text-sm text-blue-500\"\n ></i>\n <span>{{ item.title }}</span>\n </div>\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <!-- TEXT FILTER -->\n <div\n class=\"min-w-[200px] flex-1\"\n *ngIf=\"\n $any(filterGroup).get('selectFilter')?.value?.arrange === 'filter'\n \"\n >\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label class=\"flex items-center gap-2\">\n <i class=\"fa fa-search text-gray-400\"></i>\n <span>{{\n $any(filterGroup).get(\"selectFilter\")?.value?.title ||\n \"Filtrar\"\n }}</span>\n </mat-label>\n <input\n (keyup.enter)=\"search($event)\"\n formControlName=\"typeFilter\"\n matInput\n placeholder=\"Digite para filtrar...\"\n #input\n />\n </mat-form-field>\n </div>\n\n <!-- DROPDOWN FILTER -->\n <div\n class=\"min-w-[200px] flex-1\"\n *ngIf=\"\n $any(filterGroup).get('selectFilter')?.value &&\n $any(filterGroup)\n .get('selectFilter')\n ?.value.hasOwnProperty('items')\n \"\n >\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label>{{\n $any(filterGroup).get(\"selectFilter\")?.value?.title ||\n \"Selecione\"\n }}</mat-label>\n <mat-select\n placeholder=\"Selecione...\"\n formControlName=\"selectItem\"\n multiple\n >\n <mat-option\n *ngFor=\"\n let item of $any(filterGroup).get('selectFilter')?.value\n .items\n \"\n [value]=\"item\"\n >\n {{ item.label }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <!-- DATE FILTER -->\n <div\n class=\"min-w-[340px] flex-auto\"\n *ngIf=\"\n $any(filterGroup).get('selectFilter')?.value?.arrange ===\n 'filterByDate'\n \"\n >\n <div\n class=\"flex flex-col items-stretch gap-3 sm:flex-row sm:items-center\"\n >\n <mat-form-field appearance=\"outline\" class=\"flex-1\">\n <mat-label class=\"flex items-center gap-2\">\n <i class=\"fa fa-calendar text-gray-400\"></i>\n <span>Data Inicial</span>\n </mat-label>\n <input\n type=\"text\"\n matInput\n (keydown.enter)=\"search($event)\"\n (input)=\"onDateInput($event, 'initialDate', i)\"\n formControlName=\"initialDate\"\n placeholder=\"DD/MM/AAAA\"\n maxlength=\"10\"\n />\n </mat-form-field>\n\n <mat-form-field appearance=\"outline\" class=\"flex-1\">\n <mat-label class=\"flex items-center gap-2\">\n <i class=\"fa fa-calendar text-gray-400\"></i>\n <span>Data Final</span>\n </mat-label>\n <input\n type=\"text\"\n (keydown.enter)=\"search($event)\"\n (input)=\"onDateInput($event, 'finalDate', i)\"\n matInput\n formControlName=\"finalDate\"\n placeholder=\"DD/MM/AAAA\"\n maxlength=\"10\"\n />\n </mat-form-field>\n </div>\n </div>\n\n <!-- REMOVE FILTER BUTTON -->\n <div *ngIf=\"filtersForm.length > 1\" class=\"ml-auto flex-shrink-0\">\n <button\n (click)=\"removeFilter(i)\"\n class=\"flex h-10 w-10 items-center justify-center rounded-full transition-colors duration-300 hover:bg-red-100\"\n matTooltip=\"Remover filtro\"\n >\n <i class=\"fa fa-trash text-red-500 hover:text-red-600\"></i>\n </button>\n </div>\n </div>\n </div>\n\n <!-- PANEL FOOTER: Add Filter & Action Buttons -->\n <div\n class=\"-mb-2 flex items-start justify-between gap-4 border-t border-gray-200 pt-4\"\n >\n <!-- Add Filter Button -->\n <div *ngIf=\"dropdownItems.length > 0\">\n <button\n (click)=\"addFilter()\"\n class=\"transform rounded-full border-2 border-blue-300 bg-blue-50 px-6 py-2 text-sm font-medium text-blue-600 transition-all duration-300 hover:-translate-y-0.5 hover:border-blue-400 hover:bg-blue-100 hover:shadow-md\"\n matTooltip=\"Adicionar novo filtro\"\n >\n <i class=\"fa fa-plus mr-2\"></i>\n Adicionar Filtro\n </button>\n </div>\n\n <!-- Right Side: Search, Reset, Export -->\n <div\n class=\"flex flex-wrap gap-3 self-start sm:self-auto\"\n *ngIf=\"\n this.hasFilterableColumn === true || this.hasSortableColumn === true\n \"\n >\n <button\n (click)=\"search()\"\n type=\"button\"\n class=\"flex items-center gap-2 rounded-lg bg-green-600 px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-green-700\"\n matTooltip=\"Aplicar filtros\"\n >\n <i class=\"fa fa-search\"></i>\n Pesquisar\n </button>\n\n <button\n (click)=\"resetFilter()\"\n class=\"flex items-center gap-2 rounded-lg bg-red-500 px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-red-600\"\n matTooltip=\"Limpar filtros\"\n >\n <i class=\"fas fa-redo-alt\"></i>\n Resetar\n </button>\n\n <button\n *ngIf=\"data.download !== false && downloadTable\"\n class=\"flex items-center gap-2 rounded-lg bg-orange-500 px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-orange-600\"\n matTooltipPosition=\"above\"\n matTooltip=\"Exportar Tabela\"\n [disabled]=\"\n this.dataSource && this.dataSource.filteredData.length <= 0\n \"\n (click)=\"\n $any(arrange) && downloadTable !== undefined\n ? downloadTable($any(arrange), data.conditions || [])\n : null\n \"\n >\n <i class=\"fa fa-download\"></i>\n Exportar\n </button>\n </div>\n </div>\n </div>\n\n <!-- UNIFIED CONTROL PANEL (for non-paginated tables): SEARCH, SORT & FILTERS -->\n <div\n class=\"rounded-xl border border-gray-200 bg-white p-4 shadow-lg\"\n *ngIf=\"\n data.pagination === false &&\n (hasFilterableColumn === true ||\n dropdownItems.length > 0 ||\n data.actionButton)\n \"\n >\n <!-- PANEL HEADER: Title and Custom Action -->\n <div\n class=\"mb-4 flex flex-col items-start justify-between gap-4 border-b-2 border-gray-200 pb-4 md:flex-row md:items-center\"\n >\n <!-- Left Side: Title & Main Action Button -->\n <div class=\"flex flex-wrap items-center gap-4\">\n <div class=\"flex items-center gap-2\">\n <i class=\"fa fa-filter text-xl text-blue-500\"></i>\n <span class=\"text-lg font-semibold text-gray-700\"\n >Filtros e A\u00E7\u00F5es</span\n >\n </div>\n <button\n *ngIf=\"data.actionButton && data.actionButton.condition\"\n [ngClass]=\"getActionButtonClass()\"\n [routerLink]=\"data.actionButton.routerLink\"\n (click)=\"\n data.actionButton.method ? data.actionButton.method($event) : null\n \"\n >\n <i\n *ngIf=\"data.actionButton.icon\"\n [class]=\"data.actionButton.icon\"\n ></i>\n {{ data.actionButton.label }}\n </button>\n </div>\n </div>\n\n <!-- SIMPLE SEARCH -->\n <div\n class=\"mb-4\"\n *ngIf=\"hasFilterableColumn === true && data.showSimpleSearch !== false\"\n >\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label class=\"flex items-center gap-2\">\n <i class=\"fa fa-search text-blue-500\"></i>\n Buscar\n </mat-label>\n <input\n matInput\n (keyup.enter)=\"search($event)\"\n (keyup)=\"applyFilter(filterInput.value)\"\n placeholder=\"Digite para filtrar...\"\n #filterInput\n />\n <mat-icon matSuffix class=\"text-gray-500\">search</mat-icon>\n </mat-form-field>\n </div>\n\n <!-- FILTERS PANEL -->\n <div *ngIf=\"dropdownItems.length > 0\">\n <!-- FILTERS CONTENT -->\n <div class=\"mb-4 space-y-3\" *ngIf=\"filtersForm.controls.length > 0\">\n <div\n [formGroup]=\"$any(filterGroup)\"\n *ngFor=\"let filterGroup of filtersForm.controls; let i = index\"\n class=\"flex flex-wrap items-center gap-3\"\n >\n <!-- FILTER TYPE SELECTOR -->\n <div class=\"min-w-[200px] flex-1\" *ngIf=\"dropdownItems.length > 0\">\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label>Tipo de filtro</mat-label>\n <mat-select\n placeholder=\"Selecione o tipo...\"\n formControlName=\"selectFilter\"\n (selectionChange)=\"onSelectFilterChange()\"\n >\n <mat-option\n *ngFor=\"let item of getAvailableFilterOptions()\"\n [value]=\"item\"\n >\n <div class=\"flex items-center gap-2\">\n <i\n [class]=\"item.icon || 'fa fa-filter'\"\n class=\"text-sm text-blue-500\"\n ></i>\n <span>{{ item.title }}</span>\n </div>\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <!-- TEXT FILTER -->\n <div\n class=\"min-w-[200px] flex-1\"\n *ngIf=\"\n $any(filterGroup).get('selectFilter')?.value?.arrange ===\n 'filter'\n \"\n >\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label class=\"flex items-center gap-2\">\n <i class=\"fa fa-search text-gray-400\"></i>\n <span>{{\n $any(filterGroup).get(\"selectFilter\")?.value?.title ||\n \"Filtrar\"\n }}</span>\n </mat-label>\n <input\n (keyup.enter)=\"search($event)\"\n formControlName=\"typeFilter\"\n matInput\n placeholder=\"Digite para filtrar...\"\n #input\n />\n </mat-form-field>\n </div>\n\n <!-- DROPDOWN FILTER -->\n <div\n class=\"min-w-[200px] flex-1\"\n *ngIf=\"\n $any(filterGroup).get('selectFilter')?.value &&\n $any(filterGroup)\n .get('selectFilter')\n ?.value.hasOwnProperty('items')\n \"\n >\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label>{{\n $any(filterGroup).get(\"selectFilter\")?.value?.title ||\n \"Selecione\"\n }}</mat-label>\n <mat-select\n placeholder=\"Selecione...\"\n formControlName=\"selectItem\"\n multiple\n >\n <mat-option\n *ngFor=\"\n let item of $any(filterGroup).get('selectFilter')?.value\n .items\n \"\n [value]=\"item\"\n >\n {{ item.label }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n </div>\n\n <!-- DATE FILTER -->\n <div\n class=\"min-w-[340px] flex-auto\"\n *ngIf=\"\n $any(filterGroup).get('selectFilter')?.value?.arrange ===\n 'filterByDate'\n \"\n >\n <div\n class=\"flex flex-col items-stretch gap-3 sm:flex-row sm:items-center\"\n >\n <mat-form-field appearance=\"outline\" class=\"flex-1\">\n <mat-label class=\"flex items-center gap-2\">\n <i class=\"fa fa-calendar text-gray-400\"></i>\n <span>Data Inicial</span>\n </mat-label>\n <input\n type=\"text\"\n matInput\n (keydown.enter)=\"search($event)\"\n (input)=\"onDateInput($event, 'initialDate', i)\"\n (blur)=\"onDateFilterChange()\"\n formControlName=\"initialDate\"\n placeholder=\"DD/MM/AAAA\"\n maxlength=\"10\"\n />\n </mat-form-field>\n\n <mat-form-field appearance=\"outline\" class=\"flex-1\">\n <mat-label class=\"flex items-center gap-2\">\n <i class=\"fa fa-calendar text-gray-400\"></i>\n <span>Data Final</span>\n </mat-label>\n <input\n type=\"text\"\n (keydown.enter)=\"search($event)\"\n (input)=\"onDateInput($event, 'finalDate', i)\"\n (blur)=\"onDateFilterChange()\"\n matInput\n formControlName=\"finalDate\"\n placeholder=\"DD/MM/AAAA\"\n maxlength=\"10\"\n />\n </mat-form-field>\n </div>\n </div>\n\n <!-- REMOVE FILTER BUTTON -->\n <div *ngIf=\"filtersForm.length > 1\" class=\"ml-auto flex-shrink-0\">\n <button\n (click)=\"removeFilter(i)\"\n class=\"flex h-10 w-10 items-center justify-center rounded-full transition-colors duration-300 hover:bg-red-100\"\n matTooltip=\"Remover filtro\"\n >\n <i class=\"fa fa-trash text-red-500 hover:text-red-600\"></i>\n </button>\n </div>\n </div>\n </div>\n\n <!-- PANEL FOOTER: Add Filter & Actions -->\n <div\n class=\"-mb-2 flex items-start justify-between gap-4 border-t border-gray-200 pt-4\"\n >\n <!-- Add Filter Button -->\n <div *ngIf=\"dropdownItems.length > 0\">\n <button\n (click)=\"addFilter()\"\n class=\"transform rounded-full border-2 border-blue-300 bg-blue-50 px-6 py-2 text-sm font-medium text-blue-600 transition-all duration-300 hover:-translate-y-0.5 hover:border-blue-400 hover:bg-blue-100 hover:shadow-md\"\n matTooltip=\"Adicionar novo filtro\"\n >\n <i class=\"fa fa-plus mr-2\"></i>\n Adicionar Filtro\n </button>\n </div>\n\n <!-- Action Buttons -->\n <div\n class=\"flex flex-wrap gap-3 self-start sm:self-auto\"\n *ngIf=\"\n this.hasFilterableColumn === true ||\n this.hasSortableColumn === true\n \"\n >\n <button\n (click)=\"search()\"\n type=\"button\"\n class=\"flex items-center gap-2 rounded-lg bg-green-600 px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-green-700\"\n matTooltip=\"Aplicar filtros\"\n >\n <i class=\"fa fa-search\"></i>\n Pesquisar\n </button>\n\n <button\n (click)=\"resetFilter()\"\n class=\"flex items-center gap-2 rounded-lg bg-red-500 px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-red-600\"\n matTooltip=\"Limpar filtros\"\n >\n <i class=\"fas fa-redo-alt\"></i>\n Resetar\n </button>\n\n <button\n *ngIf=\"data.download !== false && downloadTable\"\n class=\"flex items-center gap-2 rounded-lg bg-orange-500 px-5 py-2 text-sm font-medium text-white transition-colors hover:bg-orange-600\"\n matTooltipPosition=\"above\"\n matTooltip=\"Exportar Tabela\"\n [disabled]=\"\n this.dataSource && this.dataSource.filteredData.length <= 0\n \"\n (click)=\"handleDownload()\"\n >\n <i class=\"fa fa-download\"></i>\n Exportar\n </button>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"flex flex-col\">\n <!-- TABS COMPONENT -->\n <lib-table-tabs\n *ngIf=\"data.tabs && data.tabs.tabsData && data.tabs.tabsData.length > 0\"\n [tabsData]=\"data.tabs.tabsData\"\n [selectedTab]=\"selectedTab\"\n (tabSelected)=\"onTabSelected($event)\"\n ></lib-table-tabs>\n <div\n class=\"mat-elevation-z8 w-full overflow-x-auto rounded-xl table-container\"\n >\n <table\n mat-table\n [dataSource]=\"dataSource\"\n matSort\n #sort=\"matSort\"\n matSortActive=\"createdAt\"\n matSortDirection=\"desc\"\n >\n <ng-container\n *ngFor=\"let col of data.displayedColumns; trackBy: trackByProperty\"\n matColumnDef=\"{{ col.property }}\"\n >\n <ng-container *matHeaderCellDef>\n <!-- IF THE COLUMN IS NOT SORTABLE, THEN DON'T SHOW THE SORT BUTTONS -->\n <th\n *ngIf=\"!col.isSortable || data.pagination === true\"\n mat-header-cell\n >\n {{ col.title }}\n </th>\n <!-- IF THE COLUMN IS SORTABLE, THEN SHOW THE SORT BUTTONS -->\n <th\n *ngIf=\"col.isSortable && data.pagination === false\"\n mat-header-cell\n mat-sort-header\n >\n {{ col.title }}\n </th>\n <td\n mat-cell\n *matCellDef=\"let row\"\n (click)=\"col.method ? col.method(row) : null\"\n (mouseenter)=\"onCellMouseEnter($event, row, col)\"\n (mouseleave)=\"onCellMouseLeave()\"\n (mousemove)=\"onCellMouseMove($event)\"\n >\n <!-- CHECK IF THE COLUMN MUST BE DISPLAYED -->\n <span *ngIf=\"!col.image && !col.iconClass && !col.method\">\n <ng-container>\n <span\n *ngIf=\"\n col.charLimit &&\n row[col.property] &&\n row[col.property].length > col.charLimit;\n else withinLimit\n \"\n >\n <a\n *ngIf=\"col.hasLink === true\"\n [href]=\"row[col.property]\"\n target=\"_blank\"\n >\n {{ getDisplayValue(col, row) }}\n </a>\n <a\n *ngIf=\"col.hasLink && isString(col.hasLink)\"\n [href]=\"col.hasLink\"\n target=\"_blank\"\n >\n {{ getDisplayValue(col, row) }}\n </a>\n <span\n *ngIf=\"col.hasLink !== true && !isString(col.hasLink)\"\n >\n {{ getDisplayValue(col, row) }}\n </span>\n </span>\n </ng-container>\n <ng-template #withinLimit>\n <a\n *ngIf=\"col.hasLink === true\"\n [href]=\"row[col.property]\"\n target=\"_blank\"\n >\n {{ getDisplayValue(col, row, true) }}\n </a>\n <a\n *ngIf=\"col.hasLink && isString(col.hasLink)\"\n [href]=\"col.hasLink\"\n target=\"_blank\"\n >\n {{ getDisplayValue(col, row, true) }}\n </a>\n <span\n *ngIf=\"col.hasLink !== true && !isString(col.hasLink)\"\n >\n {{ getDisplayValue(col, row, true) }}\n </span>\n </ng-template>\n </span>\n <!------------------- IMAGE ------------------>\n <!-- Imagem com loading -->\n <div\n *ngIf=\"\n col.image && col.image.path && !col.iconClass && !col.method\n \"\n class=\"relative inline-block\"\n >\n <mat-spinner\n *ngIf=\"isImageLoading(row, col)\"\n [diameter]=\"32\"\n class=\"absolute inset-0 m-auto\"\n ></mat-spinner>\n <img\n [src]=\"col.image.path + '/' + row[col.property]\"\n [ngClass]=\"col.image.class\"\n [class.opacity-0]=\"isImageLoading(row, col)\"\n alt=\"\"\n (load)=\"onImageLoad(row, col)\"\n (error)=\"onImageError($event, row, col, col.image.default)\"\n />\n </div>\n\n <!-- Imagem com URL completa e loading -->\n <div\n *ngIf=\"\n col.image && col.image.url && !col.iconClass && !col.method\n \"\n class=\"relative inline-block\"\n >\n <mat-spinner\n *ngIf=\"isImageLoading(row, col)\"\n [diameter]=\"32\"\n class=\"absolute inset-0 m-auto\"\n ></mat-spinner>\n <img\n [src]=\"row[col.property]\"\n [ngClass]=\"col.image.class\"\n [class.opacity-0]=\"isImageLoading(row, col)\"\n alt=\"\"\n (load)=\"onImageLoad(row, col)\"\n (error)=\"onImageError($event, row, col, col.image.default)\"\n />\n </div>\n <ng-container *ngIf=\"col.iconClass\">\n <button\n *ngFor=\"let iconClass of col.iconClass\"\n (click)=\"\n iconClass.buttonMethod\n ? iconClass.buttonMethod(row, $event)\n : $event.stopPropagation()\n \"\n >\n <span\n [ngClass]=\"iconClass.class\"\n *ngIf=\"\n iconClass.condition === undefined ||\n (iconClass.condition !== undefined &&\n $any(iconClass.condition)(row))\n \"\n >{{ iconClass.text }}</span\n >\n </button>\n </ng-container>\n </td>\n </ng-container>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnProperties\"></tr>\n <tr\n [ngClass]=\"getTableRowNgClass()\"\n mat-row\n *matRowDef=\"let row; columns: columnProperties\"\n (click)=\"goToDetails(row)\"\n ></tr>\n\n <!-- ROW SHOWN WHEN THERE IS NO MATCHING DATA. -->\n <tr class=\"mat-row\" *matNoDataRow>\n <td *ngIf=\"!(isLoading$ | async)\" class=\"mat-cell p-4\" colspan=\"4\">\n Nenhum resultado encontrado para a busca\n </td>\n </tr>\n </table>\n\n <div class=\"flex justify-center\" *ngIf=\"isLoading$ | async\">\n <mat-spinner></mat-spinner>\n </div>\n\n <div class=\"paginator-container\">\n <mat-paginator\n #paginator\n [pageSizeOptions]=\"[25, 50, 100]\"\n [pageSize]=\"pageSize\"\n [length]=\"totalItems\"\n showFirstLastButtons\n aria-label=\"Select page of periodic elements\"\n (page)=\"onPageChange($event)\"\n [ngClass]=\"getPaginatorNgClass()\"\n >\n </mat-paginator>\n <!-- <div\n *ngIf=\"\n !(isLoading$ | async) &&\n dataSource?.data &&\n dataSource.data.length > 0 &&\n data?.filterFn\n \"\n class=\"page-number-display\"\n >\n {{ currentPageNumber }}\n </div> -->\n </div>\n </div>\n </div>\n </div>\n\n <!-- TOOLTIP PERSONALIZADO -->\n <lib-table-tooltip\n [state]=\"tooltipState\"\n [styles]=\"getTooltipStyles()\"\n ></lib-table-tooltip>\n</div>\n", styles: ["@charset \"UTF-8\";:host{--table-color: #1976d2;--table-text-color: white;--table-header-bg: #1976d2;--table-header-text: white;--table-scrollbar-bg: #f5f5f5;--table-scrollbar-thumb: var(--table-color)}.table-container::-webkit-scrollbar{width:10px;height:10px;background-color:var(--table-scrollbar-bg, #f5f5f5)}.table-container::-webkit-scrollbar-thumb{background-color:var(--table-scrollbar-thumb, var(--table-color, #1976d2));border-radius:5px}.table-container::-webkit-scrollbar-thumb:hover{background-color:var(--table-scrollbar-thumb, var(--table-color, #1976d2));opacity:.8}.overflow-x-auto::-webkit-scrollbar,.overflow-y-auto::-webkit-scrollbar,.overflow-auto::-webkit-scrollbar{width:10px;height:10px;background-color:var(--table-scrollbar-bg, #f5f5f5)}.overflow-x-auto::-webkit-scrollbar-thumb,.overflow-y-auto::-webkit-scrollbar-thumb,.overflow-auto::-webkit-scrollbar-thumb{background-color:var(--table-scrollbar-thumb, var(--table-color, #1976d2));border-radius:5px}.overflow-x-auto::-webkit-scrollbar-thumb:hover,.overflow-y-auto::-webkit-scrollbar-thumb:hover,.overflow-auto::-webkit-scrollbar-thumb:hover{background-color:var(--table-scrollbar-thumb, var(--table-color, #1976d2));opacity:.8}:host ::ng-deep .mat-table .mat-header-cell,:host ::ng-deep .mat-header-cell,:host ::ng-deep th.mat-header-cell,:host ::ng-deep .mat-mdc-table .mat-mdc-header-cell,:host ::ng-deep .mat-mdc-header-cell,:host ::ng-deep th.mat-mdc-header-cell{background-color:var(--table-header-bg, #1976d2)!important;color:var(--table-header-text, white)!important;font-weight:600}::ng-deep .fa-filter,::ng-deep i.fa-filter{color:var(--table-color, #1976d2)!important}::ng-deep .rounded-xl.border{border-color:var(--table-color, #1976d2)!important}::ng-deep .border-gray-200.rounded-xl{border-color:var(--table-color, #1976d2)!important}::ng-deep .mdc-notched-outline__notch{border-right:none!important}.mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{padding-bottom:0}::ng-deep .mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{padding-bottom:0}.mat-mdc-text-field-wrapper.mdc-text-field--outlined.mdc-text-field--disabled{background:rgba(0,0,0,.15);background-size:1px 100%!important;background-repeat:repeat-x!important}.mdc-text-field--disabled .mdc-text-field__input{color:#525252}button:not([matTooltip=\"Adicionar novo filtro\"]):not([matTooltip=\"Aplicar filtros\"]):not([matTooltip=\"Limpar filtros\"]):not([matTooltip=\"Exportar Tabela\"]):not(:has(i.fa-plus)):not(:has(i.fa-search)):not(:has(i.fas.fa-redo-alt)):not(:has(i.fa-download)){transition:all .2s ease;cursor:pointer}button:not([matTooltip=\"Adicionar novo filtro\"]):not([matTooltip=\"Aplicar filtros\"]):not([matTooltip=\"Limpar filtros\"]):not([matTooltip=\"Exportar Tabela\"]):not(:has(i.fa-plus)):not(:has(i.fa-search)):not(:has(i.fas.fa-redo-alt)):not(:has(i.fa-download)):hover:not(:disabled){opacity:.9;transform:scale(1.02)}button:not([matTooltip=\"Adicionar novo filtro\"]):not([matTooltip=\"Aplicar filtros\"]):not([matTooltip=\"Limpar filtros\"]):not([matTooltip=\"Exportar Tabela\"]):not(:has(i.fa-plus)):not(:has(i.fa-search)):not(:has(i.fas.fa-redo-alt)):not(:has(i.fa-download)):disabled{opacity:.5;cursor:not-allowed;transform:none}::ng-deep .hide-length .mat-mdc-paginator-range-label{display:none}::ng-deep .hide-next-button .mat-mdc-tooltip-trigger.mat-mdc-paginator-navigation-next.mdc-icon-button.mat-mdc-icon-button.mat-unthemed.mat-mdc-button-base{visibility:hidden}::ng-deep .hide-next-button .mat-mdc-tooltip-trigger.mat-mdc-paginator-navigation-last.mdc-icon-button.mat-mdc-icon-button.mat-unthemed.mat-mdc-button-base.ng-star-inserted{visibility:hidden}::ng-deep .mat-mdc-text-field-wrapper.mdc-text-field.ng-tns-c162-1.mdc-text-field--filled{width:25dvw}::ng-deep .custom-filter .mat-mdc-text-field-wrapper{width:20dvw;max-width:300px}button[matTooltip=\"Adicionar novo filtro\"],button:has(i.fa-plus){display:inline-flex;align-items:center;gap:.5rem;border-radius:9999px;border:2px solid #93c5fd;background-color:#dbeafe;padding:.5rem 1.5rem;font-size:.875rem;font-weight:500;color:#2563eb;transition:all .3s;cursor:pointer;transform:translateY(0)}button[matTooltip=\"Adicionar novo filtro\"]:hover,button:has(i.fa-plus):hover{transform:translateY(-2px);border-color:#60a5fa;background-color:#bfdbfe;box-shadow:0 4px 6px #0000001a}button[matTooltip=\"Aplicar filtros\"],button:has(i.fa-search){display:inline-flex;align-items:center;gap:.5rem;border-radius:.5rem;background-color:#16a34a;padding:.5rem 1.25rem;font-size:.875rem;font-weight:500;color:#fff;transition:background-color .2s;cursor:pointer;border:none}button[matTooltip=\"Aplicar filtros\"]:hover,button:has(i.fa-search):hover{background-color:#15803d}button[matTooltip=\"Aplicar filtros\"]:disabled,button:has(i.fa-search):disabled{opacity:.5;cursor:not-allowed}button[matTooltip=\"Limpar filtros\"],button:has(i.fas.fa-redo-alt){display:inline-flex;align-items:center;gap:.5rem;border-radius:.5rem;background-color:#ef4444;padding:.5rem 1.25rem;font-size:.875rem;font-weight:500;color:#fff;transition:background-color .2s;cursor:pointer;border:none}button[matTooltip=\"Limpar filtros\"]:hover,button:has(i.fas.fa-redo-alt):hover{background-color:#dc2626}button[matTooltip=\"Exportar Tabela\"],button:has(i.fa-download){display:inline-flex;align-items:center;gap:.5rem;border-radius:.5rem;background-color:#f97316;padding:.5rem 1.25rem;font-size:.875rem;font-weight:500;color:#fff;transition:background-color .2s;cursor:pointer;border:none}button[matTooltip=\"Exportar Tabela\"]:hover:not(:disabled),button:has(i.fa-download):hover:not(:disabled){background-color:#ea580c}button[matTooltip=\"Exportar Tabela\"]:disabled,button:has(i.fa-download):disabled{opacity:.5;cursor:not-allowed}\n"] }]
|
|
3909
|
+
}], function () { return [{ type: i1$2.Router }, { type: TableService }, { type: FilterService }, { type: TooltipService }, { type: PaginationService }, { type: i1.AngularFirestore }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, { data: [{
|
|
3910
|
+
type: Input
|
|
3911
|
+
}], downloadTable: [{
|
|
3912
|
+
type: Input
|
|
3913
|
+
}], paginator: [{
|
|
3914
|
+
type: ViewChild,
|
|
3915
|
+
args: [MatPaginator]
|
|
3916
|
+
}], sort: [{
|
|
3917
|
+
type: ViewChild,
|
|
3918
|
+
args: [MatSort]
|
|
3919
|
+
}] });
|
|
3920
|
+
})();
|
|
3921
|
+
|
|
3922
|
+
class NgFirebaseTableKxpModule {
|
|
3923
|
+
}
|
|
3924
|
+
NgFirebaseTableKxpModule.ɵfac = function NgFirebaseTableKxpModule_Factory(t) { return new (t || NgFirebaseTableKxpModule)(); };
|
|
3925
|
+
NgFirebaseTableKxpModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: NgFirebaseTableKxpModule });
|
|
3926
|
+
NgFirebaseTableKxpModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ providers: [TableService, FilterService, TooltipService, PaginationService], imports: [CommonModule,
|
|
3927
|
+
ReactiveFormsModule,
|
|
3928
|
+
FormsModule,
|
|
3929
|
+
RouterModule,
|
|
3930
|
+
MatTableModule,
|
|
3931
|
+
MatPaginatorModule,
|
|
3932
|
+
MatSortModule,
|
|
3933
|
+
MatFormFieldModule,
|
|
3934
|
+
MatInputModule,
|
|
3935
|
+
MatOptionModule,
|
|
3936
|
+
MatSelectModule,
|
|
3937
|
+
MatTooltipModule,
|
|
3938
|
+
MatProgressSpinnerModule,
|
|
3939
|
+
MatIconModule,
|
|
3940
|
+
MatDialogModule] });
|
|
3941
|
+
(function () {
|
|
3942
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgFirebaseTableKxpModule, [{
|
|
3943
|
+
type: NgModule,
|
|
3944
|
+
args: [{
|
|
3945
|
+
declarations: [
|
|
3946
|
+
NgFirebaseTableKxpComponent,
|
|
3947
|
+
TableComponent,
|
|
3948
|
+
TableTabsComponent,
|
|
3949
|
+
TableTooltipComponent,
|
|
3950
|
+
],
|
|
3951
|
+
imports: [
|
|
3952
|
+
CommonModule,
|
|
3953
|
+
ReactiveFormsModule,
|
|
3954
|
+
FormsModule,
|
|
3955
|
+
RouterModule,
|
|
3956
|
+
MatTableModule,
|
|
3957
|
+
MatPaginatorModule,
|
|
3958
|
+
MatSortModule,
|
|
3959
|
+
MatFormFieldModule,
|
|
3960
|
+
MatInputModule,
|
|
3961
|
+
MatOptionModule,
|
|
3962
|
+
MatSelectModule,
|
|
3963
|
+
MatTooltipModule,
|
|
3964
|
+
MatProgressSpinnerModule,
|
|
3965
|
+
MatIconModule,
|
|
3966
|
+
MatDialogModule,
|
|
3967
|
+
],
|
|
3968
|
+
exports: [
|
|
3969
|
+
NgFirebaseTableKxpComponent,
|
|
3970
|
+
TableComponent,
|
|
3971
|
+
TableTabsComponent,
|
|
3972
|
+
TableTooltipComponent,
|
|
3973
|
+
],
|
|
3974
|
+
providers: [TableService, FilterService, TooltipService, PaginationService],
|
|
3975
|
+
}]
|
|
3976
|
+
}], null, null);
|
|
3977
|
+
})();
|
|
3978
|
+
(function () {
|
|
3979
|
+
(typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(NgFirebaseTableKxpModule, { declarations: [NgFirebaseTableKxpComponent,
|
|
3980
|
+
TableComponent,
|
|
3981
|
+
TableTabsComponent,
|
|
3982
|
+
TableTooltipComponent], imports: [CommonModule,
|
|
3983
|
+
ReactiveFormsModule,
|
|
3984
|
+
FormsModule,
|
|
3985
|
+
RouterModule,
|
|
3986
|
+
MatTableModule,
|
|
3987
|
+
MatPaginatorModule,
|
|
3988
|
+
MatSortModule,
|
|
3989
|
+
MatFormFieldModule,
|
|
3990
|
+
MatInputModule,
|
|
3991
|
+
MatOptionModule,
|
|
3992
|
+
MatSelectModule,
|
|
3993
|
+
MatTooltipModule,
|
|
3994
|
+
MatProgressSpinnerModule,
|
|
3995
|
+
MatIconModule,
|
|
3996
|
+
MatDialogModule], exports: [NgFirebaseTableKxpComponent,
|
|
3997
|
+
TableComponent,
|
|
3998
|
+
TableTabsComponent,
|
|
3999
|
+
TableTooltipComponent] });
|
|
4000
|
+
})();
|
|
4001
|
+
|
|
4002
|
+
class NgFirebaseTableKxpService {
|
|
4003
|
+
constructor() { }
|
|
4004
|
+
}
|
|
4005
|
+
NgFirebaseTableKxpService.ɵfac = function NgFirebaseTableKxpService_Factory(t) { return new (t || NgFirebaseTableKxpService)(); };
|
|
4006
|
+
NgFirebaseTableKxpService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: NgFirebaseTableKxpService, factory: NgFirebaseTableKxpService.ɵfac, providedIn: 'root' });
|
|
4007
|
+
(function () {
|
|
4008
|
+
(typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NgFirebaseTableKxpService, [{
|
|
4009
|
+
type: Injectable,
|
|
4010
|
+
args: [{
|
|
4011
|
+
providedIn: 'root',
|
|
4012
|
+
}]
|
|
4013
|
+
}], function () { return []; }, null);
|
|
4014
|
+
})();
|
|
4015
|
+
|
|
4016
|
+
/*
|
|
4017
|
+
* Public API Surface of ng-firebase-table-kxp
|
|
4018
|
+
*/
|
|
4019
|
+
// Main module
|
|
4020
|
+
|
|
4021
|
+
/**
|
|
4022
|
+
* Generated bundle index. Do not edit.
|
|
4023
|
+
*/
|
|
4024
|
+
|
|
4025
|
+
export { FilterService, NgFirebaseTableKxpComponent, NgFirebaseTableKxpModule, NgFirebaseTableKxpService, PaginationService, TABLE_DEFAULTS, TableComponent, TableService, TableTabsComponent, TableTooltipComponent, TooltipService, formatArrayValue, getDisplayValue, getImageKey, getNestedValue, isString, trackByProperty };
|
|
4026
|
+
//# sourceMappingURL=ng-firebase-table-kxp.mjs.map
|