ng-firebase-table-kxp 1.0.1 → 1.0.3

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 (38) hide show
  1. package/README.md +602 -594
  2. package/esm2020/lib/components/table/table.component.mjs +790 -0
  3. package/esm2020/lib/firebase-table-kxp-lib.component.mjs +19 -0
  4. package/esm2020/lib/firebase-table-kxp-lib.module.mjs +74 -0
  5. package/esm2020/lib/firebase-table-kxp-lib.service.mjs +14 -0
  6. package/esm2020/lib/services/table.service.mjs +905 -0
  7. package/esm2020/lib/types/Table.mjs +2 -0
  8. package/esm2020/ng-firebase-table-kxp.mjs +5 -0
  9. package/esm2020/public-api.mjs +15 -0
  10. package/fesm2015/ng-firebase-table-kxp.mjs +1823 -0
  11. package/fesm2015/ng-firebase-table-kxp.mjs.map +1 -0
  12. package/fesm2020/ng-firebase-table-kxp.mjs +1795 -0
  13. package/fesm2020/ng-firebase-table-kxp.mjs.map +1 -0
  14. package/index.d.ts +5 -0
  15. package/lib/components/table/table.component.d.ts +112 -0
  16. package/lib/firebase-table-kxp-lib.component.d.ts +5 -0
  17. package/lib/firebase-table-kxp-lib.module.d.ts +21 -0
  18. package/lib/firebase-table-kxp-lib.service.d.ts +6 -0
  19. package/lib/services/table.service.d.ts +74 -0
  20. package/{src/lib/types/Table.ts → lib/types/Table.d.ts} +139 -142
  21. package/package.json +22 -2
  22. package/{src/public-api.ts → public-api.d.ts} +6 -19
  23. package/CHANGELOG.md +0 -88
  24. package/ng-package.json +0 -7
  25. package/src/lib/components/table/table.component.html +0 -555
  26. package/src/lib/components/table/table.component.scss +0 -22
  27. package/src/lib/components/table/table.component.spec.ts +0 -24
  28. package/src/lib/components/table/table.component.ts +0 -917
  29. package/src/lib/firebase-table-kxp-lib.component.spec.ts +0 -23
  30. package/src/lib/firebase-table-kxp-lib.component.ts +0 -15
  31. package/src/lib/firebase-table-kxp-lib.module.ts +0 -45
  32. package/src/lib/firebase-table-kxp-lib.service.spec.ts +0 -16
  33. package/src/lib/firebase-table-kxp-lib.service.ts +0 -9
  34. package/src/lib/services/table.service.spec.ts +0 -16
  35. package/src/lib/services/table.service.ts +0 -1235
  36. package/tsconfig.lib.json +0 -14
  37. package/tsconfig.lib.prod.json +0 -10
  38. package/tsconfig.spec.json +0 -14
@@ -0,0 +1,74 @@
1
+ import { AngularFirestore, CollectionReference } from '@angular/fire/compat/firestore';
2
+ import firebase from 'firebase/compat/app';
3
+ import { Arrange, Condition, Pagination } from '../types/Table';
4
+ import { MatDialog } from '@angular/material/dialog';
5
+ import { ToastrService } from 'ngx-toastr';
6
+ import { ValidatorFn } from '@angular/forms';
7
+ import * as i0 from "@angular/core";
8
+ interface PaginationResult {
9
+ items: any[];
10
+ filterLength: number | null;
11
+ firstDoc: firebase.firestore.QueryDocumentSnapshot<unknown> | null;
12
+ lastDoc: firebase.firestore.QueryDocumentSnapshot<unknown> | null;
13
+ hasNextPage: boolean;
14
+ hasPreviousPage?: boolean;
15
+ currentClientPageIndex?: number;
16
+ totalPages?: number;
17
+ }
18
+ export declare class TableService {
19
+ private ngFire;
20
+ private dialog;
21
+ private toastr;
22
+ constructor(ngFire: AngularFirestore, dialog: MatDialog, toastr: ToastrService);
23
+ getItems(collection: CollectionReference<unknown>): Promise<any[]>;
24
+ private executeQuery;
25
+ applyFilters(query: firebase.firestore.Query<unknown>, arrange: Arrange, conditions: Condition[] | undefined): firebase.firestore.Query<unknown>;
26
+ /**
27
+ * Detecta se a query vai precisar de index composto e deve usar fallback client-side
28
+ */
29
+ private shouldUseClientSideFallback;
30
+ getPaginated(params: Pagination): Promise<PaginationResult>;
31
+ executeClientSideQuery(params: Pagination): Promise<PaginationResult>;
32
+ getItemsData(collection: string, arrange: Arrange, conditions?: Condition[] | undefined): Promise<any[]>;
33
+ operators: {
34
+ '==': (a: any, b: any) => boolean;
35
+ '!=': (a: any, b: any) => boolean;
36
+ '>': (a: any, b: any) => boolean;
37
+ '<': (a: any, b: any) => boolean;
38
+ '>=': (a: any, b: any) => boolean;
39
+ '<=': (a: any, b: any) => boolean;
40
+ in: (a: any, b: any) => boolean;
41
+ 'not-in': (a: any, b: any) => boolean;
42
+ 'array-contains': (a: any, b: any) => boolean;
43
+ 'array-contains-any': (a: any, b: any) => boolean;
44
+ includes: (a: any, b: any) => any;
45
+ };
46
+ deleteIndex(id: string, col: string): Promise<boolean>;
47
+ reindex(index: number, col: string, batch: firebase.firestore.WriteBatch): Promise<void>;
48
+ dateFormatValidator(): ValidatorFn;
49
+ updateIndex(index: number, id: string, col: string): Promise<void>;
50
+ /**
51
+ * Extrai o link de criação de índice da mensagem de erro do Firestore
52
+ */
53
+ private extractIndexLink;
54
+ /**
55
+ * Rastreia índices ausentes ao usar fallback preventivo
56
+ */
57
+ private trackMissingIndexPreventive;
58
+ /**
59
+ * Gera uma assinatura única para uma query
60
+ */
61
+ private generateQuerySignature;
62
+ /**
63
+ * Gera instruções claras para criar o índice manualmente
64
+ */
65
+ private generateIndexInstructions;
66
+ /**
67
+ * Gera um link de índice baseado na estrutura da query
68
+ */
69
+ private generateIndexLink;
70
+ private trackMissingIndex;
71
+ static ɵfac: i0.ɵɵFactoryDeclaration<TableService, [{ optional: true; }, { optional: true; }, { optional: true; }]>;
72
+ static ɵprov: i0.ɵɵInjectableDeclaration<TableService>;
73
+ }
74
+ export {};
@@ -1,142 +1,139 @@
1
- import {
2
- CollectionReference,
3
- DocumentReference,
4
- QueryDocumentSnapshot
5
- } from '@angular/fire/compat/firestore';
6
- import {PipeTransform} from '@angular/core';
7
- import firebase from 'firebase/compat';
8
- import WhereFilterOp = firebase.firestore.WhereFilterOp;
9
- import {OrderByDirection} from 'firebase/firestore';
10
-
11
- export interface TableData {
12
- displayedColumns: Column[];
13
- filterableOptions?: FilterableOption[];
14
- collectionRef: CollectionReference<unknown>;
15
- collection: string;
16
- name: string;
17
- totalRef?: {ref: DocumentReference<unknown>; field: string}[];
18
- download: boolean;
19
- pagination: boolean;
20
- isNotClickable?: boolean;
21
- url?: string;
22
- sortBy?: {field: string; order: OrderByDirection};
23
- conditions?: {
24
- operator: WhereFilterOp;
25
- firestoreProperty: string;
26
- dashProperty: string | string[];
27
- }[];
28
- filterFn?: (item: any) => boolean;
29
- color?: {bg: string; text: string};
30
- actionButton?: {
31
- label: string;
32
- routerLink: string;
33
- icon?: string;
34
- colorClass?: string;
35
- method?: (row: any, event?: any) => any;
36
- condition?: (row?: any) => boolean;
37
- };
38
- tabs?: Tab;
39
- }
40
-
41
- export interface Tab {
42
- method: (tab: any, event?: any) => any;
43
- tabsData: TabData[];
44
- }
45
-
46
- export interface TabData {
47
- label: string;
48
- counter?: number;
49
- counterClass?: string;
50
- }
51
-
52
- export interface Column {
53
- property: string;
54
- title?: string;
55
- charLimit?: number;
56
- pipe?: PipeTransform;
57
- iconClass?: {
58
- text?: string;
59
- class?: string;
60
- condition?: (row: any) => any;
61
- buttonMethod?: (row: any, event?: any) => any;
62
- }[];
63
- isSortable?: boolean;
64
- isFilterable?: boolean;
65
- isFilterableByDate?: boolean;
66
- hasLink?: boolean | string;
67
- hasDownload?: boolean | string;
68
- relation?: {
69
- collection: string;
70
- property: string;
71
- newProperty: string;
72
- };
73
- queryLength?: {
74
- collection: string;
75
- property: string;
76
- operator: WhereFilterOp;
77
- value: string;
78
- };
79
- image?: Image;
80
- method?: (row: any, event?: any) => any;
81
- filterPredicates?: string[];
82
- calculateValue?: (row: any) => any;
83
- arrayField?: string;
84
- }
85
-
86
- export interface Image {
87
- class: string;
88
- path?: string;
89
- url?: boolean;
90
- default?: string;
91
- }
92
-
93
- export interface FilterableOption {
94
- title: string;
95
- items: {
96
- property: string;
97
- value: string | boolean;
98
- label: string;
99
- }[];
100
- }
101
-
102
- export interface Pagination {
103
- batchSize: number;
104
- collection: string;
105
- doc?: {
106
- firstDoc: QueryDocumentSnapshot<any> | null;
107
- lastDoc: QueryDocumentSnapshot<any> | null;
108
- };
109
- navigation: 'reload' | 'forward' | 'backward';
110
- arrange: Arrange;
111
- conditions?: Condition[];
112
- filterFn?: (item: any) => boolean;
113
- size?: number;
114
- clientPageIndex?: number;
115
- }
116
-
117
- export interface Condition {
118
- operator: WhereFilterOp;
119
- firestoreProperty: string;
120
- dashProperty: string | string[];
121
- }
122
-
123
- export interface Arrange {
124
- filters: {
125
- arrange:
126
- | 'ascending'
127
- | 'descending'
128
- | 'filter'
129
- | 'filterByDate'
130
- | 'equals'
131
- | '';
132
- filter?: {property: string; filtering: string} | null;
133
- dateFilter?: {
134
- initial: Date;
135
- final: Date;
136
- };
137
- }[];
138
- sortBy: {field: string; order: OrderByDirection};
139
- elementId?: {property: string; value: string};
140
- }
141
-
142
-
1
+ import { CollectionReference, DocumentReference, QueryDocumentSnapshot } from '@angular/fire/compat/firestore';
2
+ import { PipeTransform } from '@angular/core';
3
+ import firebase from 'firebase/compat';
4
+ import WhereFilterOp = firebase.firestore.WhereFilterOp;
5
+ import { OrderByDirection } from 'firebase/firestore';
6
+ export interface TableData {
7
+ displayedColumns: Column[];
8
+ filterableOptions?: FilterableOption[];
9
+ collectionRef: CollectionReference<unknown>;
10
+ collection: string;
11
+ name: string;
12
+ totalRef?: {
13
+ ref: DocumentReference<unknown>;
14
+ field: string;
15
+ }[];
16
+ download: boolean;
17
+ pagination: boolean;
18
+ isNotClickable?: boolean;
19
+ url?: string;
20
+ sortBy?: {
21
+ field: string;
22
+ order: OrderByDirection;
23
+ };
24
+ conditions?: {
25
+ operator: WhereFilterOp;
26
+ firestoreProperty: string;
27
+ dashProperty: string | string[];
28
+ }[];
29
+ filterFn?: (item: any) => boolean;
30
+ color?: {
31
+ bg: string;
32
+ text: string;
33
+ };
34
+ actionButton?: {
35
+ label: string;
36
+ routerLink: string;
37
+ icon?: string;
38
+ colorClass?: string;
39
+ method?: (row: any, event?: any) => any;
40
+ condition?: (row?: any) => boolean;
41
+ };
42
+ tabs?: Tab;
43
+ }
44
+ export interface Tab {
45
+ method: (tab: any, event?: any) => any;
46
+ tabsData: TabData[];
47
+ }
48
+ export interface TabData {
49
+ label: string;
50
+ counter?: number;
51
+ counterClass?: string;
52
+ }
53
+ export interface Column {
54
+ property: string;
55
+ title?: string;
56
+ charLimit?: number;
57
+ pipe?: PipeTransform;
58
+ iconClass?: {
59
+ text?: string;
60
+ class?: string;
61
+ condition?: (row: any) => any;
62
+ buttonMethod?: (row: any, event?: any) => any;
63
+ }[];
64
+ isSortable?: boolean;
65
+ isFilterable?: boolean;
66
+ isFilterableByDate?: boolean;
67
+ hasLink?: boolean | string;
68
+ hasDownload?: boolean | string;
69
+ relation?: {
70
+ collection: string;
71
+ property: string;
72
+ newProperty: string;
73
+ };
74
+ queryLength?: {
75
+ collection: string;
76
+ property: string;
77
+ operator: WhereFilterOp;
78
+ value: string;
79
+ };
80
+ image?: Image;
81
+ method?: (row: any, event?: any) => any;
82
+ filterPredicates?: string[];
83
+ calculateValue?: (row: any) => any;
84
+ arrayField?: string;
85
+ }
86
+ export interface Image {
87
+ class: string;
88
+ path?: string;
89
+ url?: boolean;
90
+ default?: string;
91
+ }
92
+ export interface FilterableOption {
93
+ title: string;
94
+ items: {
95
+ property: string;
96
+ value: string | boolean;
97
+ label: string;
98
+ }[];
99
+ }
100
+ export interface Pagination {
101
+ batchSize: number;
102
+ collection: string;
103
+ doc?: {
104
+ firstDoc: QueryDocumentSnapshot<any> | null;
105
+ lastDoc: QueryDocumentSnapshot<any> | null;
106
+ };
107
+ navigation: 'reload' | 'forward' | 'backward';
108
+ arrange: Arrange;
109
+ conditions?: Condition[];
110
+ filterFn?: (item: any) => boolean;
111
+ size?: number;
112
+ clientPageIndex?: number;
113
+ }
114
+ export interface Condition {
115
+ operator: WhereFilterOp;
116
+ firestoreProperty: string;
117
+ dashProperty: string | string[];
118
+ }
119
+ export interface Arrange {
120
+ filters: {
121
+ arrange: 'ascending' | 'descending' | 'filter' | 'filterByDate' | 'equals' | '';
122
+ filter?: {
123
+ property: string;
124
+ filtering: string;
125
+ } | null;
126
+ dateFilter?: {
127
+ initial: Date;
128
+ final: Date;
129
+ };
130
+ }[];
131
+ sortBy: {
132
+ field: string;
133
+ order: OrderByDirection;
134
+ };
135
+ elementId?: {
136
+ property: string;
137
+ value: string;
138
+ };
139
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-firebase-table-kxp",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Uma biblioteca Angular poderosa para criar tabelas dinâmicas com integração completa ao Firebase Firestore",
5
5
  "keywords": [
6
6
  "angular",
@@ -32,5 +32,25 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "tslib": "^2.3.0"
35
- }
35
+ },
36
+ "module": "fesm2015/ng-firebase-table-kxp.mjs",
37
+ "es2020": "fesm2020/ng-firebase-table-kxp.mjs",
38
+ "esm2020": "esm2020/ng-firebase-table-kxp.mjs",
39
+ "fesm2020": "fesm2020/ng-firebase-table-kxp.mjs",
40
+ "fesm2015": "fesm2015/ng-firebase-table-kxp.mjs",
41
+ "typings": "index.d.ts",
42
+ "exports": {
43
+ "./package.json": {
44
+ "default": "./package.json"
45
+ },
46
+ ".": {
47
+ "types": "./index.d.ts",
48
+ "esm2020": "./esm2020/ng-firebase-table-kxp.mjs",
49
+ "es2020": "./fesm2020/ng-firebase-table-kxp.mjs",
50
+ "es2015": "./fesm2015/ng-firebase-table-kxp.mjs",
51
+ "node": "./fesm2015/ng-firebase-table-kxp.mjs",
52
+ "default": "./fesm2020/ng-firebase-table-kxp.mjs"
53
+ }
54
+ },
55
+ "sideEffects": false
36
56
  }
@@ -1,19 +1,6 @@
1
- /*
2
- * Public API Surface of firebase-table-kxp-lib
3
- */
4
-
5
- // Main module
6
- export * from './lib/firebase-table-kxp-lib.module';
7
-
8
- // Legacy components (se existirem)
9
- export * from './lib/firebase-table-kxp-lib.service';
10
- export * from './lib/firebase-table-kxp-lib.component';
11
-
12
- // Components
13
- export * from './lib/components/table/table.component';
14
-
15
- // Services
16
- export * from './lib/services/table.service';
17
-
18
- // Types
19
- export * from './lib/types/Table';
1
+ export * from './lib/firebase-table-kxp-lib.module';
2
+ export * from './lib/firebase-table-kxp-lib.service';
3
+ export * from './lib/firebase-table-kxp-lib.component';
4
+ export * from './lib/components/table/table.component';
5
+ export * from './lib/services/table.service';
6
+ export * from './lib/types/Table';
package/CHANGELOG.md DELETED
@@ -1,88 +0,0 @@
1
- # Changelog
2
-
3
- Todas as mudanças notáveis neste projeto serão documentadas neste arquivo.
4
-
5
- O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.0.0/),
6
- e este projeto adere ao [Versionamento Semântico](https://semver.org/lang/pt-BR/).
7
-
8
- ## [Unreleased]
9
-
10
- ## [0.0.1] - 2024-11-03
11
-
12
- ### Adicionado
13
- - ✨ Componente principal de tabela (`TableComponent`)
14
- - 🔥 Integração completa com Firebase Firestore
15
- - 📊 Sistema de paginação avançado (client-side e server-side)
16
- - 🔍 Sistema de filtros:
17
- - Filtro por texto
18
- - Filtro por data
19
- - Filtro por igualdade (equals)
20
- - Filtros personalizados com dropdown
21
- - Função de filtro customizada (filterFn)
22
- - ⚡ Fallback automático client-side quando índices compostos não existem
23
- - 📈 Rastreamento automático de índices ausentes
24
- - 🔗 Suporte a relações entre collections
25
- - 🖼️ Suporte a exibição de imagens
26
- - 🎯 Botões de ação customizáveis
27
- - 📥 Sistema de exportação de dados
28
- - 🎨 Interface Material Design responsiva
29
- - 📝 Suporte a valores calculados
30
- - 🔢 Suporte a arrays e propriedades aninhadas
31
- - 💬 Tooltips para valores longos com charLimit
32
- - 🎨 Customização de cores e estilos
33
- - 📑 Sistema de tabs
34
- - 🔄 Método público `reloadTable()` para atualização manual
35
- - 📊 Query lengths para contar documentos relacionados
36
-
37
- ### Serviços
38
- - `TableService` com métodos:
39
- - `getPaginated()` - Paginação otimizada
40
- - `getItems()` - Buscar todos os itens
41
- - `getItemsData()` - Buscar itens com filtros
42
- - `executeClientSideQuery()` - Fallback client-side
43
- - `deleteIndex()` - Deletar com reindexação
44
- - `dateFormatValidator()` - Validador de data
45
- - `operators` - Operadores de comparação
46
-
47
- ### Tipos
48
- - `TableData` - Interface principal de configuração
49
- - `Column` - Interface de configuração de colunas
50
- - `Arrange` - Interface de arranjo (filtros e ordenação)
51
- - `Condition` - Interface de condições where
52
- - `Pagination` - Interface de paginação
53
- - `FilterableOption` - Interface de opções filtráveis
54
- - `Tab` e `TabData` - Interfaces para tabs
55
- - `Image` - Interface para imagens
56
-
57
- ### Documentação
58
- - README.md completo com exemplos
59
- - USAGE_EXAMPLE.md com casos de uso detalhados
60
- - BUILD.md com guia de publicação
61
- - CHANGELOG.md
62
-
63
- ### Dependências Peer
64
- - @angular/common ^15.0.0
65
- - @angular/core ^15.0.0
66
- - @angular/forms ^15.0.0
67
- - @angular/router ^15.0.0
68
- - @angular/material ^15.0.0
69
- - @angular/cdk ^15.0.0
70
- - @angular/fire ^7.0.0
71
- - firebase ^9.0.0
72
- - ngx-toastr ^16.0.0
73
- - moment ^2.29.0
74
- - ngx-mask ^15.0.0
75
-
76
- ## Tipos de Mudanças
77
-
78
- - `Added` - para novas funcionalidades
79
- - `Changed` - para mudanças em funcionalidades existentes
80
- - `Deprecated` - para funcionalidades que serão removidas
81
- - `Removed` - para funcionalidades removidas
82
- - `Fixed` - para correção de bugs
83
- - `Security` - para vulnerabilidades de segurança
84
-
85
- [Unreleased]: https://github.com/adryanmmm/firebase-table-kxp-lib/compare/v0.0.1...HEAD
86
- [0.0.1]: https://github.com/adryanmmm/firebase-table-kxp-lib/releases/tag/v0.0.1
87
-
88
-
package/ng-package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/ng-firebase-table-kxp",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- }
7
- }