devlab-one-dynamic-table 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.
|
@@ -0,0 +1,872 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, EventEmitter, Output, Input, ViewChild, Component } from '@angular/core';
|
|
3
|
+
import * as i3 from '@angular/material/paginator';
|
|
4
|
+
import { MatPaginatorModule, MatPaginator } from '@angular/material/paginator';
|
|
5
|
+
import * as i4 from '@angular/material/sort';
|
|
6
|
+
import { MatSortModule, MatSort } from '@angular/material/sort';
|
|
7
|
+
import * as i2 from '@angular/material/table';
|
|
8
|
+
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
9
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
10
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
11
|
+
import { FormGroup } from '@angular/forms';
|
|
12
|
+
import { CommonModule } from '@angular/common';
|
|
13
|
+
import * as i5 from '@angular/material/menu';
|
|
14
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
15
|
+
import * as i6 from '@angular/material/icon';
|
|
16
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
17
|
+
import * as i7 from '@angular/material/checkbox';
|
|
18
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
19
|
+
import * as i8 from '@angular/material/button';
|
|
20
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
21
|
+
import { DynamicForm } from 'dynamic-form';
|
|
22
|
+
import * as i9 from '@angular/material/progress-spinner';
|
|
23
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
24
|
+
import * as XLSX from 'xlsx';
|
|
25
|
+
|
|
26
|
+
var SearchOn;
|
|
27
|
+
(function (SearchOn) {
|
|
28
|
+
SearchOn[SearchOn["AllColumns"] = 1] = "AllColumns";
|
|
29
|
+
SearchOn[SearchOn["MatchingColumns"] = 2] = "MatchingColumns";
|
|
30
|
+
})(SearchOn || (SearchOn = {}));
|
|
31
|
+
var SearchAt;
|
|
32
|
+
(function (SearchAt) {
|
|
33
|
+
SearchAt[SearchAt["ClientSide"] = 1] = "ClientSide";
|
|
34
|
+
SearchAt[SearchAt["ServerSide"] = 2] = "ServerSide";
|
|
35
|
+
})(SearchAt || (SearchAt = {}));
|
|
36
|
+
var OrderBy;
|
|
37
|
+
(function (OrderBy) {
|
|
38
|
+
OrderBy["asc"] = "asc";
|
|
39
|
+
OrderBy["desc"] = "desc";
|
|
40
|
+
})(OrderBy || (OrderBy = {}));
|
|
41
|
+
const defaultPageSize = 5;
|
|
42
|
+
|
|
43
|
+
const AppLiteralConsts = {
|
|
44
|
+
actionButton: {
|
|
45
|
+
create: 'create',
|
|
46
|
+
add: 'add',
|
|
47
|
+
edit: 'edit',
|
|
48
|
+
delete: 'delete',
|
|
49
|
+
view: 'view',
|
|
50
|
+
sortChange: 'sortChange',
|
|
51
|
+
pageChange: 'pageChange',
|
|
52
|
+
search: 'search',
|
|
53
|
+
sortBy: '__utcLastUpdatedOn',
|
|
54
|
+
export: 'export',
|
|
55
|
+
},
|
|
56
|
+
dataTypes: {
|
|
57
|
+
type: 'type',
|
|
58
|
+
string: 'string',
|
|
59
|
+
object: 'object',
|
|
60
|
+
array: 'array',
|
|
61
|
+
datetimeLocal: 'datetime-local',
|
|
62
|
+
date: 'date',
|
|
63
|
+
group: 'group',
|
|
64
|
+
boolean: 'boolean',
|
|
65
|
+
},
|
|
66
|
+
sheet: {
|
|
67
|
+
excel: 'xlsx',
|
|
68
|
+
csv: 'csv',
|
|
69
|
+
},
|
|
70
|
+
dateFormat: {
|
|
71
|
+
yearMonthDay: 'yyyy-MM-dd HH:mm',
|
|
72
|
+
},
|
|
73
|
+
imgIconPath: {
|
|
74
|
+
swipeCard: '../../../../assets/images/icons/swipe-card-white.svg',
|
|
75
|
+
merchant: '../../../../assets/images/icons/merchant-white.svg',
|
|
76
|
+
bank: '../../../../assets/images/icons/bank-account-white.svg',
|
|
77
|
+
gateway: '../../../../assets/images/icons/gateway-white.svg',
|
|
78
|
+
card: '../../../../assets/images/icons/cards-white.svg',
|
|
79
|
+
region: '../../../../assets/images/icons/region-white.svg',
|
|
80
|
+
settings: '../../../../assets/images/icons/settings-white.svg',
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var ExportType;
|
|
85
|
+
(function (ExportType) {
|
|
86
|
+
ExportType["excel"] = "xlsx";
|
|
87
|
+
ExportType["csv"] = "csv";
|
|
88
|
+
ExportType["pdf"] = "pdf";
|
|
89
|
+
})(ExportType || (ExportType = {}));
|
|
90
|
+
|
|
91
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
92
|
+
class ExportService {
|
|
93
|
+
/**
|
|
94
|
+
* Desc : Export data in excel/csv format
|
|
95
|
+
* @param exportType : type of file which we are going to export
|
|
96
|
+
* @param sourceData : target data to export
|
|
97
|
+
* @param fileName : indicates the file name to be exported
|
|
98
|
+
*/
|
|
99
|
+
exportData(exportType, sourceData, fileName) {
|
|
100
|
+
const dataSheets = this.prepareDataForExport(sourceData, fileName);
|
|
101
|
+
const workBook = XLSX.utils.book_new();
|
|
102
|
+
let worSheet;
|
|
103
|
+
for (const key in dataSheets) {
|
|
104
|
+
worSheet = XLSX.utils.json_to_sheet(dataSheets[key]);
|
|
105
|
+
XLSX.utils.book_append_sheet(workBook, worSheet, key);
|
|
106
|
+
}
|
|
107
|
+
XLSX.writeFile(workBook, `${fileName}.${exportType}`);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Desc : prepare data for exports
|
|
111
|
+
* @param sourceData : target data to export
|
|
112
|
+
* @param fileName : indicates the file name to be exported
|
|
113
|
+
*/
|
|
114
|
+
prepareDataForExport(sourceData, fileName) {
|
|
115
|
+
// eslint-disable-next-line prefer-const
|
|
116
|
+
let numberOfSheets = {};
|
|
117
|
+
for (const source of sourceData) {
|
|
118
|
+
for (const [key, value] of Object.entries(source)) {
|
|
119
|
+
if (typeof value == AppLiteralConsts.dataTypes.object && value != null) {
|
|
120
|
+
if (Array.isArray(value)) {
|
|
121
|
+
source[key] = JSON.stringify(value);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
for (const [secondaryKey, secondaryValue] of Object.entries(value)) {
|
|
125
|
+
source[secondaryKey] = secondaryValue;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
numberOfSheets[fileName] = sourceData;
|
|
131
|
+
}
|
|
132
|
+
return numberOfSheets;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* dec : export in pdf format
|
|
136
|
+
*/
|
|
137
|
+
exportPdf(values) {
|
|
138
|
+
console.log(values);
|
|
139
|
+
}
|
|
140
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ExportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
141
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ExportService, providedIn: 'root' });
|
|
142
|
+
}
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: ExportService, decorators: [{
|
|
144
|
+
type: Injectable,
|
|
145
|
+
args: [{
|
|
146
|
+
providedIn: 'root',
|
|
147
|
+
}]
|
|
148
|
+
}] });
|
|
149
|
+
|
|
150
|
+
/**********************************************************************
|
|
151
|
+
Page : Table component
|
|
152
|
+
Desc : Displaying the table data dynamically
|
|
153
|
+
**********************************************************************/
|
|
154
|
+
class DynamicTable {
|
|
155
|
+
exportService;
|
|
156
|
+
renderer;
|
|
157
|
+
el;
|
|
158
|
+
data = {
|
|
159
|
+
data: [],
|
|
160
|
+
totalRecords: 0
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Desc : declaring search variable for customizing the table data search
|
|
164
|
+
*/
|
|
165
|
+
pagination = {
|
|
166
|
+
offset: 1,
|
|
167
|
+
limit: 5,
|
|
168
|
+
searchQuery: {},
|
|
169
|
+
order: AppLiteralConsts.actionButton.sortBy,
|
|
170
|
+
sort: OrderBy.asc,
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Desc : declaring tableDetails variable for customzing the table appearance
|
|
174
|
+
*/
|
|
175
|
+
tableDetails = {
|
|
176
|
+
selectRequired: false,
|
|
177
|
+
columns: [],
|
|
178
|
+
tableButtons: {
|
|
179
|
+
add: false,
|
|
180
|
+
edit: false,
|
|
181
|
+
delete: false,
|
|
182
|
+
view: false,
|
|
183
|
+
export: false,
|
|
184
|
+
},
|
|
185
|
+
paging: {
|
|
186
|
+
enabled: false,
|
|
187
|
+
pageSizeOptions: [],
|
|
188
|
+
pageNumber: 0,
|
|
189
|
+
pageSize: 0
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Desc : filter visibility
|
|
194
|
+
*/
|
|
195
|
+
filterVisibility = true;
|
|
196
|
+
/**
|
|
197
|
+
* Desc : declaring formgroup variable for filter
|
|
198
|
+
*/
|
|
199
|
+
filter = new FormGroup({});
|
|
200
|
+
/**
|
|
201
|
+
* Desc : declaring variable for column names
|
|
202
|
+
*/
|
|
203
|
+
displayedColumns = [];
|
|
204
|
+
/**
|
|
205
|
+
* Desc : declaring variable for master column names
|
|
206
|
+
*/
|
|
207
|
+
masterDisplayedColumns = [];
|
|
208
|
+
/**
|
|
209
|
+
* Desc : declaring variable for table data
|
|
210
|
+
*/
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
212
|
+
dataSource = new MatTableDataSource([]);
|
|
213
|
+
/**
|
|
214
|
+
* Desc : declaring variable for selecting the row data
|
|
215
|
+
*/
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
217
|
+
selection = new SelectionModel(true, []);
|
|
218
|
+
/**
|
|
219
|
+
* Desc : consuming view child feature for export option menu
|
|
220
|
+
*/
|
|
221
|
+
exportOptionMenu;
|
|
222
|
+
/**
|
|
223
|
+
* Desc : consuming view child feature for paginator
|
|
224
|
+
*/
|
|
225
|
+
paginator;
|
|
226
|
+
/**
|
|
227
|
+
* Desc : consuming view child feature for table data sorting
|
|
228
|
+
*/
|
|
229
|
+
sort;
|
|
230
|
+
/**
|
|
231
|
+
* Desc : receiving the dataset input from parent component
|
|
232
|
+
*/
|
|
233
|
+
dataset = {
|
|
234
|
+
data: [],
|
|
235
|
+
totalRecords: 0
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Desc : receiving the search input from parent component
|
|
239
|
+
*/
|
|
240
|
+
search = {
|
|
241
|
+
searchOn: SearchOn.AllColumns,
|
|
242
|
+
formElements: {
|
|
243
|
+
controls: [],
|
|
244
|
+
outline: false
|
|
245
|
+
},
|
|
246
|
+
value: {},
|
|
247
|
+
searchAt: SearchAt.ClientSide
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Desc : send search element to form component
|
|
251
|
+
*/
|
|
252
|
+
dynamicFormDetails = {
|
|
253
|
+
formComponent: this.search.formElements
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Desc : emitting the action output to parent component
|
|
257
|
+
*/
|
|
258
|
+
action = new EventEmitter();
|
|
259
|
+
/**
|
|
260
|
+
* Desc : declaring variable for expand column info
|
|
261
|
+
*/
|
|
262
|
+
expandColumnDefination = [];
|
|
263
|
+
/**
|
|
264
|
+
* Desc : declaring variable for expanded column info
|
|
265
|
+
*/
|
|
266
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
267
|
+
expandedElement;
|
|
268
|
+
/**
|
|
269
|
+
* Desc : declaring variable for expanded column prefix info
|
|
270
|
+
*/
|
|
271
|
+
expandedPrefix = 'expanded_';
|
|
272
|
+
/**
|
|
273
|
+
* Desc : declaring the variable for storing table row counts
|
|
274
|
+
*/
|
|
275
|
+
tableRowCount = 0;
|
|
276
|
+
/**
|
|
277
|
+
* Desc : expand group
|
|
278
|
+
*/
|
|
279
|
+
isExpandedGroupRow = undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Desc : constructor initialization
|
|
282
|
+
*/
|
|
283
|
+
constructor(exportService, renderer, el) {
|
|
284
|
+
this.exportService = exportService;
|
|
285
|
+
this.renderer = renderer;
|
|
286
|
+
this.el = el;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Desc : execute when component is initalized
|
|
290
|
+
*/
|
|
291
|
+
ngOnInit() {
|
|
292
|
+
this.selection.changed.subscribe((change) => {
|
|
293
|
+
this.addActionForSelectedRows();
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Desc : execute when component has any changes
|
|
298
|
+
*/
|
|
299
|
+
ngOnChanges(changes) {
|
|
300
|
+
if (changes['dataset'] || changes['search'] || changes['tableDetails']) {
|
|
301
|
+
this.displayedColumns = [];
|
|
302
|
+
}
|
|
303
|
+
this.dataSource = new MatTableDataSource(this.dataset.data);
|
|
304
|
+
this.renderTableDetails();
|
|
305
|
+
this.initializeSearchPredicate();
|
|
306
|
+
this.initializeGridColumns();
|
|
307
|
+
if (this.search) {
|
|
308
|
+
this.initializeSearchFields();
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* desc : after view is rendered
|
|
313
|
+
*/
|
|
314
|
+
ngAfterViewInit() {
|
|
315
|
+
this.renderTableDetails();
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* config paginator and sorting options
|
|
319
|
+
*/
|
|
320
|
+
renderTableDetails() {
|
|
321
|
+
switch (this.search.searchAt) {
|
|
322
|
+
case SearchAt.ClientSide:
|
|
323
|
+
if (this.paginator) {
|
|
324
|
+
this.paginator.pageSize = this.tableDetails.paging.pageSize;
|
|
325
|
+
this.paginator.pageSizeOptions = this.tableDetails.paging.pageSizeOptions;
|
|
326
|
+
this.paginator.pageIndex = this.tableDetails.paging.pageNumber - 1;
|
|
327
|
+
this.dataSource.paginator = this.paginator;
|
|
328
|
+
}
|
|
329
|
+
if (this.sort && this.paginator) {
|
|
330
|
+
this.dataSource.sort = this.sort;
|
|
331
|
+
}
|
|
332
|
+
break;
|
|
333
|
+
case SearchAt.ServerSide:
|
|
334
|
+
if (this.paginator) {
|
|
335
|
+
this.paginator.pageSize = this.tableDetails.paging.pageSize;
|
|
336
|
+
this.paginator.pageSizeOptions = this.tableDetails.paging.pageSizeOptions;
|
|
337
|
+
this.paginator.pageIndex = this.tableDetails.paging.pageNumber - 1;
|
|
338
|
+
this.paginator.length = this.dataset.totalRecords;
|
|
339
|
+
}
|
|
340
|
+
break;
|
|
341
|
+
default:
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Desc : execute when moved to another component
|
|
347
|
+
*/
|
|
348
|
+
ngOnDestroy() {
|
|
349
|
+
this.action.unsubscribe();
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Desc : organizing the search filter fields
|
|
353
|
+
*/
|
|
354
|
+
initializeSearchPredicate() {
|
|
355
|
+
if (this.search?.searchOn == SearchOn.MatchingColumns) {
|
|
356
|
+
this.dataSource.filterPredicate = (data, filter) => {
|
|
357
|
+
const searchFilterValues = this.isJSON(filter) ? JSON.parse(filter) : this.filter.value;
|
|
358
|
+
const allemptyFilters = Object.keys(searchFilterValues).every((filterData) => searchFilterValues[filterData] == '' || searchFilterValues[filterData] == null);
|
|
359
|
+
if (allemptyFilters) {
|
|
360
|
+
return true;
|
|
361
|
+
}
|
|
362
|
+
let found = false;
|
|
363
|
+
for (let index = 0; index < this.search.formElements.controls.length; index++) {
|
|
364
|
+
const field = this.search.formElements.controls.at(index) ?? '';
|
|
365
|
+
if (data[field] && searchFilterValues[field]) {
|
|
366
|
+
found = data[field].toLowerCase().indexOf(searchFilterValues[field].toLowerCase()) != -1;
|
|
367
|
+
if (found) {
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return found;
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Desc : Filter the table data
|
|
378
|
+
*/
|
|
379
|
+
filterGrid(filterValue, field) {
|
|
380
|
+
if (this.search?.searchAt == SearchAt.ClientSide) {
|
|
381
|
+
if (this.search?.searchOn == SearchOn.AllColumns) {
|
|
382
|
+
this.dataSource.filter = (filterValue[Object.keys(filterValue).at(0) ?? ''] ?? '').trim().toLowerCase();
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
this.applyDefaultFilter(filterValue[field], field);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
this.action.emit({ name: AppLiteralConsts.actionButton.search, value: filterValue });
|
|
389
|
+
this.addActionForSelectedRows();
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Desc : execute default search method
|
|
393
|
+
*/
|
|
394
|
+
applyDefaultFilter(value, column) {
|
|
395
|
+
this.dataSource.filterPredicate = (data, filter) => {
|
|
396
|
+
let matchFound = false;
|
|
397
|
+
if (column in data) {
|
|
398
|
+
if (data[column]) {
|
|
399
|
+
matchFound =
|
|
400
|
+
matchFound || data[column].toString().trim().toLowerCase().indexOf(filter.trim().toLowerCase()) !== -1;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return matchFound;
|
|
404
|
+
};
|
|
405
|
+
this.dataSource.filter = value ? value.trim().toLowerCase() : '';
|
|
406
|
+
if (this.dataSource.paginator) {
|
|
407
|
+
this.dataSource.paginator?.firstPage();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Desc : validating if all the checkbox are checked or not
|
|
412
|
+
*/
|
|
413
|
+
isAllSelected() {
|
|
414
|
+
const numSelected = this.selection.selected.length;
|
|
415
|
+
const numRows = this.dataSource.data.length;
|
|
416
|
+
return numSelected === numRows;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Desc : Enable select and deselect all rows
|
|
420
|
+
*/
|
|
421
|
+
toggleAllRows() {
|
|
422
|
+
if (this.isAllSelected()) {
|
|
423
|
+
this.selection.clear();
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
this.selection.select(...this.dataSource.data);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Desc : Column visibility
|
|
430
|
+
*/
|
|
431
|
+
setColumn(event, column) {
|
|
432
|
+
if (!event) {
|
|
433
|
+
this.displayedColumns.filter((col, index) => {
|
|
434
|
+
if (col == column) {
|
|
435
|
+
this.displayedColumns.splice(index, 1);
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
this.displayedColumns.push(column);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Desc : Initalize columns and expanded columns
|
|
445
|
+
*/
|
|
446
|
+
initializeGridColumns() {
|
|
447
|
+
if (this.tableDetails?.selectRequired) {
|
|
448
|
+
this.displayedColumns.push('select');
|
|
449
|
+
}
|
|
450
|
+
this.tableDetails?.columns?.forEach((cols) => {
|
|
451
|
+
this.displayedColumns.push(cols.columnDef);
|
|
452
|
+
this.masterDisplayedColumns.push(cols.columnDef);
|
|
453
|
+
if (cols.isComplex) {
|
|
454
|
+
this.expandColumnDefination.push(cols);
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
if (this.actionRequired()) {
|
|
458
|
+
this.displayedColumns.push('action');
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Desc : Initialize search fields
|
|
463
|
+
*/
|
|
464
|
+
initializeSearchFields() {
|
|
465
|
+
this.search?.formElements?.controls?.map((control) => {
|
|
466
|
+
control.OnChange = this.filterFieldChanges.bind(this);
|
|
467
|
+
});
|
|
468
|
+
this.dynamicFormDetails = {
|
|
469
|
+
...this.dynamicFormDetails,
|
|
470
|
+
formComponent: this.search.formElements
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Desc : detect changes in filter field on keyup
|
|
475
|
+
*/
|
|
476
|
+
filterFieldChanges(event, field) {
|
|
477
|
+
if (this.search?.value) {
|
|
478
|
+
this.search.value[field] = event;
|
|
479
|
+
}
|
|
480
|
+
const formControlIndex = this.search?.formElements?.controls?.findIndex((element) => element.name == field);
|
|
481
|
+
if (this.search?.formElements && formControlIndex != undefined) {
|
|
482
|
+
this.search.formElements.controls[formControlIndex].value = event;
|
|
483
|
+
}
|
|
484
|
+
this.filterGrid(this.search?.value, field);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Desc : validating input features in table
|
|
488
|
+
*/
|
|
489
|
+
actionRequired(buttonType) {
|
|
490
|
+
if (buttonType == AppLiteralConsts.actionButton.add) {
|
|
491
|
+
return this.tableDetails.tableButtons.add;
|
|
492
|
+
}
|
|
493
|
+
else if (buttonType == AppLiteralConsts.actionButton.export) {
|
|
494
|
+
return this.tableDetails.tableButtons.export;
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
return (this.tableDetails.tableButtons.delete ||
|
|
498
|
+
this.tableDetails.tableButtons.edit ||
|
|
499
|
+
this.tableDetails.tableButtons.view);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Desc : Export table data
|
|
504
|
+
*/
|
|
505
|
+
exportData(exportType) {
|
|
506
|
+
if (this.search?.searchAt == SearchAt.ServerSide) {
|
|
507
|
+
this.onTableAction(AppLiteralConsts.actionButton.export, exportType);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
if (exportType == 'pdf') {
|
|
511
|
+
if (this.selection.isEmpty()) {
|
|
512
|
+
this.exportService.exportPdf(this.dataSource.data);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
this.exportService.exportPdf(this.selection.selected);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
this.exportService.exportData(exportType == AppLiteralConsts.sheet.excel ? ExportType.excel : ExportType.csv, this.dataset?.data, exportType);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Desc : emitting the data to parent component
|
|
525
|
+
*/
|
|
526
|
+
onTableAction(type, value) {
|
|
527
|
+
const dataValue = {
|
|
528
|
+
name: type,
|
|
529
|
+
value: value,
|
|
530
|
+
};
|
|
531
|
+
this.action.emit(dataValue);
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Desc : return expanded column data
|
|
535
|
+
*/
|
|
536
|
+
getExpandedColumnHeaderDef(ele) {
|
|
537
|
+
return ele?.map((x) => `${this.expandedPrefix}${x.columnDef}`) ?? [];
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Desc : return inner column data
|
|
541
|
+
*/
|
|
542
|
+
getInnerColumnDef(ele) {
|
|
543
|
+
return ele?.map((x) => x.columnDef) ?? [];
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Desc : validate json
|
|
547
|
+
*/
|
|
548
|
+
isJSON(str) {
|
|
549
|
+
try {
|
|
550
|
+
return JSON.parse(str) && !!str;
|
|
551
|
+
}
|
|
552
|
+
catch (e) {
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Desc : event triggers while chaning the page
|
|
558
|
+
*/
|
|
559
|
+
pageChanged(event) {
|
|
560
|
+
event.pageIndex = event.pageIndex + 1;
|
|
561
|
+
this.action.emit({ name: AppLiteralConsts.actionButton.pageChange, value: event });
|
|
562
|
+
this.addActionForSelectedRows();
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Desc: Event triggers while sorting the column
|
|
566
|
+
*/
|
|
567
|
+
onSortChanges(event) {
|
|
568
|
+
if (this.search?.searchAt == SearchAt.ServerSide && this.paginator != undefined) {
|
|
569
|
+
this.paginator.pageIndex = 0;
|
|
570
|
+
}
|
|
571
|
+
this.action.emit({ name: AppLiteralConsts.actionButton.sortChange, value: event });
|
|
572
|
+
this.addActionForSelectedRows();
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Desc : array exist
|
|
576
|
+
*/
|
|
577
|
+
isArray(inputValue) {
|
|
578
|
+
return Array.isArray(inputValue);
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Desc : expanding the array data list
|
|
582
|
+
* @param index : row index
|
|
583
|
+
*/
|
|
584
|
+
expandList(index) {
|
|
585
|
+
if (this.isExpandedGroupRow == index) {
|
|
586
|
+
this.isExpandedGroupRow = undefined;
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
this.isExpandedGroupRow = index;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* desc: label for the checkbox on the passed row
|
|
594
|
+
*/
|
|
595
|
+
checkboxLabel(row) {
|
|
596
|
+
if (!row) {
|
|
597
|
+
return `${this.isAllSelected() ? 'deselect' : 'select'} all`;
|
|
598
|
+
}
|
|
599
|
+
return `${this.selection.isSelected(row) ? 'deselect' : 'select'} row ${row.position + 1}`;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Desc : toggle filter
|
|
603
|
+
*/
|
|
604
|
+
toggleFilter() {
|
|
605
|
+
this.filterVisibility = !this.filterVisibility;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Desc : column visibility
|
|
609
|
+
*/
|
|
610
|
+
columnVisibility(column) {
|
|
611
|
+
if (this.displayedColumns.includes(column)) {
|
|
612
|
+
this.displayedColumns = this.displayedColumns.filter(item => item !== column);
|
|
613
|
+
this.search.formElements.controls.forEach((item) => { if (item.name == column) {
|
|
614
|
+
item.visible = false;
|
|
615
|
+
} });
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
const newIndex = this.masterDisplayedColumns.indexOf(column);
|
|
619
|
+
const targetIndex = this.displayedColumns.findIndex(item => this.masterDisplayedColumns.indexOf(item) > newIndex);
|
|
620
|
+
if (targetIndex === -1) {
|
|
621
|
+
this.displayedColumns.push(column);
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
this.displayedColumns.splice(targetIndex, 0, column);
|
|
625
|
+
}
|
|
626
|
+
this.search.formElements.controls.forEach((item) => { if (item.name == column) {
|
|
627
|
+
item.visible = true;
|
|
628
|
+
} });
|
|
629
|
+
}
|
|
630
|
+
this.addActionForSelectedRows();
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Desc : toggle row select
|
|
634
|
+
*/
|
|
635
|
+
toggleRowSelect(row, event) {
|
|
636
|
+
const target = event.target;
|
|
637
|
+
let lastColumnIndex = this.displayedColumns.length - 1;
|
|
638
|
+
const headingLength = document.querySelector('table thead tr')?.children.length;
|
|
639
|
+
const headingLastColumn = document.querySelector('table thead tr')?.children[headingLength - 1];
|
|
640
|
+
if (headingLastColumn?.textContent == 'Action') {
|
|
641
|
+
lastColumnIndex = headingLength - 1;
|
|
642
|
+
}
|
|
643
|
+
const cell = target.closest('td');
|
|
644
|
+
if (cell) {
|
|
645
|
+
const cellIndex = Array.from(cell.parentNode.children).indexOf(cell);
|
|
646
|
+
if (cellIndex === lastColumnIndex) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
this.expandedElement = this.expandedElement === row ? null : row;
|
|
653
|
+
this.selection.toggle(row);
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Desc : create single cell td and append to last column
|
|
657
|
+
*/
|
|
658
|
+
createElementForSelelctedRows() {
|
|
659
|
+
this.addHeaderCell();
|
|
660
|
+
this.addActionCell();
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Desc : create DOM element for action column specifically for selected row
|
|
664
|
+
*/
|
|
665
|
+
addActionForSelectedRows() {
|
|
666
|
+
if (!this.selection.isEmpty()) {
|
|
667
|
+
const index = this.displayedColumns.indexOf('action');
|
|
668
|
+
if (index !== -1) {
|
|
669
|
+
this.displayedColumns.splice(index, 1);
|
|
670
|
+
setTimeout(() => { this.createElementForSelelctedRows(); }, 100);
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
this.resetAndCreateActionElement();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
if (!this.displayedColumns.includes('action')) {
|
|
678
|
+
this.displayedColumns.push('action');
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* desc : delete DOM element for action column
|
|
684
|
+
*/
|
|
685
|
+
resetActionColumn() {
|
|
686
|
+
const tableHeaderRow = this.el.nativeElement.querySelector('table thead tr');
|
|
687
|
+
if (tableHeaderRow) {
|
|
688
|
+
const lastChild = tableHeaderRow.lastChild;
|
|
689
|
+
if (lastChild) {
|
|
690
|
+
this.renderer.removeChild(tableHeaderRow, lastChild);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
let renderSingletdCell = false;
|
|
694
|
+
const tableCellRows = this.el.nativeElement.querySelectorAll('table tbody tr');
|
|
695
|
+
tableCellRows.forEach((row) => {
|
|
696
|
+
if (row.children.length > 0 && !renderSingletdCell) {
|
|
697
|
+
renderSingletdCell = true;
|
|
698
|
+
const lastChild = row.lastChild;
|
|
699
|
+
if (lastChild) {
|
|
700
|
+
this.renderer.removeChild(row, lastChild);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* desc : add header cell using renderer library
|
|
707
|
+
*/
|
|
708
|
+
addHeaderCell() {
|
|
709
|
+
const tableHeaderRow = this.el.nativeElement.querySelector('table thead tr');
|
|
710
|
+
if (tableHeaderRow) {
|
|
711
|
+
const newTh = this.renderer.createElement('th');
|
|
712
|
+
this.renderer.addClass(newTh, 'mat-mdc-header-cell');
|
|
713
|
+
this.renderer.addClass(newTh, 'mdc-data-table__header-cell');
|
|
714
|
+
this.renderer.addClass(newTh, 'cdk-header-cell');
|
|
715
|
+
this.renderer.addClass(newTh, 'header-align-right');
|
|
716
|
+
this.renderer.addClass(newTh, 'cdk-column-action');
|
|
717
|
+
this.renderer.addClass(newTh, 'mat-column-action');
|
|
718
|
+
this.renderer.addClass(newTh, 'ng-tns-c1115897789-0');
|
|
719
|
+
this.renderer.addClass(newTh, 'ng-star-inserted');
|
|
720
|
+
this.renderer.addClass(newTh, 'mat-mdc-table-sticky');
|
|
721
|
+
this.renderer.addClass(newTh, 'mat-mdc-table-sticky-border-elem-top');
|
|
722
|
+
this.renderer.addClass(newTh, 'mat-mdc-table-sticky-border-elem-right');
|
|
723
|
+
this.renderer.setStyle(newTh, 'position', 'sticky');
|
|
724
|
+
this.renderer.setStyle(newTh, 'top', '0px');
|
|
725
|
+
this.renderer.setStyle(newTh, 'zIndex', '101');
|
|
726
|
+
this.renderer.setStyle(newTh, 'right', '0px');
|
|
727
|
+
this.renderer.setStyle(newTh, 'color', '#000000');
|
|
728
|
+
this.renderer.setStyle(newTh, 'fontSize', '15px');
|
|
729
|
+
this.renderer.setStyle(newTh, 'textTransform', 'uppercase');
|
|
730
|
+
this.renderer.setStyle(newTh, 'backgroundColor', '#ffffff');
|
|
731
|
+
this.renderer.setStyle(newTh, 'minWidth', '250px');
|
|
732
|
+
this.renderer.setStyle(newTh, 'textAlign', 'center');
|
|
733
|
+
this.renderer.setAttribute(newTh, '_ngcontent-ng-c1115897789', '');
|
|
734
|
+
this.renderer.setAttribute(newTh, 'role', 'columnheader');
|
|
735
|
+
this.renderer.setAttribute(newTh, 'mat-header-cell', '');
|
|
736
|
+
this.renderer.appendChild(newTh, this.renderer.createText('Action'));
|
|
737
|
+
this.renderer.appendChild(tableHeaderRow, newTh);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* desc: add action cell using renderer
|
|
742
|
+
*/
|
|
743
|
+
addActionCell() {
|
|
744
|
+
let renderSingletdCell = false;
|
|
745
|
+
const tableCellRows = this.el.nativeElement.querySelectorAll('table tbody tr');
|
|
746
|
+
tableCellRows.forEach((row, index) => {
|
|
747
|
+
if (row.children.length > 0 && !renderSingletdCell) {
|
|
748
|
+
renderSingletdCell = true;
|
|
749
|
+
const newTd = this.renderer.createElement('td');
|
|
750
|
+
this.renderer.addClass(newTd, 'mat-mdc-cell');
|
|
751
|
+
this.renderer.addClass(newTd, 'mdc-data-table__cell');
|
|
752
|
+
this.renderer.addClass(newTd, 'cdk-cell');
|
|
753
|
+
this.renderer.addClass(newTd, 'header-align-right');
|
|
754
|
+
this.renderer.addClass(newTd, 'cdk-column-action');
|
|
755
|
+
this.renderer.addClass(newTd, 'mat-column-action');
|
|
756
|
+
this.renderer.addClass(newTd, 'ng-tns-c1115897789-0');
|
|
757
|
+
this.renderer.addClass(newTd, 'ng-star-inserted');
|
|
758
|
+
this.renderer.addClass(newTd, 'mat-mdc-table-sticky');
|
|
759
|
+
this.renderer.addClass(newTd, 'mat-mdc-table-sticky-border-elem-right');
|
|
760
|
+
this.renderer.setStyle(newTd, 'zIndex', '1');
|
|
761
|
+
this.renderer.setStyle(newTd, 'right', '0px');
|
|
762
|
+
this.renderer.setStyle(newTd, 'textAlign', 'center');
|
|
763
|
+
this.renderer.setStyle(newTd, 'borderLeft', '1px solid #cccccc');
|
|
764
|
+
this.renderer.setAttribute(newTd, '_ngcontent-ng-c1115897789', '');
|
|
765
|
+
this.renderer.setAttribute(newTd, 'mat-cell', '');
|
|
766
|
+
this.renderer.setAttribute(newTd, 'rowspan', '100');
|
|
767
|
+
const delButton = this.renderer.createElement('button');
|
|
768
|
+
delButton.className = 'action-icon action-delete';
|
|
769
|
+
this.renderer.setAttribute(delButton, 'mat-menu-item', '');
|
|
770
|
+
this.renderer.setStyle(delButton, 'display', 'inline-block');
|
|
771
|
+
this.renderer.setStyle(delButton, 'cursor', 'pointer');
|
|
772
|
+
this.renderer.setStyle(delButton, 'backgroundColor', 'unset');
|
|
773
|
+
this.renderer.setStyle(delButton, 'border', 'unset');
|
|
774
|
+
this.renderer.setStyle(delButton, 'borderRadius', '2px');
|
|
775
|
+
this.renderer.setStyle(delButton, 'padding', '5px');
|
|
776
|
+
this.renderer.setStyle(delButton, 'marginRight', '25px');
|
|
777
|
+
this.renderer.setStyle(delButton, 'border', '1px solid #ccc');
|
|
778
|
+
const delMatIcon = this.renderer.createElement('mat-icon');
|
|
779
|
+
this.renderer.setAttribute(delMatIcon, 'role', 'img');
|
|
780
|
+
this.renderer.addClass(delMatIcon, 'mat-icon');
|
|
781
|
+
this.renderer.addClass(delMatIcon, 'notranslate');
|
|
782
|
+
this.renderer.addClass(delMatIcon, 'material-icons');
|
|
783
|
+
this.renderer.addClass(delMatIcon, 'mat-ligature-font');
|
|
784
|
+
this.renderer.addClass(delMatIcon, 'mat-icon-no-color');
|
|
785
|
+
this.renderer.setAttribute(delMatIcon, 'aria-hidden', 'true');
|
|
786
|
+
this.renderer.setAttribute(delMatIcon, 'data-mat-icon-type', 'font');
|
|
787
|
+
this.renderer.appendChild(delMatIcon, this.renderer.createText('delete'));
|
|
788
|
+
this.renderer.listen(delButton, 'click', () => this.onTableAction('delete', this.selection.selected));
|
|
789
|
+
this.renderer.appendChild(delButton, delMatIcon);
|
|
790
|
+
this.renderer.appendChild(newTd, delButton);
|
|
791
|
+
this.renderer.appendChild(row, newTd);
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
*
|
|
797
|
+
*/
|
|
798
|
+
resetAndCreateActionElement() {
|
|
799
|
+
const headingLength = document.querySelector('table thead tr')?.children.length;
|
|
800
|
+
const headingLastColumn = document.querySelector('table thead tr')?.children[headingLength - 1];
|
|
801
|
+
if (headingLastColumn?.textContent == 'Action') {
|
|
802
|
+
this.resetActionColumn();
|
|
803
|
+
setTimeout(() => { this.createElementForSelelctedRows(); }, 100);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Desc : empty bin list
|
|
808
|
+
*/
|
|
809
|
+
emptyList() {
|
|
810
|
+
this.data = { data: [], totalRecords: 0 };
|
|
811
|
+
this.tableDetails.paging.enabled = false;
|
|
812
|
+
}
|
|
813
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: DynamicTable, deps: [{ token: ExportService }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
814
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: DynamicTable, isStandalone: true, selector: "lib-dynamic-table", inputs: { pagination: "pagination", tableDetails: "tableDetails", dataset: "dataset", search: "search" }, outputs: { action: "action" }, viewQueries: [{ propertyName: "exportOptionMenu", first: true, predicate: ["exportOptionMenu"], descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"main-table-container\">\n <!-- Filter section begins -->\n @if(search){\n <div class=\"filter-section\">\n <!-- filter icon begins-->\n <div class=\"filter-icon-section\">\n <div class=\"toggle-filter\" (click)=\"toggleFilter()\">\n <mat-icon>filter_list</mat-icon>\n </div>\n </div>\n <!-- filter icon ends -->\n <!-- filter field begins -->\n @if(filterVisibility){\n <div class=\"filter\">\n <lib-dynamic-form\n class=\"toolbar-form\"\n [dynamicFormDetails]=\"dynamicFormDetails\"\n ></lib-dynamic-form>\n </div>\n }\n <!-- filter field ends -->\n <!-- Action button section begins -->\n <div class=\"main-action-button\">\n <button\n matIconButton\n color=\"primary\"\n [matMenuTriggerFor]=\"fieldVisibilitySettings\"\n >\n <mat-icon class=\"unset-margin\">settings</mat-icon>\n </button>\n <mat-menu #fieldVisibilitySettings=\"matMenu\">\n @for(col of masterDisplayedColumns;track col){\n <div>\n <mat-checkbox [checked]=\"displayedColumns.includes(col)\" (change)=\"columnVisibility(col)\">\n {{col}}\n </mat-checkbox>\n </div>\n }\n </mat-menu>\n @if(actionRequired('export')){\n <button\n matIconButton\n color=\"primary\"\n [matMenuTriggerFor]=\"exportOptionMenu\"\n >\n <mat-icon class=\"unset-margin\">cloud_download</mat-icon>\n </button>\n <mat-menu #exportOptionMenu=\"matMenu\">\n <button mat-menu-item (click)=\"exportData('csv')\">CSV</button>\n <button mat-menu-item (click)=\"exportData('xlsx')\">XLSX</button>\n <button mat-menu-item (click)=\"exportData('pdf')\">PDF</button>\n </mat-menu>\n }\n @if(actionRequired('add')){\n <button\n mat-stroked-button\n color=\"primary\"\n (click)=\"onTableAction('create')\"\n >\n <mat-icon class=\"unset-margin\">add_circle</mat-icon>Add\n </button>\n }\n </div>\n <!-- Action button section ends -->\n </div>\n }\n <!-- Filter section ends -->\n\n <!-- Table section begins -->\n <div class=\"table-container hide-scrollbar\">\n <table\n mat-table\n [dataSource]=\"dataSource\"\n class=\"mat-elevation-z8\"\n matSort\n multiTemplateDataRows\n (matSortChange)=\"onSortChanges($event)\"\n aria-label=\"table\"\n >\n @if(tableDetails.selectRequired){\n <ng-container matColumnDef=\"select\" [sticky]=\"true\">\n <th mat-header-cell *matHeaderCellDef>\n <mat-checkbox\n color=\"primary\"\n (change)=\"$event ? toggleAllRows() : null\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n [aria-label]=\"checkboxLabel()\"\n ></mat-checkbox>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <mat-checkbox\n color=\"primary\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null\"\n [checked]=\"selection.isSelected(row)\"\n [aria-label]=\"checkboxLabel(row)\"\n ></mat-checkbox>\n </td>\n </ng-container>\n }\n @for(column of tableDetails.columns;track column){\n @if(column.isComplex){\n <ng-container matColumnDef=\"{{ column.columnDef }}\">\n <th mat-header-cell *matHeaderCellDef aria-label=\"row actions\">{{ column.header }}</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element[column.columnDef].length }}\n <button\n mat-icon-button\n aria-label=\"expand row\"\n class=\"valign-middle\"\n (click)=\"expandedElement = expandedElement === element ? null : element; $event.stopPropagation()\"\n >\n @if(expandedElement === element){\n <mat-icon>keyboard_arrow_up</mat-icon>\n }@else{\n <mat-icon>keyboard_arrow_down</mat-icon>\n }\n </button>\n </td>\n </ng-container>\n }@else{\n <ng-container matColumnDef=\"{{ column.columnDef }}\">\n @if(column.sortRequired){\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n {{ column.header }}\n </th>\n }@else{\n <th mat-header-cell *matHeaderCellDef>{{ column.header }}</th>\n }\n @if(column.cell){\n <td mat-cell *matCellDef=\"let row; let i = dataIndex\">\n @if(isArray(column.cell(row))){\n @for(cell of column.cell(row);track cell;let first = $first){\n @if(first){\n {{ cell }}\n }\n }\n @if(column.cell(row).length > 1){\n @if(isExpandedGroupRow === i){\n <mat-icon class=\"hoverCursorIcon\" (click)=\"expandList(i)\">keyboard_arrow_up</mat-icon>\n }@else{\n <mat-icon class=\"hoverCursorIcon\" (click)=\"expandList(i)\">keyboard_arrow_down</mat-icon>\n }\n }\n @if(isExpandedGroupRow === i){\n @for(cell of column.cell(row);track cell;let first = $first){\n @if(!first){\n <div class=\"hoverContent\">\n {{ cell }}\n </div>\n }\n }\n }\n }@else{\n {{ column.cell(row) }}\n }\n </td>\n }@else{\n <td mat-cell *matCellDef=\"let row\">{{ row[column.columnDef] }}</td>\n }\n </ng-container>\n }\n }\n <!-- table expanded columns -->\n @for(expandedCol of expandColumnDefination;track expandedCol){\n <ng-container matColumnDef=\"{{ expandedPrefix + expandedCol.columnDef }}\">\n <td mat-cell *matCellDef=\"let element\" [attr.colspan]=\"displayedColumns.length + 1\">\n @if(element[expandedCol.columnDef]?.length > 0){\n <div\n class=\"example-element-detail\"\n [@detailExpand]=\"element === expandedElement ? 'expanded' : 'collapsed'\"\n >\n @if(expandedElement){\n <div class=\"inner-table mat-elevation-z8\">\n <!-- IF THE OBJECT ARRAY NEEDS TO BE DISPLAYED -->\n <table\n mat-table\n #innerTables\n mat-table\n aria-label=\"table\"\n [dataSource]=\"element[expandedCol.columnDef]\"\n class=\"w-100\"\n >\n @for(innerColumn of expandedCol?.innerColumns;track innerColumn){\n <ng-container matColumnDef=\"{{ innerColumn.columnDef }}\">\n <th mat-header-cell *matHeaderCellDef>{{ innerColumn.header }}</th>\n <td mat-cell *matCellDef=\"let innerRow\">\n {{ innerColumn.cell ? innerColumn.cell(innerRow) : innerRow[innerColumn.columnDef] }}\n </td>\n </ng-container>\n }\n <tr\n mat-header-row\n *matHeaderRowDef=\"getInnerColumnDef(expandedCol.innerColumns)\"\n style=\"background-color: lightgray\"\n ></tr>\n <tr\n mat-row\n *matRowDef=\"let row; columns: getInnerColumnDef(expandedCol.innerColumns)\"\n [class.expanded-row]\n ></tr>\n </table>\n </div>\n }\n </div>\n }\n </td>\n </ng-container>\n }\n <!-- Action Column -->\n @if(actionRequired()){\n <ng-container matColumnDef=\"action\" [stickyEnd]=\"true\">\n <th mat-header-cell *matHeaderCellDef class=\"header-align-right\">Action</th>\n <td mat-cell *matCellDef=\"let element\" class=\"header-align-right\">\n @if(tableDetails.tableButtons.view){\n <button\n class=\"action-icon action-view\"\n mat-menu-item\n (click)=\"onTableAction('view', element)\"\n >\n <mat-icon>remove_red_eye</mat-icon>\n </button>\n }\n @if(tableDetails.tableButtons.edit){\n <button\n class=\"action-icon action-edit\"\n mat-menu-item\n (click)=\"onTableAction('edit', element)\"\n >\n <mat-icon>edit</mat-icon>\n </button>\n }\n @if(tableDetails.tableButtons.delete){\n <button\n class=\"action-icon action-delete\"\n mat-menu-item\n (click)=\"onTableAction('delete', element)\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n }\n </td>\n </ng-container>\n }\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns;sticky:true\"></tr>\n <tr\n mat-row\n *matRowDef=\"let row; columns: displayedColumns\"\n [class.example-expanded-row]=\"expandedElement === row\"\n (click)=\"toggleRowSelect(row,$event)\"\n >\n </tr>\n <!-- table Rows which are expanded -->\n <tr\n mat-row\n *matRowDef=\"let row; columns: getExpandedColumnHeaderDef(expandColumnDefination)\"\n class=\"example-detail-row\"\n style=\"height: 0 !important\"\n ></tr>\n </table>\n </div>\n @if(dataset.data === undefined){\n <mat-spinner class=\"loader-for-table\"></mat-spinner>\n }\n @if(dataset.totalRecords === 0){\n <section class=\"no-data-text\">\n <p>No Records Found</p>\n </section>\n }\n @if(tableDetails.paging.enabled){\n <mat-paginator\n #paginator\n class=\"mat-elevation-z8 table-paginator\"\n showFirstLastButtons\n aria-label=\"Select page\"\n (page)=\"pageChanged($event)\"\n >\n </mat-paginator>\n }\n <!-- Table section ends -->\n </div>\n\n ", styles: [":host{--FONT-FAMILY-NORMAL-TEXT: Roboto, \"Helvetica Neue\", sans-serif;--FONT-FAMILY-HEADING-TEXT: Roboto, \"Helvetica Neue\", sans-serif;--FONT-SIZE-FOR-VERY-TINY: 12px;--FONT-SIZE-FOR-VERY-SMALL-TEXT: 14px;--FONT-SIZE-FOR-SMALL-TEXT: 15px;--FONT-SIZE-FOR-NORMAL-TEXT: 16px;--FONT-SIZE-FOR-HEADING-TEXT: 22px;--FONT-SIZE-FOR-LARGE-HEADING-TEXT: 24px;--FONT-SIZE-FOR-SUB-HEADING-TEXT: 20px;--FONT-WEIGHT-LOW: 300;--FONT-WEIGHT-NORMAL: 400;--FONT-WEIGHT-VERY-BOLD: 900;--FONT-WEIGHT-BOLD: 600;--FONT-WEIGHT-SEMI-BOLD: 500;--PAGE-MAX-WIDTH: 1440px;--DIVIDER-MARGIN-TOP: 15px;--LIST-CONTAINER-MARGIN-TOP: 2%;--FORM-PAGE-MAIN-CONTAINER-MARGIN-TOP: 4%;--FORM-PAGE-MAIN-CONTAINER-MARGIN-BOTTOM: 4%;--LAYOUT-MIN-HEIGHT: calc(100% - 45px) ;--LANDING-PAGE-CONTAINER-MARGIN: 50px auto 0 auto;--LANDING-PAGE-MAX-WIDTH: 1218px;--LANDING-PAGE-PADDING: 0px 30px;--PRIMARY-COLOR: #016ed3;--SECONDARY-COLOR: #fafafa;--WHITE-BG-COLOR: #ffffff;--PAGE-BG-COLOR: #e4eaec;--LAYOUT-BG-COLOR: #f8f9fd;--TEXT-DARK-COLOR: #000000;--TEXT-LIGHT-COLOR: #ffffff;--TEXT-GREY-COLOR: #76838f;--TEXT-GREY-COLOR-FOR-TITLE: #4a5065;--TEXT-GREY-COLOR-FOR-CONTENT: #76838f;--BORDER-COLOR: #cccccc;--BOX-SHADOW: 0px 1px 6px #ccc;--LINK-COLOR: #0163bd;--DEFAULT-BUTTON-HOVER: #f0f0f0;--INFORMATION-COLOR: #fde6b6;--ICON-LIGHT-COLOR: #ffffff;--ICON-GREY-COLOR: #5f5f5f;--ICON-HOVER-COLOR: #02549c;--GREY-TABLE-HEADER-COLOR: #f5f5f5;--BG-FORM-ARRAY-CONTAINER: #ffffff;--FOOTER-BG-COLOR: #e0e5e7;--BUTTON-PRIMARY-BG-COLOR: #016ed3;--BUTTON-HOVER-PRIMARY-BG-COLOR: #8897ec;--BUTTON-NORMAL-BG-COLOR: transparent;--BUTTON-DANGER-BG-COLOR: red;--ALERT-DANGER-COLOR: #ad0606;--TOAST-SUCCESS-COLOR: #e9f7ee;--TOAST-ERROR-COLOR: #fddddd;--TOAST-WARNING-COLOR: #daedfa;--TOAST-TEXT-COLOR: #757070}html,body{height:100%}body{margin:0;font-family:Roboto,Helvetica Neue,sans-serif}.custom-container-fluid{width:100%;padding:0 16px;box-sizing:border-box}.custom-row{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:16px}.custom-col-1{grid-column:span 1}.custom-col-2{grid-column:span 2}.custom-col-3{grid-column:span 3}.custom-col-4{grid-column:span 4}.custom-col-5{grid-column:span 5}.custom-col-6{grid-column:span 6}.custom-col-7{grid-column:span 7}.custom-col-8{grid-column:span 8}.custom-col-9{grid-column:span 9}.custom-col-10{grid-column:span 10}.custom-col-11{grid-column:span 11}.custom-col-12{grid-column:span 12}@media(max-width:768px){.custom-row>*{grid-column:span 12}}.hide-scrollbar{overflow:scroll}.hide-scrollbar::-webkit-scrollbar{display:none}.hide-scrollbar{-ms-overflow-style:none;scrollbar-width:none}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:100px}::-webkit-scrollbar-track{background-color:#e4e4e4;border-radius:100px}.main-form{padding:10px}.main-form.form-with-outline{border:1px solid #cccccc;border-radius:10px;padding:30px 20px 20px}.main-form .form-btn-section{padding:30px 0 0;text-align:right}.main-form .form-btn-section button:not(:last-child){margin-right:20px}.main-form .form-btn-section .form-btn-save:disabled{background:unset;border:1px solid var(--BORDER-COLOR);color:var(--TEXT-DARK-COLOR);font-weight:var(--FONT-WEIGHT-NORMAL)}.unset-margin{margin:unset!important}.main-table-container{padding:10px 30px}.main-table-container .filter-section{display:flex;justify-content:space-between;align-items:center;margin:20px 0}.main-table-container .filter-section .filter-icon-section{width:50px;padding:0 12px}.main-table-container .filter-section .filter-icon-section .toggle-filter{cursor:pointer;color:#000}.main-table-container .filter-section .filter{width:80%}.main-table-container .filter-section .filter .toolbar-form{width:100%}.main-table-container .filter-section .main-action-button{margin-left:auto;width:30%;text-align:end}.main-table-container .filter-section .main-action-button button:not(:last-child){margin-right:15px;color:#000;vertical-align:middle}.main-table-container .table-container{border:1px solid #ccc;border-bottom:none;border-top-right-radius:10px;border-top-left-radius:10px}.main-table-container .table-container .header-align-right{text-align:center}.main-table-container .table-container .action-icon{display:inline-block;cursor:pointer;background-color:unset;border:unset;border-radius:2px;padding:unset;width:unset;height:unset;margin-right:25px;border:1px solid #ccc;padding:5px 0 5px 5px;min-height:unset}.main-table-container .table-container .action-icon .mat-icon{margin-right:5px;vertical-align:middle}.main-table-container .table-container .action-icon.action-view:hover mat-icon{color:#016ed3}.main-table-container .table-container .action-icon.action-edit:hover mat-icon{color:#ffb700}.main-table-container .table-container .action-icon.action-delete:hover mat-icon{color:red}.main-table-container .table-container .action-icon-transition:hover{color:var(--PRIMARY-COLOR)}.main-table-container .table-container .align-action-icon{vertical-align:middle;font-size:20px}.main-table-container .table-container .no-data-text{text-align:center;padding:10% 0%}.main-table-container .table-container table{border-collapse:separate}.main-table-container .table-container table tr th{text-transform:capitalize;border-bottom:none;color:#000;font-size:15px;font-weight:500;text-transform:uppercase;background-color:#fff;border-bottom:1px solid #ccc;z-index:1!important}.main-table-container .table-container table tr th:first-child{background-color:#fff;z-index:2!important;border-right:1px solid #ccc}.main-table-container .table-container table tr th:last-child{background-color:#fff;z-index:2!important;border-left:1px solid #ccc}.main-table-container .table-container table tr td{line-height:20px;border-bottom:none;border-bottom:1px solid var(--BORDER-COLOR);font-weight:var(--FONT-WEIGHT-LOW);background:#fff}.main-table-container .table-container table tr td:first-child{background:#fff!important;border-right:1px solid #ccc}.main-table-container .table-container table tr td:last-child{background:#fff!important}.action-column-for-selected-row{position:absolute;top:0;right:0;z-index:999;height:100%;width:250px}.action-column-for-selected-row table{height:100%;width:100%}.action-column-for-selected-row table thead th{position:sticky}.hoverCursorIcon{cursor:pointer;vertical-align:middle;margin-left:2%}.groupListFirstData{display:inline-block;width:80%;line-height:normal;word-wrap:break-word;vertical-align:middle;padding:10px 0}.hoverContent{text-align:left;padding:10px 0;line-height:20px}.valign-middle{vertical-align:middle}.loader-for-table{width:45px!important;height:45px!important;margin:5% auto;color:var(--BUTTON-PRIMARY-BG-COLOR)}.mat-mdc-paginator{border-bottom:1px solid #cccccc;border-left:1px solid #cccccc;border-right:1px solid #cccccc;border-bottom-right-radius:10px;border-bottom-left-radius:10px;background-color:#fff}.mat-mdc-header-cell,.mat-mdc-footer-cell,.mat-mdc-cell{min-width:250px}.mat-mdc-header-row,.mat-mdc-footer-row,.mat-mdc-row{min-width:1920px}.mat-mdc-table-sticky-border-elem-right{min-width:250px}.mat-mdc-table-sticky-border-elem-left{min-width:100px}.mat-elevation-z8{box-shadow:unset}.header-align-right{border-left:1px solid #ccc}::ng-deep app-field-index .field-active{margin-bottom:unset!important}::ng-deep .mat-mdc-menu-content mat-checkbox{width:100%;padding:0 10px;border-bottom:1px solid rgba(204,204,204,.8)}::ng-deep .mat-mdc-menu-content mat-checkbox .mdc-label{text-transform:capitalize;font-size:15px}::ng-deep .mat-mdc-menu-content button{width:100%;padding:0 10px;border-bottom:1px solid rgba(204,204,204,.8)}::ng-deep .mat-mdc-menu-content button .mdc-label{text-transform:capitalize;font-size:15px}::ng-deep .mat-mdc-text-field-wrapper{height:45px!important}::ng-deep .mat-mdc-form-field-infix{padding:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: DynamicForm, selector: "lib-dynamic-form", inputs: ["dynamicFormDetails"], outputs: ["onSubmitForm", "onCancelForm", "onFormValueChange"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i2.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i2.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i2.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i2.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i2.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i2.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i2.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i2.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i2.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i2.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i3.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i4.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i4.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i5.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i5.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i5.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i7.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i8.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i8.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }], animations: [
|
|
815
|
+
trigger('detailExpand', [
|
|
816
|
+
state('collapsed', style({ height: '0px', minHeight: '0' })),
|
|
817
|
+
state('expanded', style({ height: '*' })),
|
|
818
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
819
|
+
]),
|
|
820
|
+
] });
|
|
821
|
+
}
|
|
822
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: DynamicTable, decorators: [{
|
|
823
|
+
type: Component,
|
|
824
|
+
args: [{ selector: 'lib-dynamic-table', standalone: true, imports: [
|
|
825
|
+
CommonModule,
|
|
826
|
+
DynamicForm,
|
|
827
|
+
MatTableModule,
|
|
828
|
+
MatPaginatorModule,
|
|
829
|
+
MatSortModule,
|
|
830
|
+
MatMenuModule,
|
|
831
|
+
MatIconModule,
|
|
832
|
+
MatCheckboxModule,
|
|
833
|
+
MatButtonModule,
|
|
834
|
+
MatProgressSpinnerModule
|
|
835
|
+
], animations: [
|
|
836
|
+
trigger('detailExpand', [
|
|
837
|
+
state('collapsed', style({ height: '0px', minHeight: '0' })),
|
|
838
|
+
state('expanded', style({ height: '*' })),
|
|
839
|
+
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
840
|
+
]),
|
|
841
|
+
], template: "<div class=\"main-table-container\">\n <!-- Filter section begins -->\n @if(search){\n <div class=\"filter-section\">\n <!-- filter icon begins-->\n <div class=\"filter-icon-section\">\n <div class=\"toggle-filter\" (click)=\"toggleFilter()\">\n <mat-icon>filter_list</mat-icon>\n </div>\n </div>\n <!-- filter icon ends -->\n <!-- filter field begins -->\n @if(filterVisibility){\n <div class=\"filter\">\n <lib-dynamic-form\n class=\"toolbar-form\"\n [dynamicFormDetails]=\"dynamicFormDetails\"\n ></lib-dynamic-form>\n </div>\n }\n <!-- filter field ends -->\n <!-- Action button section begins -->\n <div class=\"main-action-button\">\n <button\n matIconButton\n color=\"primary\"\n [matMenuTriggerFor]=\"fieldVisibilitySettings\"\n >\n <mat-icon class=\"unset-margin\">settings</mat-icon>\n </button>\n <mat-menu #fieldVisibilitySettings=\"matMenu\">\n @for(col of masterDisplayedColumns;track col){\n <div>\n <mat-checkbox [checked]=\"displayedColumns.includes(col)\" (change)=\"columnVisibility(col)\">\n {{col}}\n </mat-checkbox>\n </div>\n }\n </mat-menu>\n @if(actionRequired('export')){\n <button\n matIconButton\n color=\"primary\"\n [matMenuTriggerFor]=\"exportOptionMenu\"\n >\n <mat-icon class=\"unset-margin\">cloud_download</mat-icon>\n </button>\n <mat-menu #exportOptionMenu=\"matMenu\">\n <button mat-menu-item (click)=\"exportData('csv')\">CSV</button>\n <button mat-menu-item (click)=\"exportData('xlsx')\">XLSX</button>\n <button mat-menu-item (click)=\"exportData('pdf')\">PDF</button>\n </mat-menu>\n }\n @if(actionRequired('add')){\n <button\n mat-stroked-button\n color=\"primary\"\n (click)=\"onTableAction('create')\"\n >\n <mat-icon class=\"unset-margin\">add_circle</mat-icon>Add\n </button>\n }\n </div>\n <!-- Action button section ends -->\n </div>\n }\n <!-- Filter section ends -->\n\n <!-- Table section begins -->\n <div class=\"table-container hide-scrollbar\">\n <table\n mat-table\n [dataSource]=\"dataSource\"\n class=\"mat-elevation-z8\"\n matSort\n multiTemplateDataRows\n (matSortChange)=\"onSortChanges($event)\"\n aria-label=\"table\"\n >\n @if(tableDetails.selectRequired){\n <ng-container matColumnDef=\"select\" [sticky]=\"true\">\n <th mat-header-cell *matHeaderCellDef>\n <mat-checkbox\n color=\"primary\"\n (change)=\"$event ? toggleAllRows() : null\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n [aria-label]=\"checkboxLabel()\"\n ></mat-checkbox>\n </th>\n <td mat-cell *matCellDef=\"let row\">\n <mat-checkbox\n color=\"primary\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null\"\n [checked]=\"selection.isSelected(row)\"\n [aria-label]=\"checkboxLabel(row)\"\n ></mat-checkbox>\n </td>\n </ng-container>\n }\n @for(column of tableDetails.columns;track column){\n @if(column.isComplex){\n <ng-container matColumnDef=\"{{ column.columnDef }}\">\n <th mat-header-cell *matHeaderCellDef aria-label=\"row actions\">{{ column.header }}</th>\n <td mat-cell *matCellDef=\"let element\">\n {{ element[column.columnDef].length }}\n <button\n mat-icon-button\n aria-label=\"expand row\"\n class=\"valign-middle\"\n (click)=\"expandedElement = expandedElement === element ? null : element; $event.stopPropagation()\"\n >\n @if(expandedElement === element){\n <mat-icon>keyboard_arrow_up</mat-icon>\n }@else{\n <mat-icon>keyboard_arrow_down</mat-icon>\n }\n </button>\n </td>\n </ng-container>\n }@else{\n <ng-container matColumnDef=\"{{ column.columnDef }}\">\n @if(column.sortRequired){\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n {{ column.header }}\n </th>\n }@else{\n <th mat-header-cell *matHeaderCellDef>{{ column.header }}</th>\n }\n @if(column.cell){\n <td mat-cell *matCellDef=\"let row; let i = dataIndex\">\n @if(isArray(column.cell(row))){\n @for(cell of column.cell(row);track cell;let first = $first){\n @if(first){\n {{ cell }}\n }\n }\n @if(column.cell(row).length > 1){\n @if(isExpandedGroupRow === i){\n <mat-icon class=\"hoverCursorIcon\" (click)=\"expandList(i)\">keyboard_arrow_up</mat-icon>\n }@else{\n <mat-icon class=\"hoverCursorIcon\" (click)=\"expandList(i)\">keyboard_arrow_down</mat-icon>\n }\n }\n @if(isExpandedGroupRow === i){\n @for(cell of column.cell(row);track cell;let first = $first){\n @if(!first){\n <div class=\"hoverContent\">\n {{ cell }}\n </div>\n }\n }\n }\n }@else{\n {{ column.cell(row) }}\n }\n </td>\n }@else{\n <td mat-cell *matCellDef=\"let row\">{{ row[column.columnDef] }}</td>\n }\n </ng-container>\n }\n }\n <!-- table expanded columns -->\n @for(expandedCol of expandColumnDefination;track expandedCol){\n <ng-container matColumnDef=\"{{ expandedPrefix + expandedCol.columnDef }}\">\n <td mat-cell *matCellDef=\"let element\" [attr.colspan]=\"displayedColumns.length + 1\">\n @if(element[expandedCol.columnDef]?.length > 0){\n <div\n class=\"example-element-detail\"\n [@detailExpand]=\"element === expandedElement ? 'expanded' : 'collapsed'\"\n >\n @if(expandedElement){\n <div class=\"inner-table mat-elevation-z8\">\n <!-- IF THE OBJECT ARRAY NEEDS TO BE DISPLAYED -->\n <table\n mat-table\n #innerTables\n mat-table\n aria-label=\"table\"\n [dataSource]=\"element[expandedCol.columnDef]\"\n class=\"w-100\"\n >\n @for(innerColumn of expandedCol?.innerColumns;track innerColumn){\n <ng-container matColumnDef=\"{{ innerColumn.columnDef }}\">\n <th mat-header-cell *matHeaderCellDef>{{ innerColumn.header }}</th>\n <td mat-cell *matCellDef=\"let innerRow\">\n {{ innerColumn.cell ? innerColumn.cell(innerRow) : innerRow[innerColumn.columnDef] }}\n </td>\n </ng-container>\n }\n <tr\n mat-header-row\n *matHeaderRowDef=\"getInnerColumnDef(expandedCol.innerColumns)\"\n style=\"background-color: lightgray\"\n ></tr>\n <tr\n mat-row\n *matRowDef=\"let row; columns: getInnerColumnDef(expandedCol.innerColumns)\"\n [class.expanded-row]\n ></tr>\n </table>\n </div>\n }\n </div>\n }\n </td>\n </ng-container>\n }\n <!-- Action Column -->\n @if(actionRequired()){\n <ng-container matColumnDef=\"action\" [stickyEnd]=\"true\">\n <th mat-header-cell *matHeaderCellDef class=\"header-align-right\">Action</th>\n <td mat-cell *matCellDef=\"let element\" class=\"header-align-right\">\n @if(tableDetails.tableButtons.view){\n <button\n class=\"action-icon action-view\"\n mat-menu-item\n (click)=\"onTableAction('view', element)\"\n >\n <mat-icon>remove_red_eye</mat-icon>\n </button>\n }\n @if(tableDetails.tableButtons.edit){\n <button\n class=\"action-icon action-edit\"\n mat-menu-item\n (click)=\"onTableAction('edit', element)\"\n >\n <mat-icon>edit</mat-icon>\n </button>\n }\n @if(tableDetails.tableButtons.delete){\n <button\n class=\"action-icon action-delete\"\n mat-menu-item\n (click)=\"onTableAction('delete', element)\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n }\n </td>\n </ng-container>\n }\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns;sticky:true\"></tr>\n <tr\n mat-row\n *matRowDef=\"let row; columns: displayedColumns\"\n [class.example-expanded-row]=\"expandedElement === row\"\n (click)=\"toggleRowSelect(row,$event)\"\n >\n </tr>\n <!-- table Rows which are expanded -->\n <tr\n mat-row\n *matRowDef=\"let row; columns: getExpandedColumnHeaderDef(expandColumnDefination)\"\n class=\"example-detail-row\"\n style=\"height: 0 !important\"\n ></tr>\n </table>\n </div>\n @if(dataset.data === undefined){\n <mat-spinner class=\"loader-for-table\"></mat-spinner>\n }\n @if(dataset.totalRecords === 0){\n <section class=\"no-data-text\">\n <p>No Records Found</p>\n </section>\n }\n @if(tableDetails.paging.enabled){\n <mat-paginator\n #paginator\n class=\"mat-elevation-z8 table-paginator\"\n showFirstLastButtons\n aria-label=\"Select page\"\n (page)=\"pageChanged($event)\"\n >\n </mat-paginator>\n }\n <!-- Table section ends -->\n </div>\n\n ", styles: [":host{--FONT-FAMILY-NORMAL-TEXT: Roboto, \"Helvetica Neue\", sans-serif;--FONT-FAMILY-HEADING-TEXT: Roboto, \"Helvetica Neue\", sans-serif;--FONT-SIZE-FOR-VERY-TINY: 12px;--FONT-SIZE-FOR-VERY-SMALL-TEXT: 14px;--FONT-SIZE-FOR-SMALL-TEXT: 15px;--FONT-SIZE-FOR-NORMAL-TEXT: 16px;--FONT-SIZE-FOR-HEADING-TEXT: 22px;--FONT-SIZE-FOR-LARGE-HEADING-TEXT: 24px;--FONT-SIZE-FOR-SUB-HEADING-TEXT: 20px;--FONT-WEIGHT-LOW: 300;--FONT-WEIGHT-NORMAL: 400;--FONT-WEIGHT-VERY-BOLD: 900;--FONT-WEIGHT-BOLD: 600;--FONT-WEIGHT-SEMI-BOLD: 500;--PAGE-MAX-WIDTH: 1440px;--DIVIDER-MARGIN-TOP: 15px;--LIST-CONTAINER-MARGIN-TOP: 2%;--FORM-PAGE-MAIN-CONTAINER-MARGIN-TOP: 4%;--FORM-PAGE-MAIN-CONTAINER-MARGIN-BOTTOM: 4%;--LAYOUT-MIN-HEIGHT: calc(100% - 45px) ;--LANDING-PAGE-CONTAINER-MARGIN: 50px auto 0 auto;--LANDING-PAGE-MAX-WIDTH: 1218px;--LANDING-PAGE-PADDING: 0px 30px;--PRIMARY-COLOR: #016ed3;--SECONDARY-COLOR: #fafafa;--WHITE-BG-COLOR: #ffffff;--PAGE-BG-COLOR: #e4eaec;--LAYOUT-BG-COLOR: #f8f9fd;--TEXT-DARK-COLOR: #000000;--TEXT-LIGHT-COLOR: #ffffff;--TEXT-GREY-COLOR: #76838f;--TEXT-GREY-COLOR-FOR-TITLE: #4a5065;--TEXT-GREY-COLOR-FOR-CONTENT: #76838f;--BORDER-COLOR: #cccccc;--BOX-SHADOW: 0px 1px 6px #ccc;--LINK-COLOR: #0163bd;--DEFAULT-BUTTON-HOVER: #f0f0f0;--INFORMATION-COLOR: #fde6b6;--ICON-LIGHT-COLOR: #ffffff;--ICON-GREY-COLOR: #5f5f5f;--ICON-HOVER-COLOR: #02549c;--GREY-TABLE-HEADER-COLOR: #f5f5f5;--BG-FORM-ARRAY-CONTAINER: #ffffff;--FOOTER-BG-COLOR: #e0e5e7;--BUTTON-PRIMARY-BG-COLOR: #016ed3;--BUTTON-HOVER-PRIMARY-BG-COLOR: #8897ec;--BUTTON-NORMAL-BG-COLOR: transparent;--BUTTON-DANGER-BG-COLOR: red;--ALERT-DANGER-COLOR: #ad0606;--TOAST-SUCCESS-COLOR: #e9f7ee;--TOAST-ERROR-COLOR: #fddddd;--TOAST-WARNING-COLOR: #daedfa;--TOAST-TEXT-COLOR: #757070}html,body{height:100%}body{margin:0;font-family:Roboto,Helvetica Neue,sans-serif}.custom-container-fluid{width:100%;padding:0 16px;box-sizing:border-box}.custom-row{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:16px}.custom-col-1{grid-column:span 1}.custom-col-2{grid-column:span 2}.custom-col-3{grid-column:span 3}.custom-col-4{grid-column:span 4}.custom-col-5{grid-column:span 5}.custom-col-6{grid-column:span 6}.custom-col-7{grid-column:span 7}.custom-col-8{grid-column:span 8}.custom-col-9{grid-column:span 9}.custom-col-10{grid-column:span 10}.custom-col-11{grid-column:span 11}.custom-col-12{grid-column:span 12}@media(max-width:768px){.custom-row>*{grid-column:span 12}}.hide-scrollbar{overflow:scroll}.hide-scrollbar::-webkit-scrollbar{display:none}.hide-scrollbar{-ms-overflow-style:none;scrollbar-width:none}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-thumb{background-color:#ccc;border-radius:100px}::-webkit-scrollbar-track{background-color:#e4e4e4;border-radius:100px}.main-form{padding:10px}.main-form.form-with-outline{border:1px solid #cccccc;border-radius:10px;padding:30px 20px 20px}.main-form .form-btn-section{padding:30px 0 0;text-align:right}.main-form .form-btn-section button:not(:last-child){margin-right:20px}.main-form .form-btn-section .form-btn-save:disabled{background:unset;border:1px solid var(--BORDER-COLOR);color:var(--TEXT-DARK-COLOR);font-weight:var(--FONT-WEIGHT-NORMAL)}.unset-margin{margin:unset!important}.main-table-container{padding:10px 30px}.main-table-container .filter-section{display:flex;justify-content:space-between;align-items:center;margin:20px 0}.main-table-container .filter-section .filter-icon-section{width:50px;padding:0 12px}.main-table-container .filter-section .filter-icon-section .toggle-filter{cursor:pointer;color:#000}.main-table-container .filter-section .filter{width:80%}.main-table-container .filter-section .filter .toolbar-form{width:100%}.main-table-container .filter-section .main-action-button{margin-left:auto;width:30%;text-align:end}.main-table-container .filter-section .main-action-button button:not(:last-child){margin-right:15px;color:#000;vertical-align:middle}.main-table-container .table-container{border:1px solid #ccc;border-bottom:none;border-top-right-radius:10px;border-top-left-radius:10px}.main-table-container .table-container .header-align-right{text-align:center}.main-table-container .table-container .action-icon{display:inline-block;cursor:pointer;background-color:unset;border:unset;border-radius:2px;padding:unset;width:unset;height:unset;margin-right:25px;border:1px solid #ccc;padding:5px 0 5px 5px;min-height:unset}.main-table-container .table-container .action-icon .mat-icon{margin-right:5px;vertical-align:middle}.main-table-container .table-container .action-icon.action-view:hover mat-icon{color:#016ed3}.main-table-container .table-container .action-icon.action-edit:hover mat-icon{color:#ffb700}.main-table-container .table-container .action-icon.action-delete:hover mat-icon{color:red}.main-table-container .table-container .action-icon-transition:hover{color:var(--PRIMARY-COLOR)}.main-table-container .table-container .align-action-icon{vertical-align:middle;font-size:20px}.main-table-container .table-container .no-data-text{text-align:center;padding:10% 0%}.main-table-container .table-container table{border-collapse:separate}.main-table-container .table-container table tr th{text-transform:capitalize;border-bottom:none;color:#000;font-size:15px;font-weight:500;text-transform:uppercase;background-color:#fff;border-bottom:1px solid #ccc;z-index:1!important}.main-table-container .table-container table tr th:first-child{background-color:#fff;z-index:2!important;border-right:1px solid #ccc}.main-table-container .table-container table tr th:last-child{background-color:#fff;z-index:2!important;border-left:1px solid #ccc}.main-table-container .table-container table tr td{line-height:20px;border-bottom:none;border-bottom:1px solid var(--BORDER-COLOR);font-weight:var(--FONT-WEIGHT-LOW);background:#fff}.main-table-container .table-container table tr td:first-child{background:#fff!important;border-right:1px solid #ccc}.main-table-container .table-container table tr td:last-child{background:#fff!important}.action-column-for-selected-row{position:absolute;top:0;right:0;z-index:999;height:100%;width:250px}.action-column-for-selected-row table{height:100%;width:100%}.action-column-for-selected-row table thead th{position:sticky}.hoverCursorIcon{cursor:pointer;vertical-align:middle;margin-left:2%}.groupListFirstData{display:inline-block;width:80%;line-height:normal;word-wrap:break-word;vertical-align:middle;padding:10px 0}.hoverContent{text-align:left;padding:10px 0;line-height:20px}.valign-middle{vertical-align:middle}.loader-for-table{width:45px!important;height:45px!important;margin:5% auto;color:var(--BUTTON-PRIMARY-BG-COLOR)}.mat-mdc-paginator{border-bottom:1px solid #cccccc;border-left:1px solid #cccccc;border-right:1px solid #cccccc;border-bottom-right-radius:10px;border-bottom-left-radius:10px;background-color:#fff}.mat-mdc-header-cell,.mat-mdc-footer-cell,.mat-mdc-cell{min-width:250px}.mat-mdc-header-row,.mat-mdc-footer-row,.mat-mdc-row{min-width:1920px}.mat-mdc-table-sticky-border-elem-right{min-width:250px}.mat-mdc-table-sticky-border-elem-left{min-width:100px}.mat-elevation-z8{box-shadow:unset}.header-align-right{border-left:1px solid #ccc}::ng-deep app-field-index .field-active{margin-bottom:unset!important}::ng-deep .mat-mdc-menu-content mat-checkbox{width:100%;padding:0 10px;border-bottom:1px solid rgba(204,204,204,.8)}::ng-deep .mat-mdc-menu-content mat-checkbox .mdc-label{text-transform:capitalize;font-size:15px}::ng-deep .mat-mdc-menu-content button{width:100%;padding:0 10px;border-bottom:1px solid rgba(204,204,204,.8)}::ng-deep .mat-mdc-menu-content button .mdc-label{text-transform:capitalize;font-size:15px}::ng-deep .mat-mdc-text-field-wrapper{height:45px!important}::ng-deep .mat-mdc-form-field-infix{padding:0}\n"] }]
|
|
842
|
+
}], ctorParameters: () => [{ type: ExportService }, { type: i0.Renderer2 }, { type: i0.ElementRef }], propDecorators: { pagination: [{
|
|
843
|
+
type: Input
|
|
844
|
+
}], tableDetails: [{
|
|
845
|
+
type: Input
|
|
846
|
+
}], exportOptionMenu: [{
|
|
847
|
+
type: ViewChild,
|
|
848
|
+
args: ['exportOptionMenu', { static: false }]
|
|
849
|
+
}], paginator: [{
|
|
850
|
+
type: ViewChild,
|
|
851
|
+
args: [MatPaginator]
|
|
852
|
+
}], sort: [{
|
|
853
|
+
type: ViewChild,
|
|
854
|
+
args: [MatSort]
|
|
855
|
+
}], dataset: [{
|
|
856
|
+
type: Input
|
|
857
|
+
}], search: [{
|
|
858
|
+
type: Input
|
|
859
|
+
}], action: [{
|
|
860
|
+
type: Output
|
|
861
|
+
}] } });
|
|
862
|
+
|
|
863
|
+
/*
|
|
864
|
+
* Public API Surface of dynamic-table
|
|
865
|
+
*/
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Generated bundle index. Do not edit.
|
|
869
|
+
*/
|
|
870
|
+
|
|
871
|
+
export { DynamicTable, OrderBy, SearchAt, SearchOn, defaultPageSize };
|
|
872
|
+
//# sourceMappingURL=devlab-one-dynamic-table.mjs.map
|