ng-firebase-table-kxp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/README.md +476 -0
- package/ng-package.json +7 -0
- package/package.json +36 -0
- package/src/lib/components/table/table.component.html +555 -0
- package/src/lib/components/table/table.component.scss +22 -0
- package/src/lib/components/table/table.component.spec.ts +24 -0
- package/src/lib/components/table/table.component.ts +917 -0
- package/src/lib/firebase-table-kxp-lib.component.spec.ts +23 -0
- package/src/lib/firebase-table-kxp-lib.component.ts +15 -0
- package/src/lib/firebase-table-kxp-lib.module.ts +45 -0
- package/src/lib/firebase-table-kxp-lib.service.spec.ts +16 -0
- package/src/lib/firebase-table-kxp-lib.service.ts +9 -0
- package/src/lib/services/table.service.spec.ts +16 -0
- package/src/lib/services/table.service.ts +1235 -0
- package/src/lib/types/Table.ts +142 -0
- package/src/public-api.ts +19 -0
- package/tsconfig.lib.json +14 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +14 -0
|
@@ -0,0 +1,142 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
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';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
+
{
|
|
3
|
+
"extends": "../../tsconfig.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"outDir": "../../../out-tsc/lib",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"inlineSources": true,
|
|
9
|
+
"types": []
|
|
10
|
+
},
|
|
11
|
+
"exclude": [
|
|
12
|
+
"**/*.spec.ts"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
+
{
|
|
3
|
+
"extends": "../../../tsconfig.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"outDir": "../../../out-tsc/spec",
|
|
6
|
+
"types": [
|
|
7
|
+
"jasmine"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"**/*.spec.ts",
|
|
12
|
+
"**/*.d.ts"
|
|
13
|
+
]
|
|
14
|
+
}
|