ng-firebase-table-kxp 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/esm2020/lib/components/table/table.component.mjs +776 -0
  2. package/esm2020/lib/firebase-table-kxp-lib.component.mjs +19 -0
  3. package/esm2020/lib/firebase-table-kxp-lib.module.mjs +74 -0
  4. package/esm2020/lib/firebase-table-kxp-lib.service.mjs +14 -0
  5. package/esm2020/lib/services/table.service.mjs +908 -0
  6. package/esm2020/lib/types/Table.mjs +2 -0
  7. package/esm2020/ng-firebase-table-kxp.mjs +5 -0
  8. package/esm2020/public-api.mjs +15 -0
  9. package/fesm2015/ng-firebase-table-kxp.mjs +1811 -0
  10. package/fesm2015/ng-firebase-table-kxp.mjs.map +1 -0
  11. package/fesm2020/ng-firebase-table-kxp.mjs +1784 -0
  12. package/fesm2020/ng-firebase-table-kxp.mjs.map +1 -0
  13. package/index.d.ts +5 -0
  14. package/lib/components/table/table.component.d.ts +111 -0
  15. package/lib/firebase-table-kxp-lib.component.d.ts +5 -0
  16. package/lib/firebase-table-kxp-lib.module.d.ts +21 -0
  17. package/lib/firebase-table-kxp-lib.service.d.ts +6 -0
  18. package/lib/services/table.service.d.ts +70 -0
  19. package/{src/lib/types/Table.ts → lib/types/Table.d.ts} +28 -31
  20. package/package.json +22 -2
  21. package/{src/public-api.ts → public-api.d.ts} +0 -13
  22. package/CHANGELOG.md +0 -88
  23. package/ng-package.json +0 -7
  24. package/src/lib/components/table/table.component.html +0 -555
  25. package/src/lib/components/table/table.component.scss +0 -22
  26. package/src/lib/components/table/table.component.spec.ts +0 -24
  27. package/src/lib/components/table/table.component.ts +0 -917
  28. package/src/lib/firebase-table-kxp-lib.component.spec.ts +0 -23
  29. package/src/lib/firebase-table-kxp-lib.component.ts +0 -15
  30. package/src/lib/firebase-table-kxp-lib.module.ts +0 -45
  31. package/src/lib/firebase-table-kxp-lib.service.spec.ts +0 -16
  32. package/src/lib/firebase-table-kxp-lib.service.ts +0 -9
  33. package/src/lib/services/table.service.spec.ts +0 -16
  34. package/src/lib/services/table.service.ts +0 -1235
  35. package/tsconfig.lib.json +0 -14
  36. package/tsconfig.lib.prod.json +0 -10
  37. package/tsconfig.spec.json +0 -14
@@ -0,0 +1,1784 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, Injectable, Optional, Input, ViewChild, NgModule } from '@angular/core';
3
+ import * as i4 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i5 from '@angular/forms';
6
+ import { FormControl, FormArray, FormGroup, ReactiveFormsModule, FormsModule } from '@angular/forms';
7
+ import * as i1$1 from '@angular/router';
8
+ import { RouterModule } from '@angular/router';
9
+ import * as i6 from '@angular/material/table';
10
+ import { MatTableDataSource, MatTableModule } from '@angular/material/table';
11
+ import * as i7 from '@angular/material/paginator';
12
+ import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
13
+ import * as i8 from '@angular/material/sort';
14
+ import { MatSort, MatSortModule } from '@angular/material/sort';
15
+ import * as i9 from '@angular/material/form-field';
16
+ import { MatFormFieldModule } from '@angular/material/form-field';
17
+ import * as i10 from '@angular/material/input';
18
+ import { MatInputModule } from '@angular/material/input';
19
+ import * as i11 from '@angular/material/select';
20
+ import { MatSelectModule } from '@angular/material/select';
21
+ import * as i13 from '@angular/material/tooltip';
22
+ import { MatTooltipModule } from '@angular/material/tooltip';
23
+ import * as i14 from '@angular/material/progress-spinner';
24
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
25
+ import * as i15 from '@angular/material/icon';
26
+ import { MatIconModule } from '@angular/material/icon';
27
+ import * as i2 from '@angular/material/dialog';
28
+ import { MatDialogModule } from '@angular/material/dialog';
29
+ import { firstValueFrom, Subject, debounceTime } from 'rxjs';
30
+ import firebase from 'firebase/compat/app';
31
+ import * as moment from 'moment';
32
+ import * as i1 from '@angular/fire/compat/firestore';
33
+ import * as i3 from 'ngx-toastr';
34
+ import * as i12 from '@angular/material/core';
35
+
36
+ class FirebaseTableKxpLibComponent {
37
+ }
38
+ FirebaseTableKxpLibComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FirebaseTableKxpLibComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
39
+ FirebaseTableKxpLibComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FirebaseTableKxpLibComponent, selector: "lib-firebase-table-kxp-lib", ngImport: i0, template: `
40
+ <p>
41
+ firebase-table-kxp-lib works!
42
+ </p>
43
+ `, isInline: true });
44
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FirebaseTableKxpLibComponent, decorators: [{
45
+ type: Component,
46
+ args: [{ selector: 'lib-firebase-table-kxp-lib', template: `
47
+ <p>
48
+ firebase-table-kxp-lib works!
49
+ </p>
50
+ ` }]
51
+ }] });
52
+
53
+ class TableService {
54
+ constructor(ngFire, dialog, toastr) {
55
+ this.ngFire = ngFire;
56
+ this.dialog = dialog;
57
+ this.toastr = toastr;
58
+ this.operators = {
59
+ '==': (a, b) => a === b,
60
+ '!=': (a, b) => a !== b,
61
+ '>': (a, b) => a > b,
62
+ '<': (a, b) => a < b,
63
+ '>=': (a, b) => a >= b,
64
+ '<=': (a, b) => a <= b,
65
+ includes: (a, b) => a.includes(b),
66
+ };
67
+ }
68
+ async getItems(collection) {
69
+ try {
70
+ const querySnapshot = await collection.get();
71
+ return querySnapshot.docs.map((doc) => {
72
+ return { ...doc.data(), id: doc.id };
73
+ });
74
+ }
75
+ catch (error) {
76
+ console.warn('Collection não encontrada:', error);
77
+ return [];
78
+ }
79
+ }
80
+ async executeQuery(params) {
81
+ if (params.filterFn) {
82
+ // Lógica com filtro no cliente (filterFn)
83
+ const BATCH_FETCH_SIZE = params.batchSize;
84
+ const GOAL_SIZE = params.batchSize + 1;
85
+ if (params.navigation === 'forward' || params.navigation === 'reload') {
86
+ if (params.navigation === 'reload' && params.doc) {
87
+ params.doc.lastDoc = null;
88
+ }
89
+ let lastDocCursor = params.doc ? params.doc.lastDoc : null;
90
+ let pageResults = [];
91
+ let allFetchedDocs = [];
92
+ let hasMoreDocsInDb = true;
93
+ while (pageResults.length < GOAL_SIZE && hasMoreDocsInDb) {
94
+ let query = this.ngFire.collection(params.collection).ref;
95
+ query = this.applyFilters(query, params.arrange, params.conditions);
96
+ if (lastDocCursor) {
97
+ query = query.startAfter(lastDocCursor);
98
+ }
99
+ query = query.limit(BATCH_FETCH_SIZE);
100
+ const snapshot = await query.get();
101
+ if (snapshot.empty) {
102
+ hasMoreDocsInDb = false;
103
+ break;
104
+ }
105
+ lastDocCursor = snapshot.docs[snapshot.docs.length - 1];
106
+ allFetchedDocs.push(...snapshot.docs);
107
+ const batchUsers = snapshot.docs
108
+ .map((doc) => ({
109
+ id: doc.id,
110
+ ...doc.data(),
111
+ }))
112
+ .filter(params.filterFn);
113
+ pageResults.push(...batchUsers);
114
+ if (snapshot.size < BATCH_FETCH_SIZE) {
115
+ hasMoreDocsInDb = false;
116
+ }
117
+ }
118
+ const hasNextPage = pageResults.length > params.batchSize;
119
+ const finalItems = pageResults.slice(0, params.batchSize);
120
+ const firstDocOfPage = allFetchedDocs.find((doc) => doc.id === finalItems[0]?.id) || null;
121
+ const lastDocOfPage = allFetchedDocs.find((doc) => doc.id === finalItems[finalItems.length - 1]?.id) || null;
122
+ return {
123
+ items: finalItems,
124
+ filterLength: null,
125
+ firstDoc: firstDocOfPage,
126
+ lastDoc: lastDocOfPage,
127
+ hasNextPage: hasNextPage,
128
+ hasPreviousPage: !!(params.doc && params.doc.lastDoc) &&
129
+ params.navigation !== 'reload',
130
+ currentClientPageIndex: undefined,
131
+ };
132
+ }
133
+ // Lógica para trás (backward)
134
+ else if (params.navigation === 'backward') {
135
+ if (!params.doc || !params.doc.firstDoc) {
136
+ return {
137
+ items: [],
138
+ filterLength: null,
139
+ firstDoc: null,
140
+ lastDoc: null,
141
+ hasNextPage: true,
142
+ hasPreviousPage: false,
143
+ currentClientPageIndex: undefined,
144
+ };
145
+ }
146
+ let pageResults = [];
147
+ let allFetchedDocs = [];
148
+ let hasMoreDocsInDb = true;
149
+ let boundaryDoc = params.doc.firstDoc;
150
+ while (pageResults.length < GOAL_SIZE && hasMoreDocsInDb) {
151
+ let query = this.ngFire.collection(params.collection).ref;
152
+ query = this.applyFilters(query, params.arrange, params.conditions);
153
+ query = query.endBefore(boundaryDoc);
154
+ query = query.limitToLast(BATCH_FETCH_SIZE);
155
+ const snapshot = await query.get();
156
+ if (snapshot.empty) {
157
+ hasMoreDocsInDb = false;
158
+ break;
159
+ }
160
+ boundaryDoc = snapshot.docs[0];
161
+ allFetchedDocs = [...snapshot.docs, ...allFetchedDocs];
162
+ const batchUsers = snapshot.docs
163
+ .map((doc) => ({
164
+ id: doc.id,
165
+ ...doc.data(),
166
+ }))
167
+ .filter(params.filterFn);
168
+ pageResults = [...batchUsers, ...pageResults];
169
+ if (snapshot.size < BATCH_FETCH_SIZE) {
170
+ hasMoreDocsInDb = false;
171
+ }
172
+ }
173
+ const finalItems = pageResults.slice(0, params.batchSize);
174
+ const firstDocOfPage = allFetchedDocs.find((doc) => doc.id === finalItems[0]?.id) || null;
175
+ const lastDocOfPage = allFetchedDocs.find((doc) => doc.id === finalItems[finalItems.length - 1]?.id) || null;
176
+ return {
177
+ items: finalItems,
178
+ filterLength: null,
179
+ firstDoc: firstDocOfPage,
180
+ lastDoc: lastDocOfPage,
181
+ hasNextPage: true,
182
+ currentClientPageIndex: undefined,
183
+ };
184
+ }
185
+ }
186
+ else {
187
+ let items = [];
188
+ let docs = [];
189
+ let hasNextPage = false;
190
+ let filterLength = null;
191
+ let query = this.ngFire.collection(params.collection).ref;
192
+ if (params.conditions) {
193
+ params.conditions.forEach((c) => {
194
+ if (c.operator === '!=') {
195
+ query = query.orderBy(c.firestoreProperty);
196
+ }
197
+ });
198
+ }
199
+ query = this.applyFilters(query, params.arrange, params.conditions);
200
+ if (params.navigation === 'reload') {
201
+ query = query.limit(params.batchSize + 1);
202
+ if (params.doc && params.doc.firstDoc) {
203
+ query = query.startAt(params.doc.firstDoc);
204
+ }
205
+ }
206
+ else if (params.navigation === 'forward') {
207
+ query = query.limit(params.batchSize + 1);
208
+ if (params.doc && params.doc.lastDoc) {
209
+ query = query.startAfter(params.doc.lastDoc);
210
+ }
211
+ }
212
+ else {
213
+ // backward
214
+ query = query.limitToLast(params.batchSize + 1);
215
+ if (params.doc && params.doc.firstDoc) {
216
+ query = query.endBefore(params.doc.firstDoc);
217
+ }
218
+ }
219
+ const itemCol = await query.get();
220
+ itemCol.docs.forEach((doc) => docs.push(doc));
221
+ const itemPromises = docs.map(async (item) => {
222
+ const itemData = item.data();
223
+ items.push({ id: item.id, ...itemData });
224
+ });
225
+ let lastDoc = docs[docs.length - 1] || null;
226
+ let firstDoc = docs[0];
227
+ if ((items.length > params.batchSize && params.navigation === 'forward') ||
228
+ (params.navigation === 'reload' && items.length > params.batchSize)) {
229
+ lastDoc = docs[docs.length - 2] || null;
230
+ items.pop();
231
+ hasNextPage = true;
232
+ }
233
+ if (items.length > params.batchSize && params.navigation === 'backward') {
234
+ firstDoc = docs[1];
235
+ items.shift();
236
+ hasNextPage = true;
237
+ }
238
+ await Promise.all(itemPromises);
239
+ return {
240
+ items,
241
+ filterLength,
242
+ lastDoc,
243
+ firstDoc,
244
+ hasNextPage,
245
+ currentClientPageIndex: undefined,
246
+ };
247
+ }
248
+ // Fallback para garantir que sempre retornamos algo
249
+ return {
250
+ items: [],
251
+ filterLength: null,
252
+ firstDoc: null,
253
+ lastDoc: null,
254
+ hasNextPage: false,
255
+ currentClientPageIndex: undefined,
256
+ };
257
+ }
258
+ applyFilters(query, arrange, conditions) {
259
+ if (conditions) {
260
+ conditions.map((cond) => {
261
+ query = query.where(cond.firestoreProperty, cond.operator, cond.dashProperty);
262
+ });
263
+ }
264
+ let hasFilterSpecificOrderBy = false;
265
+ let appliedOrderByField = null;
266
+ const equalsFilters = arrange.filters.filter((f) => f.arrange === 'equals' && f.filter);
267
+ const otherFilters = arrange.filters.filter((f) => f.arrange !== 'equals');
268
+ const equalsGroupedByProperty = equalsFilters.reduce((acc, current) => {
269
+ const prop = current.filter.property;
270
+ if (!acc[prop]) {
271
+ acc[prop] = [];
272
+ }
273
+ acc[prop].push(current.filter.filtering);
274
+ return acc;
275
+ }, {});
276
+ for (const prop in equalsGroupedByProperty) {
277
+ const values = equalsGroupedByProperty[prop];
278
+ if (values.length > 0) {
279
+ query = query.where(prop, 'in', values);
280
+ }
281
+ }
282
+ otherFilters.forEach((filterItem) => {
283
+ // Aplicar filtragem por busca
284
+ if (filterItem.filter?.filtering &&
285
+ filterItem.filter?.property !== '' &&
286
+ filterItem.arrange === 'filter') {
287
+ query = query
288
+ .where(filterItem.filter.property, '>=', filterItem.filter.filtering.trim().toUpperCase())
289
+ .where(filterItem.filter.property, '<=', filterItem.filter.filtering.trim().toUpperCase() + '\uf8ff');
290
+ if (!hasFilterSpecificOrderBy) {
291
+ query = query.orderBy(filterItem.filter.property);
292
+ hasFilterSpecificOrderBy = true;
293
+ appliedOrderByField = filterItem.filter.property;
294
+ }
295
+ }
296
+ // Aplicar filtro do tipo "filterByDate"
297
+ if (filterItem.dateFilter && filterItem.arrange === 'filterByDate') {
298
+ query = query
299
+ .where(arrange.sortBy.field, '>=', filterItem.dateFilter.initial)
300
+ .where(arrange.sortBy.field, '<=', filterItem.dateFilter.final);
301
+ if (!hasFilterSpecificOrderBy) {
302
+ query = query.orderBy(arrange.sortBy.field);
303
+ hasFilterSpecificOrderBy = true;
304
+ appliedOrderByField = arrange.sortBy.field;
305
+ }
306
+ }
307
+ });
308
+ // Aplicar sortBy
309
+ if (arrange.sortBy && arrange.sortBy.field && arrange.sortBy.order) {
310
+ if (appliedOrderByField !== arrange.sortBy.field) {
311
+ query = query.orderBy(arrange.sortBy.field, arrange.sortBy.order);
312
+ }
313
+ }
314
+ return query;
315
+ }
316
+ /**
317
+ * Detecta se a query vai precisar de index composto e deve usar fallback client-side
318
+ */
319
+ shouldUseClientSideFallback(params) {
320
+ const hasConditions = params.conditions && params.conditions.length > 0;
321
+ const hasArrangeFilters = params.arrange?.filters && params.arrange.filters.length > 0;
322
+ const hasSortBy = params.arrange?.sortBy?.field;
323
+ if (params.filterFn) {
324
+ return false;
325
+ }
326
+ if (hasConditions && hasArrangeFilters && hasSortBy) {
327
+ return true;
328
+ }
329
+ if (hasConditions && hasArrangeFilters) {
330
+ return true;
331
+ }
332
+ if (hasArrangeFilters && params.arrange.filters.length > 1 && hasSortBy) {
333
+ return true;
334
+ }
335
+ return false;
336
+ }
337
+ async getPaginated(params) {
338
+ // Detectar preventivamente se deve usar fallback
339
+ if (this.shouldUseClientSideFallback(params)) {
340
+ await this.trackMissingIndexPreventive(params.collection, params.arrange, params.conditions);
341
+ const result = await this.executeClientSideQuery(params);
342
+ console.log('📊 [TABLE] Resultados paginados via fallback client-side:', {
343
+ totalItems: result.filterLength,
344
+ returnedItems: result.items.length,
345
+ hasNextPage: result.hasNextPage,
346
+ currentPage: (result.currentClientPageIndex || 0) + 1,
347
+ });
348
+ return result;
349
+ }
350
+ try {
351
+ const result = await this.executeQuery(params);
352
+ console.log('📊 [TABLE] Resultados paginados via Firestore:', {
353
+ totalItems: result.filterLength || 'N/A',
354
+ returnedItems: result.items.length,
355
+ hasNextPage: result.hasNextPage,
356
+ });
357
+ return result;
358
+ }
359
+ catch (error) {
360
+ if (error && error.code === 'failed-precondition') {
361
+ await this.trackMissingIndex(error, params.collection, params.arrange, params.conditions);
362
+ const result = await this.executeClientSideQuery(params);
363
+ console.log('📊 [TABLE] Resultados paginados via fallback (erro de index):', {
364
+ totalItems: result.filterLength,
365
+ returnedItems: result.items.length,
366
+ hasNextPage: result.hasNextPage,
367
+ currentPage: (result.currentClientPageIndex || 0) + 1,
368
+ });
369
+ return result;
370
+ }
371
+ else if (error && error.code === 'invalid-argument') {
372
+ await this.trackMissingIndex(error, params.collection, params.arrange, params.conditions);
373
+ const result = await this.executeClientSideQuery(params);
374
+ console.log('📊 [TABLE] Resultados paginados via fallback (argumento inválido):', {
375
+ totalItems: result.filterLength,
376
+ returnedItems: result.items.length,
377
+ hasNextPage: result.hasNextPage,
378
+ currentPage: (result.currentClientPageIndex || 0) + 1,
379
+ });
380
+ return result;
381
+ }
382
+ else {
383
+ throw error;
384
+ }
385
+ }
386
+ }
387
+ async executeClientSideQuery(params) {
388
+ // Otimizar usando pelo menos uma cláusula .where() quando possível
389
+ let query = this.ngFire.collection(params.collection).ref;
390
+ let appliedCondition = null;
391
+ let hasAppliedWhereClause = false;
392
+ // Primeiro, tenta aplicar condições simples
393
+ if (params.conditions && params.conditions.length > 0) {
394
+ const simpleCondition = params.conditions.find((cond) => ['==', '>', '<', '>=', '<='].includes(cond.operator));
395
+ if (simpleCondition) {
396
+ query = query.where(simpleCondition.firestoreProperty, simpleCondition.operator, simpleCondition.dashProperty);
397
+ appliedCondition = simpleCondition;
398
+ hasAppliedWhereClause = true;
399
+ }
400
+ }
401
+ // Se não há condições disponíveis, tenta aplicar filtros do arrange
402
+ let appliedFirestoreFilter = null;
403
+ if (!hasAppliedWhereClause && params.arrange?.filters) {
404
+ const equalsFilter = params.arrange.filters.find((f) => f.arrange === 'equals' && f.filter?.filtering);
405
+ if (equalsFilter && equalsFilter.filter) {
406
+ query = query.where(equalsFilter.filter.property, '==', equalsFilter.filter.filtering);
407
+ hasAppliedWhereClause = true;
408
+ appliedFirestoreFilter = equalsFilter;
409
+ }
410
+ else {
411
+ const otherFilter = params.arrange.filters.find((f) => (f.arrange === 'filter' &&
412
+ f.filter?.filtering &&
413
+ f.filter?.property) ||
414
+ (f.arrange === 'filterByDate' &&
415
+ f.dateFilter?.initial &&
416
+ f.dateFilter?.final));
417
+ if (otherFilter) {
418
+ if (otherFilter.arrange === 'filter' && otherFilter.filter) {
419
+ const filterValue = otherFilter.filter.filtering
420
+ .trim()
421
+ .toUpperCase();
422
+ query = query
423
+ .where(otherFilter.filter.property, '>=', filterValue)
424
+ .where(otherFilter.filter.property, '<=', filterValue + '\uf8ff');
425
+ hasAppliedWhereClause = true;
426
+ appliedFirestoreFilter = otherFilter;
427
+ }
428
+ else if (otherFilter.arrange === 'filterByDate' &&
429
+ otherFilter.dateFilter &&
430
+ params.arrange.sortBy?.field) {
431
+ query = query
432
+ .where(params.arrange.sortBy.field, '>=', otherFilter.dateFilter.initial)
433
+ .where(params.arrange.sortBy.field, '<=', otherFilter.dateFilter.final);
434
+ hasAppliedWhereClause = true;
435
+ appliedFirestoreFilter = otherFilter;
436
+ }
437
+ }
438
+ }
439
+ }
440
+ const allDocsSnapshot = await query.get();
441
+ let items = allDocsSnapshot.docs.map((doc) => ({
442
+ id: doc.id,
443
+ ...doc.data(),
444
+ }));
445
+ // Aplicar condições restantes
446
+ if (params.conditions) {
447
+ const remainingConditions = params.conditions.filter((cond) => cond !== appliedCondition);
448
+ if (remainingConditions.length > 0) {
449
+ const operators = this.operators;
450
+ items = items.filter((item) => {
451
+ return remainingConditions.every((cond) => {
452
+ const operatorFn = operators[cond.operator];
453
+ return operatorFn
454
+ ? operatorFn(item[cond.firestoreProperty], cond.dashProperty)
455
+ : false;
456
+ });
457
+ });
458
+ }
459
+ }
460
+ const { filters, sortBy } = params.arrange;
461
+ // Track which filter was already applied in Firestore to avoid double filtering
462
+ if (hasAppliedWhereClause && !appliedCondition && params.arrange?.filters) {
463
+ const equalsFilter = params.arrange.filters.find((f) => f.arrange === 'equals' && f.filter?.filtering);
464
+ if (equalsFilter) {
465
+ appliedFirestoreFilter = equalsFilter;
466
+ }
467
+ else {
468
+ appliedFirestoreFilter = params.arrange.filters.find((f) => (f.arrange === 'filter' &&
469
+ f.filter?.filtering &&
470
+ f.filter?.property) ||
471
+ (f.arrange === 'filterByDate' &&
472
+ f.dateFilter?.initial &&
473
+ f.dateFilter?.final));
474
+ }
475
+ }
476
+ const equalsFilters = filters.filter((f) => f.arrange === 'equals');
477
+ const otherFilters = filters.filter((f) => f.arrange !== 'equals');
478
+ const remainingEqualsFilters = equalsFilters.filter((f) => f !== appliedFirestoreFilter);
479
+ if (remainingEqualsFilters.length > 0) {
480
+ items = items.filter((item) => {
481
+ return remainingEqualsFilters.every((f) => item[f.filter.property] === f.filter.filtering);
482
+ });
483
+ }
484
+ otherFilters.forEach((filterItem) => {
485
+ if (appliedFirestoreFilter === filterItem) {
486
+ return;
487
+ }
488
+ if (filterItem.arrange === 'filter' &&
489
+ filterItem.filter?.filtering &&
490
+ filterItem.filter?.property) {
491
+ const filterValue = String(filterItem.filter.filtering)
492
+ .trim()
493
+ .toLowerCase();
494
+ items = items.filter((item) => {
495
+ const itemValue = String(item[filterItem.filter.property]).toLowerCase();
496
+ return itemValue.includes(filterValue);
497
+ });
498
+ }
499
+ if (filterItem.arrange === 'filterByDate' &&
500
+ filterItem.dateFilter?.initial &&
501
+ filterItem.dateFilter?.final &&
502
+ sortBy.field) {
503
+ items = items.filter((item) => {
504
+ try {
505
+ const fieldValue = item[sortBy.field];
506
+ if (!fieldValue) {
507
+ return false;
508
+ }
509
+ let itemDate;
510
+ if (typeof fieldValue.toDate === 'function') {
511
+ itemDate = fieldValue.toDate();
512
+ }
513
+ else if (fieldValue instanceof Date) {
514
+ itemDate = fieldValue;
515
+ }
516
+ else if (typeof fieldValue === 'string') {
517
+ itemDate = new Date(fieldValue);
518
+ if (isNaN(itemDate.getTime())) {
519
+ return false;
520
+ }
521
+ }
522
+ else if (typeof fieldValue === 'number') {
523
+ itemDate = new Date(fieldValue);
524
+ }
525
+ else {
526
+ return false;
527
+ }
528
+ return (itemDate >= filterItem.dateFilter.initial &&
529
+ itemDate <= filterItem.dateFilter.final);
530
+ }
531
+ catch (error) {
532
+ console.warn('Erro ao processar filtro de data para o item:', item.id, error);
533
+ return false;
534
+ }
535
+ });
536
+ }
537
+ });
538
+ // Aplicar filterFn se existir
539
+ if (params.filterFn) {
540
+ items = items.filter(params.filterFn);
541
+ }
542
+ if (sortBy && sortBy.field && sortBy.order) {
543
+ items.sort((a, b) => {
544
+ const valA = a[sortBy.field];
545
+ const valB = b[sortBy.field];
546
+ if (valA < valB) {
547
+ return sortBy.order === 'asc' ? -1 : 1;
548
+ }
549
+ if (valA > valB) {
550
+ return sortBy.order === 'asc' ? 1 : -1;
551
+ }
552
+ return 0;
553
+ });
554
+ }
555
+ // Paginação
556
+ let currentClientPageIndex = 0;
557
+ if (params.navigation === 'reload') {
558
+ currentClientPageIndex = params.clientPageIndex || 0;
559
+ }
560
+ else if (params.navigation === 'forward') {
561
+ currentClientPageIndex = (params.clientPageIndex || 0) + 1;
562
+ }
563
+ else if (params.navigation === 'backward') {
564
+ currentClientPageIndex = Math.max(0, (params.clientPageIndex || 0) - 1);
565
+ }
566
+ const pageSize = params.batchSize;
567
+ const startIndex = currentClientPageIndex * pageSize;
568
+ const endIndex = startIndex + pageSize;
569
+ const paginatedItems = items.slice(startIndex, endIndex);
570
+ const totalPages = Math.ceil(items.length / pageSize);
571
+ const hasNextPage = currentClientPageIndex < totalPages - 1;
572
+ const hasPreviousPage = currentClientPageIndex > 0;
573
+ return {
574
+ items: paginatedItems,
575
+ filterLength: items.length,
576
+ lastDoc: null,
577
+ firstDoc: null,
578
+ hasNextPage: hasNextPage,
579
+ hasPreviousPage: hasPreviousPage,
580
+ currentClientPageIndex: currentClientPageIndex,
581
+ totalPages: totalPages,
582
+ };
583
+ }
584
+ async getItemsData(collection, arrange, conditions = undefined) {
585
+ try {
586
+ let query = this.ngFire.collection(collection).ref;
587
+ query = this.applyFilters(query, arrange, conditions);
588
+ const snapshot = await query.get();
589
+ return await Promise.all(snapshot.docs.map(async (doc) => {
590
+ const data = doc.data();
591
+ const id = doc.id;
592
+ return {
593
+ id,
594
+ ...data,
595
+ };
596
+ }));
597
+ }
598
+ catch (e) {
599
+ throw e;
600
+ }
601
+ }
602
+ async deleteIndex(id, col, dialogComponent) {
603
+ const dialogRef = this.dialog.open(dialogComponent, {
604
+ data: {
605
+ title: 'Você realmente deseja deletar esse item?',
606
+ description: 'Essa ação é irreversível.',
607
+ },
608
+ });
609
+ const result = await firstValueFrom(dialogRef.afterClosed());
610
+ if (!result === true) {
611
+ return false;
612
+ }
613
+ try {
614
+ const batch = this.ngFire.firestore.batch();
615
+ const docRef = this.ngFire.collection(col).doc(id);
616
+ const docSnapshot = (await firstValueFrom(docRef.get()));
617
+ const doc = docSnapshot.data();
618
+ batch.delete(docRef.ref);
619
+ if (doc && typeof doc.index === 'number') {
620
+ await this.reindex(doc.index, col, batch);
621
+ }
622
+ await batch.commit();
623
+ this.toastr.success('Item excluído com sucesso!');
624
+ return true;
625
+ }
626
+ catch (e) {
627
+ const error = e;
628
+ console.error('Erro ao deletar item:', error);
629
+ this.toastr.error('Erro ao deletar item.');
630
+ return false;
631
+ }
632
+ }
633
+ async reindex(index, col, batch) {
634
+ try {
635
+ const snapshot = (await firstValueFrom(this.ngFire.collection(col).get()));
636
+ const docs = snapshot.docs;
637
+ for (let doc of docs) {
638
+ const data = doc.data();
639
+ if (data && typeof data.index === 'number' && data.index > index) {
640
+ data.index--;
641
+ const docRef = this.ngFire.collection(col).doc(doc.id).ref;
642
+ batch.update(docRef, data);
643
+ }
644
+ }
645
+ }
646
+ catch (error) {
647
+ console.error('Erro ao reindexar:', error);
648
+ }
649
+ return;
650
+ }
651
+ dateFormatValidator() {
652
+ return (control) => {
653
+ if (!control.value) {
654
+ return null;
655
+ }
656
+ const dateStr = control.value.trim();
657
+ const datePattern = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
658
+ if (!datePattern.test(dateStr)) {
659
+ return { invalidFormat: true };
660
+ }
661
+ const parts = dateStr.split('/');
662
+ const day = parts[0].padStart(2, '0');
663
+ const month = parts[1].padStart(2, '0');
664
+ const year = parts[2];
665
+ const normalizedDate = `${day}/${month}/${year}`;
666
+ const date = moment(normalizedDate, 'DD/MM/YYYY', true);
667
+ if (!date.isValid()) {
668
+ return { invalidDate: true };
669
+ }
670
+ return null;
671
+ };
672
+ }
673
+ async updateIndex(index, id, col) {
674
+ await this.ngFire.collection(col).doc(id).update({ index });
675
+ }
676
+ /**
677
+ * Extrai o link de criação de índice da mensagem de erro do Firestore
678
+ */
679
+ extractIndexLink(error) {
680
+ if (!error || !error.message)
681
+ return null;
682
+ const linkMatch = error.message.match(/(https:\/\/console\.firebase\.google\.com\/[^\s]+)/);
683
+ return linkMatch ? linkMatch[1] : null;
684
+ }
685
+ /**
686
+ * Rastreia índices ausentes ao usar fallback preventivo
687
+ */
688
+ async trackMissingIndexPreventive(collection, arrange, conditions = undefined) {
689
+ try {
690
+ const querySignature = this.generateQuerySignature(collection, arrange, conditions);
691
+ const docId = `${collection}_${querySignature}`;
692
+ const indexLink = this.generateIndexLink(collection, arrange, conditions);
693
+ const indexInstructions = this.generateIndexInstructions(collection, arrange, conditions);
694
+ const trackingData = {
695
+ collection,
696
+ indexLink,
697
+ indexInstructions,
698
+ arrange: {
699
+ sortBy: arrange.sortBy,
700
+ filters: arrange.filters?.map((f) => ({
701
+ arrange: f.arrange,
702
+ property: f.filter?.property || null,
703
+ dateField: f.arrange === 'filterByDate' ? arrange.sortBy?.field : null,
704
+ })) || [],
705
+ },
706
+ conditions: conditions?.map((c) => ({
707
+ property: c.firestoreProperty,
708
+ operator: c.operator,
709
+ })) || [],
710
+ errorMessage: `Fallback preventivo usado para a collection ${collection}. A query exigiria índice composto.`,
711
+ updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
712
+ };
713
+ console.log('📄 [INDEX LINK] Dados que serão salvos no documento:', {
714
+ docId,
715
+ collection: trackingData.collection,
716
+ indexLink: trackingData.indexLink,
717
+ arrange: trackingData.arrange,
718
+ conditions: trackingData.conditions,
719
+ errorMessage: trackingData.errorMessage,
720
+ });
721
+ const docRef = this.ngFire.collection('missingIndexes').doc(docId);
722
+ const doc = await docRef.get().toPromise();
723
+ if (doc && doc.exists) {
724
+ await docRef.update({
725
+ count: firebase.firestore.FieldValue.increment(1),
726
+ updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
727
+ lastError: trackingData.errorMessage,
728
+ });
729
+ }
730
+ else {
731
+ await docRef.set({
732
+ ...trackingData,
733
+ count: 1,
734
+ createdAt: firebase.firestore.FieldValue.serverTimestamp(),
735
+ });
736
+ }
737
+ }
738
+ catch (trackingError) {
739
+ console.warn('Falha ao rastrear fallback preventivo:', trackingError);
740
+ }
741
+ }
742
+ /**
743
+ * Gera uma assinatura única para uma query
744
+ */
745
+ generateQuerySignature(collection, arrange, conditions = undefined) {
746
+ const signature = {
747
+ collection,
748
+ sortBy: arrange.sortBy,
749
+ filters: arrange.filters?.map((f) => ({
750
+ arrange: f.arrange,
751
+ property: f.filter?.property || null,
752
+ })) || [],
753
+ conditions: conditions?.map((c) => ({
754
+ property: c.firestoreProperty,
755
+ operator: c.operator,
756
+ })) || [],
757
+ };
758
+ return btoa(JSON.stringify(signature))
759
+ .replace(/[^a-zA-Z0-9]/g, '')
760
+ .substring(0, 20);
761
+ }
762
+ /**
763
+ * Gera instruções claras para criar o índice manualmente
764
+ */
765
+ generateIndexInstructions(collection, arrange, conditions = undefined) {
766
+ const instructions = {
767
+ summary: '',
768
+ collection: collection,
769
+ fields: [],
770
+ queryExample: '',
771
+ stepByStep: [],
772
+ notes: [],
773
+ };
774
+ const fields = [];
775
+ if (conditions && conditions.length > 0) {
776
+ conditions.forEach((condition) => {
777
+ if (condition.firestoreProperty) {
778
+ fields.push({
779
+ field: condition.firestoreProperty,
780
+ order: 'Ascending',
781
+ type: 'WHERE clause',
782
+ operator: condition.operator,
783
+ description: `Filtrar por ${condition.firestoreProperty} usando operador ${condition.operator}`,
784
+ });
785
+ }
786
+ });
787
+ }
788
+ if (arrange.filters && arrange.filters.length > 0) {
789
+ arrange.filters.forEach((filter) => {
790
+ if (filter.filter?.property) {
791
+ fields.push({
792
+ field: filter.filter.property,
793
+ order: 'Ascending',
794
+ type: 'WHERE clause (filter)',
795
+ operator: filter.arrange === 'filter' ? 'CONTAINS' : 'RANGE',
796
+ description: `Filtrar por ${filter.filter.property} usando filtro ${filter.arrange}`,
797
+ });
798
+ }
799
+ });
800
+ }
801
+ if (arrange.sortBy?.field) {
802
+ fields.push({
803
+ field: arrange.sortBy.field,
804
+ order: arrange.sortBy.order === 'desc' ? 'Descending' : 'Ascending',
805
+ type: 'ORDER BY clause',
806
+ operator: 'N/A',
807
+ description: `Ordenar resultados por ${arrange.sortBy.field} em ordem ${arrange.sortBy.order}`,
808
+ });
809
+ }
810
+ instructions.fields = fields;
811
+ const fieldNames = fields.map((f) => f.field).join(' + ');
812
+ instructions.summary = `Criar índice composto para ${collection}: ${fieldNames}`;
813
+ let queryExample = `db.collection('${collection}')`;
814
+ fields.forEach((field, index) => {
815
+ if (field.type.includes('WHERE')) {
816
+ if (field.operator === '==') {
817
+ queryExample += `\n .where('${field.field}', '==', 'value')`;
818
+ }
819
+ else if (field.operator === 'CONTAINS') {
820
+ queryExample += `\n .where('${field.field}', '>=', 'searchText')`;
821
+ }
822
+ else {
823
+ queryExample += `\n .where('${field.field}', '${field.operator}', 'value')`;
824
+ }
825
+ }
826
+ });
827
+ const orderByField = fields.find((f) => f.type.includes('ORDER BY'));
828
+ if (orderByField) {
829
+ queryExample += `\n .orderBy('${orderByField.field}', '${orderByField.order.toLowerCase()}')`;
830
+ }
831
+ instructions.queryExample = queryExample;
832
+ instructions.stepByStep = [
833
+ '1. Ir para Firebase Console → Firestore → Indexes',
834
+ '2. Clicar em "Create Index"',
835
+ `3. Definir Collection ID: ${collection}`,
836
+ '4. Configurar campos nesta ORDEM EXATA:',
837
+ ...fields.map((field, index) => ` ${index + 1}. Campo: ${field.field}, Order: ${field.order}, Array: No`),
838
+ '5. Definir Query scopes: Collection',
839
+ '6. Clicar em "Create" e aguardar conclusão',
840
+ ];
841
+ instructions.notes = [
842
+ '⚠️ A ordem dos campos é CRÍTICA - deve corresponder exatamente à ordem da query',
843
+ '⚠️ As cláusulas WHERE devem vir ANTES do campo ORDER BY',
844
+ '⚠️ Este índice só funcionará para queries com esta combinação EXATA de campos',
845
+ '⚠️ A criação do índice pode levar vários minutos',
846
+ ];
847
+ return instructions;
848
+ }
849
+ /**
850
+ * Gera um link de índice baseado na estrutura da query
851
+ */
852
+ generateIndexLink(collection, arrange, conditions = undefined) {
853
+ try {
854
+ const indexFields = [];
855
+ if (conditions && conditions.length > 0) {
856
+ conditions.forEach((condition) => {
857
+ if (condition.firestoreProperty) {
858
+ indexFields.push(condition.firestoreProperty);
859
+ }
860
+ });
861
+ }
862
+ if (arrange.filters && arrange.filters.length > 0) {
863
+ arrange.filters.forEach((filter) => {
864
+ if (filter.filter?.property) {
865
+ indexFields.push(filter.filter.property);
866
+ }
867
+ });
868
+ }
869
+ if (arrange.sortBy?.field) {
870
+ indexFields.push(arrange.sortBy.field);
871
+ }
872
+ if (indexFields.length > 1) {
873
+ const baseUrl = 'https://console.firebase.google.com/project/toppayy-dev/firestore/indexes';
874
+ const queryParams = new URLSearchParams({
875
+ create_composite: `collection=${collection}&fields=${indexFields.join(',')}`,
876
+ });
877
+ const finalLink = `${baseUrl}?${queryParams.toString()}`;
878
+ return finalLink;
879
+ }
880
+ return null;
881
+ }
882
+ catch (error) {
883
+ console.warn('Falha ao gerar link de índice:', error);
884
+ return null;
885
+ }
886
+ }
887
+ async trackMissingIndex(error, collection, arrange, conditions = undefined) {
888
+ try {
889
+ const indexLink = this.extractIndexLink(error);
890
+ if (!indexLink)
891
+ return;
892
+ const linkHash = btoa(indexLink)
893
+ .replace(/[^a-zA-Z0-9]/g, '')
894
+ .substring(0, 20);
895
+ const docId = `${collection}_${linkHash}`;
896
+ const indexInstructions = this.generateIndexInstructions(collection, arrange, conditions);
897
+ const trackingData = {
898
+ collection,
899
+ indexLink,
900
+ indexInstructions,
901
+ arrange: {
902
+ sortBy: arrange.sortBy,
903
+ filters: arrange.filters?.map((f) => ({
904
+ arrange: f.arrange,
905
+ property: f.filter?.property || null,
906
+ dateField: f.arrange === 'filterByDate' ? arrange.sortBy?.field : null,
907
+ })) || [],
908
+ },
909
+ conditions: conditions?.map((c) => ({
910
+ property: c.firestoreProperty,
911
+ operator: c.operator,
912
+ })) || [],
913
+ errorMessage: error.message,
914
+ updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
915
+ };
916
+ const docRef = this.ngFire.collection('missingIndexes').doc(docId);
917
+ const doc = await docRef.get().toPromise();
918
+ if (doc && doc.exists) {
919
+ await docRef.update({
920
+ count: firebase.firestore.FieldValue.increment(1),
921
+ updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
922
+ lastError: error.message,
923
+ });
924
+ }
925
+ else {
926
+ await docRef.set({
927
+ ...trackingData,
928
+ count: 1,
929
+ createdAt: firebase.firestore.FieldValue.serverTimestamp(),
930
+ });
931
+ }
932
+ }
933
+ catch (trackingError) {
934
+ console.warn('Falha ao rastrear índice ausente:', trackingError);
935
+ }
936
+ }
937
+ }
938
+ TableService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TableService, deps: [{ token: i1.AngularFirestore, optional: true }, { token: i2.MatDialog, optional: true }, { token: i3.ToastrService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
939
+ TableService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TableService, providedIn: 'root' });
940
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TableService, decorators: [{
941
+ type: Injectable,
942
+ args: [{
943
+ providedIn: 'root',
944
+ }]
945
+ }], ctorParameters: function () { return [{ type: i1.AngularFirestore, decorators: [{
946
+ type: Optional
947
+ }] }, { type: i2.MatDialog, decorators: [{
948
+ type: Optional
949
+ }] }, { type: i3.ToastrService, decorators: [{
950
+ type: Optional
951
+ }] }]; } });
952
+
953
+ class TableComponent {
954
+ // CONSTRUCTOR
955
+ constructor(router, tableService, firestore) {
956
+ this.router = router;
957
+ this.tableService = tableService;
958
+ this.firestore = firestore;
959
+ this.arrange = null;
960
+ this.currentPageNumber = 1;
961
+ this.currentClientPageIndex = 0;
962
+ this.items = [];
963
+ this.isLoading = false;
964
+ this.lastDoc = null;
965
+ this.firstDoc = null;
966
+ this.sortBy = {
967
+ field: 'createdAt',
968
+ order: 'desc',
969
+ };
970
+ this.columnProperties = [];
971
+ this.selectSort = new FormControl('');
972
+ this.currentArrange = '';
973
+ this.hasNextPage = false;
974
+ this.dropdownItems = [];
975
+ this.sortableDropdownItems = [];
976
+ this.pageSize = 25;
977
+ this.totalItems = 0;
978
+ this.filterValue = null;
979
+ this.hasFilterableColumn = false;
980
+ this.hasSortableColumn = false;
981
+ this.filterSubject = new Subject();
982
+ this.debounceTimeMs = 500;
983
+ this.selectedTab = 0;
984
+ // Propriedades para controle do tooltip
985
+ this.hoveredCell = null;
986
+ this.showTooltip = false;
987
+ this.tooltipContent = '';
988
+ this.tooltipPosition = { x: 0, y: 0 };
989
+ this.filtersForm = new FormArray([this.createFilterGroup()]);
990
+ }
991
+ createFilterGroup() {
992
+ return new FormGroup({
993
+ selectFilter: new FormControl(''),
994
+ typeFilter: new FormControl(''),
995
+ selectItem: new FormControl(''),
996
+ initialDate: new FormControl('', this.tableService.dateFormatValidator()),
997
+ finalDate: new FormControl('', this.tableService.dateFormatValidator()),
998
+ });
999
+ }
1000
+ addFilter(filterData) {
1001
+ const newFilterGroup = this.createFilterGroup();
1002
+ if (filterData) {
1003
+ if (filterData.selectFilter) {
1004
+ newFilterGroup.get('selectFilter')?.setValue(filterData.selectFilter);
1005
+ }
1006
+ if (filterData.typeFilter) {
1007
+ newFilterGroup.get('typeFilter')?.setValue(filterData.typeFilter);
1008
+ }
1009
+ if (filterData.selectItem) {
1010
+ newFilterGroup.get('selectItem')?.setValue(filterData.selectItem);
1011
+ }
1012
+ if (filterData.initialDate) {
1013
+ newFilterGroup.get('initialDate')?.setValue(filterData.initialDate);
1014
+ }
1015
+ if (filterData.finalDate) {
1016
+ newFilterGroup.get('finalDate')?.setValue(filterData.finalDate);
1017
+ }
1018
+ }
1019
+ this.filtersForm.push(newFilterGroup);
1020
+ }
1021
+ onSelectFilterChange() {
1022
+ const lastIndex = this.filtersForm.length - 1;
1023
+ const lastFilter = this.filtersForm.at(lastIndex);
1024
+ if (lastFilter.get('selectFilter')?.value) {
1025
+ this.addFilter();
1026
+ }
1027
+ }
1028
+ removeFilter(index) {
1029
+ this.filtersForm.removeAt(index);
1030
+ if (this.filtersForm.length === 0) {
1031
+ this.addFilter();
1032
+ }
1033
+ }
1034
+ removeAllFilters() {
1035
+ this.filtersForm.clear();
1036
+ this.addFilter();
1037
+ this.resetFilter();
1038
+ }
1039
+ // METHODS
1040
+ async ngOnInit() {
1041
+ if (!this.data.color)
1042
+ this.data.color = { bg: 'bg-primary', text: 'text-black' };
1043
+ this.columnProperties = this.data.displayedColumns.map((column) => {
1044
+ return column.property;
1045
+ });
1046
+ if (this.data.actionButton && !this.data.actionButton.condition) {
1047
+ this.data.actionButton.condition = (_row) => true;
1048
+ }
1049
+ if (this.data.pagination) {
1050
+ this.data.displayedColumns.forEach((col) => {
1051
+ if (col.isFilterable) {
1052
+ if (this.hasFilterableColumn === false)
1053
+ this.hasFilterableColumn = true;
1054
+ this.dropdownItems.push({
1055
+ ...col,
1056
+ arrange: 'filter',
1057
+ title: col.title,
1058
+ });
1059
+ }
1060
+ if (col.isSortable) {
1061
+ if (this.hasSortableColumn === false)
1062
+ this.hasSortableColumn = true;
1063
+ this.sortableDropdownItems.push({
1064
+ ...col,
1065
+ arrange: 'ascending',
1066
+ title: col.title + ': crescente',
1067
+ });
1068
+ this.sortableDropdownItems.push({
1069
+ ...col,
1070
+ arrange: 'descending',
1071
+ title: col.title + ': decrescente',
1072
+ });
1073
+ }
1074
+ if (col.isFilterableByDate) {
1075
+ this.dropdownItems.push({
1076
+ ...col,
1077
+ arrange: 'filterByDate',
1078
+ title: col.title + ': filtro por data',
1079
+ });
1080
+ }
1081
+ });
1082
+ if (this.data.filterableOptions) {
1083
+ this.data.filterableOptions.forEach((option) => this.dropdownItems.push({ ...option, arrange: 'equals' }));
1084
+ }
1085
+ }
1086
+ // Sem paginação
1087
+ if (this.data.pagination === false) {
1088
+ await this.loadItems();
1089
+ }
1090
+ // Com paginação
1091
+ if (this.data.pagination === true) {
1092
+ if (this.data.sortBy)
1093
+ this.sortBy = {
1094
+ field: this.data.sortBy.field,
1095
+ order: this.data.sortBy.order,
1096
+ };
1097
+ this.filterSubject
1098
+ .pipe(debounceTime(this.debounceTimeMs))
1099
+ .subscribe(() => {
1100
+ this.loadItemsPaginated('forward', true);
1101
+ });
1102
+ this.isLoading = true;
1103
+ await this.loadItemsPaginated('forward', true);
1104
+ this.sort.active = 'createdAt';
1105
+ this.sort.direction = 'desc';
1106
+ this.dataSource.paginator = this.paginator;
1107
+ this.dataSource.sort = this.sort;
1108
+ this.totalItems = 0;
1109
+ if (this.data.totalRef) {
1110
+ for (const totalRef of this.data.totalRef) {
1111
+ const totalRefDoc = await totalRef.ref.get();
1112
+ const docData = totalRefDoc.data();
1113
+ if (docData && docData[totalRef.field])
1114
+ this.totalItems = (this.totalItems +
1115
+ docData[totalRef.field]);
1116
+ }
1117
+ }
1118
+ this.isLoading = false;
1119
+ }
1120
+ }
1121
+ getDisplayValue(col, row, withinLimit = false) {
1122
+ let value;
1123
+ if (row[col.property] === null || row[col.property] === undefined) {
1124
+ return '';
1125
+ }
1126
+ if (col.calculateValue) {
1127
+ value = String(col.calculateValue(row));
1128
+ }
1129
+ else {
1130
+ value = this.getNestedValue(row, col.property);
1131
+ }
1132
+ // Verifica se é um array e tem arrayField definido
1133
+ if (Array.isArray(value) && col.arrayField) {
1134
+ value = this.formatArrayValue(value, col.arrayField);
1135
+ }
1136
+ if (col.queryLength && row[col.property]) {
1137
+ value = row[col.property];
1138
+ }
1139
+ value = col.pipe ? col.pipe.transform(value) : value;
1140
+ return withinLimit ? value : value.substring(0, col.charLimit) + '...';
1141
+ }
1142
+ getNestedValue(obj, path) {
1143
+ if (!path)
1144
+ return undefined;
1145
+ const properties = path.split('.');
1146
+ return properties.reduce((acc, currentPart) => acc && acc[currentPart], obj);
1147
+ }
1148
+ formatArrayValue(array, field) {
1149
+ if (!Array.isArray(array) || array.length === 0) {
1150
+ return '';
1151
+ }
1152
+ const values = array
1153
+ .map((item) => {
1154
+ if (typeof item === 'object' && item !== null) {
1155
+ return item[field] || '';
1156
+ }
1157
+ return String(item);
1158
+ })
1159
+ .filter((value) => value !== '' && value !== null && value !== undefined);
1160
+ return values.join(', ');
1161
+ }
1162
+ // Métodos sem paginação
1163
+ async loadItems() {
1164
+ this.items = await this.tableService.getItems(this.data.collectionRef);
1165
+ if (this.data.conditions) {
1166
+ this.filterItems();
1167
+ }
1168
+ await this.loadRelations();
1169
+ await this.loadQueryLengths();
1170
+ this.totalItems = this.items.length;
1171
+ this.dataSource = new MatTableDataSource(this.items);
1172
+ this.dataSource.paginator = this.paginator;
1173
+ this.dataSource.sort = this.sort;
1174
+ if (this.data.sortBy) {
1175
+ this.dataSource.sort.active = this.data.sortBy.field;
1176
+ this.dataSource.sort.direction = this.data.sortBy.order;
1177
+ this.dataSource.sort.sortChange.emit();
1178
+ }
1179
+ this.dataSource.filterPredicate = (data, filter) => {
1180
+ return this.data.displayedColumns.some((col) => {
1181
+ if (col.filterPredicates) {
1182
+ return col.filterPredicates.some((predicate) => {
1183
+ const propertyValue = data[col.property];
1184
+ if (!propertyValue || typeof propertyValue !== 'object') {
1185
+ return false;
1186
+ }
1187
+ const predicateValue = propertyValue[predicate];
1188
+ if (predicateValue === null || predicateValue === undefined) {
1189
+ return false;
1190
+ }
1191
+ return String(predicateValue)
1192
+ .trim()
1193
+ .toLocaleLowerCase()
1194
+ .includes(filter);
1195
+ });
1196
+ }
1197
+ if (col.property && col.isFilterable) {
1198
+ const propertyValue = data[col.property];
1199
+ if (propertyValue === null || propertyValue === undefined) {
1200
+ return false;
1201
+ }
1202
+ return String(propertyValue)
1203
+ .trim()
1204
+ .toLocaleLowerCase()
1205
+ .includes(filter);
1206
+ }
1207
+ return false;
1208
+ });
1209
+ };
1210
+ this.filterPredicate = this.dataSource.filterPredicate;
1211
+ }
1212
+ // Métodos com paginação
1213
+ async loadItemsPaginated(navigation = 'reload', reset = false) {
1214
+ if (reset && ['forward', 'reload'].includes(navigation)) {
1215
+ this.lastDoc = null;
1216
+ }
1217
+ if (reset && ['backward', 'reload'].includes(navigation)) {
1218
+ this.firstDoc = null;
1219
+ }
1220
+ const activeFilters = this.filtersForm.controls
1221
+ .flatMap((control) => {
1222
+ const group = control;
1223
+ const selectedFilter = group.get('selectFilter')?.value;
1224
+ if (!selectedFilter)
1225
+ return [];
1226
+ const arrange = selectedFilter.arrange;
1227
+ if (arrange === 'filter') {
1228
+ const filterValue = group.get('typeFilter')?.value;
1229
+ if (!filterValue)
1230
+ return [];
1231
+ return {
1232
+ arrange,
1233
+ filter: {
1234
+ property: selectedFilter.property,
1235
+ filtering: filterValue,
1236
+ },
1237
+ dateFilter: undefined,
1238
+ };
1239
+ }
1240
+ if (arrange === 'filterByDate') {
1241
+ const initial = group.get('initialDate')?.value;
1242
+ const final = group.get('finalDate')?.value;
1243
+ if (initial && final) {
1244
+ const [dayI, monthI, yearI] = initial.split('/');
1245
+ const initialDate = new Date(`${monthI}/${dayI}/${yearI}`);
1246
+ const [dayF, monthF, yearF] = final.split('/');
1247
+ const finalDate = new Date(`${monthF}/${dayF}/${yearF}`);
1248
+ finalDate.setHours(23, 59, 59);
1249
+ return {
1250
+ arrange,
1251
+ filter: undefined,
1252
+ dateFilter: {
1253
+ initial: initialDate,
1254
+ final: finalDate,
1255
+ },
1256
+ };
1257
+ }
1258
+ return [];
1259
+ }
1260
+ if (selectedFilter.hasOwnProperty('items') && arrange === 'equals') {
1261
+ const selectedItems = group.get('selectItem')?.value;
1262
+ if (Array.isArray(selectedItems) && selectedItems.length > 0) {
1263
+ return selectedItems.map((item) => ({
1264
+ arrange,
1265
+ filter: {
1266
+ property: item.property,
1267
+ filtering: item.value,
1268
+ },
1269
+ dateFilter: undefined,
1270
+ }));
1271
+ }
1272
+ }
1273
+ return [];
1274
+ })
1275
+ .filter((f) => f && (f.filter?.filtering !== undefined || f.dateFilter));
1276
+ this.arrange = {
1277
+ filters: activeFilters,
1278
+ sortBy: this.sortBy,
1279
+ };
1280
+ const paginated = {
1281
+ batchSize: this.pageSize,
1282
+ collection: this.data.collection,
1283
+ doc: { lastDoc: this.lastDoc, firstDoc: this.firstDoc },
1284
+ navigation,
1285
+ arrange: this.arrange,
1286
+ conditions: this.data.conditions,
1287
+ size: this.totalItems,
1288
+ filterFn: this.data.filterFn,
1289
+ clientPageIndex: this.currentClientPageIndex,
1290
+ };
1291
+ const result = await this.tableService.getPaginated(paginated);
1292
+ this.items = result.items;
1293
+ await this.loadRelations();
1294
+ await this.loadQueryLengths();
1295
+ this.lastDoc = result.lastDoc;
1296
+ this.firstDoc = result.firstDoc;
1297
+ // Atualizar currentClientPageIndex se retornado pelo fallback
1298
+ if (result.currentClientPageIndex !== undefined) {
1299
+ this.currentClientPageIndex = result.currentClientPageIndex;
1300
+ }
1301
+ let sum = 0;
1302
+ if (this.data.totalRef) {
1303
+ for (const totalRef of this.data.totalRef) {
1304
+ const totalRefDoc = await totalRef.ref.get();
1305
+ const docData = totalRefDoc.data();
1306
+ if (docData || result.filterLength) {
1307
+ sum =
1308
+ result.filterLength ??
1309
+ (sum + (docData ? docData[totalRef.field] : 0));
1310
+ }
1311
+ }
1312
+ this.totalItems = sum;
1313
+ }
1314
+ this.hasNextPage = result.hasNextPage;
1315
+ this.dataSource = new MatTableDataSource(this.items);
1316
+ this.filterPredicate = this.dataSource.filterPredicate;
1317
+ }
1318
+ async onPageChange(event) {
1319
+ if (this.data.pagination === true && event) {
1320
+ this.isLoading = true;
1321
+ const previousPageIndex = event.previousPageIndex ?? 0;
1322
+ const pageIndex = event.pageIndex;
1323
+ const currentComponentPageSize = this.pageSize;
1324
+ const eventPageSize = event.pageSize;
1325
+ const totalItems = this.totalItems;
1326
+ let navigationDirection;
1327
+ let resetDocs = false;
1328
+ let originalPageSize = null;
1329
+ const lastPageIndex = Math.max(0, Math.ceil(totalItems / eventPageSize) - 1);
1330
+ // Atualizar currentClientPageIndex sempre para o fallback
1331
+ this.currentClientPageIndex = pageIndex;
1332
+ if (previousPageIndex !== undefined && pageIndex > previousPageIndex) {
1333
+ this.currentPageNumber++;
1334
+ }
1335
+ else if (previousPageIndex !== undefined &&
1336
+ pageIndex < previousPageIndex) {
1337
+ this.currentPageNumber = Math.max(1, this.currentPageNumber - 1);
1338
+ }
1339
+ if (eventPageSize !== currentComponentPageSize) {
1340
+ console.log('Alterou a quantidade de elementos exibidos por página');
1341
+ this.pageSize = eventPageSize;
1342
+ navigationDirection = 'forward';
1343
+ resetDocs = true;
1344
+ this.currentClientPageIndex = 0;
1345
+ }
1346
+ else if (pageIndex === 0 &&
1347
+ previousPageIndex !== undefined &&
1348
+ pageIndex < previousPageIndex) {
1349
+ console.log('Pulou para a primeira página');
1350
+ navigationDirection = 'forward';
1351
+ this.currentPageNumber = 1;
1352
+ this.currentClientPageIndex = 0;
1353
+ resetDocs = true;
1354
+ }
1355
+ else if (pageIndex === lastPageIndex &&
1356
+ previousPageIndex !== undefined &&
1357
+ pageIndex > previousPageIndex &&
1358
+ pageIndex - previousPageIndex > 1) {
1359
+ console.log('Pulou para a ultima página');
1360
+ navigationDirection = 'backward';
1361
+ resetDocs = true;
1362
+ const itemsExpectedInLastPage = totalItems - lastPageIndex * eventPageSize;
1363
+ if (itemsExpectedInLastPage > 0 &&
1364
+ itemsExpectedInLastPage < eventPageSize) {
1365
+ originalPageSize = this.pageSize;
1366
+ this.pageSize = itemsExpectedInLastPage;
1367
+ }
1368
+ }
1369
+ else if (previousPageIndex !== undefined &&
1370
+ pageIndex > previousPageIndex) {
1371
+ console.log('Procedendo');
1372
+ navigationDirection = 'forward';
1373
+ resetDocs = false;
1374
+ }
1375
+ else if (previousPageIndex !== undefined &&
1376
+ pageIndex < previousPageIndex) {
1377
+ console.log('Retrocedendo.');
1378
+ navigationDirection = 'backward';
1379
+ resetDocs = false;
1380
+ }
1381
+ else if (previousPageIndex !== undefined &&
1382
+ pageIndex === previousPageIndex) {
1383
+ console.log('Recarregando.');
1384
+ navigationDirection = 'reload';
1385
+ resetDocs = false;
1386
+ }
1387
+ else if (previousPageIndex === undefined && pageIndex === 0) {
1388
+ console.log('Evento inicial do paginador para pág 0. ngOnInit carregou.');
1389
+ this.isLoading = false;
1390
+ if (event)
1391
+ this.pageEvent = event;
1392
+ return;
1393
+ }
1394
+ else {
1395
+ console.warn('INESPERADO! Condição de navegação não tratada:', event);
1396
+ this.isLoading = false;
1397
+ if (event)
1398
+ this.pageEvent = event;
1399
+ return;
1400
+ }
1401
+ if (navigationDirection) {
1402
+ try {
1403
+ await this.loadItemsPaginated(navigationDirection, resetDocs);
1404
+ }
1405
+ catch (error) {
1406
+ console.error('Erro ao carregar itens paginados:', error);
1407
+ }
1408
+ finally {
1409
+ if (originalPageSize !== null) {
1410
+ this.pageSize = originalPageSize;
1411
+ }
1412
+ }
1413
+ }
1414
+ if (event)
1415
+ this.pageEvent = event;
1416
+ this.isLoading = false;
1417
+ }
1418
+ }
1419
+ // Outros métodos
1420
+ applyFilter(value) {
1421
+ // Sem paginação
1422
+ if (this.data.pagination === false) {
1423
+ this.dataSource.filter = String(value).trim().toLowerCase();
1424
+ }
1425
+ // Com paginação
1426
+ if (this.data.pagination === true) {
1427
+ this.filterValue = value;
1428
+ this.filterSubject.next(this.filterValue);
1429
+ }
1430
+ }
1431
+ goToDetails(row) {
1432
+ if (this.data.isNotClickable) {
1433
+ return;
1434
+ }
1435
+ const urlPath = this.data.url || this.data.name;
1436
+ const url = this.router.serializeUrl(this.router.createUrlTree([`/${urlPath}`, row.id]));
1437
+ window.open(url, '_blank');
1438
+ }
1439
+ async getRelation(params) {
1440
+ try {
1441
+ let snapshot;
1442
+ if (params.id !== '' &&
1443
+ params.id !== undefined &&
1444
+ params.collection !== undefined &&
1445
+ params.collection !== '') {
1446
+ snapshot = await firstValueFrom(this.firestore.collection(params.collection).doc(params.id).get());
1447
+ }
1448
+ if (snapshot && snapshot.exists) {
1449
+ const data = snapshot.data();
1450
+ return data?.[params.newProperty] ?? '';
1451
+ }
1452
+ return '';
1453
+ }
1454
+ catch (e) {
1455
+ console.log(e);
1456
+ return '';
1457
+ }
1458
+ }
1459
+ async loadRelations() {
1460
+ const relationPromises = this.data.displayedColumns
1461
+ .filter((col) => col.relation)
1462
+ .flatMap((col) => this.items.map(async (item) => {
1463
+ if (col.relation) {
1464
+ item[col.property] = await this.getRelation({
1465
+ id: item[col.relation.property],
1466
+ collection: col.relation.collection,
1467
+ newProperty: col.relation.newProperty,
1468
+ });
1469
+ }
1470
+ }));
1471
+ await Promise.all(relationPromises);
1472
+ }
1473
+ async getQueryLength(params) {
1474
+ const snapshot = await this.firestore
1475
+ .collection(params.relation.collection)
1476
+ .ref.where(params.relation.property, params.relation.operator, params.item[params.relation.value])
1477
+ .get();
1478
+ return snapshot.size;
1479
+ }
1480
+ async loadQueryLengths() {
1481
+ const lengthPromises = this.data.displayedColumns
1482
+ .filter((col) => col.queryLength)
1483
+ .flatMap((col) => this.items.map(async (item) => {
1484
+ if (col.queryLength) {
1485
+ item[col.property] = await this.getQueryLength({
1486
+ item: item,
1487
+ relation: col.queryLength,
1488
+ });
1489
+ }
1490
+ }));
1491
+ await Promise.all(lengthPromises);
1492
+ }
1493
+ filterItems() {
1494
+ if (this.data.conditions) {
1495
+ this.data.conditions.forEach((cond) => {
1496
+ this.items = this.items.filter((item) => {
1497
+ const operatorFunction = this.tableService.operators[cond.operator];
1498
+ if (operatorFunction) {
1499
+ return operatorFunction(item[cond.firestoreProperty], cond.dashProperty);
1500
+ }
1501
+ return false;
1502
+ });
1503
+ });
1504
+ }
1505
+ }
1506
+ // Filtro de data
1507
+ async search() {
1508
+ if (this.selectSort.value) {
1509
+ if (this.selectSort.value.arrange === 'ascending') {
1510
+ this.sortBy = {
1511
+ field: this.selectSort.value.property,
1512
+ order: 'asc',
1513
+ };
1514
+ }
1515
+ if (this.selectSort.value.arrange === 'descending') {
1516
+ this.sortBy = {
1517
+ field: this.selectSort.value.property,
1518
+ order: 'desc',
1519
+ };
1520
+ }
1521
+ }
1522
+ await this.loadItemsPaginated('reload', true);
1523
+ this.currentArrange =
1524
+ this.filtersForm.length > 0
1525
+ ? this.filtersForm.at(0).get('selectFilter')?.value?.arrange ?? ''
1526
+ : '';
1527
+ this.paginator.firstPage();
1528
+ }
1529
+ async resetFilter() {
1530
+ if (!this.data.pagination) {
1531
+ this.dataSource.filter = '';
1532
+ if (this.filterPredicate) {
1533
+ this.dataSource.filterPredicate = this.filterPredicate;
1534
+ }
1535
+ }
1536
+ else {
1537
+ this.dataSource.filter = '';
1538
+ if (this.filterPredicate) {
1539
+ this.dataSource.filterPredicate = this.filterPredicate;
1540
+ }
1541
+ }
1542
+ this.filtersForm.clear();
1543
+ this.addFilter();
1544
+ this.selectSort.patchValue('');
1545
+ this.sortBy = {
1546
+ order: this.data.sortBy ? this.data.sortBy.order : 'desc',
1547
+ field: this.data.sortBy ? this.data.sortBy.field : 'createdAt',
1548
+ };
1549
+ await this.loadItemsPaginated('reload', true);
1550
+ this.currentArrange = '';
1551
+ this.paginator.firstPage();
1552
+ }
1553
+ // Método público para recarregar a tabela
1554
+ async reloadTable() {
1555
+ if (this.data.pagination) {
1556
+ await this.loadItemsPaginated('reload', true);
1557
+ this.paginator.firstPage();
1558
+ }
1559
+ else {
1560
+ await this.loadItems();
1561
+ }
1562
+ }
1563
+ updateDisplayedColumns() {
1564
+ if (this.dataSource) {
1565
+ this.dataSource = new MatTableDataSource([]);
1566
+ }
1567
+ this.columnProperties = this.data.displayedColumns.map((column) => {
1568
+ return column.property;
1569
+ });
1570
+ this.dropdownItems = [];
1571
+ this.sortableDropdownItems = [];
1572
+ this.data.displayedColumns.forEach((col) => {
1573
+ if (col.isFilterable) {
1574
+ this.dropdownItems.push({
1575
+ ...col,
1576
+ arrange: 'filter',
1577
+ title: col.title,
1578
+ });
1579
+ }
1580
+ if (col.isSortable) {
1581
+ this.sortableDropdownItems.push({
1582
+ ...col,
1583
+ arrange: 'ascending',
1584
+ title: col.title + ': crescente',
1585
+ });
1586
+ this.sortableDropdownItems.push({
1587
+ ...col,
1588
+ arrange: 'descending',
1589
+ title: col.title + ': decrescente',
1590
+ });
1591
+ }
1592
+ if (col.isFilterableByDate) {
1593
+ this.dropdownItems.push({
1594
+ ...col,
1595
+ arrange: 'filterByDate',
1596
+ title: col.title + ': filtro por data',
1597
+ });
1598
+ }
1599
+ });
1600
+ if (this.data.filterableOptions) {
1601
+ this.data.filterableOptions.forEach((option) => this.dropdownItems.push({ ...option, arrange: 'equals' }));
1602
+ }
1603
+ }
1604
+ isString(value) {
1605
+ return typeof value === 'string';
1606
+ }
1607
+ // Métodos para controle do tooltip
1608
+ onCellMouseEnter(event, row, col) {
1609
+ // Só mostrar tooltip se a coluna tiver charLimit definido
1610
+ if (!col.charLimit) {
1611
+ return;
1612
+ }
1613
+ const fullValue = this.getDisplayValue(col, row, true);
1614
+ // Só mostrar tooltip se o valor completo for maior que o limite
1615
+ if (fullValue.length <= col.charLimit) {
1616
+ return;
1617
+ }
1618
+ this.hoveredCell = { row, col };
1619
+ this.tooltipContent = fullValue;
1620
+ // Definir posição do tooltip
1621
+ this.tooltipPosition = {
1622
+ x: event.clientX + 10,
1623
+ y: event.clientY - 10,
1624
+ };
1625
+ // Timeout para mostrar o tooltip
1626
+ this.tooltipTimeout = setTimeout(() => {
1627
+ if (this.hoveredCell &&
1628
+ this.hoveredCell.row === row &&
1629
+ this.hoveredCell.col === col) {
1630
+ this.showTooltip = true;
1631
+ }
1632
+ }, 500);
1633
+ }
1634
+ onCellMouseLeave() {
1635
+ if (this.tooltipTimeout) {
1636
+ clearTimeout(this.tooltipTimeout);
1637
+ this.tooltipTimeout = null;
1638
+ }
1639
+ this.showTooltip = false;
1640
+ this.hoveredCell = null;
1641
+ this.tooltipContent = '';
1642
+ }
1643
+ onCellMouseMove(event) {
1644
+ if (this.showTooltip) {
1645
+ this.tooltipPosition = {
1646
+ x: event.clientX + 10,
1647
+ y: event.clientY - 10,
1648
+ };
1649
+ }
1650
+ }
1651
+ // Métodos para inversão vertical dos tabs
1652
+ getTabGroups(tabs) {
1653
+ if (!tabs || tabs.length === 0)
1654
+ return [];
1655
+ const totalGroups = Math.ceil(tabs.length / 6);
1656
+ const groups = [];
1657
+ // Criar array de índices invertidos (último grupo primeiro)
1658
+ for (let i = totalGroups - 1; i >= 0; i--) {
1659
+ groups.push(i);
1660
+ }
1661
+ return groups;
1662
+ }
1663
+ getTabGroup(tabs, groupIndex) {
1664
+ if (!tabs || tabs.length === 0)
1665
+ return [];
1666
+ const startIndex = groupIndex * 6;
1667
+ const endIndex = Math.min(startIndex + 6, tabs.length);
1668
+ return tabs.slice(startIndex, endIndex);
1669
+ }
1670
+ getRealTabIndex(groupIndex, tabIndexInGroup) {
1671
+ if (!this.data.tabs?.tabsData)
1672
+ return 0;
1673
+ const totalGroups = Math.ceil(this.data.tabs.tabsData.length / 6);
1674
+ const realGroupIndex = totalGroups - 1 - groupIndex;
1675
+ return realGroupIndex * 6 + tabIndexInGroup;
1676
+ }
1677
+ onTableSelected(i, j) {
1678
+ if (!this.data.tabs?.tabsData || !this.data.tabs.method)
1679
+ return;
1680
+ this.selectedTab = this.getRealTabIndex(i, j);
1681
+ const tab = this.data.tabs.tabsData[this.selectedTab];
1682
+ if (tab) {
1683
+ this.data.tabs.method(tab, this.selectedTab);
1684
+ }
1685
+ }
1686
+ isTabSelected(originalIndex) {
1687
+ return this.selectedTab === originalIndex;
1688
+ }
1689
+ }
1690
+ TableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TableComponent, deps: [{ token: i1$1.Router }, { token: TableService }, { token: i1.AngularFirestore }], target: i0.ɵɵFactoryTarget.Component });
1691
+ TableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TableComponent, selector: "lib-table", inputs: { data: "data", downloadTable: "downloadTable" }, viewQueries: [{ propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }], ngImport: i0, 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, Custom Action, and Global Actions -->\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]=\"\n (data.actionButton.colorClass || 'bg-blue-500') +\n ' flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white hover:opacity-70'\n \"\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\n <!-- Right Side: Search, Reset, Export -->\n <div\n class=\"flex flex-wrap gap-3\"\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\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 rounded-lg border border-gray-200 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 *ngFor=\"let item of dropdownItems\" [value]=\"item\">\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()\"\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 matInput\n (keyup.enter)=\"search()\"\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 (keyup.enter)=\"search()\"\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 & Sort -->\n <div\n class=\"-mb-2 flex flex-col items-center justify-between gap-4 border-t border-gray-200 pt-4 sm:flex-row\"\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 <!-- Sort Dropdown -->\n <div\n class=\"w-full sm:w-auto sm:min-w-[250px]\"\n *ngIf=\"sortableDropdownItems.length > 0\"\n >\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label>Ordenar por</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 <!-- SIMPLE SEARCH (for non-paginated tables) -->\n <div\n class=\"rounded-xl border border-gray-200 bg-white p-4 shadow-lg\"\n *ngIf=\"data.pagination === 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()\"\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 <button\n *ngIf=\"data.actionButton\"\n [ngClass]=\"\n (data.actionButton.colorClass || 'bg-blue-500') +\n ' float-right flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white hover:opacity-70'\n \"\n [routerLink]=\"data.actionButton.routerLink\"\n (click)=\"\n data.actionButton.method ? data.actionButton.method($event) : null\n \"\n >\n <i *ngIf=\"data.actionButton.icon\" [class]=\"data.actionButton.icon\"></i>\n {{ data.actionButton.label }}\n </button>\n </div>\n\n <div class=\"flex flex-col\">\n <div\n class=\"mx-auto flex flex-col\"\n *ngIf=\"data.tabs && data.tabs.tabsData && data.tabs.tabsData.length > 0\"\n >\n <!-- Calcular quantos grupos de 6 tabs existem -->\n <ng-container\n *ngFor=\"\n let groupIndex of getTabGroups(data.tabs.tabsData);\n let i = index\n \"\n >\n <div class=\"mx-auto flex flex-row\">\n <ng-container\n *ngFor=\"\n let tab of getTabGroup(data.tabs.tabsData, groupIndex);\n let j = index\n \"\n >\n <button\n class=\"border-2 border-gray-300 bg-gray-200 px-4 py-2 font-medium transition hover:brightness-95\"\n [ngClass]=\"\n isTabSelected(getRealTabIndex(i, j))\n ? 'border-b-0 brightness-110'\n : ''\n \"\n (click)=\"onTableSelected(i, j)\"\n >\n {{ tab.label }}\n <span\n *ngIf=\"tab.counter !== undefined\"\n class=\"ml-2 text-xs font-bold\"\n [ngClass]=\"tab.counterClass\"\n >\n {{ tab.counter }}\n </span>\n </button>\n </ng-container>\n </div>\n </ng-container>\n </div>\n <div class=\"mat-elevation-z8 w-full overflow-x-auto rounded-xl\">\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\"\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 [ngClass]=\"\n (data?.color?.bg ? ' ' + $any(data.color).bg : '') +\n (data?.color?.text ? ' ' + $any(data.color).text : '')\n \"\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 [ngClass]=\"\n (data?.color?.bg ? ' ' + $any(data.color).bg : '') +\n (data?.color?.text ? ' ' + $any(data.color).text : '')\n \"\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 <img\n *ngIf=\"\n col.image && col.image.path && !col.iconClass && !col.method\n \"\n [src]=\"col.image.path + '/' + row[col.property]\"\n [ngClass]=\"col.image.class\"\n alt=\"Imagem\"\n />\n <img\n *ngIf=\"\n col.image && col.image.url && !col.iconClass && !col.method\n \"\n [src]=\"row[col.property]\"\n [ngClass]=\"col.image.class\"\n alt=\"Imagem\"\n />\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]=\"{\n 'example-element-row': data.isNotClickable === true,\n 'example-element-row cursor-pointer': !data.isNotClickable\n }\"\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\" 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\">\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]=\"{\n 'hide-length':\n ['filter', 'filterByDate', 'equals'].includes(\n this.currentArrange\n ) || this.data.filterFn,\n 'hide-next-button': !hasNextPage && data.pagination === true,\n 'hide-last-button':\n (!hasNextPage && data.pagination === true) || this.data.filterFn\n }\"\n >\n </mat-paginator>\n <div\n *ngIf=\"\n !isLoading &&\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 <div\n *ngIf=\"showTooltip\"\n class=\"fixed z-50 max-w-md break-words rounded-lg bg-gray-800 px-3 py-2 text-sm text-white shadow-lg\"\n [style.left.px]=\"tooltipPosition.x\"\n [style.top.px]=\"tooltipPosition.y\"\n [style.pointer-events]=\"'none'\"\n >\n {{ tooltipContent }}\n </div>\n</div>\n", styles: ["::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}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i6.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i6.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i6.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i6.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i6.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i6.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i6.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i6.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i6.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i6.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i6.MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "component", type: i7.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "directive", type: i8.MatSort, selector: "[matSort]", inputs: ["matSortDisabled", "matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i8.MatSortHeader, selector: "[mat-sort-header]", inputs: ["disabled", "mat-sort-header", "arrowPosition", "start", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: i9.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i9.MatLabel, selector: "mat-label" }, { kind: "directive", type: i9.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i10.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i11.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i12.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i13.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i14.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i15.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
1692
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TableComponent, decorators: [{
1693
+ type: Component,
1694
+ args: [{ selector: 'lib-table', 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, Custom Action, and Global Actions -->\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]=\"\n (data.actionButton.colorClass || 'bg-blue-500') +\n ' flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white hover:opacity-70'\n \"\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\n <!-- Right Side: Search, Reset, Export -->\n <div\n class=\"flex flex-wrap gap-3\"\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\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 rounded-lg border border-gray-200 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 *ngFor=\"let item of dropdownItems\" [value]=\"item\">\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()\"\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 matInput\n (keyup.enter)=\"search()\"\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 (keyup.enter)=\"search()\"\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 & Sort -->\n <div\n class=\"-mb-2 flex flex-col items-center justify-between gap-4 border-t border-gray-200 pt-4 sm:flex-row\"\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 <!-- Sort Dropdown -->\n <div\n class=\"w-full sm:w-auto sm:min-w-[250px]\"\n *ngIf=\"sortableDropdownItems.length > 0\"\n >\n <mat-form-field appearance=\"outline\" class=\"w-full\">\n <mat-label>Ordenar por</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 <!-- SIMPLE SEARCH (for non-paginated tables) -->\n <div\n class=\"rounded-xl border border-gray-200 bg-white p-4 shadow-lg\"\n *ngIf=\"data.pagination === 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()\"\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 <button\n *ngIf=\"data.actionButton\"\n [ngClass]=\"\n (data.actionButton.colorClass || 'bg-blue-500') +\n ' float-right flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-white hover:opacity-70'\n \"\n [routerLink]=\"data.actionButton.routerLink\"\n (click)=\"\n data.actionButton.method ? data.actionButton.method($event) : null\n \"\n >\n <i *ngIf=\"data.actionButton.icon\" [class]=\"data.actionButton.icon\"></i>\n {{ data.actionButton.label }}\n </button>\n </div>\n\n <div class=\"flex flex-col\">\n <div\n class=\"mx-auto flex flex-col\"\n *ngIf=\"data.tabs && data.tabs.tabsData && data.tabs.tabsData.length > 0\"\n >\n <!-- Calcular quantos grupos de 6 tabs existem -->\n <ng-container\n *ngFor=\"\n let groupIndex of getTabGroups(data.tabs.tabsData);\n let i = index\n \"\n >\n <div class=\"mx-auto flex flex-row\">\n <ng-container\n *ngFor=\"\n let tab of getTabGroup(data.tabs.tabsData, groupIndex);\n let j = index\n \"\n >\n <button\n class=\"border-2 border-gray-300 bg-gray-200 px-4 py-2 font-medium transition hover:brightness-95\"\n [ngClass]=\"\n isTabSelected(getRealTabIndex(i, j))\n ? 'border-b-0 brightness-110'\n : ''\n \"\n (click)=\"onTableSelected(i, j)\"\n >\n {{ tab.label }}\n <span\n *ngIf=\"tab.counter !== undefined\"\n class=\"ml-2 text-xs font-bold\"\n [ngClass]=\"tab.counterClass\"\n >\n {{ tab.counter }}\n </span>\n </button>\n </ng-container>\n </div>\n </ng-container>\n </div>\n <div class=\"mat-elevation-z8 w-full overflow-x-auto rounded-xl\">\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\"\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 [ngClass]=\"\n (data?.color?.bg ? ' ' + $any(data.color).bg : '') +\n (data?.color?.text ? ' ' + $any(data.color).text : '')\n \"\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 [ngClass]=\"\n (data?.color?.bg ? ' ' + $any(data.color).bg : '') +\n (data?.color?.text ? ' ' + $any(data.color).text : '')\n \"\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 <img\n *ngIf=\"\n col.image && col.image.path && !col.iconClass && !col.method\n \"\n [src]=\"col.image.path + '/' + row[col.property]\"\n [ngClass]=\"col.image.class\"\n alt=\"Imagem\"\n />\n <img\n *ngIf=\"\n col.image && col.image.url && !col.iconClass && !col.method\n \"\n [src]=\"row[col.property]\"\n [ngClass]=\"col.image.class\"\n alt=\"Imagem\"\n />\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]=\"{\n 'example-element-row': data.isNotClickable === true,\n 'example-element-row cursor-pointer': !data.isNotClickable\n }\"\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\" 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\">\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]=\"{\n 'hide-length':\n ['filter', 'filterByDate', 'equals'].includes(\n this.currentArrange\n ) || this.data.filterFn,\n 'hide-next-button': !hasNextPage && data.pagination === true,\n 'hide-last-button':\n (!hasNextPage && data.pagination === true) || this.data.filterFn\n }\"\n >\n </mat-paginator>\n <div\n *ngIf=\"\n !isLoading &&\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 <div\n *ngIf=\"showTooltip\"\n class=\"fixed z-50 max-w-md break-words rounded-lg bg-gray-800 px-3 py-2 text-sm text-white shadow-lg\"\n [style.left.px]=\"tooltipPosition.x\"\n [style.top.px]=\"tooltipPosition.y\"\n [style.pointer-events]=\"'none'\"\n >\n {{ tooltipContent }}\n </div>\n</div>\n", styles: ["::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}\n"] }]
1695
+ }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: TableService }, { type: i1.AngularFirestore }]; }, propDecorators: { data: [{
1696
+ type: Input
1697
+ }], downloadTable: [{
1698
+ type: Input
1699
+ }], paginator: [{
1700
+ type: ViewChild,
1701
+ args: [MatPaginator]
1702
+ }], sort: [{
1703
+ type: ViewChild,
1704
+ args: [MatSort]
1705
+ }] } });
1706
+
1707
+ class FirebaseTableKxpLibModule {
1708
+ }
1709
+ FirebaseTableKxpLibModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FirebaseTableKxpLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1710
+ FirebaseTableKxpLibModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: FirebaseTableKxpLibModule, declarations: [FirebaseTableKxpLibComponent, TableComponent], imports: [CommonModule,
1711
+ ReactiveFormsModule,
1712
+ FormsModule,
1713
+ RouterModule,
1714
+ MatTableModule,
1715
+ MatPaginatorModule,
1716
+ MatSortModule,
1717
+ MatFormFieldModule,
1718
+ MatInputModule,
1719
+ MatSelectModule,
1720
+ MatTooltipModule,
1721
+ MatProgressSpinnerModule,
1722
+ MatIconModule,
1723
+ MatDialogModule], exports: [FirebaseTableKxpLibComponent, TableComponent] });
1724
+ FirebaseTableKxpLibModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FirebaseTableKxpLibModule, imports: [CommonModule,
1725
+ ReactiveFormsModule,
1726
+ FormsModule,
1727
+ RouterModule,
1728
+ MatTableModule,
1729
+ MatPaginatorModule,
1730
+ MatSortModule,
1731
+ MatFormFieldModule,
1732
+ MatInputModule,
1733
+ MatSelectModule,
1734
+ MatTooltipModule,
1735
+ MatProgressSpinnerModule,
1736
+ MatIconModule,
1737
+ MatDialogModule] });
1738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FirebaseTableKxpLibModule, decorators: [{
1739
+ type: NgModule,
1740
+ args: [{
1741
+ declarations: [FirebaseTableKxpLibComponent, TableComponent],
1742
+ imports: [
1743
+ CommonModule,
1744
+ ReactiveFormsModule,
1745
+ FormsModule,
1746
+ RouterModule,
1747
+ MatTableModule,
1748
+ MatPaginatorModule,
1749
+ MatSortModule,
1750
+ MatFormFieldModule,
1751
+ MatInputModule,
1752
+ MatSelectModule,
1753
+ MatTooltipModule,
1754
+ MatProgressSpinnerModule,
1755
+ MatIconModule,
1756
+ MatDialogModule,
1757
+ ],
1758
+ exports: [FirebaseTableKxpLibComponent, TableComponent],
1759
+ }]
1760
+ }] });
1761
+
1762
+ class FirebaseTableKxpLibService {
1763
+ constructor() { }
1764
+ }
1765
+ FirebaseTableKxpLibService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FirebaseTableKxpLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1766
+ FirebaseTableKxpLibService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FirebaseTableKxpLibService, providedIn: 'root' });
1767
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FirebaseTableKxpLibService, decorators: [{
1768
+ type: Injectable,
1769
+ args: [{
1770
+ providedIn: 'root'
1771
+ }]
1772
+ }], ctorParameters: function () { return []; } });
1773
+
1774
+ /*
1775
+ * Public API Surface of firebase-table-kxp-lib
1776
+ */
1777
+ // Main module
1778
+
1779
+ /**
1780
+ * Generated bundle index. Do not edit.
1781
+ */
1782
+
1783
+ export { FirebaseTableKxpLibComponent, FirebaseTableKxpLibModule, FirebaseTableKxpLibService, TableComponent, TableService };
1784
+ //# sourceMappingURL=ng-firebase-table-kxp.mjs.map