@competer/primeng-table 0.0.0-stage → 14.2.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.
Files changed (96) hide show
  1. package/README.md +279 -3
  2. package/esm2020/competer-primeng-table.mjs +5 -0
  3. package/esm2020/lib/components/column-selector/column-selector.mjs +147 -0
  4. package/esm2020/lib/components/ecs-primeng-table/ecs-primeng-table.mjs +1411 -0
  5. package/esm2020/lib/components/ecs-primeng-table/ecs-primeng-table.service.mjs +222 -0
  6. package/esm2020/lib/components/export-excel/export-excel.mjs +153 -0
  7. package/esm2020/lib/components/export-excel/export-excel.service.mjs +23 -0
  8. package/esm2020/lib/components/table-button/table-button.mjs +63 -0
  9. package/esm2020/lib/components/table-cell/table-cell.mjs +159 -0
  10. package/esm2020/lib/components/table-predefined-filters/table-predefined-filters.mjs +94 -0
  11. package/esm2020/lib/components/views-management/views-management.mjs +117 -0
  12. package/esm2020/lib/enums/cell-display.enum.mjs +7 -0
  13. package/esm2020/lib/enums/cell-overflow-behaviour.enum.mjs +14 -0
  14. package/esm2020/lib/enums/data-align-horizontal.enum.mjs +16 -0
  15. package/esm2020/lib/enums/data-align-vertical.enum.mjs +16 -0
  16. package/esm2020/lib/enums/data-type.enum.enum.mjs +21 -0
  17. package/esm2020/lib/enums/device-type.enum.mjs +8 -0
  18. package/esm2020/lib/enums/frozen-column-align.enum.mjs +17 -0
  19. package/esm2020/lib/enums/index.mjs +9 -0
  20. package/esm2020/lib/enums/table-view-save-mode.enum.mjs +19 -0
  21. package/esm2020/lib/interfaces/columns-metadata.interface.mjs +2 -0
  22. package/esm2020/lib/interfaces/excel-export-request.interface.mjs +2 -0
  23. package/esm2020/lib/interfaces/index.mjs +11 -0
  24. package/esm2020/lib/interfaces/predefined-filter.interface.mjs +2 -0
  25. package/esm2020/lib/interfaces/table-button.interface.mjs +2 -0
  26. package/esm2020/lib/interfaces/table-configuration.interface.mjs +2 -0
  27. package/esm2020/lib/interfaces/table-options.interface.mjs +107 -0
  28. package/esm2020/lib/interfaces/table-paged-response.interface.mjs +2 -0
  29. package/esm2020/lib/interfaces/table-query-request.interface.mjs +2 -0
  30. package/esm2020/lib/interfaces/table-view-data.interface.mjs +2 -0
  31. package/esm2020/lib/interfaces/table-view.interface.mjs +2 -0
  32. package/esm2020/lib/pipes/ui-translate.pipe.mjs +21 -0
  33. package/esm2020/lib/services/http.service.mjs +18 -0
  34. package/esm2020/lib/services/i18n.service.mjs +61 -0
  35. package/esm2020/lib/services/index.mjs +5 -0
  36. package/esm2020/lib/services/notification.service.mjs +17 -0
  37. package/esm2020/lib/services/table-state.service.mjs +38 -0
  38. package/esm2020/lib/utils/create-table-options.mjs +37 -0
  39. package/esm2020/lib/utils/data-align-horizontal-as-text.mjs +23 -0
  40. package/esm2020/lib/utils/data-align-vertical-as-text.mjs +23 -0
  41. package/esm2020/lib/utils/data-type-as-text.mjs +25 -0
  42. package/esm2020/lib/utils/frozen-column-align-as-text.mjs +21 -0
  43. package/esm2020/lib/utils/highlight-text.mjs +36 -0
  44. package/esm2020/lib/utils/index.mjs +7 -0
  45. package/esm2020/lib/utils/tree-table-state.mjs +239 -0
  46. package/esm2020/public-api.mjs +19 -0
  47. package/fesm2015/competer-primeng-table.mjs +3119 -0
  48. package/fesm2015/competer-primeng-table.mjs.map +1 -0
  49. package/fesm2020/competer-primeng-table.mjs +3049 -0
  50. package/fesm2020/competer-primeng-table.mjs.map +1 -0
  51. package/index.d.ts +5 -0
  52. package/lib/components/column-selector/column-selector.d.ts +55 -0
  53. package/lib/components/ecs-primeng-table/ecs-primeng-table.d.ts +256 -0
  54. package/lib/components/ecs-primeng-table/ecs-primeng-table.service.d.ts +52 -0
  55. package/lib/components/export-excel/export-excel.d.ts +51 -0
  56. package/lib/components/export-excel/export-excel.service.d.ts +6 -0
  57. package/lib/components/table-button/table-button.d.ts +16 -0
  58. package/lib/components/table-cell/table-cell.d.ts +69 -0
  59. package/lib/components/table-predefined-filters/table-predefined-filters.d.ts +39 -0
  60. package/lib/components/views-management/views-management.d.ts +34 -0
  61. package/lib/enums/cell-display.enum.d.ts +5 -0
  62. package/lib/enums/cell-overflow-behaviour.enum.d.ts +12 -0
  63. package/lib/enums/data-align-horizontal.enum.d.ts +14 -0
  64. package/lib/enums/data-align-vertical.enum.d.ts +14 -0
  65. package/lib/enums/data-type.enum.enum.d.ts +19 -0
  66. package/lib/enums/device-type.enum.d.ts +6 -0
  67. package/lib/enums/frozen-column-align.enum.d.ts +15 -0
  68. package/lib/enums/index.d.ts +8 -0
  69. package/lib/enums/table-view-save-mode.enum.d.ts +17 -0
  70. package/lib/interfaces/columns-metadata.interface.d.ts +66 -0
  71. package/lib/interfaces/excel-export-request.interface.d.ts +20 -0
  72. package/lib/interfaces/index.d.ts +10 -0
  73. package/lib/interfaces/predefined-filter.interface.d.ts +101 -0
  74. package/lib/interfaces/table-button.interface.d.ts +75 -0
  75. package/lib/interfaces/table-configuration.interface.d.ts +23 -0
  76. package/lib/interfaces/table-options.interface.d.ts +604 -0
  77. package/lib/interfaces/table-paged-response.interface.d.ts +16 -0
  78. package/lib/interfaces/table-query-request.interface.d.ts +28 -0
  79. package/lib/interfaces/table-view-data.interface.d.ts +28 -0
  80. package/lib/interfaces/table-view.interface.d.ts +15 -0
  81. package/lib/pipes/ui-translate.pipe.d.ts +13 -0
  82. package/lib/services/http.service.d.ts +34 -0
  83. package/lib/services/i18n.service.d.ts +20 -0
  84. package/lib/services/index.d.ts +4 -0
  85. package/lib/services/notification.service.d.ts +23 -0
  86. package/lib/services/table-state.service.d.ts +31 -0
  87. package/lib/utils/create-table-options.d.ts +5 -0
  88. package/lib/utils/data-align-horizontal-as-text.d.ts +11 -0
  89. package/lib/utils/data-align-vertical-as-text.d.ts +11 -0
  90. package/lib/utils/data-type-as-text.d.ts +11 -0
  91. package/lib/utils/frozen-column-align-as-text.d.ts +11 -0
  92. package/lib/utils/highlight-text.d.ts +17 -0
  93. package/lib/utils/index.d.ts +6 -0
  94. package/lib/utils/tree-table-state.d.ts +66 -0
  95. package/package.json +58 -3
  96. package/public-api.d.ts +10 -0
@@ -0,0 +1,3049 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, inject, Pipe, Component, Input, EventEmitter, ViewChild, Output, ChangeDetectorRef, ViewEncapsulation, HostListener } from '@angular/core';
3
+ import * as i1$2 from '@ngx-translate/core';
4
+ import { TranslateService, TranslateDefaultParser, TranslateModule } from '@ngx-translate/core';
5
+ import * as i3$2 from 'primeng/api';
6
+ import { PrimeNGConfig, TranslationKeys } from 'primeng/api';
7
+ import { Subject, merge, EMPTY, takeUntil, Observable, finalize, firstValueFrom } from 'rxjs';
8
+ import * as i1$1 from '@angular/common';
9
+ import { CommonModule } from '@angular/common';
10
+ import * as i6$1 from '@angular/forms';
11
+ import { FormsModule } from '@angular/forms';
12
+ import * as i6 from 'primeng/table';
13
+ import { TableModule } from 'primeng/table';
14
+ import * as i5 from 'primeng/button';
15
+ import { ButtonModule } from 'primeng/button';
16
+ import * as i3$1 from 'primeng/tooltip';
17
+ import { TooltipModule } from 'primeng/tooltip';
18
+ import * as i10 from 'primeng/inputtext';
19
+ import { InputTextModule } from 'primeng/inputtext';
20
+ import * as i11 from 'primeng/multiselect';
21
+ import { MultiSelectModule } from 'primeng/multiselect';
22
+ import * as i5$1 from 'primeng/checkbox';
23
+ import { CheckboxModule } from 'primeng/checkbox';
24
+ import * as i13 from 'primeng/paginator';
25
+ import { PaginatorModule } from 'primeng/paginator';
26
+ import * as i14 from 'primeng/overlaypanel';
27
+ import { OverlayPanelModule } from 'primeng/overlaypanel';
28
+ import * as i15 from 'primeng/menu';
29
+ import { MenuModule } from 'primeng/menu';
30
+ import * as i3 from 'primeng/skeleton';
31
+ import { SkeletonModule } from 'primeng/skeleton';
32
+ import * as i4 from 'primeng/tag';
33
+ import { TagModule } from 'primeng/tag';
34
+ import * as i1 from '@angular/platform-browser';
35
+ import { HttpHeaders } from '@angular/common/http';
36
+ import { DomHandler } from 'primeng/dom';
37
+ import * as i2 from 'primeng/dialog';
38
+ import { DialogModule } from 'primeng/dialog';
39
+ import * as i7 from 'primeng/selectbutton';
40
+ import { SelectButtonModule } from 'primeng/selectbutton';
41
+
42
+ /**
43
+ * Defines how content that overflows a table cell is displayed.
44
+ *
45
+ * @remarks
46
+ * This enumeration specifies the visual behavior of cell content when it exceeds the cell’s width.
47
+ */
48
+ var CellOverflowBehaviour;
49
+ (function (CellOverflowBehaviour) {
50
+ /** The overflowing content is clipped and not visible. */
51
+ CellOverflowBehaviour[CellOverflowBehaviour["Hidden"] = 0] = "Hidden";
52
+ /** The content wraps onto multiple lines to fit within the cell. */
53
+ CellOverflowBehaviour[CellOverflowBehaviour["Wrap"] = 1] = "Wrap";
54
+ })(CellOverflowBehaviour || (CellOverflowBehaviour = {}));
55
+
56
+ /**
57
+ * Defines the horizontal alignment of content within a table cell.
58
+ *
59
+ * @remarks
60
+ * Specifies how the content inside a cell is positioned horizontally relative to the cell's width.
61
+ */
62
+ var DataAlignHorizontal;
63
+ (function (DataAlignHorizontal) {
64
+ /** Content is aligned to the left side of the cell. */
65
+ DataAlignHorizontal[DataAlignHorizontal["Left"] = 0] = "Left";
66
+ /** Content is aligned to the center of the cell. */
67
+ DataAlignHorizontal[DataAlignHorizontal["Center"] = 1] = "Center";
68
+ /** Content is aligned to the right side of the cell. */
69
+ DataAlignHorizontal[DataAlignHorizontal["Right"] = 2] = "Right";
70
+ })(DataAlignHorizontal || (DataAlignHorizontal = {}));
71
+
72
+ /**
73
+ * Enum representing the vertical alignment of content within a table cell.
74
+ *
75
+ * @remarks
76
+ * Determines how the content inside a cell is positioned vertically relative to the cell's height.
77
+ */
78
+ var DataAlignVertical;
79
+ (function (DataAlignVertical) {
80
+ /** Align content to the top of the cell. */
81
+ DataAlignVertical[DataAlignVertical["Top"] = 0] = "Top";
82
+ /** Align content to the vertical middle of the cell. */
83
+ DataAlignVertical[DataAlignVertical["Middle"] = 1] = "Middle";
84
+ /** Align content to the bottom of the cell. */
85
+ DataAlignVertical[DataAlignVertical["Bottom"] = 2] = "Bottom";
86
+ })(DataAlignVertical || (DataAlignVertical = {}));
87
+
88
+ /**
89
+ * Enum representing the different types of data a table column can hold.
90
+ *
91
+ * @remarks
92
+ * This is used to determine how values should be rendered, formatted, and
93
+ * filtered in the table component.
94
+ */
95
+ var DataType;
96
+ (function (DataType) {
97
+ /** Plain text string values. */
98
+ DataType[DataType["Text"] = 0] = "Text";
99
+ /** Numeric values, e.g., integers or decimals. */
100
+ DataType[DataType["Numeric"] = 1] = "Numeric";
101
+ /** Boolean values (true/false). */
102
+ DataType[DataType["Boolean"] = 2] = "Boolean";
103
+ /** Date or datetime values. */
104
+ DataType[DataType["Date"] = 3] = "Date";
105
+ /** List of values, stored as a string separated by a delimiter (";"). */
106
+ DataType[DataType["List"] = 4] = "List";
107
+ })(DataType || (DataType = {}));
108
+
109
+ /**
110
+ * Enum representing the alignment of frozen columns in a table.
111
+ *
112
+ * @remarks
113
+ * Used to determine if a column should be frozen, and if so, on which side
114
+ * of the table it should appear.
115
+ */
116
+ var FrozenColumnAlign;
117
+ (function (FrozenColumnAlign) {
118
+ /** The column is not frozen. */
119
+ FrozenColumnAlign[FrozenColumnAlign["Noone"] = 0] = "Noone";
120
+ /** The column is frozen on the left side of the table. */
121
+ FrozenColumnAlign[FrozenColumnAlign["Left"] = 1] = "Left";
122
+ /** The column is frozen on the right side of the table. */
123
+ FrozenColumnAlign[FrozenColumnAlign["Right"] = 2] = "Right";
124
+ })(FrozenColumnAlign || (FrozenColumnAlign = {}));
125
+
126
+ /**
127
+ * Enum representing the mode used to save the state or configuration of a table view.
128
+ *
129
+ * @remarks
130
+ * Determines where and how the table's view settings (e.g., column order, filters,
131
+ * sorting) are persisted.
132
+ */
133
+ var TableViewSaveMode;
134
+ (function (TableViewSaveMode) {
135
+ /** Views are disabled. */
136
+ TableViewSaveMode[TableViewSaveMode["None"] = 0] = "None";
137
+ /** Save the table view state in the browser's sessionStorage (cleared on tab close). */
138
+ TableViewSaveMode[TableViewSaveMode["SessionStorage"] = 1] = "SessionStorage";
139
+ /** Save the table view state in the browser's localStorage (persists across sessions). */
140
+ TableViewSaveMode[TableViewSaveMode["LocalStorage"] = 2] = "LocalStorage";
141
+ /** Save the table view state in a backend database (requires server support). */
142
+ TableViewSaveMode[TableViewSaveMode["DatabaseStorage"] = 3] = "DatabaseStorage";
143
+ })(TableViewSaveMode || (TableViewSaveMode = {}));
144
+
145
+ /** Viewport categories; numeric values match the backend DeviceType enum. */
146
+ var DeviceType;
147
+ (function (DeviceType) {
148
+ DeviceType[DeviceType["Mobile"] = 0] = "Mobile";
149
+ DeviceType[DeviceType["Tablet"] = 1] = "Tablet";
150
+ DeviceType[DeviceType["Desktop"] = 2] = "Desktop";
151
+ })(DeviceType || (DeviceType = {}));
152
+
153
+ /** Cell presentation. Filtering, sorting and export continue to use DataType. */
154
+ var CellDisplay;
155
+ (function (CellDisplay) {
156
+ CellDisplay[CellDisplay["Default"] = 0] = "Default";
157
+ CellDisplay[CellDisplay["ProgressBar"] = 1] = "ProgressBar";
158
+ })(CellDisplay || (CellDisplay = {}));
159
+
160
+ /** Default configuration options for ECS Primeng table */
161
+ const DEFAULT_TABLE_OPTIONS = {
162
+ isActive: true,
163
+ responsive: {
164
+ tabletMinWidth: 768,
165
+ desktopMinWidth: 1200,
166
+ headerMenu: false,
167
+ rowMenu: false,
168
+ headerMenuLabel: 'Table actions',
169
+ rowMenuLabel: 'Row actions'
170
+ },
171
+ statePersistence: { enabled: false },
172
+ urlTableConfiguration: undefined,
173
+ urlTableData: undefined,
174
+ data: [],
175
+ columnDescriptionIcon: "pi pi-info-circle",
176
+ description: {
177
+ icon: "pi pi-info-circle",
178
+ tooltip: true,
179
+ text: undefined
180
+ },
181
+ legend: {
182
+ content: undefined,
183
+ button: {
184
+ icon: "pi pi-bars",
185
+ label: "Legend"
186
+ }
187
+ },
188
+ header: {
189
+ buttons: [],
190
+ clearSortsEnabled: true,
191
+ clearSortsIcon: "pi pi-sort-alt-slash",
192
+ clearFiltersEnabled: true,
193
+ clearFiltersIcon: "pi pi-filter-slash"
194
+ },
195
+ columns: {
196
+ selectorEnabled: true,
197
+ selectorIcon: "pi pi-pencil",
198
+ selectorOrderByColumnName: true,
199
+ shown: []
200
+ },
201
+ rows: {
202
+ style: () => ({}),
203
+ class: () => ({}),
204
+ action: {
205
+ buttons: [],
206
+ header: "Actions",
207
+ positionRight: true,
208
+ width: 150,
209
+ frozen: true,
210
+ resizable: false,
211
+ horizontalAlignment: DataAlignHorizontal.Center,
212
+ verticalAlignment: DataAlignVertical.Middle
213
+ },
214
+ checkboxSelector: {
215
+ enabled: false,
216
+ selectAllEnabled: false,
217
+ urlSelectAll: undefined,
218
+ header: "Selected",
219
+ positionRight: false,
220
+ width: 150,
221
+ frozen: true,
222
+ resizable: false,
223
+ enabledCondition: undefined,
224
+ horizontalAlignment: DataAlignHorizontal.Center,
225
+ verticalAlignment: DataAlignVertical.Middle
226
+ },
227
+ singleSelector: {
228
+ enabled: false,
229
+ metakey: true
230
+ }
231
+ },
232
+ verticalScroll: {
233
+ fitToContainer: true,
234
+ height: 0,
235
+ cssFormula: undefined
236
+ },
237
+ globalFilter: {
238
+ enabled: true,
239
+ minLength: 0,
240
+ debounceTime: 0,
241
+ maxLength: 20
242
+ },
243
+ predefinedFilters: {},
244
+ views: {
245
+ saveMode: TableViewSaveMode.None,
246
+ saveKey: undefined,
247
+ urlGet: undefined,
248
+ urlSave: undefined,
249
+ selectViewButtonClass: undefined,
250
+ reloadViewButtonClass: undefined,
251
+ reloadViewButtonIcon: "pi pi-refresh",
252
+ noViewSelectedText: "--- Select a view ---"
253
+ },
254
+ resetTableView: {
255
+ enabled: true,
256
+ icon: "pi pi-eraser"
257
+ },
258
+ excelReport: {
259
+ url: undefined,
260
+ defaultTitle: "Report",
261
+ titleAllowUserEdit: true
262
+ },
263
+ copyToClipboardTime: 0.5
264
+ };
265
+
266
+ /**
267
+ * Deep merge two objects.
268
+ * Recursively copies properties from `source` into `target`,
269
+ * but ignores `undefined` values to preserve defaults.
270
+ */
271
+ function deepMerge(target, source) {
272
+ for (const key in source) {
273
+ const value = source[key];
274
+ if (value === undefined) { // skip undefined values to keep defaults
275
+ continue;
276
+ }
277
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
278
+ if (!target[key])
279
+ target[key] = {};
280
+ deepMerge(target[key], value);
281
+ }
282
+ else {
283
+ target[key] = value;
284
+ }
285
+ }
286
+ return target;
287
+ }
288
+ /**
289
+ * Create table options based on defaults, with optional overrides.
290
+ */
291
+ function createTableOptions(overrides = {}) {
292
+ const defaultsCopy = JSON.parse(JSON.stringify(DEFAULT_TABLE_OPTIONS)); // clone only data
293
+ const merged = deepMerge(defaultsCopy, overrides);
294
+ // Reasign function if they exist in override
295
+ if (overrides.rows?.style)
296
+ merged.rows.style = overrides.rows.style;
297
+ if (overrides.rows?.class)
298
+ merged.rows.class = overrides.rows.class;
299
+ return merged;
300
+ }
301
+
302
+ class TreeTableState {
303
+ constructor(options) {
304
+ this.options = options;
305
+ this.expanded = new Set();
306
+ this.nodes = new Map();
307
+ this.children = new Map();
308
+ this.totals = new Map();
309
+ this.pages = new Map();
310
+ this.entries = new WeakMap();
311
+ this.roots = [];
312
+ this.allRoots = [];
313
+ this.version = 0;
314
+ this.pending = new Set();
315
+ this.restoredPages = {};
316
+ this.visible = [];
317
+ this.loading = false;
318
+ this.page = 0;
319
+ this.pageSize = 10;
320
+ this.totalRecords = 0;
321
+ this.totalRecordsNotFiltered = 0;
322
+ if (!options.keyExpr?.trim() || !options.parentIdExpr?.trim() || !options.column?.trim()) {
323
+ throw new Error('Tree configuration requires keyExpr, parentIdExpr and column.');
324
+ }
325
+ if (!['all', 'onDemand', 'pagedChildren'].includes(this.mode)) {
326
+ throw new Error('Invalid tree loadMode.');
327
+ }
328
+ if (this.mode !== 'all' && !options.hasItemsExpr?.trim()) {
329
+ throw new Error('Remote tree loading requires hasItemsExpr.');
330
+ }
331
+ }
332
+ get mode() { return this.options.loadMode ?? 'onDemand'; }
333
+ get rootValue() { return this.options.rootValue === undefined ? 0 : this.options.rootValue; }
334
+ key(row) {
335
+ const key = row[this.options.keyExpr];
336
+ if ((typeof key !== 'string' && typeof key !== 'number') || key === '' ||
337
+ (typeof key === 'number' && !Number.isFinite(key))) {
338
+ throw new Error('Tree keys must be non-empty strings or finite numbers.');
339
+ }
340
+ return key;
341
+ }
342
+ restore(keys = [], pages = {}) {
343
+ this.expanded.clear();
344
+ keys.forEach(key => this.expanded.add(key));
345
+ this.restoredPages = { ...pages };
346
+ }
347
+ snapshotPages() {
348
+ return Object.fromEntries([...this.pages].map(([key, page]) => [JSON.stringify(key), page]));
349
+ }
350
+ depth(row) { return this.entries.get(row)?.depth ?? 0; }
351
+ isMore(row) { return !!this.entries.get(row)?.more; }
352
+ moreParent(row) { return this.entries.get(row)?.parent; }
353
+ isExpanded(row) { return this.expanded.has(this.key(row)); }
354
+ isLoading(row) { return this.pending.has(this.key(row)); }
355
+ hasChildren(row) {
356
+ if (this.mode === 'all')
357
+ return !!this.children.get(this.key(row))?.length;
358
+ return row[this.options.hasItemsExpr] === true;
359
+ }
360
+ cancel() { this.version++; this.loading = false; this.pending.clear(); }
361
+ async load(page, pageSize, fetch) {
362
+ const version = ++this.version;
363
+ this.loading = true;
364
+ this.pending.clear();
365
+ this.nodes.clear();
366
+ this.children.clear();
367
+ this.totals.clear();
368
+ this.pages.clear();
369
+ this.visible = [];
370
+ this.page = page;
371
+ this.pageSize = pageSize;
372
+ try {
373
+ const response = await fetch({ roots: true, parentId: this.rootValue, loadMode: this.mode, page, pageSize });
374
+ if (version !== this.version)
375
+ return false;
376
+ this.insert(response.data);
377
+ this.page = response.page;
378
+ this.totalRecords = response.totalRecords;
379
+ this.totalRecordsNotFiltered = response.totalRecordsNotFiltered;
380
+ if (this.mode === 'all') {
381
+ this.buildAll();
382
+ this.page = Math.min(Math.max(0, page), Math.max(0, Math.ceil(this.allRoots.length / pageSize) - 1));
383
+ this.roots = this.allRoots.slice(this.page * pageSize, (this.page + 1) * pageSize);
384
+ }
385
+ else {
386
+ this.roots = response.data.map(row => this.key(row));
387
+ }
388
+ response.ancestorKeys?.forEach(key => this.expanded.add(key));
389
+ const queue = [...this.roots];
390
+ for (let cursor = 0; cursor < queue.length; cursor++) {
391
+ const key = queue[cursor];
392
+ const row = this.nodes.get(key);
393
+ if (!this.expanded.has(key) || !this.hasChildren(row))
394
+ continue;
395
+ if (this.mode !== 'all') {
396
+ await this.fetchChildren(key, 0, fetch, version);
397
+ const targetPage = this.restoredPages[JSON.stringify(key)] ?? 0;
398
+ while (version === this.version && this.mode === 'pagedChildren' &&
399
+ (this.pages.get(key) ?? 0) < targetPage && this.hasMore(key)) {
400
+ await this.fetchChildren(key, (this.pages.get(key) ?? 0) + 1, fetch, version);
401
+ }
402
+ }
403
+ if (version !== this.version)
404
+ return false;
405
+ queue.push(...(this.children.get(key) ?? []));
406
+ }
407
+ this.restoredPages = {};
408
+ this.rebuild();
409
+ return true;
410
+ }
411
+ finally {
412
+ if (version === this.version)
413
+ this.loading = false;
414
+ }
415
+ }
416
+ async toggle(row, fetch) {
417
+ const key = this.key(row);
418
+ if (this.pending.has(key))
419
+ return;
420
+ if (this.expanded.delete(key)) {
421
+ this.rebuild();
422
+ return;
423
+ }
424
+ this.expanded.add(key);
425
+ const version = this.version;
426
+ try {
427
+ const queue = [key];
428
+ for (let cursor = 0; cursor < queue.length; cursor++) {
429
+ const current = queue[cursor];
430
+ if (this.mode !== 'all' && !this.children.has(current))
431
+ await this.fetchChildren(current, 0, fetch, version);
432
+ if (version !== this.version)
433
+ return;
434
+ for (const child of this.children.get(current) ?? []) {
435
+ if (this.expanded.has(child) && this.hasChildren(this.nodes.get(child)))
436
+ queue.push(child);
437
+ }
438
+ }
439
+ this.rebuild();
440
+ }
441
+ catch (error) {
442
+ if (version === this.version)
443
+ this.expanded.delete(key);
444
+ throw error;
445
+ }
446
+ }
447
+ async loadMore(row, fetch) {
448
+ const parent = this.moreParent(row);
449
+ if (parent === undefined || this.pending.has(parent))
450
+ return;
451
+ const version = this.version;
452
+ await this.fetchChildren(parent, (this.pages.get(parent) ?? 0) + 1, fetch, version);
453
+ if (version === this.version)
454
+ this.rebuild();
455
+ }
456
+ insert(rows) {
457
+ const keys = new Set();
458
+ for (const row of rows) {
459
+ const key = this.key(row);
460
+ if (keys.has(key) || this.nodes.has(key))
461
+ throw new Error('Duplicate tree key.');
462
+ keys.add(key);
463
+ }
464
+ for (const row of rows)
465
+ this.nodes.set(this.key(row), row);
466
+ }
467
+ buildAll() {
468
+ this.allRoots = [];
469
+ for (const [key, row] of this.nodes) {
470
+ const parent = row[this.options.parentIdExpr];
471
+ if (parent === this.rootValue)
472
+ this.allRoots.push(key);
473
+ else {
474
+ if (!this.nodes.has(parent))
475
+ throw new Error('Missing tree parent.');
476
+ const siblings = this.children.get(parent) ?? [];
477
+ siblings.push(key);
478
+ this.children.set(parent, siblings);
479
+ }
480
+ }
481
+ const seen = new Set();
482
+ const queue = [...this.allRoots];
483
+ for (let cursor = 0; cursor < queue.length; cursor++) {
484
+ const key = queue[cursor];
485
+ if (seen.has(key))
486
+ throw new Error('Tree cycle.');
487
+ seen.add(key);
488
+ queue.push(...(this.children.get(key) ?? []));
489
+ }
490
+ if (seen.size !== this.nodes.size)
491
+ throw new Error('Tree cycle.');
492
+ }
493
+ async fetchChildren(key, page, fetch, version) {
494
+ this.pending.add(key);
495
+ try {
496
+ const response = await fetch({ roots: false, parentId: key, loadMode: this.mode, page, pageSize: this.pageSize });
497
+ if (version !== this.version)
498
+ return;
499
+ for (const row of response.data) {
500
+ if (row[this.options.parentIdExpr] !== key)
501
+ throw new Error('Unexpected tree parent.');
502
+ }
503
+ this.insert(response.data);
504
+ this.children.set(key, [...(this.children.get(key) ?? []), ...response.data.map(row => this.key(row))]);
505
+ this.totals.set(key, response.totalRecords);
506
+ this.pages.set(key, response.page);
507
+ response.ancestorKeys?.forEach(ancestor => this.expanded.add(ancestor));
508
+ }
509
+ finally {
510
+ if (version === this.version)
511
+ this.pending.delete(key);
512
+ }
513
+ }
514
+ hasMore(key) {
515
+ return (this.children.get(key)?.length ?? 0) < (this.totals.get(key) ?? 0);
516
+ }
517
+ rebuild() {
518
+ this.entries = new WeakMap();
519
+ const result = [];
520
+ const stack = this.roots.map(key => ({ row: this.nodes.get(key), depth: 0 })).reverse();
521
+ while (stack.length) {
522
+ const entry = stack.pop();
523
+ this.entries.set(entry.row, entry);
524
+ result.push(entry.row);
525
+ if (entry.more)
526
+ continue;
527
+ const key = this.key(entry.row);
528
+ if (!this.expanded.has(key))
529
+ continue;
530
+ if (this.hasMore(key))
531
+ stack.push({ row: {}, depth: entry.depth + 1, parent: key, more: true });
532
+ const children = this.children.get(key) ?? [];
533
+ for (let index = children.length - 1; index >= 0; index--) {
534
+ stack.push({ row: this.nodes.get(children[index]), depth: entry.depth + 1, parent: key });
535
+ }
536
+ }
537
+ this.visible = result;
538
+ }
539
+ }
540
+
541
+ /**
542
+ * Abstract service for handling HTTP requests for **ECS Primeng table**.
543
+ *
544
+ * Provides a consistent interface for making GET and POST requests to the backend.
545
+ * Implementations must define how requests are executed, including error handling,
546
+ * headers, and response processing.
547
+ */
548
+ class ECSPrimengTableHttpService {
549
+ }
550
+ ECSPrimengTableHttpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableHttpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
551
+ ECSPrimengTableHttpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableHttpService, providedIn: 'root' });
552
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableHttpService, decorators: [{
553
+ type: Injectable,
554
+ args: [{ providedIn: 'root' }]
555
+ }] });
556
+
557
+ /**
558
+ * Abstract service for handling notifications in **ECS Primeng table**.
559
+ *
560
+ * Provides a consistent interface for displaying and clearing toast notifications.
561
+ * Implementations must define how the notifications are managed.
562
+ */
563
+ class ECSPrimengTableNotificationService {
564
+ }
565
+ ECSPrimengTableNotificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
566
+ ECSPrimengTableNotificationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableNotificationService, providedIn: 'root' });
567
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableNotificationService, decorators: [{
568
+ type: Injectable,
569
+ args: [{ providedIn: 'root' }]
570
+ }] });
571
+
572
+ /**
573
+ * Provide on the parent COMPONENT containing the list and detail router outlet.
574
+ * Do not provide at application/root level or on the list component itself.
575
+ * Destroying that parent ends the scope and discards all its table states.
576
+ */
577
+ class ECSPrimengTableStateService {
578
+ constructor() {
579
+ this.states = new Map();
580
+ this.destroyed = false;
581
+ }
582
+ get(key) {
583
+ const state = this.states.get(key);
584
+ return state ? structuredClone(state) : undefined;
585
+ }
586
+ set(key, state) {
587
+ // Parent and child destruction order must not resurrect a discarded scope.
588
+ if (!this.destroyed)
589
+ this.states.set(key, structuredClone(state));
590
+ }
591
+ clear(key) {
592
+ if (key === undefined)
593
+ this.states.clear();
594
+ else
595
+ this.states.delete(key);
596
+ }
597
+ ngOnDestroy() {
598
+ this.destroyed = true;
599
+ this.clear();
600
+ }
601
+ }
602
+ ECSPrimengTableStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
603
+ ECSPrimengTableStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableStateService });
604
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableStateService, decorators: [{
605
+ type: Injectable
606
+ }] });
607
+
608
+ /** Translates UI text only; never changes column keys, data or persisted view names. */
609
+ class ECSPrimengTableI18nService {
610
+ constructor() {
611
+ this.translate = inject(TranslateService, { optional: true });
612
+ this.prime = inject(PrimeNGConfig, { optional: true });
613
+ this.destroy$ = new Subject();
614
+ this.parser = new TranslateDefaultParser();
615
+ this.connected = false;
616
+ this.appliedPrimeTranslations = false;
617
+ this.changes = this.translate
618
+ ? merge(this.translate.onLangChange, this.translate.onTranslationChange, this.translate.onDefaultLangChange)
619
+ : EMPTY;
620
+ }
621
+ text(key, params) {
622
+ if (!key)
623
+ return '';
624
+ const value = this.translate?.instant(key, params);
625
+ // Literal English keys also serve as defaults, including interpolated counters.
626
+ if (typeof value === 'string' && value !== key)
627
+ return value;
628
+ return this.parser.interpolate(key, params) ?? key;
629
+ }
630
+ /** Optional dictionary section "primeng" configures the application's shared PrimeNG locale. */
631
+ connectPrimeNG() {
632
+ if (this.connected || !this.prime || !this.translate)
633
+ return;
634
+ this.connected = true;
635
+ this.primeDefaults = Object.fromEntries([...Object.values(TranslationKeys), 'dateFormat', 'aria'].map(key => [key, structuredClone(this.prime.getTranslation(key))]));
636
+ this.syncPrimeNG();
637
+ this.changes.pipe(takeUntil(this.destroy$)).subscribe(() => this.syncPrimeNG());
638
+ }
639
+ ngOnDestroy() {
640
+ this.destroy$.next();
641
+ this.destroy$.complete();
642
+ }
643
+ syncPrimeNG() {
644
+ const value = this.translate.instant('primeng');
645
+ const defined = value && typeof value === 'object' && !Array.isArray(value);
646
+ if (!defined && !this.appliedPrimeTranslations)
647
+ return;
648
+ const defaults = this.primeDefaults;
649
+ const overrides = defined ? value : {};
650
+ this.prime.setTranslation({
651
+ ...defaults, ...overrides,
652
+ aria: { ...defaults['aria'], ...overrides['aria'] }
653
+ });
654
+ this.appliedPrimeTranslations = !!defined;
655
+ }
656
+ }
657
+ ECSPrimengTableI18nService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableI18nService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
658
+ ECSPrimengTableI18nService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableI18nService, providedIn: 'root' });
659
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableI18nService, decorators: [{
660
+ type: Injectable,
661
+ args: [{ providedIn: 'root' }]
662
+ }] });
663
+
664
+ /** Supports English defaults and live dictionary updates without mutating the source value. */
665
+ class ECSTableTranslatePipe {
666
+ constructor(i18n, changeDetector) {
667
+ this.i18n = i18n;
668
+ this.subscription = i18n.changes.subscribe(() => changeDetector.markForCheck());
669
+ }
670
+ transform(key, params) {
671
+ return this.i18n.text(key, params);
672
+ }
673
+ ngOnDestroy() { this.subscription.unsubscribe(); }
674
+ }
675
+ ECSTableTranslatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSTableTranslatePipe, deps: [{ token: ECSPrimengTableI18nService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe });
676
+ ECSTableTranslatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: ECSTableTranslatePipe, isStandalone: true, name: "ecsTranslate", pure: false });
677
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSTableTranslatePipe, decorators: [{
678
+ type: Pipe,
679
+ args: [{ name: 'ecsTranslate', standalone: true, pure: false }]
680
+ }], ctorParameters: function () { return [{ type: ECSPrimengTableI18nService }, { type: i0.ChangeDetectorRef }]; } });
681
+
682
+ /**
683
+ * Converts a `DataAlignHorizontal` enum value to its corresponding CSS text alignment string.
684
+ *
685
+ * @param dataAlignHorizontal - The horizontal alignment enum value.
686
+ * @returns The CSS text alignment string ('left', 'center', or 'right').
687
+ *
688
+ * @remarks
689
+ * If an unknown value is provided, the function defaults to 'center'.
690
+ */
691
+ function dataAlignHorizontalAsText(dataAlignHorizontal) {
692
+ switch (dataAlignHorizontal) {
693
+ case DataAlignHorizontal.Left:
694
+ return 'left';
695
+ case DataAlignHorizontal.Center:
696
+ return 'center';
697
+ case DataAlignHorizontal.Right:
698
+ return 'right';
699
+ default:
700
+ return 'center';
701
+ }
702
+ }
703
+
704
+ /**
705
+ * Converts a `DataAlignVertical` enum value to its corresponding CSS vertical alignment string.
706
+ *
707
+ * @param dataAlignVertical - The vertical alignment enum value.
708
+ * @returns The CSS vertical alignment string ('top', 'middle', or 'bottom').
709
+ *
710
+ * @remarks
711
+ * If an unknown value is provided, the function defaults to 'middle'.
712
+ */
713
+ function dataAlignVerticalAsText(dataAlignVertical) {
714
+ switch (dataAlignVertical) {
715
+ case DataAlignVertical.Top:
716
+ return 'top';
717
+ case DataAlignVertical.Middle:
718
+ return 'middle';
719
+ case DataAlignVertical.Bottom:
720
+ return 'bottom';
721
+ default:
722
+ return 'middle';
723
+ }
724
+ }
725
+
726
+ /**
727
+ * Converts a `DataType` enum value to its corresponding string representation.
728
+ *
729
+ * @param dataType - The data type enum value.
730
+ * @returns The string representation of the data type ('text', 'numeric', 'boolean', or 'date').
731
+ *
732
+ * @remarks
733
+ * If an unknown value is provided, the function defaults to 'text'.
734
+ */
735
+ function dataTypeAsText(dataType) {
736
+ switch (dataType) {
737
+ case DataType.Text:
738
+ return 'text';
739
+ case DataType.Numeric:
740
+ return 'numeric';
741
+ case DataType.Boolean:
742
+ return 'boolean';
743
+ case DataType.Date:
744
+ return 'date';
745
+ default:
746
+ return 'text';
747
+ }
748
+ }
749
+
750
+ /**
751
+ * Converts a `FrozenColumnAlign` enum value to its corresponding CSS alignment string.
752
+ *
753
+ * @param frozenColumnAlign - The frozen column alignment enum value.
754
+ * @returns The CSS alignment string ('left' or 'right').
755
+ *
756
+ * @remarks
757
+ * If an unknown value is provided, the function defaults to 'left'.
758
+ */
759
+ function frozenColumnAlignAsText(frozenColumnAlign) {
760
+ switch (frozenColumnAlign) {
761
+ case FrozenColumnAlign.Left:
762
+ return 'left';
763
+ case FrozenColumnAlign.Right:
764
+ return 'right';
765
+ default:
766
+ return 'left';
767
+ }
768
+ }
769
+
770
+ /**
771
+ * Generates sanitized HTML (`SafeHtml`) with highlighted text based on a global search term.
772
+ *
773
+ * @remarks
774
+ * This utility safely creates HTML content where occurrences of the provided global search text
775
+ * within the cell value are wrapped in a `<span class="highlighted-text">` tag for visual emphasis.
776
+ * If the cell does not match the search text or is of type `Boolean`, the original value is returned as safe HTML.
777
+ *
778
+ * @param {any} cellValue - The cell's value that may contain the text to highlight.
779
+ * @param {IColumnMetadata} colMetadata - Metadata configuration of the column that defines its data type and filtering behavior.
780
+ * @param {string | null} globalSearchText - The search text to highlight if found within the cell's content.
781
+ * @param {DomSanitizer} sanitizer - Angular's sanitizer used to safely produce trusted HTML content.
782
+ * @returns {SafeHtml} A `SafeHtml` instance containing highlighted HTML when a match is found, or the original sanitized text otherwise.
783
+ */
784
+ function highlightText(cellValue, colMetadata, globalSearchText, sanitizer) {
785
+ if (colMetadata.dataType !== DataType.Boolean && globalSearchText !== null) { // Check if the column data type is not boolean and global search text is not null
786
+ const valueToUse = String(cellValue); // Convert cell value to string
787
+ if (colMetadata.canBeGlobalFiltered) { // Check if the column can be globally filtered
788
+ const searchLowerCase = globalSearchText.toUpperCase(); // Convert global search text to uppercase for case-insensitive comparison
789
+ const cellValueLowerCase = valueToUse.toUpperCase(); // Convert cell value to uppercase for case-insensitive comparison
790
+ if (cellValueLowerCase.includes(searchLowerCase)) { // Check if the cell value contains the search text
791
+ // Determine the start and end indices of the search text within the cell value
792
+ const startIndex = cellValueLowerCase.indexOf(searchLowerCase);
793
+ const endIndex = startIndex + globalSearchText.length;
794
+ // Extract the prefix, highlight, and suffix of the cell value
795
+ const prefix = valueToUse.substring(0, startIndex);
796
+ const highlight = valueToUse.substring(startIndex, endIndex);
797
+ const suffix = valueToUse.substring(endIndex);
798
+ return sanitizer.bypassSecurityTrustHtml(`${prefix}<span class="highlighted-text">${highlight}</span>${suffix}`); // Construct SafeHtml with highlighted text using the <mark> element
799
+ }
800
+ }
801
+ }
802
+ return sanitizer.bypassSecurityTrustHtml(String(cellValue)); // Return the original cell value if it doesn't meet the highlighting conditions
803
+ }
804
+
805
+ class ECSPrimengTableService {
806
+ constructor(http, notification) {
807
+ this.http = http;
808
+ this.notification = notification;
809
+ this.i18n = inject(ECSPrimengTableI18nService);
810
+ }
811
+ fetchTableConfiguration(url) {
812
+ return this.http.handleHttpGetRequest(url);
813
+ }
814
+ fetchTableData(url, postData) {
815
+ return this.http.handleHttpPostRequest(url, postData);
816
+ }
817
+ fetchExcelReport(url, postData) {
818
+ let httpOptions = new HttpHeaders({
819
+ 'accept': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
820
+ 'Content-Type': 'application/json'
821
+ });
822
+ return this.http.handleHttpPostRequest(url, postData, httpOptions, "blob");
823
+ }
824
+ getIconBlob(url) {
825
+ return this.http.handleHttpGetRequest(url, "blob");
826
+ }
827
+ downloadFile(data, fileName, contentType) {
828
+ const blob = new Blob([data], { type: contentType });
829
+ const url = window.URL.createObjectURL(blob);
830
+ const link = document.createElement('a');
831
+ link.href = url;
832
+ link.download = fileName;
833
+ link.click();
834
+ window.URL.revokeObjectURL(url);
835
+ }
836
+ handleTableError(error, customTitle = 'Data Loading Error') {
837
+ const message = error.message || 'Unknown error occurred';
838
+ this.notification.showToast('error', this.i18n.text(customTitle), this.i18n.text(message));
839
+ }
840
+ orderColumnsWithFrozens(colsToOrder) {
841
+ const frozenLeftColumns = colsToOrder.filter(col => col.frozenColumnAlign === FrozenColumnAlign.Left);
842
+ const frozenRightColumns = colsToOrder.filter(col => col.frozenColumnAlign === FrozenColumnAlign.Right);
843
+ const nonFrozenColumns = colsToOrder.filter(col => col.frozenColumnAlign === FrozenColumnAlign.Noone);
844
+ return [...frozenLeftColumns, ...nonFrozenColumns, ...frozenRightColumns];
845
+ }
846
+ /**
847
+ * Handles click events on action buttons in a row of data.
848
+ *
849
+ * @param {function} action - The action function to be executed when the button is clicked. It should accept one parameter, which is the row data.
850
+ * @param {any} [rowData=null] - The data of the row corresponding to the clicked button. Defaults to null.
851
+ *
852
+ * @returns {void}
853
+ *
854
+ * @example
855
+ * // Define an action for a button
856
+ * const deleteAction = (rowData) => {
857
+ * console.log(`Delete row with id: ${rowData.rowID}`);
858
+ * };
859
+ *
860
+ * // Use handleButtonsClick with row data
861
+ * handleButtonsClick(deleteAction, { rowID: 1, name: 'John Doe' });
862
+ */
863
+ handleButtonsClick(action, rowData = null) {
864
+ if (action) { // If the button has an assigned action
865
+ action(rowData); // Perform the action
866
+ }
867
+ }
868
+ handlePredefinedFilterClick(action, rowData = null, option) {
869
+ if (action) { // If the button has an assigned action
870
+ action(rowData, option); // Perform the action
871
+ }
872
+ }
873
+ getColumnStyle(col, headerCols = false) {
874
+ let styles = {};
875
+ if (!headerCols) {
876
+ switch (col.cellOverflowBehaviour) {
877
+ case CellOverflowBehaviour.Wrap:
878
+ styles['white-space'] = 'normal';
879
+ styles['word-wrap'] = 'break-word';
880
+ styles['word-break'] = 'break-all';
881
+ styles['overflow'] = 'hidden';
882
+ break;
883
+ /*case CellOverflowBehaviour.Ellipsis:
884
+ styles['white-space'] = 'nowrap';
885
+ styles['overflow'] = 'hidden';
886
+ styles['text-overflow'] = 'ellipsis';
887
+ styles['width'] = '100%';
888
+ styles['min-width'] = '100%';
889
+ styles['max-width'] = '100%';
890
+ break;*/
891
+ /*
892
+ display: block;
893
+ width: 100%;
894
+ text-align: center;
895
+ */
896
+ case CellOverflowBehaviour.Hidden:
897
+ default:
898
+ styles['white-space'] = 'nowrap';
899
+ break;
900
+ }
901
+ }
902
+ if (col.initialWidth > 0) {
903
+ const width = `${col.initialWidth}px`;
904
+ styles['width'] = width;
905
+ styles['min-width'] = width;
906
+ styles['max-width'] = width;
907
+ }
908
+ return styles;
909
+ /*let styles: Record<string, string> = {};
910
+ if(!headerCols){
911
+ styles = {
912
+ 'white-space': col.cellOverflowBehaviour === CellOverflowBehaviour.Wrap ? 'normal' : 'nowrap',
913
+ 'word-wrap': col.cellOverflowBehaviour === CellOverflowBehaviour.Wrap ? 'break-word' : 'normal',
914
+ 'word-break': col.cellOverflowBehaviour === CellOverflowBehaviour.Wrap ? 'break-all' : 'normal'
915
+ };
916
+ }
917
+ if (col.initialWidth > 0) {
918
+ styles['max-width'] = col.initialWidth + 'px';
919
+ styles['min-width'] = col.initialWidth + 'px';
920
+ styles['width'] = col.initialWidth + 'px';
921
+ }
922
+ return styles;*/
923
+ }
924
+ fetchTableViews(tableViewSaveAs, recoverListEndpoint, tableViewSaveKey) {
925
+ let tableViewList = [];
926
+ let tableViewNotParsed = null;
927
+ if (tableViewSaveKey !== "" && tableViewSaveKey !== '') {
928
+ switch (tableViewSaveAs) {
929
+ case TableViewSaveMode.None:
930
+ tableViewNotParsed = null;
931
+ break;
932
+ case TableViewSaveMode.SessionStorage:
933
+ tableViewNotParsed = sessionStorage.getItem(tableViewSaveKey);
934
+ break;
935
+ case TableViewSaveMode.LocalStorage:
936
+ tableViewNotParsed = localStorage.getItem(tableViewSaveKey);
937
+ break;
938
+ case TableViewSaveMode.DatabaseStorage:
939
+ const postData = {
940
+ tableViewSaveKey: tableViewSaveKey
941
+ };
942
+ return this.http.handleHttpPostRequest(recoverListEndpoint, postData);
943
+ default:
944
+ this.notification.showToast("error", this.i18n.text("SAVE VIEW TYPE DOES NOT EXIST"), this.i18n.text("This type of save view does not exist."));
945
+ }
946
+ }
947
+ tableViewList = tableViewNotParsed ? JSON.parse(tableViewNotParsed) : [];
948
+ this.sortViews(tableViewList);
949
+ return tableViewList;
950
+ }
951
+ sortViews(tableSaveViewList) {
952
+ tableSaveViewList.sort((a, b) => a.viewAlias.toLowerCase().localeCompare(b.viewAlias.toLowerCase()));
953
+ }
954
+ updateViewsMenuItems(tableSaveViewList) {
955
+ return tableSaveViewList.map(item => ({
956
+ label: item.viewAlias,
957
+ lastActive: item.lastActive
958
+ }));
959
+ }
960
+ viewsSaveToDatabase(tableSaveViewList, setListEndpoint, tableViewSaveKey) {
961
+ const serializedSaveViews = tableSaveViewList.map(view => ({
962
+ viewAlias: view.viewAlias,
963
+ viewData: JSON.stringify(view.viewData),
964
+ lastActive: view.lastActive
965
+ }));
966
+ const postData = {
967
+ tableViewSaveKey: tableViewSaveKey,
968
+ views: serializedSaveViews
969
+ };
970
+ return this.http.handleHttpPostRequest(setListEndpoint, postData);
971
+ }
972
+ fetchSelectionKeys(endpoint, request) {
973
+ return this.http.handleHttpPostRequest(endpoint, request);
974
+ }
975
+ viewGenerateData(dt, globalSearchText, currentPage, currentRowsPerPage, modifyFiltersFn) {
976
+ let colsWidth = this.computeColumnWidths(dt);
977
+ let tableWidth = this.computeTableWidth(dt);
978
+ const filtersWithoutGlobalAndSelectedRows = { ...modifyFiltersFn(JSON.parse(JSON.stringify(dt.filters))) };
979
+ if (filtersWithoutGlobalAndSelectedRows['rowID']) {
980
+ filtersWithoutGlobalAndSelectedRows['rowID'][0].value = null;
981
+ }
982
+ if (filtersWithoutGlobalAndSelectedRows['selector']) {
983
+ filtersWithoutGlobalAndSelectedRows['selector'][0].value = null;
984
+ }
985
+ const tableView = {
986
+ columnsShown: [...dt.columns],
987
+ multiSortMeta: dt.multiSortMeta,
988
+ filters: { ...filtersWithoutGlobalAndSelectedRows },
989
+ globalSearchText: globalSearchText,
990
+ currentPage: currentPage,
991
+ currentRowsPerPage: currentRowsPerPage,
992
+ tableWidth: tableWidth,
993
+ columnsWidth: colsWidth
994
+ };
995
+ return tableView;
996
+ }
997
+ computeColumnWidths(dt) {
998
+ let widths = [];
999
+ const headers = dt.el.nativeElement.querySelectorAll('.p-datatable-thead > tr > th');
1000
+ headers.forEach((header) => widths.push(DomHandler.getOuterWidth(header)));
1001
+ return widths.join(',');
1002
+ }
1003
+ computeTableWidth(dt) {
1004
+ let tableWidth = 0;
1005
+ if (dt.columnResizeMode === 'expand') {
1006
+ tableWidth = DomHandler.getOuterWidth(dt.tableViewChild?.nativeElement);
1007
+ }
1008
+ return tableWidth;
1009
+ }
1010
+ }
1011
+ ECSPrimengTableService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableService, deps: [{ token: ECSPrimengTableHttpService }, { token: ECSPrimengTableNotificationService }], target: i0.ɵɵFactoryTarget.Injectable });
1012
+ ECSPrimengTableService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableService, providedIn: 'root' });
1013
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTableService, decorators: [{
1014
+ type: Injectable,
1015
+ args: [{
1016
+ providedIn: 'root'
1017
+ }]
1018
+ }], ctorParameters: function () { return [{ type: ECSPrimengTableHttpService }, { type: ECSPrimengTableNotificationService }]; } });
1019
+
1020
+ class TablePredefinedFilters {
1021
+ constructor(sanitizer, tableService) {
1022
+ this.sanitizer = sanitizer;
1023
+ this.tableService = tableService;
1024
+ this.selectable = false;
1025
+ }
1026
+ /**
1027
+ * Converts a blob from the database to a safe URL that can be used to display an image.
1028
+ *
1029
+ * This function takes a `Blob` object, converts it to a base64 encoded string, and returns a `SafeUrl`
1030
+ * that can be used in an HTML template to display the image securely. The `SafeUrl` ensures that
1031
+ * Angular's security mechanisms are bypassed correctly, preventing potential security risks.
1032
+ *
1033
+ * @param {Blob} blob - The blob object representing the image data from the database.
1034
+ * @returns {SafeUrl} A safe URL that can be used to display the image in an HTML template.
1035
+ *
1036
+ * @example
1037
+ * // Example usage in a component
1038
+ * const imageBlob = new Blob([binaryData], { type: 'image/jpeg' });
1039
+ * const imageUrl = this.getBlobIconAsUrl(imageBlob);
1040
+ *
1041
+ * // In your HTML template
1042
+ * <img [src]="imageUrl" alt="Image">
1043
+ */
1044
+ getBlobIconAsUrl(blob) {
1045
+ let objectURL = `data:image/jpeg;base64,${blob}`; // Create a base64 encoded string from the blob data
1046
+ return this.sanitizer.bypassSecurityTrustUrl(objectURL); // Bypass Angular's security mechanisms to create a SafeUrl
1047
+ }
1048
+ handleClick() {
1049
+ if (this.option.action) {
1050
+ this.tableService.handlePredefinedFilterClick(this.option.action, this.rowData, this.option);
1051
+ }
1052
+ }
1053
+ getTagStyle(option) {
1054
+ return {
1055
+ ...option.tagStyle,
1056
+ 'vertical-align': 'middle',
1057
+ 'gap': 0
1058
+ };
1059
+ }
1060
+ getImageSkeletonStyle(width, height, isSkeleton = false) {
1061
+ const finalHeight = height && height > 0 ? `${height}px` : '22px'; // Compute final height; use default if invalid
1062
+ let finalWidth;
1063
+ if (width && width > 0) { // If width is valid, use it
1064
+ finalWidth = `${width}px`;
1065
+ }
1066
+ else if (isSkeleton) { // If it's a skeleton and width is not provided, mirror the height
1067
+ finalWidth = finalHeight;
1068
+ }
1069
+ const style = {
1070
+ 'vertical-align': 'middle',
1071
+ 'height': finalHeight
1072
+ };
1073
+ if (finalWidth) { // Add width if available
1074
+ style['width'] = finalWidth;
1075
+ }
1076
+ return style;
1077
+ }
1078
+ highlightText(cellValue, colMetadata, globalSearchText) {
1079
+ return highlightText(cellValue, colMetadata, globalSearchText ?? null, this.sanitizer);
1080
+ }
1081
+ }
1082
+ TablePredefinedFilters.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TablePredefinedFilters, deps: [{ token: i1.DomSanitizer }, { token: ECSPrimengTableService }], target: i0.ɵɵFactoryTarget.Component });
1083
+ TablePredefinedFilters.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TablePredefinedFilters, isStandalone: true, selector: "ecs-table-predefined-filters", inputs: { option: "option", col: "col", selectable: "selectable", rowData: "rowData", globalSearchText: "globalSearchText" }, ngImport: i0, template: "<div style=\"display: flex; align-items: center; gap: 0.5rem;\"\r\n [style.cursor]=\"(selectable && option?.action) ? 'pointer' : 'default'\"\r\n [attr.role]=\"selectable && option?.action ? 'button' : null\"\r\n (click)=\"handleClick(); selectable && option?.action && $event.stopPropagation();\">\r\n <ng-container *ngIf=\"option?.icon\">\r\n <i [class]=\"option.icon\" [style]=\"'vertical-align: middle; color: '+(option.iconColor || '') +';' +(option.iconStyle || '')\"></i>\r\n </ng-container>\r\n <ng-container *ngIf=\"!option?.imageBlob && option?.imageBlobSourceEndpoint\"> <!-- If a blob image needs to be loaded from endpoint, while it's still loading, show skeleton -->\r\n <p-skeleton [style]=\"getImageSkeletonStyle(option.imageWidth, option.imageHeight, true)\"></p-skeleton>\r\n </ng-container>\r\n <ng-container *ngIf=\"option?.imageBlob\">\r\n <img alt=\"image\" [src]=\"getBlobIconAsUrl(option.imageBlob)\" [style]=\"getImageSkeletonStyle(option.imageWidth, option.imageHeight)\"/>\r\n </ng-container>\r\n <ng-container *ngIf=\"option?.imageURL\">\r\n <img alt=\"iconFromURL\" [src]=\"option.imageURL\" [style]=\"getImageSkeletonStyle(option.imageWidth, option.imageHeight)\"/>\r\n </ng-container>\r\n <ng-container *ngIf=\"option?.displayTag === true\">\r\n <p-tag [innerHtml]=\"highlightText(option.name, col, globalSearchText)\" [style]=\"getTagStyle(option)\" [value]=\"option.name\"></p-tag>\r\n </ng-container>\r\n <ng-container *ngIf=\"option?.displayName === true\">\r\n <span style=\"gap: 0;\" [innerHtml]=\"highlightText(option.name, col, globalSearchText)\" [ngStyle]=\"option.nameStyle || {}\">{{ option.name }}</span>\r\n </ng-container>\r\n</div>", dependencies: [{ kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i3.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i4.Tag, selector: "p-tag", inputs: ["styleClass", "style", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
1084
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TablePredefinedFilters, decorators: [{
1085
+ type: Component,
1086
+ args: [{ selector: 'ecs-table-predefined-filters', imports: [
1087
+ SkeletonModule,
1088
+ TagModule,
1089
+ CommonModule
1090
+ ], standalone: true, template: "<div style=\"display: flex; align-items: center; gap: 0.5rem;\"\r\n [style.cursor]=\"(selectable && option?.action) ? 'pointer' : 'default'\"\r\n [attr.role]=\"selectable && option?.action ? 'button' : null\"\r\n (click)=\"handleClick(); selectable && option?.action && $event.stopPropagation();\">\r\n <ng-container *ngIf=\"option?.icon\">\r\n <i [class]=\"option.icon\" [style]=\"'vertical-align: middle; color: '+(option.iconColor || '') +';' +(option.iconStyle || '')\"></i>\r\n </ng-container>\r\n <ng-container *ngIf=\"!option?.imageBlob && option?.imageBlobSourceEndpoint\"> <!-- If a blob image needs to be loaded from endpoint, while it's still loading, show skeleton -->\r\n <p-skeleton [style]=\"getImageSkeletonStyle(option.imageWidth, option.imageHeight, true)\"></p-skeleton>\r\n </ng-container>\r\n <ng-container *ngIf=\"option?.imageBlob\">\r\n <img alt=\"image\" [src]=\"getBlobIconAsUrl(option.imageBlob)\" [style]=\"getImageSkeletonStyle(option.imageWidth, option.imageHeight)\"/>\r\n </ng-container>\r\n <ng-container *ngIf=\"option?.imageURL\">\r\n <img alt=\"iconFromURL\" [src]=\"option.imageURL\" [style]=\"getImageSkeletonStyle(option.imageWidth, option.imageHeight)\"/>\r\n </ng-container>\r\n <ng-container *ngIf=\"option?.displayTag === true\">\r\n <p-tag [innerHtml]=\"highlightText(option.name, col, globalSearchText)\" [style]=\"getTagStyle(option)\" [value]=\"option.name\"></p-tag>\r\n </ng-container>\r\n <ng-container *ngIf=\"option?.displayName === true\">\r\n <span style=\"gap: 0;\" [innerHtml]=\"highlightText(option.name, col, globalSearchText)\" [ngStyle]=\"option.nameStyle || {}\">{{ option.name }}</span>\r\n </ng-container>\r\n</div>" }]
1091
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }, { type: ECSPrimengTableService }]; }, propDecorators: { option: [{
1092
+ type: Input
1093
+ }], col: [{
1094
+ type: Input
1095
+ }], selectable: [{
1096
+ type: Input
1097
+ }], rowData: [{
1098
+ type: Input
1099
+ }], globalSearchText: [{
1100
+ type: Input
1101
+ }] } });
1102
+
1103
+ class TableCell {
1104
+ constructor(datePipe, sanitizer) {
1105
+ this.datePipe = datePipe;
1106
+ this.sanitizer = sanitizer;
1107
+ this.globalSearchText = null;
1108
+ this.predefinedFiltersCollection = {}; // Contains a collection of the values that need to be shown for predefined column filters
1109
+ this.dateFormat = "dd-MMM-yyyy HH:mm:ss zzzz";
1110
+ this.dateTimezone = "+00:00";
1111
+ this.dateCulture = "en-US";
1112
+ this.DataType = DataType;
1113
+ this.CellDisplay = CellDisplay;
1114
+ }
1115
+ /** Only finite numbers are valid; do not turn empty strings or booleans into progress. */
1116
+ get hasProgressValue() {
1117
+ return typeof this.value === 'number' && Number.isFinite(this.value);
1118
+ }
1119
+ get progressValue() {
1120
+ return Math.min(100, Math.max(0, this.value));
1121
+ }
1122
+ get progressTooltip() {
1123
+ return this.col.dataTooltipCustomColumnSource ? this.tooltipText : `${this.value} %`;
1124
+ }
1125
+ get value() {
1126
+ return this.rowData[this.col.field];
1127
+ }
1128
+ get tooltipText() {
1129
+ if (this.col.dataTooltipCustomColumnSource && this.col.dataTooltipCustomColumnSource.length > 0) {
1130
+ return this.rowData[this.col.dataTooltipCustomColumnSource];
1131
+ }
1132
+ return this.value;
1133
+ }
1134
+ getListValues(col, rowData) {
1135
+ const value = rowData[col.field];
1136
+ return value ? value.split(';').map((v) => v.trim()) : [];
1137
+ }
1138
+ /** List tooltips use the same semicolon-separated positions as the displayed list. */
1139
+ getListTooltip(item, index) {
1140
+ const source = this.col.dataTooltipCustomColumnSource;
1141
+ const tooltips = source ? this.rowData[source] : null;
1142
+ if (typeof tooltips !== 'string')
1143
+ return item;
1144
+ // Preserve empty entries so subsequent tooltips never move to another item.
1145
+ return tooltips.split(';')[index]?.trim() ?? item;
1146
+ }
1147
+ getDataAlignHorizontalAsText(dataAlignHorizontal) {
1148
+ dataAlignHorizontalAsText(dataAlignHorizontal);
1149
+ }
1150
+ getDataAlignVerticalAsText(dataAlignVertical) {
1151
+ dataAlignVerticalAsText(dataAlignVertical);
1152
+ }
1153
+ /**
1154
+ * Formats a date value using either column-level overrides or global settings.
1155
+ * The incoming value is assumed to represent a UTC date.
1156
+ *
1157
+ * @param {any} value - The date value to be formatted.
1158
+ * @param {string | null} dateFormat - Optional column-level override for the date format.
1159
+ * @param {string | null} dateTimezone - Optional column-level override for the timezone used in formatting.
1160
+ * @param {string | null} dateCulture - Optional column-level override for the culture used in formatting.
1161
+ *
1162
+ * @returns {string} - The formatted date string using the effective (column or global) settings,
1163
+ * or an empty string if the value is invalid or undefined.
1164
+ *
1165
+ * @example
1166
+ * // Example using only global settings:
1167
+ * const result = formatDate(dateValue, null, null, null);
1168
+ *
1169
+ * @example
1170
+ * // Example using column-level overrides:
1171
+ * const result = formatDate(dateValue, 'dd/MM/yyyy', 'UTC', 'en-GB');
1172
+ */
1173
+ formatDate(value, dateFormat, dateTimezone, dateCulture) {
1174
+ if (!value) { // If no value, return empty
1175
+ return '';
1176
+ }
1177
+ let formattedDate = undefined; // By default, formattedDate will be undefined
1178
+ const effectiveFormat = dateFormat ?? this.dateFormat;
1179
+ const effectiveTimezone = dateTimezone ?? this.dateTimezone;
1180
+ const effectiveCulture = dateCulture ?? this.dateCulture;
1181
+ if (value) { // If value is not undefined
1182
+ let dateToParse = value;
1183
+ if (typeof value === 'string' && !value.endsWith('Z') && !/[+-]\d{2}:\d{2}$/.test(value)) { // Check if the date does not contain Z
1184
+ dateToParse += 'Z';
1185
+ }
1186
+ const dateUtc = new Date(dateToParse);
1187
+ if (!isNaN(dateUtc.getTime())) { // Check that the date is valid before performing transformation
1188
+ formattedDate = this.datePipe.transform(dateUtc, effectiveFormat, effectiveTimezone, effectiveCulture); // Perform the date masking
1189
+ }
1190
+ }
1191
+ return formattedDate ?? ''; // Returns the date formatted, or as empty string if an issue was found (or value was undefined).
1192
+ }
1193
+ getPredefinedFilterTooltip(colMetadata, value) {
1194
+ if (colMetadata.dataType == DataType.List) {
1195
+ return value;
1196
+ }
1197
+ if (colMetadata.filterPredefinedValuesName && colMetadata.filterPredefinedValuesName.length > 0) {
1198
+ const options = this.getPredefinedFilterValues(colMetadata.filterPredefinedValuesName);
1199
+ return options.find(x => x.value == value)?.name;
1200
+ }
1201
+ return null;
1202
+ }
1203
+ /**
1204
+ * Checks if the provided column metadata matches a specific style of the predefined filters
1205
+ * that need to be applied to an item on a row.
1206
+ *
1207
+ * @param {IprimengColumnsMetadata} colMetadata - The metadata of the column being checked.
1208
+ * @param {any} value - The value to be matched against the predefined filter values.
1209
+ * @returns {any} The matching predefined filter value if found, otherwise null.
1210
+ */
1211
+ getPredfinedFilterMatch(colMetadata, value) {
1212
+ if (colMetadata.filterPredefinedValuesName && colMetadata.filterPredefinedValuesName.length > 0) { // Check if the column uses predefined filter values
1213
+ const options = this.getPredefinedFilterValues(colMetadata.filterPredefinedValuesName); // Get the predefined filter values based on the name
1214
+ return options.find(option => option.value === value); // Return the matching option if found
1215
+ }
1216
+ return null; // Return null if the column does not use predefined filter values
1217
+ }
1218
+ getPredefinedFilterValues(columnKeyName) {
1219
+ return this.predefinedFiltersCollection?.[columnKeyName] || []; // Return the predefined filter values or an empty array if the option name does not exist
1220
+ }
1221
+ highlightText(cellValue, colMetadata, globalSearchText) {
1222
+ return highlightText(cellValue, colMetadata, globalSearchText, this.sanitizer);
1223
+ }
1224
+ ecsTrack6(index, item) { return index; }
1225
+ ecsTrack7(index, item) { return index; }
1226
+ }
1227
+ TableCell.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TableCell, deps: [{ token: i1$1.DatePipe }, { token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
1228
+ TableCell.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TableCell, isStandalone: true, selector: "ecs-table-cell", inputs: { col: "col", rowData: "rowData", globalSearchText: "globalSearchText", predefinedFiltersCollection: "predefinedFiltersCollection", dateFormat: "dateFormat", dateTimezone: "dateTimezone", dateCulture: "dateCulture" }, ngImport: i0, template: "<ng-container *ngIf=\"value !== null && value !== undefined\">\r\n <ng-container *ngIf=\"col.dataType === DataType.Numeric && col.cellDisplay === CellDisplay.ProgressBar; else ecsElse6\">\r\n <ng-container *ngIf=\"hasProgressValue\">\r\n <div class=\"ecs-progress-cell\"\r\n [pTooltip]=\"progressTooltip\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"200\" tooltipPosition=\"top\">\r\n <div class=\"ecs-progress-bar\" role=\"progressbar\"\r\n [attr.aria-label]=\"col.header\"\r\n aria-valuemin=\"0\" aria-valuemax=\"100\"\r\n [attr.aria-valuenow]=\"progressValue\"\r\n [attr.aria-valuetext]=\"value + ' %'\">\r\n <div class=\"ecs-progress-bar-fill\" [style.width.%]=\"progressValue\"></div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container><ng-template #ecsElse6><ng-container *ngIf=\"col.filterPredefinedValuesName && col.filterPredefinedValuesName.length > 0; else ecsElse7\">\r\n <div [ngStyle]=\"{\r\n 'justify-content': getDataAlignHorizontalAsText(col.dataAlignHorizontal),\r\n 'align-items': getDataAlignVerticalAsText(col.dataAlignVertical)\r\n }\">\r\n <ng-container *ngIf=\"col.dataType === DataType.List; else ecsElse8\">\r\n <ng-container *ngFor=\"let item of getListValues(col, rowData); trackBy: ecsTrack6; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <ng-container *ngIf=\"getPredfinedFilterMatch(col, item) as option\">\r\n <div style=\"display: inline-block; margin-right: 0.5rem;\"\r\n [pTooltip]=\"getListTooltip(item, $index)\"\r\n [escape]=\"false\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\">\r\n <ecs-table-predefined-filters [option]=\"option\" [col]=\"col\" [selectable]=\"true\" [rowData]=\"rowData\" [globalSearchText]=\"globalSearchText\"></ecs-table-predefined-filters>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container><ng-template #ecsElse8>\r\n <ng-container *ngIf=\"getPredfinedFilterMatch(col, value) as option\">\r\n <div style=\"display: inline-block;\"\r\n [pTooltip]=\"col.dataTooltipCustomColumnSource && col.dataTooltipCustomColumnSource.length > 0 \r\n ? rowData[col.dataTooltipCustomColumnSource] \r\n : value\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\">\r\n <ecs-table-predefined-filters [option]=\"option\" [col]=\"col\" [selectable]=\"true\" [rowData]=\"rowData\" [globalSearchText]=\"globalSearchText\"></ecs-table-predefined-filters>\r\n </div>\r\n </ng-container>\r\n </ng-template>\r\n </div>\r\n </ng-container><ng-template #ecsElse7>\r\n <ng-container [ngSwitch]=\"col.dataType\"><ng-container *ngSwitchCase=\"DataType.List\">\r\n <ng-container *ngFor=\"let item of getListValues(col, rowData); trackBy: ecsTrack7; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <span [innerHtml]=\"highlightText(item, col, globalSearchText)\"\r\n [pTooltip]=\"getListTooltip(item, $index)\"\r\n [escape]=\"false\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\"></span><ng-container *ngIf=\"!$last\"><span>;</span></ng-container>\r\n </ng-container>\r\n </ng-container><ng-container *ngSwitchCase=\"DataType.Boolean\">\r\n <i class=\"pi\"\r\n [pTooltip]=\"col.dataTooltipCustomColumnSource && col.dataTooltipCustomColumnSource.length > 0 \r\n ? rowData[col.dataTooltipCustomColumnSource] \r\n : value\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow || !col.dataTooltipCustomColumnSource || col.dataTooltipCustomColumnSource.length === 0\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\"\r\n [style.color]=\"value ? 'green' : 'red'\"\r\n [ngClass]=\"{ 'pi-check-circle': value, 'pi-times-circle': !value }\">\r\n </i>\r\n </ng-container><ng-container *ngSwitchCase=\"DataType.Date\">\r\n <div \r\n [innerHtml]=\"highlightText(formatDate(value, col.dateFormat, col.dateTimezone, col.dateCulture), col, globalSearchText)\"\r\n [pTooltip]=\"col.dataTooltipCustomColumnSource && col.dataTooltipCustomColumnSource.length > 0 \r\n ? rowData[col.dataTooltipCustomColumnSource] \r\n : formatDate(value, col.dateFormat, col.dateTimezone, col.dateCulture)\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\">\r\n {{ formatDate(value, col.dateFormat, col.dateTimezone, col.dateCulture) }}\r\n </div>\r\n </ng-container><ng-container *ngSwitchDefault>\r\n <div\r\n [innerHtml]=\"highlightText(value, col, globalSearchText)\"\r\n [pTooltip]=\"col.dataTooltipCustomColumnSource && col.dataTooltipCustomColumnSource.length > 0 \r\n ? rowData[col.dataTooltipCustomColumnSource] \r\n : value\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\">\r\n {{ value }}\r\n </div>\r\n </ng-container></ng-container>\r\n </ng-template></ng-template>\r\n</ng-container>\r\n", styles: [":host:has(.ecs-progress-bar){display:block;min-width:0}.ecs-progress-cell{padding-block:.5rem;margin-block:-.5rem}.ecs-progress-bar{width:100%;height:.875rem;overflow:hidden;border:1px solid var(--p-content-border-color, var(--surface-border, #d1d5db));border-radius:999px;background:var(--p-content-background, var(--surface-card, #f8fafc))}.ecs-progress-bar-fill{height:100%;background:var(--p-progressbar-value-background, var(--primary-color, #ffb547))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: TablePredefinedFilters, selector: "ecs-table-predefined-filters", inputs: ["option", "col", "selectable", "rowData", "globalSearchText"] }] });
1229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TableCell, decorators: [{
1230
+ type: Component,
1231
+ args: [{ selector: 'ecs-table-cell', imports: [
1232
+ CommonModule,
1233
+ TooltipModule,
1234
+ TablePredefinedFilters
1235
+ ], standalone: true, template: "<ng-container *ngIf=\"value !== null && value !== undefined\">\r\n <ng-container *ngIf=\"col.dataType === DataType.Numeric && col.cellDisplay === CellDisplay.ProgressBar; else ecsElse6\">\r\n <ng-container *ngIf=\"hasProgressValue\">\r\n <div class=\"ecs-progress-cell\"\r\n [pTooltip]=\"progressTooltip\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"200\" tooltipPosition=\"top\">\r\n <div class=\"ecs-progress-bar\" role=\"progressbar\"\r\n [attr.aria-label]=\"col.header\"\r\n aria-valuemin=\"0\" aria-valuemax=\"100\"\r\n [attr.aria-valuenow]=\"progressValue\"\r\n [attr.aria-valuetext]=\"value + ' %'\">\r\n <div class=\"ecs-progress-bar-fill\" [style.width.%]=\"progressValue\"></div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container><ng-template #ecsElse6><ng-container *ngIf=\"col.filterPredefinedValuesName && col.filterPredefinedValuesName.length > 0; else ecsElse7\">\r\n <div [ngStyle]=\"{\r\n 'justify-content': getDataAlignHorizontalAsText(col.dataAlignHorizontal),\r\n 'align-items': getDataAlignVerticalAsText(col.dataAlignVertical)\r\n }\">\r\n <ng-container *ngIf=\"col.dataType === DataType.List; else ecsElse8\">\r\n <ng-container *ngFor=\"let item of getListValues(col, rowData); trackBy: ecsTrack6; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <ng-container *ngIf=\"getPredfinedFilterMatch(col, item) as option\">\r\n <div style=\"display: inline-block; margin-right: 0.5rem;\"\r\n [pTooltip]=\"getListTooltip(item, $index)\"\r\n [escape]=\"false\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\">\r\n <ecs-table-predefined-filters [option]=\"option\" [col]=\"col\" [selectable]=\"true\" [rowData]=\"rowData\" [globalSearchText]=\"globalSearchText\"></ecs-table-predefined-filters>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container><ng-template #ecsElse8>\r\n <ng-container *ngIf=\"getPredfinedFilterMatch(col, value) as option\">\r\n <div style=\"display: inline-block;\"\r\n [pTooltip]=\"col.dataTooltipCustomColumnSource && col.dataTooltipCustomColumnSource.length > 0 \r\n ? rowData[col.dataTooltipCustomColumnSource] \r\n : value\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\">\r\n <ecs-table-predefined-filters [option]=\"option\" [col]=\"col\" [selectable]=\"true\" [rowData]=\"rowData\" [globalSearchText]=\"globalSearchText\"></ecs-table-predefined-filters>\r\n </div>\r\n </ng-container>\r\n </ng-template>\r\n </div>\r\n </ng-container><ng-template #ecsElse7>\r\n <ng-container [ngSwitch]=\"col.dataType\"><ng-container *ngSwitchCase=\"DataType.List\">\r\n <ng-container *ngFor=\"let item of getListValues(col, rowData); trackBy: ecsTrack7; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <span [innerHtml]=\"highlightText(item, col, globalSearchText)\"\r\n [pTooltip]=\"getListTooltip(item, $index)\"\r\n [escape]=\"false\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\"></span><ng-container *ngIf=\"!$last\"><span>;</span></ng-container>\r\n </ng-container>\r\n </ng-container><ng-container *ngSwitchCase=\"DataType.Boolean\">\r\n <i class=\"pi\"\r\n [pTooltip]=\"col.dataTooltipCustomColumnSource && col.dataTooltipCustomColumnSource.length > 0 \r\n ? rowData[col.dataTooltipCustomColumnSource] \r\n : value\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow || !col.dataTooltipCustomColumnSource || col.dataTooltipCustomColumnSource.length === 0\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\"\r\n [style.color]=\"value ? 'green' : 'red'\"\r\n [ngClass]=\"{ 'pi-check-circle': value, 'pi-times-circle': !value }\">\r\n </i>\r\n </ng-container><ng-container *ngSwitchCase=\"DataType.Date\">\r\n <div \r\n [innerHtml]=\"highlightText(formatDate(value, col.dateFormat, col.dateTimezone, col.dateCulture), col, globalSearchText)\"\r\n [pTooltip]=\"col.dataTooltipCustomColumnSource && col.dataTooltipCustomColumnSource.length > 0 \r\n ? rowData[col.dataTooltipCustomColumnSource] \r\n : formatDate(value, col.dateFormat, col.dateTimezone, col.dateCulture)\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\">\r\n {{ formatDate(value, col.dateFormat, col.dateTimezone, col.dateCulture) }}\r\n </div>\r\n </ng-container><ng-container *ngSwitchDefault>\r\n <div\r\n [innerHtml]=\"highlightText(value, col, globalSearchText)\"\r\n [pTooltip]=\"col.dataTooltipCustomColumnSource && col.dataTooltipCustomColumnSource.length > 0 \r\n ? rowData[col.dataTooltipCustomColumnSource] \r\n : value\"\r\n [tooltipDisabled]=\"!col.dataTooltipShow\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\">\r\n {{ value }}\r\n </div>\r\n </ng-container></ng-container>\r\n </ng-template></ng-template>\r\n</ng-container>\r\n", styles: [":host:has(.ecs-progress-bar){display:block;min-width:0}.ecs-progress-cell{padding-block:.5rem;margin-block:-.5rem}.ecs-progress-bar{width:100%;height:.875rem;overflow:hidden;border:1px solid var(--p-content-border-color, var(--surface-border, #d1d5db));border-radius:999px;background:var(--p-content-background, var(--surface-card, #f8fafc))}.ecs-progress-bar-fill{height:100%;background:var(--p-progressbar-value-background, var(--primary-color, #ffb547))}\n"] }]
1236
+ }], ctorParameters: function () { return [{ type: i1$1.DatePipe }, { type: i1.DomSanitizer }]; }, propDecorators: { col: [{
1237
+ type: Input
1238
+ }], rowData: [{
1239
+ type: Input
1240
+ }], globalSearchText: [{
1241
+ type: Input
1242
+ }], predefinedFiltersCollection: [{
1243
+ type: Input
1244
+ }], dateFormat: [{
1245
+ type: Input
1246
+ }], dateTimezone: [{
1247
+ type: Input
1248
+ }], dateCulture: [{
1249
+ type: Input
1250
+ }] } });
1251
+
1252
+ class TableButton {
1253
+ constructor(tableService) {
1254
+ this.tableService = tableService;
1255
+ this.isActionButton = false;
1256
+ this.isLastActionButton = false;
1257
+ }
1258
+ handleClick(event) {
1259
+ if (this.button?.action || this.overrideAction) { // If there is an action or an override, execute logic
1260
+ if (this.overrideAction) { // If overrideAction exists, execute it first
1261
+ this.overrideAction(event); // Call override action
1262
+ }
1263
+ else { // Otherwise execute the normal button action through the service
1264
+ this.tableService.handleButtonsClick(this.button.action, this.rowData);
1265
+ }
1266
+ }
1267
+ }
1268
+ getButtonStyle(button, isActionButton, isLastActionButton) {
1269
+ const styles = {};
1270
+ if (button.style) { // Add inline styles from button.style
1271
+ button.style.split(';').forEach(part => {
1272
+ const [prop, value] = part.split(':').map(x => x.trim());
1273
+ if (prop && value)
1274
+ styles[prop] = value;
1275
+ });
1276
+ }
1277
+ if (isActionButton && !isLastActionButton) { // Add margin-right for action buttons
1278
+ styles['margin-right'] = '10px';
1279
+ }
1280
+ return styles;
1281
+ }
1282
+ }
1283
+ TableButton.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TableButton, deps: [{ token: ECSPrimengTableService }], target: i0.ɵɵFactoryTarget.Component });
1284
+ TableButton.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: TableButton, isStandalone: true, selector: "ecs-table-button", inputs: { button: "button", rowData: "rowData", isActionButton: "isActionButton", isLastActionButton: "isLastActionButton", overrideAction: "overrideAction" }, ngImport: i0, template: "<ng-container *ngIf=\"button.visibleCondition?.(rowData) ?? true\"> <!--If 'visibleCondition' is true or not defined-->\r\n <ng-container *ngIf=\"(button.enabledCondition?.(rowData) ?? true) || !button.conditionFailHide\"> <!--Render button if 'enabledCondition' is true or undefined, OR if 'conditionFailHide' is false-->\r\n <p-button\r\n [ariaLabel]=\"(button.label || button.tooltip || '') | ecsTranslate\"\r\n [disabled]=\"!(button.enabledCondition?.(rowData) ?? true)\"\r\n [iconPos]=\"button.iconPos || 'left'\"\r\n [pTooltip]=\"(button.tooltip || '') | ecsTranslate\"\r\n [tooltipDisabled]=\"!button.tooltip || button.tooltip.length === 0\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\"\r\n [styleClass]=\"\r\n (isActionButton ? ' custom-small-btn' : '') +\r\n (button.rounded ? ' p-button-rounded' : '') +\r\n (button.raised ? ' p-button-raised' : '') +\r\n (button.variant === 'text' ? ' p-button-text' : '') +\r\n (button.variant === 'outlined' ? ' p-button-outlined' : '') +\r\n (button.class ? ' ' + button.class : '')\r\n \"\r\n [icon]=\"button.icon || ''\"\r\n [label]=\"(button.label || '') | ecsTranslate\"\r\n [ngStyle]=\"getButtonStyle(button, isActionButton, isLastActionButton)\"\r\n (onClick)=\"handleClick($event)\"></p-button>\r\n </ng-container>\r\n</ng-container>", styles: [":host ::ng-deep .custom-small-btn.p-button{height:28px!important;line-height:28px;padding-top:0;padding-bottom:0}\n"], dependencies: [{ kind: "pipe", type: ECSTableTranslatePipe, name: "ecsTranslate" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i5.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }] });
1285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TableButton, decorators: [{
1286
+ type: Component,
1287
+ args: [{ selector: 'ecs-table-button', imports: [
1288
+ ECSTableTranslatePipe,
1289
+ CommonModule,
1290
+ ButtonModule,
1291
+ TooltipModule
1292
+ ], standalone: true, template: "<ng-container *ngIf=\"button.visibleCondition?.(rowData) ?? true\"> <!--If 'visibleCondition' is true or not defined-->\r\n <ng-container *ngIf=\"(button.enabledCondition?.(rowData) ?? true) || !button.conditionFailHide\"> <!--Render button if 'enabledCondition' is true or undefined, OR if 'conditionFailHide' is false-->\r\n <p-button\r\n [ariaLabel]=\"(button.label || button.tooltip || '') | ecsTranslate\"\r\n [disabled]=\"!(button.enabledCondition?.(rowData) ?? true)\"\r\n [iconPos]=\"button.iconPos || 'left'\"\r\n [pTooltip]=\"(button.tooltip || '') | ecsTranslate\"\r\n [tooltipDisabled]=\"!button.tooltip || button.tooltip.length === 0\"\r\n [showDelay]=\"700\"\r\n tooltipPosition=\"top\"\r\n [styleClass]=\"\r\n (isActionButton ? ' custom-small-btn' : '') +\r\n (button.rounded ? ' p-button-rounded' : '') +\r\n (button.raised ? ' p-button-raised' : '') +\r\n (button.variant === 'text' ? ' p-button-text' : '') +\r\n (button.variant === 'outlined' ? ' p-button-outlined' : '') +\r\n (button.class ? ' ' + button.class : '')\r\n \"\r\n [icon]=\"button.icon || ''\"\r\n [label]=\"(button.label || '') | ecsTranslate\"\r\n [ngStyle]=\"getButtonStyle(button, isActionButton, isLastActionButton)\"\r\n (onClick)=\"handleClick($event)\"></p-button>\r\n </ng-container>\r\n</ng-container>", styles: [":host ::ng-deep .custom-small-btn.p-button{height:28px!important;line-height:28px;padding-top:0;padding-bottom:0}\n"] }]
1293
+ }], ctorParameters: function () { return [{ type: ECSPrimengTableService }]; }, propDecorators: { button: [{
1294
+ type: Input
1295
+ }], rowData: [{
1296
+ type: Input
1297
+ }], isActionButton: [{
1298
+ type: Input
1299
+ }], isLastActionButton: [{
1300
+ type: Input
1301
+ }], overrideAction: [{
1302
+ type: Input
1303
+ }] } });
1304
+
1305
+ class ColumnSelector {
1306
+ constructor(translate, changeDetector) {
1307
+ this.translate = translate;
1308
+ this.destroy$ = new Subject();
1309
+ this.orderByHeader = false;
1310
+ this.visible = false;
1311
+ this.columnModalData = [];
1312
+ this.filteredColumnData = [];
1313
+ this.visibleChange = new EventEmitter();
1314
+ this.applyChanges = new EventEmitter();
1315
+ this.cellOverflowBehaviourOptions = [
1316
+ { icon: 'pi pi-minus', val: CellOverflowBehaviour.Hidden, name: "Hidden" },
1317
+ { icon: 'pi pi-equals', val: CellOverflowBehaviour.Wrap, name: "Wrap" } /*,
1318
+ {icon: 'pi pi-ellipsis-h', val: CellOverflowBehaviour.Ellipsis, name: "Ellipsis"}*/
1319
+ ];
1320
+ this.dataAlignHorizontalOptions = [
1321
+ { icon: 'pi pi-align-left', val: DataAlignHorizontal.Left, name: "Left" },
1322
+ { icon: 'pi pi-align-center', val: DataAlignHorizontal.Center, name: "Center" },
1323
+ { icon: 'pi pi-align-right', val: DataAlignHorizontal.Right, name: "Right" }
1324
+ ];
1325
+ this.dataAlignVerticalOptions = [
1326
+ { icon: 'pi pi-angle-up', val: DataAlignVertical.Top, name: "Top" },
1327
+ { icon: 'pi pi-align-justify', val: DataAlignVertical.Middle, name: "Middle" },
1328
+ { icon: 'pi pi-angle-down', val: DataAlignVertical.Bottom, name: "Bottom" }
1329
+ ];
1330
+ this.globalSearchText = null; // The text used by the global search
1331
+ this.globalSearchMaxLength = 50;
1332
+ merge(translate.onLangChange, translate.onTranslationChange, translate.onDefaultLangChange)
1333
+ .pipe(takeUntil(this.destroy$))
1334
+ .subscribe(() => {
1335
+ this.updateVisibleColumns();
1336
+ changeDetector.markForCheck();
1337
+ });
1338
+ }
1339
+ ngOnChanges() {
1340
+ if (!this.visible)
1341
+ this.globalSearchText = null;
1342
+ this.updateVisibleColumns();
1343
+ }
1344
+ ngOnDestroy() {
1345
+ this.destroy$.next();
1346
+ this.destroy$.complete();
1347
+ }
1348
+ updateVisibleColumns() {
1349
+ const search = (this.globalSearchText ?? '').toLocaleLowerCase();
1350
+ const label = (column) => column.header ? this.translate.instant(column.header) : '';
1351
+ this.filteredColumnData = this.columnModalData.filter(column => label(column).toLocaleLowerCase().includes(search));
1352
+ if (this.orderByHeader) {
1353
+ this.filteredColumnData.sort((a, b) => label(a).localeCompare(label(b)));
1354
+ }
1355
+ }
1356
+ translatedOptions(options) {
1357
+ return options.map(option => ({ ...option, name: this.translate.instant(option.name) }));
1358
+ }
1359
+ allColumnsCheckboxActive() {
1360
+ return this.columnModalData.every(column => column.selected);
1361
+ }
1362
+ allColumnsCheckboxClick(event) {
1363
+ if (event.checked) {
1364
+ this.columnModalData.forEach(column => { column.selected = true; });
1365
+ }
1366
+ else {
1367
+ this.columnModalData.forEach(column => {
1368
+ if (!column.selectDisabled) {
1369
+ column.selected = false;
1370
+ }
1371
+ });
1372
+ }
1373
+ }
1374
+ filterColumnModal(event) {
1375
+ this.globalSearchText = event.target.value;
1376
+ this.updateVisibleColumns();
1377
+ }
1378
+ applyColumnModalChanges() {
1379
+ const selected = this.columnModalData.filter(c => c.selected && !c.selectDisabled);
1380
+ this.applyChanges.emit(selected);
1381
+ this.closeModal();
1382
+ }
1383
+ clearGlobalFilter(dt) {
1384
+ this.globalSearchText = null;
1385
+ this.updateVisibleColumns();
1386
+ }
1387
+ closeModal() {
1388
+ this.globalSearchText = null;
1389
+ this.visibleChange.emit(false);
1390
+ }
1391
+ }
1392
+ ColumnSelector.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ColumnSelector, deps: [{ token: i1$2.TranslateService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1393
+ ColumnSelector.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ColumnSelector, isStandalone: true, selector: "ecs-column-selector", inputs: { orderByHeader: "orderByHeader", visible: "visible", columnModalData: "columnModalData", filteredColumnData: "filteredColumnData" }, outputs: { visibleChange: "visibleChange", applyChanges: "applyChanges" }, viewQueries: [{ propertyName: "dt_columnDialog", first: true, predicate: ["dt_columnDialog"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!--COLUMN MODAL DIALOG-->\r\n<p-dialog [(visible)]=\"visible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" [closeOnEscape]=\"false\" [closable]=\"false\" [maximizable]=\"false\" [style]=\"{'min-width': '65vw', 'max-width': '65vw'}\">\r\n <ng-template pTemplate=\"header\">\r\n <span class=\"white-space-nowrap\"><b>{{ 'MODIFY COLUMNS' | ecsTranslate }}</b></span>\r\n </ng-template>\r\n <div style=\"padding: 10px;\">\r\n <p-table #dt_columnDialog [value]=\"filteredColumnData\" [scrollable]=\"true\" size=\"small\" showGridlines stripedRows\r\n scrollHeight=\"calc(80vh - 220px)\">\r\n <ng-template pTemplate=\"caption\">\r\n <div style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <div style=\"display: flex; align-items: center; gap: 10px\">\r\n <p-checkbox inputId=\"selectAll\" [binary]=\"true\" [ngModel]=\"allColumnsCheckboxActive()\" (onChange)=\"allColumnsCheckboxClick($event)\"></p-checkbox>\r\n <label for=\"selectAll\">{{ 'Select all columns' | ecsTranslate }}</label>\r\n </div>\r\n <div style=\"display: flex; align-items: center;\">\r\n <span class=\"ecs-global-search\">\r\n <span class=\"ecs-input-icon\">\r\n <i class=\"pi pi-search\"></i>\r\n </span>\r\n <input pInputText type=\"text\" \r\n (input)=\"filterColumnModal($event)\" autocomplete=\"off\" \r\n [maxlength]=\"globalSearchMaxLength\" [placeholder]=\"'Search column name' | ecsTranslate\" [(ngModel)]=\"globalSearchText\"\r\n style=\"width: 220px;\"/>\r\n <!-- Right icon (only if there is text) -->\r\n <ng-container *ngIf=\"globalSearchText\">\r\n <span class=\"ecs-input-icon\" position=\"right\">\r\n <i class=\"pi pi-times\" style=\"cursor: pointer;\" (click)=\"clearGlobalFilter(dt_columnDialog); $event.stopPropagation()\"></i>\r\n </span>\r\n </ng-container>\r\n </span>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\">\r\n <tr>\r\n <th pFrozenColumn style=\"max-width: 100px; min-width: 100px; width: 100px; text-align: center;\">{{ 'Show column' | ecsTranslate }}</th>\r\n <th pFrozenColumn style=\"max-width: 250px; min-width: 250px; width: 250px; text-align: center;\">{{ 'Column name' | ecsTranslate }}</th>\r\n <th style=\"max-width: 150px; min-width: 150px; width: 150px; text-align: center;\">{{ 'Cell overflow behaviour' | ecsTranslate }}</th>\r\n <th style=\"max-width: 160px; min-width: 160px; width: 160px; text-align: center;\">{{ 'Horizontal alignment' | ecsTranslate }}</th>\r\n <th style=\"max-width: 150px; min-width: 150px; width: 150px; text-align: center;\">{{ 'Vertical alignment' | ecsTranslate }}</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData>\r\n <tr>\r\n <td pFrozenColumn style=\"max-width: 100px; min-width: 100px; width: 100px; text-align: center;\">\r\n <p-checkbox \r\n [(ngModel)]=\"rowData.selected\" \r\n [binary]=\"true\"\r\n [disabled]=\"rowData.selectDisabled\"></p-checkbox>\r\n </td>\r\n <td pFrozenColumn style=\"max-width: 250px; min-width: 250px; width: 250px;\">{{rowData.header | translate}}</td>\r\n <td style=\"max-width: 150px; min-width: 150px; width: 150px; text-align: center;\">\r\n <p-selectButton [(ngModel)]=\"rowData.cellOverflowBehaviour\" [options]=\"translatedOptions(cellOverflowBehaviourOptions)\" optionValue=\"val\" optionLabel=\"name\" [disabled]=\"rowData.cellOverflowBehaviourDisabled\" allowEmpty=\"false\">\r\n <ng-template pTemplate=\"item\" let-item>\r\n <i [class]=\"item.icon\" style=\"margin: -20px;\" [pTooltip]=\"(item.name) | ecsTranslate\" [showDelay]=\"400\" tooltipPosition=\"top\"></i>\r\n </ng-template>\r\n </p-selectButton>\r\n </td>\r\n <td style=\"max-width: 160px; min-width: 160px; width: 160px; text-align: center;\">\r\n <p-selectButton [(ngModel)]=\"rowData.dataAlignHorizontal\" [options]=\"translatedOptions(dataAlignHorizontalOptions)\" optionValue=\"val\" optionLabel=\"name\" [disabled]=\"rowData.dataAlignHorizontalDisabled\" allowEmpty=\"false\">\r\n <ng-template pTemplate=\"item\" let-item>\r\n <i [class]=\"item.icon\" style=\"margin: -20px;\" [pTooltip]=\"(item.name) | ecsTranslate\" [showDelay]=\"400\" tooltipPosition=\"top\"></i>\r\n </ng-template>\r\n </p-selectButton>\r\n </td>\r\n <td style=\"max-width: 150px; min-width: 150px; width: 150px; text-align: center;\">\r\n <p-selectButton [(ngModel)]=\"rowData.dataAlignVertical\" [options]=\"translatedOptions(dataAlignVerticalOptions)\" optionValue=\"val\" optionLabel=\"name\" [disabled]=\"rowData.dataAlignVerticalDisabled\" allowEmpty=\"false\">\r\n <ng-template pTemplate=\"item\" let-item>\r\n <i [class]=\"item.icon\" style=\"margin: -20px;\" [pTooltip]=\"(item.name) | ecsTranslate\" [showDelay]=\"400\" tooltipPosition=\"top\"></i>\r\n </ng-template>\r\n </p-selectButton>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"999\">{{ 'There are no columns' | ecsTranslate }}</td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n <div style=\"display: flex; flex-direction: row; justify-content: space-between; align-items: center; margin-top: 10px;\">\r\n {{ 'Showing {{count}} columns of {{total}} available columns' | ecsTranslate: { count: filteredColumnData ? filteredColumnData.length : 0, total: columnModalData ? columnModalData.length : 0 } }}\r\n </div>\r\n </div>\r\n <ng-template pTemplate=\"footer\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <p-button (click)=\"closeModal()\" [label]=\"'Cancel changes' | ecsTranslate\" outlined=\"true\" [style]=\"{'margin-top': '10px'}\"></p-button>\r\n <p-button (click)=\"applyColumnModalChanges()\" [label]=\"'Save changes' | ecsTranslate\" [style]=\"{'margin-top': '10px'}\"></p-button>\r\n </ng-template>\r\n</p-dialog>", dependencies: [{ kind: "pipe", type: ECSTableTranslatePipe, name: "ecsTranslate" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i2.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i3$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "virtualRowHeight", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i6.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i5$1.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "trueValue", "falseValue"], outputs: ["onChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i5.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: SelectButtonModule }, { kind: "component", type: i7.SelectButton, selector: "p-selectButton", inputs: ["options", "optionLabel", "optionValue", "optionDisabled", "tabindex", "multiple", "style", "styleClass", "ariaLabelledBy", "disabled", "dataKey"], outputs: ["onOptionClick", "onChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i6$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i6$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i10.InputText, selector: "[pInputText]" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }] });
1394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ColumnSelector, decorators: [{
1395
+ type: Component,
1396
+ args: [{ selector: 'ecs-column-selector', imports: [
1397
+ ECSTableTranslatePipe,
1398
+ TranslateModule,
1399
+ DialogModule,
1400
+ TableModule,
1401
+ CheckboxModule,
1402
+ ButtonModule,
1403
+ SelectButtonModule,
1404
+ CommonModule,
1405
+ FormsModule,
1406
+ InputTextModule,
1407
+ TooltipModule
1408
+ ], standalone: true, template: "<!--COLUMN MODAL DIALOG-->\r\n<p-dialog [(visible)]=\"visible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" [closeOnEscape]=\"false\" [closable]=\"false\" [maximizable]=\"false\" [style]=\"{'min-width': '65vw', 'max-width': '65vw'}\">\r\n <ng-template pTemplate=\"header\">\r\n <span class=\"white-space-nowrap\"><b>{{ 'MODIFY COLUMNS' | ecsTranslate }}</b></span>\r\n </ng-template>\r\n <div style=\"padding: 10px;\">\r\n <p-table #dt_columnDialog [value]=\"filteredColumnData\" [scrollable]=\"true\" size=\"small\" showGridlines stripedRows\r\n scrollHeight=\"calc(80vh - 220px)\">\r\n <ng-template pTemplate=\"caption\">\r\n <div style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <div style=\"display: flex; align-items: center; gap: 10px\">\r\n <p-checkbox inputId=\"selectAll\" [binary]=\"true\" [ngModel]=\"allColumnsCheckboxActive()\" (onChange)=\"allColumnsCheckboxClick($event)\"></p-checkbox>\r\n <label for=\"selectAll\">{{ 'Select all columns' | ecsTranslate }}</label>\r\n </div>\r\n <div style=\"display: flex; align-items: center;\">\r\n <span class=\"ecs-global-search\">\r\n <span class=\"ecs-input-icon\">\r\n <i class=\"pi pi-search\"></i>\r\n </span>\r\n <input pInputText type=\"text\" \r\n (input)=\"filterColumnModal($event)\" autocomplete=\"off\" \r\n [maxlength]=\"globalSearchMaxLength\" [placeholder]=\"'Search column name' | ecsTranslate\" [(ngModel)]=\"globalSearchText\"\r\n style=\"width: 220px;\"/>\r\n <!-- Right icon (only if there is text) -->\r\n <ng-container *ngIf=\"globalSearchText\">\r\n <span class=\"ecs-input-icon\" position=\"right\">\r\n <i class=\"pi pi-times\" style=\"cursor: pointer;\" (click)=\"clearGlobalFilter(dt_columnDialog); $event.stopPropagation()\"></i>\r\n </span>\r\n </ng-container>\r\n </span>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\">\r\n <tr>\r\n <th pFrozenColumn style=\"max-width: 100px; min-width: 100px; width: 100px; text-align: center;\">{{ 'Show column' | ecsTranslate }}</th>\r\n <th pFrozenColumn style=\"max-width: 250px; min-width: 250px; width: 250px; text-align: center;\">{{ 'Column name' | ecsTranslate }}</th>\r\n <th style=\"max-width: 150px; min-width: 150px; width: 150px; text-align: center;\">{{ 'Cell overflow behaviour' | ecsTranslate }}</th>\r\n <th style=\"max-width: 160px; min-width: 160px; width: 160px; text-align: center;\">{{ 'Horizontal alignment' | ecsTranslate }}</th>\r\n <th style=\"max-width: 150px; min-width: 150px; width: 150px; text-align: center;\">{{ 'Vertical alignment' | ecsTranslate }}</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData>\r\n <tr>\r\n <td pFrozenColumn style=\"max-width: 100px; min-width: 100px; width: 100px; text-align: center;\">\r\n <p-checkbox \r\n [(ngModel)]=\"rowData.selected\" \r\n [binary]=\"true\"\r\n [disabled]=\"rowData.selectDisabled\"></p-checkbox>\r\n </td>\r\n <td pFrozenColumn style=\"max-width: 250px; min-width: 250px; width: 250px;\">{{rowData.header | translate}}</td>\r\n <td style=\"max-width: 150px; min-width: 150px; width: 150px; text-align: center;\">\r\n <p-selectButton [(ngModel)]=\"rowData.cellOverflowBehaviour\" [options]=\"translatedOptions(cellOverflowBehaviourOptions)\" optionValue=\"val\" optionLabel=\"name\" [disabled]=\"rowData.cellOverflowBehaviourDisabled\" allowEmpty=\"false\">\r\n <ng-template pTemplate=\"item\" let-item>\r\n <i [class]=\"item.icon\" style=\"margin: -20px;\" [pTooltip]=\"(item.name) | ecsTranslate\" [showDelay]=\"400\" tooltipPosition=\"top\"></i>\r\n </ng-template>\r\n </p-selectButton>\r\n </td>\r\n <td style=\"max-width: 160px; min-width: 160px; width: 160px; text-align: center;\">\r\n <p-selectButton [(ngModel)]=\"rowData.dataAlignHorizontal\" [options]=\"translatedOptions(dataAlignHorizontalOptions)\" optionValue=\"val\" optionLabel=\"name\" [disabled]=\"rowData.dataAlignHorizontalDisabled\" allowEmpty=\"false\">\r\n <ng-template pTemplate=\"item\" let-item>\r\n <i [class]=\"item.icon\" style=\"margin: -20px;\" [pTooltip]=\"(item.name) | ecsTranslate\" [showDelay]=\"400\" tooltipPosition=\"top\"></i>\r\n </ng-template>\r\n </p-selectButton>\r\n </td>\r\n <td style=\"max-width: 150px; min-width: 150px; width: 150px; text-align: center;\">\r\n <p-selectButton [(ngModel)]=\"rowData.dataAlignVertical\" [options]=\"translatedOptions(dataAlignVerticalOptions)\" optionValue=\"val\" optionLabel=\"name\" [disabled]=\"rowData.dataAlignVerticalDisabled\" allowEmpty=\"false\">\r\n <ng-template pTemplate=\"item\" let-item>\r\n <i [class]=\"item.icon\" style=\"margin: -20px;\" [pTooltip]=\"(item.name) | ecsTranslate\" [showDelay]=\"400\" tooltipPosition=\"top\"></i>\r\n </ng-template>\r\n </p-selectButton>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"999\">{{ 'There are no columns' | ecsTranslate }}</td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n <div style=\"display: flex; flex-direction: row; justify-content: space-between; align-items: center; margin-top: 10px;\">\r\n {{ 'Showing {{count}} columns of {{total}} available columns' | ecsTranslate: { count: filteredColumnData ? filteredColumnData.length : 0, total: columnModalData ? columnModalData.length : 0 } }}\r\n </div>\r\n </div>\r\n <ng-template pTemplate=\"footer\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <p-button (click)=\"closeModal()\" [label]=\"'Cancel changes' | ecsTranslate\" outlined=\"true\" [style]=\"{'margin-top': '10px'}\"></p-button>\r\n <p-button (click)=\"applyColumnModalChanges()\" [label]=\"'Save changes' | ecsTranslate\" [style]=\"{'margin-top': '10px'}\"></p-button>\r\n </ng-template>\r\n</p-dialog>" }]
1409
+ }], ctorParameters: function () { return [{ type: i1$2.TranslateService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { orderByHeader: [{
1410
+ type: Input
1411
+ }], dt_columnDialog: [{
1412
+ type: ViewChild,
1413
+ args: ['dt_columnDialog']
1414
+ }], visible: [{
1415
+ type: Input
1416
+ }], columnModalData: [{
1417
+ type: Input
1418
+ }], filteredColumnData: [{
1419
+ type: Input
1420
+ }], visibleChange: [{
1421
+ type: Output
1422
+ }], applyChanges: [{
1423
+ type: Output
1424
+ }] } });
1425
+
1426
+ class ExportExcelService {
1427
+ getCurrentTimeString() {
1428
+ const now = new Date();
1429
+ const year = now.getUTCFullYear();
1430
+ const month = String(now.getUTCMonth() + 1).padStart(2, '0');
1431
+ const day = String(now.getUTCDate()).padStart(2, '0');
1432
+ const hours = String(now.getUTCHours()).padStart(2, '0');
1433
+ const minutes = String(now.getUTCMinutes()).padStart(2, '0');
1434
+ const seconds = String(now.getUTCSeconds()).padStart(2, '0');
1435
+ return `_${year}${month}${day}_${hours}${minutes}${seconds}_UTC`;
1436
+ }
1437
+ }
1438
+ ExportExcelService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ExportExcelService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1439
+ ExportExcelService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ExportExcelService, providedIn: 'root' });
1440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ExportExcelService, decorators: [{
1441
+ type: Injectable,
1442
+ args: [{
1443
+ providedIn: 'root'
1444
+ }]
1445
+ }] });
1446
+
1447
+ class ExportExcel {
1448
+ constructor(notificationSerivce, exportExcelService) {
1449
+ this.notificationSerivce = notificationSerivce;
1450
+ this.exportExcelService = exportExcelService;
1451
+ this.i18n = inject(ECSPrimengTableI18nService);
1452
+ this.translatedOptionSets = new WeakMap();
1453
+ this.visible = false;
1454
+ this.rowCheckboxSelectorActive = false;
1455
+ this.excelReportTitle = "";
1456
+ this.includeTimeInTitle = true;
1457
+ this.exportUseIconsInBools = false;
1458
+ this.allowTitleUserEdit = false;
1459
+ this.exportToExcel = new EventEmitter();
1460
+ this.visibleChange = new EventEmitter();
1461
+ this.option_exportColumns_selected = false;
1462
+ this.option_exportColumns = [
1463
+ { label: 'Only visible', value: false },
1464
+ { label: 'All columns', value: true }
1465
+ ];
1466
+ this.option_applyCurrentFilters_selected = false;
1467
+ this.option_applyCurrentFilters = [
1468
+ { label: 'No filters', value: false },
1469
+ { label: 'Apply current filters', value: true }
1470
+ ];
1471
+ this.option_applyCurrentSorts_selected = false;
1472
+ this.option_applyCurrentSorts = [
1473
+ { label: 'No sorts', value: false },
1474
+ { label: 'Apply current sorts', value: true }
1475
+ ];
1476
+ this.option_selectedRowsExport_selected = 0;
1477
+ this.option_selectedRowsExport = [
1478
+ { label: 'All rows', value: 0 },
1479
+ { label: 'Selected rows', value: 1 },
1480
+ { label: 'Not selected rows', value: 2 }
1481
+ ];
1482
+ }
1483
+ ngOnChanges(changes) {
1484
+ // If visible changes from false to true, reset values
1485
+ if (changes['visible'] && changes['visible'].currentValue === true && changes['visible'].previousValue === false) {
1486
+ this.resetValues();
1487
+ }
1488
+ }
1489
+ resetValues() {
1490
+ this.includeTimeInTitle = true;
1491
+ this.exportUseIconsInBools = false;
1492
+ this.option_exportColumns_selected = false;
1493
+ this.option_applyCurrentFilters_selected = false;
1494
+ this.option_applyCurrentSorts_selected = false;
1495
+ this.option_selectedRowsExport_selected = 0;
1496
+ }
1497
+ getExcelReport() {
1498
+ let excelReportFinalTitle = "";
1499
+ this.excelReportTitle = this.excelReportTitle?.trim();
1500
+ if (!this.excelReportTitle || this.excelReportTitle.length <= 0) {
1501
+ this.notificationSerivce.clearToasts();
1502
+ this.notificationSerivce.showToast("error", this.i18n.text("REPORT NAME NOT VALID"), this.i18n.text("The report name is not valid"));
1503
+ return;
1504
+ }
1505
+ const allowedPattern = /^[A-Za-z0-9 _-]*$/;
1506
+ if (!allowedPattern.test(this.excelReportTitle)) {
1507
+ this.notificationSerivce.clearToasts();
1508
+ this.notificationSerivce.showToast("error", this.i18n.text("INVALID CHARACTERS IN REPORT NAME"), this.i18n.text("The report name contains invalid characters."));
1509
+ return;
1510
+ }
1511
+ if (this.includeTimeInTitle) {
1512
+ excelReportFinalTitle = this.excelReportTitle + this.exportExcelService.getCurrentTimeString() + ".xlsx";
1513
+ }
1514
+ else {
1515
+ excelReportFinalTitle = this.excelReportTitle + ".xlsx";
1516
+ }
1517
+ this.exportToExcel.emit({
1518
+ allColumns: this.option_exportColumns_selected,
1519
+ applyFilters: this.option_applyCurrentFilters_selected,
1520
+ applySorts: this.option_applyCurrentSorts_selected,
1521
+ selectedRows: this.option_selectedRowsExport_selected,
1522
+ filename: excelReportFinalTitle,
1523
+ useIconInBools: this.exportUseIconsInBools
1524
+ });
1525
+ }
1526
+ translatedOptions(options) {
1527
+ const labels = options.map(option => this.i18n.text(option.label));
1528
+ const cached = this.translatedOptionSets.get(options);
1529
+ if (cached?.length === options.length && cached.every((option, index) => option.label === labels[index] && option.value === options[index].value)) {
1530
+ return cached;
1531
+ }
1532
+ const translated = options.map((option, index) => ({ ...option, label: labels[index] }));
1533
+ this.translatedOptionSets.set(options, translated);
1534
+ return translated;
1535
+ }
1536
+ filterSelectorDisabled() {
1537
+ return this.option_selectedRowsExport_selected >= 1;
1538
+ }
1539
+ onChangeExportRows(event) {
1540
+ if (event.value >= 1) {
1541
+ this.option_applyCurrentFilters_selected = true;
1542
+ }
1543
+ }
1544
+ closeModal() {
1545
+ this.visibleChange.emit(false);
1546
+ }
1547
+ }
1548
+ ExportExcel.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ExportExcel, deps: [{ token: ECSPrimengTableNotificationService }, { token: ExportExcelService }], target: i0.ɵɵFactoryTarget.Component });
1549
+ ExportExcel.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ExportExcel, isStandalone: true, selector: "ecs-export-excel", inputs: { visible: "visible", rowCheckboxSelectorActive: "rowCheckboxSelectorActive", excelReportTitle: "excelReportTitle", allowTitleUserEdit: "allowTitleUserEdit" }, outputs: { exportToExcel: "exportToExcel", visibleChange: "visibleChange" }, usesOnChanges: true, ngImport: i0, template: "<p-dialog [(visible)]=\"visible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\"\r\n [closable]=\"false\" [closeOnEscape]=\"false\" [maximizable]=\"false\" [style]=\"{'min-width': '70vw', 'max-width': '70vw'}\">\r\n <ng-template pTemplate=\"header\">\r\n <div>\r\n <span class=\"p-dialog-title\">{{ 'Export data to Excel' | ecsTranslate }}</span>\r\n </div>\r\n </ng-template>\r\n <div style=\"display: grid; grid-template-columns: 4fr 8fr; gap: 1rem; align-items: center; margin-top: 10px;\">\r\n <div style=\"justify-self: end;\">\r\n {{ 'Report filename' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: stretch; width: 100%;\">\r\n <input pInputText id=\"reportTitle\" [attr.aria-label]=\"'Report filename' | ecsTranslate\" [(ngModel)]=\"excelReportTitle\" autocomplete=\"off\" style=\"width: 100%;\" [disabled]=\"!allowTitleUserEdit\" maxlength=\"100\"/>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n <i [pTooltip]=\"'Activating this option will add the current <b>\\'_{year}{month}{day}_{hours}{minutes}{seconds}_UTC\\'</b> at the end of your filename.' | ecsTranslate\"\r\n tooltipPosition=\"top\"\r\n [escape]=\"false\"\r\n class=\"pi pi-info-circle\">\r\n </i>\r\n {{ 'Include time in report filename?' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: stretch; width: 100%;\">\r\n <p-checkbox [binary]=\"true\" [(ngModel)]=\"includeTimeInTitle\"></p-checkbox>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n <i [pTooltip]=\"'Activating this option will make boolean values be shown as icons in the Excel report:<br>True \u2192 <span class=\\'bool-icon bool-true\\'>\u2714</span><br>False \u2192 <span class=\\'bool-icon bool-false\\'>\u2718</span>' | ecsTranslate\"\r\n tooltipPosition=\"top\"\r\n tooltipStyleClass=\"excel-export-tooltip\"\r\n [escape]=\"false\"\r\n class=\"pi pi-info-circle\">\r\n </i>\r\n {{ 'Use icons in boolean fields?' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: stretch; width: 100%;\">\r\n <p-checkbox [binary]=\"true\" [(ngModel)]=\"exportUseIconsInBools\"></p-checkbox>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n {{ 'Export columns' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: start;\">\r\n <p-selectButton [(ngModel)]=\"option_exportColumns_selected\" [options]=\"translatedOptions(option_exportColumns)\" optionLabel=\"label\" optionValue=\"value\" allowEmpty=\"false\"><ng-template pTemplate=\"item\" let-option>{{ option.label | ecsTranslate }}</ng-template></p-selectButton>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n <ng-container *ngIf=\"filterSelectorDisabled()\">\r\n <i [pTooltip]=\"'Sorts are active because you want to export selected rows following a filter criteria' | ecsTranslate\" tooltipPosition=\"top\" class=\"pi pi-info-circle\"></i>\r\n </ng-container>\r\n {{ 'Filters to apply' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: start;\">\r\n <p-selectButton [(ngModel)]=\"option_applyCurrentFilters_selected\" [options]=\"translatedOptions(option_applyCurrentFilters)\" optionLabel=\"label\" optionValue=\"value\" allowEmpty=\"false\" [disabled]=\"filterSelectorDisabled()\"><ng-template pTemplate=\"item\" let-option>{{ option.label | ecsTranslate }}</ng-template></p-selectButton>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n {{ 'Sorts to apply' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: start;\">\r\n <p-selectButton [(ngModel)]=\"option_applyCurrentSorts_selected\" [options]=\"translatedOptions(option_applyCurrentSorts)\" optionLabel=\"label\" optionValue=\"value\" allowEmpty=\"false\"><ng-template pTemplate=\"item\" let-option>{{ option.label | ecsTranslate }}</ng-template></p-selectButton>\r\n </div>\r\n\r\n <ng-container *ngIf=\"rowCheckboxSelectorActive\">\r\n <div style=\"justify-self: end;\">\r\n {{ 'Selected rows' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: start;\">\r\n <p-selectButton [(ngModel)]=\"option_selectedRowsExport_selected\" [options]=\"translatedOptions(option_selectedRowsExport)\" optionLabel=\"label\" optionValue=\"value\" allowEmpty=\"false\" (onChange)=\"onChangeExportRows($event)\"><ng-template pTemplate=\"item\" let-option>{{ option.label | ecsTranslate }}</ng-template></p-selectButton>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <ng-template pTemplate=\"footer\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <p-button (click)=\"closeModal()\" [label]=\"'Cancel export' | ecsTranslate\" outlined=\"true\" [style]=\"{'margin-top': '20px'}\"></p-button>\r\n <p-button (click)=\"getExcelReport()\" [label]=\"'Export' | ecsTranslate\" [style]=\"{'margin-top': '20px'}\"></p-button>\r\n </ng-template>\r\n</p-dialog>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: ECSTableTranslatePipe, name: "ecsTranslate" }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i2.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i3$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i6$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i6$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i5.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: SelectButtonModule }, { kind: "component", type: i7.SelectButton, selector: "p-selectButton", inputs: ["options", "optionLabel", "optionValue", "optionDisabled", "tabindex", "multiple", "style", "styleClass", "ariaLabelledBy", "disabled", "dataKey"], outputs: ["onOptionClick", "onChange"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i10.InputText, selector: "[pInputText]" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i5$1.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "trueValue", "falseValue"], outputs: ["onChange"] }] });
1550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ExportExcel, decorators: [{
1551
+ type: Component,
1552
+ args: [{ selector: 'ecs-export-excel', imports: [
1553
+ CommonModule,
1554
+ ECSTableTranslatePipe,
1555
+ DialogModule,
1556
+ FormsModule,
1557
+ ButtonModule,
1558
+ SelectButtonModule,
1559
+ InputTextModule,
1560
+ TooltipModule,
1561
+ CheckboxModule
1562
+ ], standalone: true, template: "<p-dialog [(visible)]=\"visible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\"\r\n [closable]=\"false\" [closeOnEscape]=\"false\" [maximizable]=\"false\" [style]=\"{'min-width': '70vw', 'max-width': '70vw'}\">\r\n <ng-template pTemplate=\"header\">\r\n <div>\r\n <span class=\"p-dialog-title\">{{ 'Export data to Excel' | ecsTranslate }}</span>\r\n </div>\r\n </ng-template>\r\n <div style=\"display: grid; grid-template-columns: 4fr 8fr; gap: 1rem; align-items: center; margin-top: 10px;\">\r\n <div style=\"justify-self: end;\">\r\n {{ 'Report filename' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: stretch; width: 100%;\">\r\n <input pInputText id=\"reportTitle\" [attr.aria-label]=\"'Report filename' | ecsTranslate\" [(ngModel)]=\"excelReportTitle\" autocomplete=\"off\" style=\"width: 100%;\" [disabled]=\"!allowTitleUserEdit\" maxlength=\"100\"/>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n <i [pTooltip]=\"'Activating this option will add the current <b>\\'_{year}{month}{day}_{hours}{minutes}{seconds}_UTC\\'</b> at the end of your filename.' | ecsTranslate\"\r\n tooltipPosition=\"top\"\r\n [escape]=\"false\"\r\n class=\"pi pi-info-circle\">\r\n </i>\r\n {{ 'Include time in report filename?' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: stretch; width: 100%;\">\r\n <p-checkbox [binary]=\"true\" [(ngModel)]=\"includeTimeInTitle\"></p-checkbox>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n <i [pTooltip]=\"'Activating this option will make boolean values be shown as icons in the Excel report:<br>True \u2192 <span class=\\'bool-icon bool-true\\'>\u2714</span><br>False \u2192 <span class=\\'bool-icon bool-false\\'>\u2718</span>' | ecsTranslate\"\r\n tooltipPosition=\"top\"\r\n tooltipStyleClass=\"excel-export-tooltip\"\r\n [escape]=\"false\"\r\n class=\"pi pi-info-circle\">\r\n </i>\r\n {{ 'Use icons in boolean fields?' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: stretch; width: 100%;\">\r\n <p-checkbox [binary]=\"true\" [(ngModel)]=\"exportUseIconsInBools\"></p-checkbox>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n {{ 'Export columns' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: start;\">\r\n <p-selectButton [(ngModel)]=\"option_exportColumns_selected\" [options]=\"translatedOptions(option_exportColumns)\" optionLabel=\"label\" optionValue=\"value\" allowEmpty=\"false\"><ng-template pTemplate=\"item\" let-option>{{ option.label | ecsTranslate }}</ng-template></p-selectButton>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n <ng-container *ngIf=\"filterSelectorDisabled()\">\r\n <i [pTooltip]=\"'Sorts are active because you want to export selected rows following a filter criteria' | ecsTranslate\" tooltipPosition=\"top\" class=\"pi pi-info-circle\"></i>\r\n </ng-container>\r\n {{ 'Filters to apply' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: start;\">\r\n <p-selectButton [(ngModel)]=\"option_applyCurrentFilters_selected\" [options]=\"translatedOptions(option_applyCurrentFilters)\" optionLabel=\"label\" optionValue=\"value\" allowEmpty=\"false\" [disabled]=\"filterSelectorDisabled()\"><ng-template pTemplate=\"item\" let-option>{{ option.label | ecsTranslate }}</ng-template></p-selectButton>\r\n </div>\r\n\r\n <div style=\"justify-self: end;\">\r\n {{ 'Sorts to apply' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: start;\">\r\n <p-selectButton [(ngModel)]=\"option_applyCurrentSorts_selected\" [options]=\"translatedOptions(option_applyCurrentSorts)\" optionLabel=\"label\" optionValue=\"value\" allowEmpty=\"false\"><ng-template pTemplate=\"item\" let-option>{{ option.label | ecsTranslate }}</ng-template></p-selectButton>\r\n </div>\r\n\r\n <ng-container *ngIf=\"rowCheckboxSelectorActive\">\r\n <div style=\"justify-self: end;\">\r\n {{ 'Selected rows' | ecsTranslate }}\r\n </div>\r\n <div style=\"justify-self: start;\">\r\n <p-selectButton [(ngModel)]=\"option_selectedRowsExport_selected\" [options]=\"translatedOptions(option_selectedRowsExport)\" optionLabel=\"label\" optionValue=\"value\" allowEmpty=\"false\" (onChange)=\"onChangeExportRows($event)\"><ng-template pTemplate=\"item\" let-option>{{ option.label | ecsTranslate }}</ng-template></p-selectButton>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <ng-template pTemplate=\"footer\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <p-button (click)=\"closeModal()\" [label]=\"'Cancel export' | ecsTranslate\" outlined=\"true\" [style]=\"{'margin-top': '20px'}\"></p-button>\r\n <p-button (click)=\"getExcelReport()\" [label]=\"'Export' | ecsTranslate\" [style]=\"{'margin-top': '20px'}\"></p-button>\r\n </ng-template>\r\n</p-dialog>\r\n" }]
1563
+ }], ctorParameters: function () { return [{ type: ECSPrimengTableNotificationService }, { type: ExportExcelService }]; }, propDecorators: { visible: [{
1564
+ type: Input
1565
+ }], rowCheckboxSelectorActive: [{
1566
+ type: Input
1567
+ }], excelReportTitle: [{
1568
+ type: Input
1569
+ }], allowTitleUserEdit: [{
1570
+ type: Input
1571
+ }], exportToExcel: [{
1572
+ type: Output
1573
+ }], visibleChange: [{
1574
+ type: Output
1575
+ }] } });
1576
+
1577
+ class ViewsManagement {
1578
+ constructor(notification) {
1579
+ this.notification = notification;
1580
+ this.i18n = inject(ECSPrimengTableI18nService);
1581
+ this.visible = false;
1582
+ this.tableViews_menuItems = [];
1583
+ this.onViewSelect = new EventEmitter();
1584
+ this.onViewDelete = new EventEmitter();
1585
+ this.onViewUpdateData = new EventEmitter();
1586
+ this.onViewUpdateActiveStartup = new EventEmitter();
1587
+ this.onViewEditAlias = new EventEmitter();
1588
+ this.onViewCreate = new EventEmitter();
1589
+ this.visibleChange = new EventEmitter();
1590
+ this.viewEditorShow = false;
1591
+ this.editingViewAlias = '';
1592
+ this.newViewAlias = '';
1593
+ }
1594
+ loadView(viewAlias) {
1595
+ this.onViewSelect.emit(viewAlias);
1596
+ }
1597
+ deleteView(viewAlias) {
1598
+ this.onViewDelete.emit(viewAlias);
1599
+ }
1600
+ updateView(viewAlias) {
1601
+ this.onViewUpdateData.emit(viewAlias);
1602
+ }
1603
+ updateViewActiveStartup(viewAlias) {
1604
+ this.onViewUpdateActiveStartup.emit(viewAlias);
1605
+ }
1606
+ createView(viewAlias) {
1607
+ const exists = this.tableViews_menuItems.some(item => item.label === viewAlias);
1608
+ if (exists) {
1609
+ this.notification.showToast("error", this.i18n.text("DUPLICATE VIEW NAME"), this.i18n.text("A view with alias \"{{value0}}\" already exists", { value0: viewAlias }));
1610
+ return;
1611
+ }
1612
+ this.onViewCreate.emit(viewAlias);
1613
+ }
1614
+ editViewAlias(viewAliasOld, viewAliasNew) {
1615
+ this.onViewEditAlias.emit({
1616
+ viewAliasOld: viewAliasOld,
1617
+ viewAliasNew: viewAliasNew
1618
+ });
1619
+ }
1620
+ showViewEditor(editingViewAlias = '') {
1621
+ this.editingViewAlias = editingViewAlias;
1622
+ this.newViewAlias = this.editingViewAlias;
1623
+ this.viewEditorShow = true;
1624
+ }
1625
+ closeModal() {
1626
+ this.visibleChange.emit(false);
1627
+ }
1628
+ createOrUpdateTableView() {
1629
+ this.viewEditorShow = false;
1630
+ if (this.editingViewAlias !== '') {
1631
+ this.editViewAlias(this.editingViewAlias, this.newViewAlias);
1632
+ }
1633
+ else {
1634
+ this.createView(this.newViewAlias);
1635
+ }
1636
+ }
1637
+ }
1638
+ ViewsManagement.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ViewsManagement, deps: [{ token: ECSPrimengTableNotificationService }], target: i0.ɵɵFactoryTarget.Component });
1639
+ ViewsManagement.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ViewsManagement, isStandalone: true, selector: "ecs-views-management", inputs: { visible: "visible", tableViews_menuItems: "tableViews_menuItems" }, outputs: { onViewSelect: "onViewSelect", onViewDelete: "onViewDelete", onViewUpdateData: "onViewUpdateData", onViewUpdateActiveStartup: "onViewUpdateActiveStartup", onViewEditAlias: "onViewEditAlias", onViewCreate: "onViewCreate", visibleChange: "visibleChange" }, ngImport: i0, template: "<p-dialog [(visible)]=\"visible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\"\r\n [closable]=\"true\" [closeOnEscape]=\"false\" [maximizable]=\"false\" [style]=\"{'min-width': '70vw', 'max-width': '70vw'}\" (onHide)=\"closeModal()\">\r\n <ng-template pTemplate=\"header\">\r\n <div>\r\n <span class=\"p-dialog-title\">{{ 'Table views' | ecsTranslate }}</span>\r\n </div>\r\n </ng-template>\r\n <div class=\"p-4 pt-0\">\r\n <p-table #dt_viewsDialog [value]=\"tableViews_menuItems\" [scrollable]=\"true\" size=\"small\" showGridlines stripedRows scrollHeight=\"400px\" [tableStyle]=\"{'min-width': '25rem'}\">\r\n <ng-template pTemplate=\"caption\">\r\n <div style=\"display: flex; justify-content: flex-end; align-items: center; width: 100%;\">\r\n <p-button icon=\"pi pi-plus\" [label]=\"'New view' | ecsTranslate\" (click)=\"showViewEditor()\" [pTooltip]=\"'New view' | ecsTranslate\" tooltipPosition=\"top\" [showDelay]=\"700\"></p-button>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\">\r\n <tr>\r\n <th style=\"text-align: center;\">{{ 'View name' | ecsTranslate }}</th>\r\n <th style=\"text-align: center; max-width: 220px; min-width: 220px; width: 220px;\">{{ 'Load on startup' | ecsTranslate }}</th>\r\n <th style=\"text-align: center; max-width: 220px; min-width: 220px; width: 220px;\">{{ 'Actions' | ecsTranslate }}</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData>\r\n <tr>\r\n <td>\r\n {{rowData.label}}\r\n </td>\r\n <td style=\"text-align: center; max-width: 220px; min-width: 220px; width: 220px;\">\r\n <p-checkbox [(ngModel)]=\"rowData.lastActive\" [binary]=\"true\" (onChange)=\"updateViewActiveStartup(rowData.label)\"></p-checkbox>\r\n </td>\r\n <td style=\"max-width: 220px; min-width: 220px; width: 220px; display: flex; justify-content: center; align-items: center; height: 100%;\">\r\n <button pButton icon=\"pi pi-upload\" (click)=\"loadView(rowData.label);\" [showDelay]=\"700\" [pTooltip]=\"'Restore' | ecsTranslate\" tooltipPosition=\"top\" size=\"small\" class=\"p-button-sm\" style=\"height: 28px; margin-right: 10px;\"></button>\r\n <button pButton icon=\"pi pi-save\" (click)=\"updateView(rowData.label);\" [showDelay]=\"700\" [pTooltip]=\"'Save' | ecsTranslate\" tooltipPosition=\"top\" size=\"small\" class=\"p-button-sm\" style=\"height: 28px; margin-right: 10px;\"></button>\r\n <button pButton icon=\"pi pi-pencil\" (click)=\"showViewEditor(rowData.label);\" [showDelay]=\"700\" [pTooltip]=\"'Edit' | ecsTranslate\" tooltipPosition=\"top\" size=\"small\" class=\"p-button-sm\" style=\"height: 28px; margin-right: 10px;\"></button>\r\n <button pButton icon=\"pi pi-trash\" (click)=\"deleteView(rowData.label);\" [showDelay]=\"700\" [pTooltip]=\"'Delete' | ecsTranslate\" tooltipPosition=\"top\" size=\"small\" class=\"p-button-sm\" style=\"height: 28px;\"></button>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"999\">{{ 'There are no views' | ecsTranslate }}</td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n <div style=\"display: flex; flex-direction: row; justify-content: space-between; align-items: center; margin-top: 10px;\">\r\n {{ 'Showing {{count}} views' | ecsTranslate: { count: tableViews_menuItems ? tableViews_menuItems.length : 0 } }}\r\n </div>\r\n </div>\r\n</p-dialog>\r\n\r\n<!--TABLE VIEW SAVE-->\r\n<p-dialog [(visible)]=\"viewEditorShow\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" [closeOnEscape]=\"false\" [closable]=\"false\" [maximizable]=\"false\" [style]=\"{'max-width': '60vw'}\">\r\n <ng-template pTemplate=\"header\">\r\n <div class=\"inline-flex align-items-center justify-content-center gap-2\">\r\n <span class=\"white-space-nowrap\"><b>{{ (editingViewAlias !== '' ? 'UPDATE VIEW' : 'CREATE NEW VIEW') | ecsTranslate }}</b></span>\r\n </div>\r\n </ng-template>\r\n <div style=\"display: flex; flex-direction: column; gap: 8px;\">\r\n <label for=\"newtableviewname\"><strong>{{ 'View alias' | ecsTranslate }}<span style=\"color: red;\">*</span></strong></label>\r\n <input \r\n pInputText \r\n id=\"newtableviewname\" \r\n aria-describedby=\"newtableviewname-help\" \r\n style=\"width: 400px;\"\r\n maxlength=\"30\"\r\n [(ngModel)]=\"newViewAlias\"/>\r\n </div>\r\n <ng-template pTemplate=\"footer\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <p-button (click)=\"viewEditorShow = false\" [label]=\"'Cancel' | ecsTranslate\" outlined=\"true\" [style]=\"{'margin-top': '20px'}\"></p-button>\r\n <p-button (click)=\"createOrUpdateTableView()\" [label]=\"(editingViewAlias !== '' ? 'Update' : 'Create') | ecsTranslate\" [style]=\"{'margin-top': '20px'}\"></p-button>\r\n </ng-template>\r\n</p-dialog>", dependencies: [{ kind: "pipe", type: ECSTableTranslatePipe, name: "ecsTranslate" }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i2.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i3$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "virtualRowHeight", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i5.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "component", type: i5.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i6$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i6$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i10.InputText, selector: "[pInputText]" }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i5$1.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "trueValue", "falseValue"], outputs: ["onChange"] }] });
1640
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ViewsManagement, decorators: [{
1641
+ type: Component,
1642
+ args: [{ selector: 'ecs-views-management', imports: [
1643
+ ECSTableTranslatePipe,
1644
+ DialogModule,
1645
+ TableModule,
1646
+ ButtonModule,
1647
+ CommonModule,
1648
+ FormsModule,
1649
+ TooltipModule,
1650
+ InputTextModule,
1651
+ CheckboxModule
1652
+ ], standalone: true, template: "<p-dialog [(visible)]=\"visible\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\"\r\n [closable]=\"true\" [closeOnEscape]=\"false\" [maximizable]=\"false\" [style]=\"{'min-width': '70vw', 'max-width': '70vw'}\" (onHide)=\"closeModal()\">\r\n <ng-template pTemplate=\"header\">\r\n <div>\r\n <span class=\"p-dialog-title\">{{ 'Table views' | ecsTranslate }}</span>\r\n </div>\r\n </ng-template>\r\n <div class=\"p-4 pt-0\">\r\n <p-table #dt_viewsDialog [value]=\"tableViews_menuItems\" [scrollable]=\"true\" size=\"small\" showGridlines stripedRows scrollHeight=\"400px\" [tableStyle]=\"{'min-width': '25rem'}\">\r\n <ng-template pTemplate=\"caption\">\r\n <div style=\"display: flex; justify-content: flex-end; align-items: center; width: 100%;\">\r\n <p-button icon=\"pi pi-plus\" [label]=\"'New view' | ecsTranslate\" (click)=\"showViewEditor()\" [pTooltip]=\"'New view' | ecsTranslate\" tooltipPosition=\"top\" [showDelay]=\"700\"></p-button>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\">\r\n <tr>\r\n <th style=\"text-align: center;\">{{ 'View name' | ecsTranslate }}</th>\r\n <th style=\"text-align: center; max-width: 220px; min-width: 220px; width: 220px;\">{{ 'Load on startup' | ecsTranslate }}</th>\r\n <th style=\"text-align: center; max-width: 220px; min-width: 220px; width: 220px;\">{{ 'Actions' | ecsTranslate }}</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData>\r\n <tr>\r\n <td>\r\n {{rowData.label}}\r\n </td>\r\n <td style=\"text-align: center; max-width: 220px; min-width: 220px; width: 220px;\">\r\n <p-checkbox [(ngModel)]=\"rowData.lastActive\" [binary]=\"true\" (onChange)=\"updateViewActiveStartup(rowData.label)\"></p-checkbox>\r\n </td>\r\n <td style=\"max-width: 220px; min-width: 220px; width: 220px; display: flex; justify-content: center; align-items: center; height: 100%;\">\r\n <button pButton icon=\"pi pi-upload\" (click)=\"loadView(rowData.label);\" [showDelay]=\"700\" [pTooltip]=\"'Restore' | ecsTranslate\" tooltipPosition=\"top\" size=\"small\" class=\"p-button-sm\" style=\"height: 28px; margin-right: 10px;\"></button>\r\n <button pButton icon=\"pi pi-save\" (click)=\"updateView(rowData.label);\" [showDelay]=\"700\" [pTooltip]=\"'Save' | ecsTranslate\" tooltipPosition=\"top\" size=\"small\" class=\"p-button-sm\" style=\"height: 28px; margin-right: 10px;\"></button>\r\n <button pButton icon=\"pi pi-pencil\" (click)=\"showViewEditor(rowData.label);\" [showDelay]=\"700\" [pTooltip]=\"'Edit' | ecsTranslate\" tooltipPosition=\"top\" size=\"small\" class=\"p-button-sm\" style=\"height: 28px; margin-right: 10px;\"></button>\r\n <button pButton icon=\"pi pi-trash\" (click)=\"deleteView(rowData.label);\" [showDelay]=\"700\" [pTooltip]=\"'Delete' | ecsTranslate\" tooltipPosition=\"top\" size=\"small\" class=\"p-button-sm\" style=\"height: 28px;\"></button>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"999\">{{ 'There are no views' | ecsTranslate }}</td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n <div style=\"display: flex; flex-direction: row; justify-content: space-between; align-items: center; margin-top: 10px;\">\r\n {{ 'Showing {{count}} views' | ecsTranslate: { count: tableViews_menuItems ? tableViews_menuItems.length : 0 } }}\r\n </div>\r\n </div>\r\n</p-dialog>\r\n\r\n<!--TABLE VIEW SAVE-->\r\n<p-dialog [(visible)]=\"viewEditorShow\" [modal]=\"true\" [draggable]=\"false\" [resizable]=\"false\" [closeOnEscape]=\"false\" [closable]=\"false\" [maximizable]=\"false\" [style]=\"{'max-width': '60vw'}\">\r\n <ng-template pTemplate=\"header\">\r\n <div class=\"inline-flex align-items-center justify-content-center gap-2\">\r\n <span class=\"white-space-nowrap\"><b>{{ (editingViewAlias !== '' ? 'UPDATE VIEW' : 'CREATE NEW VIEW') | ecsTranslate }}</b></span>\r\n </div>\r\n </ng-template>\r\n <div style=\"display: flex; flex-direction: column; gap: 8px;\">\r\n <label for=\"newtableviewname\"><strong>{{ 'View alias' | ecsTranslate }}<span style=\"color: red;\">*</span></strong></label>\r\n <input \r\n pInputText \r\n id=\"newtableviewname\" \r\n aria-describedby=\"newtableviewname-help\" \r\n style=\"width: 400px;\"\r\n maxlength=\"30\"\r\n [(ngModel)]=\"newViewAlias\"/>\r\n </div>\r\n <ng-template pTemplate=\"footer\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <p-button (click)=\"viewEditorShow = false\" [label]=\"'Cancel' | ecsTranslate\" outlined=\"true\" [style]=\"{'margin-top': '20px'}\"></p-button>\r\n <p-button (click)=\"createOrUpdateTableView()\" [label]=\"(editingViewAlias !== '' ? 'Update' : 'Create') | ecsTranslate\" [style]=\"{'margin-top': '20px'}\"></p-button>\r\n </ng-template>\r\n</p-dialog>" }]
1653
+ }], ctorParameters: function () { return [{ type: ECSPrimengTableNotificationService }]; }, propDecorators: { visible: [{
1654
+ type: Input
1655
+ }], tableViews_menuItems: [{
1656
+ type: Input
1657
+ }], onViewSelect: [{
1658
+ type: Output
1659
+ }], onViewDelete: [{
1660
+ type: Output
1661
+ }], onViewUpdateData: [{
1662
+ type: Output
1663
+ }], onViewUpdateActiveStartup: [{
1664
+ type: Output
1665
+ }], onViewEditAlias: [{
1666
+ type: Output
1667
+ }], onViewCreate: [{
1668
+ type: Output
1669
+ }], visibleChange: [{
1670
+ type: Output
1671
+ }] } });
1672
+
1673
+ class ECSPrimengTable {
1674
+ constructor(tableService, notification) {
1675
+ this.tableService = tableService;
1676
+ this.notification = notification;
1677
+ this.i18n = inject(ECSPrimengTableI18nService);
1678
+ this.changeDetector = inject(ChangeDetectorRef, { optional: true });
1679
+ this.stateScope = inject(ECSPrimengTableStateService, { optional: true });
1680
+ this.destroy$ = new Subject();
1681
+ this.initialStateApplied = false;
1682
+ this.destroyed = false;
1683
+ this.tableOptions = DEFAULT_TABLE_OPTIONS;
1684
+ this.treeStateRestored = false;
1685
+ this.onRowCheckboxChange = new EventEmitter(); // Emitter that returns the column selected and if it was selected or unselected
1686
+ this.onRowSelect = new EventEmitter;
1687
+ this.onRowUnselect = new EventEmitter;
1688
+ this.onDataEndUpdate = new EventEmitter();
1689
+ this.viewsModalShow = false;
1690
+ this.tableViewCurrentSelectedAlias = null;
1691
+ this.tableViewsFirstFetchDone = false;
1692
+ this.excelReportTitle = "";
1693
+ this.showExportModal = false;
1694
+ this.showColumnSelector = false;
1695
+ this.selectedRowsCheckbox = []; // An array to keep all the selected rows
1696
+ this.selectAllLoading = false;
1697
+ this.selectionQueryKey = '';
1698
+ this.globalSearchText = null; // The text used by the global search
1699
+ this.appliedGlobalSearchText = null;
1700
+ this.globalSearchManaged = false;
1701
+ this.tableViewsList = [];
1702
+ this.tableViews_menuItems = [];
1703
+ this.DataType = DataType;
1704
+ this.CellOverflowBehaviour = CellOverflowBehaviour;
1705
+ this.DataAlignHorizontal = DataAlignHorizontal;
1706
+ this.DataAlignVertical = DataAlignVertical;
1707
+ this.FrozenColumnAlign = FrozenColumnAlign;
1708
+ this.TableViewSaveMode = TableViewSaveMode;
1709
+ this.currentPage = 0; // The current page we are at
1710
+ this.currentRowsPerPage = 0; // The current rows per page selected
1711
+ this.allowedRowsPerPage = []; // The different values of rows per page allowed
1712
+ this.totalRecords = 0; // The number of total records that are available (taking into account the filters)
1713
+ this.totalRecordsNotFiltered = 0; // The total number of records available if no filters were applied
1714
+ this.dateFormat = "dd-MMM-yyyy HH:mm:ss zzzz";
1715
+ this.dateTimezone = "+00:00";
1716
+ this.dateCulture = "en-US";
1717
+ this.exportDateFormat = "dd-MMM-yyyy HH:mm:ss";
1718
+ this.columns = [];
1719
+ this.columnsCantBeHidden = [];
1720
+ this.columnsSelected = [];
1721
+ this.columnModalData = [];
1722
+ this.filteredColumnData = [];
1723
+ this.predefinedFiltersSelectedValuesCollection = {}; // Contains a collection of the predefined column filters selection (possible values come from 'predefinedFiltersCollection')
1724
+ this.tableLazyLoadEventInformation = {}; // Data of the last lazy load event of the table
1725
+ this.initialConfigurationFetched = false;
1726
+ this.maxViews = 0;
1727
+ this.deviceType = DeviceType.Desktop;
1728
+ this.columnSelectionCustomized = false;
1729
+ this.headerMenuItems = [];
1730
+ this.rowMenuItems = [];
1731
+ this.i18n.changes.pipe(takeUntil(this.destroy$)).subscribe(() => {
1732
+ this.headerMenuItems = this.translateMenuItems(this.headerMenuItems);
1733
+ this.rowMenuItems = this.translateMenuItems(this.rowMenuItems);
1734
+ this.changeDetector?.markForCheck();
1735
+ });
1736
+ }
1737
+ /** The applied query stays separate from text being typed during the debounce. */
1738
+ get effectiveGlobalSearchText() {
1739
+ return this.globalSearchManaged ? this.appliedGlobalSearchText : this.globalSearchText;
1740
+ }
1741
+ cancelGlobalSearch() {
1742
+ if (this.globalSearchTimer !== undefined)
1743
+ clearTimeout(this.globalSearchTimer);
1744
+ this.globalSearchTimer = undefined;
1745
+ }
1746
+ restoreGlobalSearch(value) {
1747
+ this.cancelGlobalSearch();
1748
+ this.globalSearchText = value;
1749
+ this.appliedGlobalSearchText = value || null;
1750
+ this.globalSearchManaged = true;
1751
+ }
1752
+ globalSearchOption(value) {
1753
+ return typeof value === 'number' && Number.isFinite(value) ? Math.max(0, Math.floor(value)) : 0;
1754
+ }
1755
+ onGlobalSearchInput(value) {
1756
+ if (this.destroyed)
1757
+ return;
1758
+ this.cancelGlobalSearch();
1759
+ if (!this.globalSearchManaged)
1760
+ this.appliedGlobalSearchText = this.globalSearchText || null;
1761
+ this.globalSearchManaged = true;
1762
+ this.globalSearchText = value;
1763
+ const minLength = this.globalSearchOption(this.tableOptions.globalFilter?.minLength);
1764
+ const delay = this.globalSearchOption(this.tableOptions.globalFilter?.debounceTime);
1765
+ const trimmed = value.trim();
1766
+ const effective = trimmed.length >= minLength ? (trimmed || null) : null;
1767
+ if (effective === (this.appliedGlobalSearchText?.trim() || null))
1768
+ return;
1769
+ const apply = () => {
1770
+ this.globalSearchTimer = undefined;
1771
+ if (this.destroyed)
1772
+ return;
1773
+ this.appliedGlobalSearchText = effective;
1774
+ this.currentPage = 0;
1775
+ this.dt.first = 0;
1776
+ if (minLength === 0 && delay === 0) {
1777
+ // Keep PrimeNG's existing filtering behavior when the feature is not configured.
1778
+ this.dt.filterGlobal(value, 'contains');
1779
+ }
1780
+ else {
1781
+ // Own the global delay so it is not added to PrimeNG's column-filter delay.
1782
+ this.dt.filters = { ...this.dt.filters, global: { value: effective, matchMode: 'contains' } };
1783
+ this.fetchTableData({ ...this.tableLazyLoadEventInformation, first: 0,
1784
+ rows: this.currentRowsPerPage, filters: this.dt.filters });
1785
+ }
1786
+ };
1787
+ if (effective === null || delay === 0)
1788
+ apply();
1789
+ else
1790
+ this.globalSearchTimer = setTimeout(apply, delay);
1791
+ }
1792
+ ngOnInit() {
1793
+ this.i18n.connectPrimeNG();
1794
+ if (this.tableOptions.tree)
1795
+ this.treeState = new TreeTableState(this.tableOptions.tree);
1796
+ this.validateStatePersistence();
1797
+ this.updateResponsiveViewport();
1798
+ this.fetchTableConfiguration();
1799
+ }
1800
+ ngAfterViewInit() {
1801
+ this.calculateScrollHeight();
1802
+ this.changeDetector?.detectChanges();
1803
+ }
1804
+ get compactHeader() {
1805
+ return !!this.tableOptions.responsive?.headerMenu && this.deviceType !== DeviceType.Desktop;
1806
+ }
1807
+ get compactRows() {
1808
+ return !!this.tableOptions.responsive?.rowMenu && this.deviceType !== DeviceType.Desktop;
1809
+ }
1810
+ get actionColumnWidth() {
1811
+ return this.compactRows ? 56 : (this.tableOptions.rows?.action?.width ?? 150);
1812
+ }
1813
+ getColumnHeaderGroups(columns) {
1814
+ if (!columns.some(column => column.headerGroup?.trim()))
1815
+ return [];
1816
+ const groups = [];
1817
+ for (const column of columns) {
1818
+ const label = column.headerGroup?.trim() ?? '';
1819
+ const frozenColumnAlign = column.frozenColumnAlign ?? FrozenColumnAlign.Noone;
1820
+ const previous = groups[groups.length - 1];
1821
+ if (previous && previous.label === label && previous.frozenColumnAlign === frozenColumnAlign) {
1822
+ previous.colspan++;
1823
+ }
1824
+ else {
1825
+ groups.push({ field: column.field, label, colspan: 1, frozenColumnAlign });
1826
+ }
1827
+ }
1828
+ return groups;
1829
+ }
1830
+ isInitiallyVisible(column) {
1831
+ if (!column.canBeHidden)
1832
+ return true;
1833
+ if (column.startHidden)
1834
+ return false;
1835
+ const devices = column.visibleOnlyIn;
1836
+ return !devices?.length || devices.some(device => device === this.deviceType || String(device).toLowerCase() === DeviceType[this.deviceType].toLowerCase());
1837
+ }
1838
+ updateResponsiveViewport() {
1839
+ const options = this.tableOptions.responsive;
1840
+ const tablet = options?.tabletMinWidth ?? 768;
1841
+ const desktop = options?.desktopMinWidth ?? 1200;
1842
+ if (!Number.isFinite(tablet) || !Number.isFinite(desktop) || tablet <= 0 || desktop <= tablet) {
1843
+ throw new Error('ECS table responsive widths must be finite and 0 < tabletMinWidth < desktopMinWidth.');
1844
+ }
1845
+ const width = typeof window === 'undefined' ? desktop : window.innerWidth;
1846
+ const next = width < tablet ? DeviceType.Mobile : width < desktop ? DeviceType.Tablet : DeviceType.Desktop;
1847
+ if (next === this.deviceType)
1848
+ return;
1849
+ this.deviceType = next;
1850
+ this.responsiveHeaderMenu?.hide();
1851
+ this.responsiveRowMenu?.hide();
1852
+ if (!this.initialConfigurationFetched || this.columnSelectionCustomized ||
1853
+ !this.columns.some(column => column.visibleOnlyIn?.length))
1854
+ return;
1855
+ const selected = this.columns.filter(column => column.canBeHidden && this.isInitiallyVisible(column));
1856
+ const shown = this.tableService.orderColumnsWithFrozens(this.columnsCantBeHidden.concat(selected));
1857
+ const previous = this.tableOptions.columns?.shown ?? [];
1858
+ if (shown.length === previous.length && shown.every((column, i) => column.field === previous[i].field))
1859
+ return;
1860
+ this.columnsSelected = selected;
1861
+ this.tableOptions.columns.shown = shown;
1862
+ this.showColumnSelector = false;
1863
+ // Request newly visible fields without resetting filters, sorting or pagination.
1864
+ if (this.initialStateApplied)
1865
+ this.fetchTableData(this.tableLazyLoadEventInformation);
1866
+ }
1867
+ buttonVisible(button, row) {
1868
+ return (button.visibleCondition?.(row) ?? true) &&
1869
+ ((button.enabledCondition?.(row) ?? true) || !button.conditionFailHide);
1870
+ }
1871
+ hasRowMenuActions(row) {
1872
+ return (this.tableOptions.rows?.action?.buttons ?? []).some(button => this.buttonVisible(button, row));
1873
+ }
1874
+ buttonMenuItems(buttons, row) {
1875
+ return buttons.filter(button => this.buttonVisible(button, row)).map((button, index) => ({
1876
+ label: button.label || button.tooltip || 'Action {{number}}',
1877
+ _uiParams: { number: index + 1 },
1878
+ icon: button.icon,
1879
+ disabled: !(button.enabledCondition?.(row) ?? true),
1880
+ command: () => {
1881
+ if (this.buttonVisible(button, row) && (button.enabledCondition?.(row) ?? true) && button.action) {
1882
+ this.tableService.handleButtonsClick(button.action, row);
1883
+ }
1884
+ }
1885
+ }));
1886
+ }
1887
+ closeResponsiveMenus() {
1888
+ this.responsiveHeaderMenu?.hide();
1889
+ this.responsiveRowMenu?.hide();
1890
+ }
1891
+ openRowMenu(event, row) {
1892
+ event.stopPropagation();
1893
+ this.responsiveHeaderMenu?.hide();
1894
+ if (this.responsiveRowMenu?.visible && this.rowMenuRow === row) {
1895
+ this.responsiveRowMenu.hide();
1896
+ return;
1897
+ }
1898
+ // Use one overlay for all rows. Replacing the model binds every action to this row.
1899
+ this.rowMenuRow = row;
1900
+ this.rowMenuItems = this.translateMenuItems(this.buttonMenuItems(this.tableOptions.rows?.action?.buttons ?? [], row));
1901
+ const wasOpen = this.responsiveRowMenu?.visible;
1902
+ this.responsiveRowMenu?.show(event);
1903
+ if (wasOpen)
1904
+ this.responsiveRowMenu?.alignOverlay();
1905
+ }
1906
+ translateMenuItems(items) {
1907
+ return items.map(item => {
1908
+ if (item['_literalLabel'])
1909
+ return item;
1910
+ const key = item['_uiLabelKey'] ?? item.label;
1911
+ return { ...item, _uiLabelKey: key, label: this.i18n.text(key, item['_uiParams']) };
1912
+ });
1913
+ }
1914
+ openHeaderMenu(event) {
1915
+ this.responsiveRowMenu?.hide();
1916
+ const options = this.tableOptions;
1917
+ const items = [];
1918
+ if (options.columns?.selectorEnabled)
1919
+ items.push({ label: 'Modify columns', icon: options.columns.selectorIcon, command: () => this.columnSelectorShow() });
1920
+ if (options.header?.clearSortsEnabled)
1921
+ items.push({ label: 'Clear sorts', icon: options.header.clearSortsIcon, disabled: !this.hasToClearSorts(this.dt), command: () => this.clearSorts(this.dt) });
1922
+ if (options.header?.clearFiltersEnabled)
1923
+ items.push({ label: 'Clear filters', icon: options.header.clearFiltersIcon, disabled: !this.hasToClearFilters(this.dt, this.globalSearchText), command: () => this.clearFilters(this.dt) });
1924
+ if (this.tableViewsEnabled()) {
1925
+ items.push({ label: this.tableViewCurrentSelectedAlias || options.views?.noViewSelectedText || 'Select a view', _literalLabel: !!this.tableViewCurrentSelectedAlias, icon: 'pi pi-bookmark', command: () => { this.viewsModalShow = true; } });
1926
+ items.push({ label: 'Apply view again', icon: options.views?.reloadViewButtonIcon || 'pi pi-refresh', disabled: !this.tableViewCurrentSelectedAlias, command: () => this.viewLoad(this.tableViewCurrentSelectedAlias) });
1927
+ }
1928
+ if (options.excelReport?.url?.trim())
1929
+ items.push({ label: 'Export to Excel', icon: 'pi pi-file-excel', command: () => this.openExcelExport() });
1930
+ if (options.resetTableView?.enabled)
1931
+ items.push({ label: 'Reset table view', icon: options.resetTableView.icon, command: () => this.resetTableView() });
1932
+ items.push({ label: 'Refresh data', icon: 'pi pi-refresh', command: () => this.refreshData(event) });
1933
+ items.push(...this.buttonMenuItems(options.header?.buttons ?? [], null));
1934
+ this.headerMenuItems = this.translateMenuItems(items);
1935
+ this.responsiveHeaderMenu?.toggle(event);
1936
+ }
1937
+ validateStatePersistence() {
1938
+ if (!this.tableOptions.statePersistence?.enabled)
1939
+ return;
1940
+ if (!this.tableOptions.statePersistence.key?.trim() || !this.stateScope) {
1941
+ throw new Error('ECS table statePersistence requires a non-empty key and ECSPrimengTableStateService provided on a parent scope component.');
1942
+ }
1943
+ }
1944
+ ngOnDestroy() {
1945
+ this.cancelGlobalSearch();
1946
+ this.destroyed = true;
1947
+ this.destroy$.next();
1948
+ this.destroy$.complete();
1949
+ this.treeState?.cancel();
1950
+ const options = this.tableOptions.statePersistence;
1951
+ const key = options?.key?.trim();
1952
+ if (!key || !this.stateScope)
1953
+ return;
1954
+ if (!options?.enabled) {
1955
+ this.stateScope.clear(key);
1956
+ return;
1957
+ }
1958
+ if (!this.initialStateApplied || !this.dt)
1959
+ return;
1960
+ const filters = structuredClone(this.dt.filters ?? {});
1961
+ delete filters['global'];
1962
+ delete filters['selector'];
1963
+ this.stateScope.set(key, {
1964
+ configurationUrl: this.tableOptions.urlTableConfiguration ?? '',
1965
+ dataUrl: this.tableOptions.urlTableData ?? '',
1966
+ filters,
1967
+ multiSortMeta: structuredClone(this.dt.multiSortMeta ?? []),
1968
+ globalSearchText: this.effectiveGlobalSearchText,
1969
+ currentPage: this.currentPage,
1970
+ currentRowsPerPage: this.currentRowsPerPage,
1971
+ treeMode: this.treeState?.mode,
1972
+ treeExpandedKeys: this.treeState ? [...this.treeState.expanded] : undefined,
1973
+ treeChildPages: this.treeState?.snapshotPages()
1974
+ });
1975
+ }
1976
+ restoreNavigationState() {
1977
+ this.validateStatePersistence();
1978
+ const options = this.tableOptions.statePersistence;
1979
+ const key = options?.key?.trim();
1980
+ if (!options?.enabled) {
1981
+ if (key)
1982
+ this.stateScope?.clear(key);
1983
+ return false;
1984
+ }
1985
+ const state = this.stateScope.get(key);
1986
+ if (!state)
1987
+ return false;
1988
+ if (state.configurationUrl !== this.tableOptions.urlTableConfiguration ||
1989
+ state.dataUrl !== this.tableOptions.urlTableData || state.treeMode !== this.treeState?.mode) {
1990
+ this.stateScope.clear(key);
1991
+ return false;
1992
+ }
1993
+ const fields = new Set(this.columns.map(column => column.field));
1994
+ const filters = {};
1995
+ for (const [field, filter] of Object.entries(state.filters)) {
1996
+ if (fields.has(field))
1997
+ filters[field] = filter;
1998
+ }
1999
+ this.currentRowsPerPage = this.allowedRowsPerPage.includes(state.currentRowsPerPage)
2000
+ ? state.currentRowsPerPage : this.currentRowsPerPage;
2001
+ this.currentPage = this.currentRowsPerPage === state.currentRowsPerPage
2002
+ ? Math.max(0, state.currentPage) : 0;
2003
+ this.restoreGlobalSearch(state.globalSearchText);
2004
+ this.treeState?.restore(state.treeExpandedKeys, state.treeChildPages);
2005
+ this.treeStateRestored = !!this.treeState;
2006
+ if (this.globalSearchText) {
2007
+ filters['global'] = { value: this.globalSearchText, matchMode: 'contains' };
2008
+ }
2009
+ const sorts = state.multiSortMeta.filter(sort => fields.has(sort.field));
2010
+ this.dt.filters = { ...this.dt.filters, ...structuredClone(filters) };
2011
+ // Keep initialStateApplied=false while PrimeNG setters can emit lazy-load events.
2012
+ this.dt.multiSortMeta = sorts;
2013
+ this.dt.first = this.currentPage * this.currentRowsPerPage;
2014
+ this.dt.rows = this.currentRowsPerPage;
2015
+ this.tableLazyLoadEventInformation = {
2016
+ first: this.dt.first,
2017
+ rows: this.currentRowsPerPage,
2018
+ filters: this.dt.filters,
2019
+ multiSortMeta: sorts
2020
+ };
2021
+ this.restorePredefinedSelections(filters);
2022
+ return true;
2023
+ }
2024
+ restorePredefinedSelections(filters) {
2025
+ this.predefinedFiltersSelectedValuesCollection = {};
2026
+ for (const column of this.columns) {
2027
+ const key = column.filterPredefinedValuesName;
2028
+ if (!key)
2029
+ continue;
2030
+ const criteria = filters[column.field];
2031
+ const value = (Array.isArray(criteria) ? criteria[0] : criteria)?.value;
2032
+ if (value === null || value === undefined)
2033
+ continue;
2034
+ this.predefinedFiltersSelectedValuesCollection[key] =
2035
+ (this.tableOptions.predefinedFilters?.[key] ?? []).filter(option => Array.isArray(value) ? value.includes(option.value) : value === option.value);
2036
+ }
2037
+ }
2038
+ onResize() {
2039
+ this.updateResponsiveViewport();
2040
+ this.calculateScrollHeight();
2041
+ }
2042
+ calculateScrollHeight() {
2043
+ if (this.tableOptions.verticalScroll?.cssFormula) {
2044
+ return;
2045
+ }
2046
+ if (this.tableOptions.verticalScroll?.fitToContainer && this.tableContainer && this.paginatorContainer && this.headerContainer) {
2047
+ const containerRect = this.tableContainer.nativeElement.getBoundingClientRect();
2048
+ const paginatorHeight = this.paginatorContainer.nativeElement.offsetHeight;
2049
+ const headerHeight = this.headerContainer.nativeElement.offsetHeight;
2050
+ const viewportHeight = window.innerHeight;
2051
+ const topOffset = containerRect.top + window.scrollY;
2052
+ this.tableOptions.verticalScroll.height = (viewportHeight - topOffset - paginatorHeight - headerHeight) - 60;
2053
+ }
2054
+ }
2055
+ get scrollHeightValue() {
2056
+ if (this.tableOptions.verticalScroll?.cssFormula) {
2057
+ return this.tableOptions.verticalScroll.cssFormula;
2058
+ }
2059
+ const height = this.tableOptions.verticalScroll?.height;
2060
+ return height && height > 0 ? `${height}px` : '';
2061
+ }
2062
+ /**
2063
+ * Updates the table data and, if needed, retrieves the initial table configuration from an external source.
2064
+ *
2065
+ * Also allows resetting the table to its original state before any user manipulations.
2066
+ *
2067
+ * @param {boolean} [resetTableView=false] Optional.
2068
+ * - `true`: resets the table state before loading data.
2069
+ * - `false`: refreshes data using the current configuration (and retrieves initial configuration if necessary).
2070
+ *
2071
+ * **_Behavior_**
2072
+ * - The table is automatically set to `isActive = true`.
2073
+ * - If the initial configuration has not been fetched, it will fetch it and then update the data.
2074
+ * - If the initial configuration is already fetched, it will just update the data.
2075
+ * - If `resetTableView` is true and the configuration is already initialized, the table will be reset to its original state before updating the data.
2076
+ */
2077
+ updateData(resetTableView = false) {
2078
+ this.tableOptions.isActive = true; // Enable table actions: the table is now active and can perform updates
2079
+ if (!this.initialConfigurationFetched || resetTableView) { // If initial configuration hasn't been fetched yet or a reset is explicitly requested
2080
+ if (this.initialConfigurationFetched && resetTableView) { // Reset the table only if it was already initialized and a reset is explicitly requested
2081
+ this.resetTableView(); // Reset table state (filters, pagination, sorting, etc.) and then refresh data
2082
+ }
2083
+ else { // We only need to get the table configuration without reseting the view
2084
+ this.fetchTableConfiguration(); // Fetch the initial table configuration before updating data
2085
+ }
2086
+ }
2087
+ else { // Table is already initialized and no reset requested, just refresh the data
2088
+ this.fetchTableData(this.tableLazyLoadEventInformation); // Update table rows using the last lazy load event
2089
+ }
2090
+ }
2091
+ canFetchData() {
2092
+ return !this.destroyed
2093
+ && !!this.tableOptions.isActive
2094
+ && !!this.tableOptions.urlTableConfiguration?.trim()
2095
+ && !!this.tableOptions.urlTableData?.trim();
2096
+ }
2097
+ fetchTableConfiguration(resetTableView = false) {
2098
+ if (!this.canFetchData()) {
2099
+ return;
2100
+ }
2101
+ this.tableService.fetchTableConfiguration(this.tableOptions.urlTableConfiguration)
2102
+ .pipe(takeUntil(this.destroy$)).subscribe({
2103
+ next: (response) => {
2104
+ this.handleTableConfigurationResponse(response.body, resetTableView);
2105
+ },
2106
+ error: (err) => this.tableService.handleTableError(err, 'Columns Error')
2107
+ });
2108
+ }
2109
+ handleTableConfigurationResponse(body, resetTableView = false) {
2110
+ this.allowedRowsPerPage = body.allowedItemsPerPage; // Update the number of rows allowed per page
2111
+ this.currentRowsPerPage = Math.min(...this.allowedRowsPerPage); // Update the current rows per page to use the minimum value of allowed rows per page by default
2112
+ this.columns = body.columnsInfo; // Update columns with fetched data
2113
+ this.columnsCantBeHidden = this.columns.filter((col) => !col.canBeHidden); // Filter columns that cannot be hidden
2114
+ this.columnSelectionCustomized = false;
2115
+ this.columnsSelected = this.columns.filter(col => col.canBeHidden && this.isInitiallyVisible(col)); // Selected columns that are not hidden by default
2116
+ this.tableOptions.columns.shown = this.tableService.orderColumnsWithFrozens(this.columnsCantBeHidden.concat(this.columnsSelected));
2117
+ this.dateFormat = body.dateFormat;
2118
+ this.dateTimezone = body.dateTimezone;
2119
+ this.dateCulture = body.dateCulture;
2120
+ this.exportDateFormat = body.exportDateFormat;
2121
+ this.currentPage = 0;
2122
+ this.initialConfigurationFetched = true;
2123
+ this.maxViews = body.maxViews;
2124
+ if (resetTableView) {
2125
+ this.tableOptions.isActive = false;
2126
+ this.clearFilters(this.dt, true);
2127
+ this.clearSorts(this.dt, true);
2128
+ this.dt.tableWidthState = this.initialTableWidth;
2129
+ this.dt.columnWidthsState = this.initialColumnWidths;
2130
+ this.dt.restoreColumnWidths();
2131
+ this.tableLazyLoadEventInformation.multiSortMeta = [];
2132
+ this.tableOptions.isActive = true;
2133
+ this.initialStateApplied = true;
2134
+ this.tableLazyLoadEventInformation.first = 0;
2135
+ this.tableLazyLoadEventInformation.rows = this.currentRowsPerPage;
2136
+ this.fetchTableData(this.tableLazyLoadEventInformation);
2137
+ }
2138
+ else {
2139
+ setTimeout(() => {
2140
+ if (this.destroyed)
2141
+ return;
2142
+ this.initialColumnWidths = this.tableService.computeColumnWidths(this.dt);
2143
+ this.initialTableWidth = this.tableService.computeTableWidth(this.dt);
2144
+ }, 0);
2145
+ this.fetchTableViews();
2146
+ }
2147
+ }
2148
+ refreshData(event) {
2149
+ this.fetchTableData(this.tableLazyLoadEventInformation);
2150
+ }
2151
+ tableViewsEnabled() {
2152
+ const views = this.tableOptions.views;
2153
+ if (views?.saveMode === TableViewSaveMode.None) { // saveMode must be different from noone
2154
+ return false;
2155
+ }
2156
+ if (!views?.saveKey?.trim()) { // saveKey must exist and must not be empty after trim
2157
+ return false;
2158
+ }
2159
+ if (this.maxViews <= 0) { // maxViews must be greater than 0
2160
+ return false;
2161
+ }
2162
+ if (views?.saveMode === TableViewSaveMode.DatabaseStorage) { // If saveMode is database, urlGet and urlSave must exist and must not be empty after trim
2163
+ if (!views?.urlGet?.trim() || !views?.urlSave?.trim()) {
2164
+ return false;
2165
+ }
2166
+ }
2167
+ return true; // All checks passed, views are enabled
2168
+ }
2169
+ fetchTableViews() {
2170
+ if (!this.tableViewsEnabled()) {
2171
+ this.startInitialDataLoad();
2172
+ return;
2173
+ }
2174
+ const tableViews = this.tableService.fetchTableViews(this.tableOptions.views.saveMode, this.tableOptions.views.urlGet, this.tableOptions.views.saveKey);
2175
+ if (tableViews instanceof Observable) {
2176
+ tableViews.pipe(takeUntil(this.destroy$)).subscribe({
2177
+ next: (response) => {
2178
+ let parsedResult = response.body.map((item) => ({
2179
+ viewAlias: item.viewAlias,
2180
+ viewData: JSON.parse(item.viewData),
2181
+ lastActive: item.lastActive
2182
+ }));
2183
+ this.tableViewListProcess(parsedResult);
2184
+ },
2185
+ error: (err) => {
2186
+ this.tableService.handleTableError(err, 'Views get error');
2187
+ this.startInitialDataLoad();
2188
+ }
2189
+ });
2190
+ }
2191
+ else {
2192
+ this.tableViewListProcess(tableViews);
2193
+ }
2194
+ }
2195
+ tableViewListProcess(tableViews) {
2196
+ this.tableViewsList = [...tableViews];
2197
+ if (this.tableViewsList.length > 0) {
2198
+ this.tableService.sortViews(this.tableViewsList);
2199
+ }
2200
+ this.tableViews_menuItems = [...this.tableService.updateViewsMenuItems(this.tableViewsList)];
2201
+ this.startInitialDataLoad();
2202
+ }
2203
+ startInitialDataLoad() {
2204
+ if (this.initialStateApplied || this.destroyed)
2205
+ return;
2206
+ const restored = this.restoreNavigationState();
2207
+ this.initialStateApplied = true;
2208
+ const viewToStartup = restored ? undefined : this.tableViewsList.find(v => v.lastActive);
2209
+ if (viewToStartup) { // If there is a view that needs to be loaded on startup
2210
+ this.viewLoad(viewToStartup.viewAlias);
2211
+ }
2212
+ else {
2213
+ this.fetchTableData(this.tableLazyLoadEventInformation);
2214
+ }
2215
+ }
2216
+ viewLoad(tableViewAlias) {
2217
+ const viewToLoad = this.tableViewsList.find(v => v.viewAlias === tableViewAlias);
2218
+ if (!viewToLoad) {
2219
+ this.notification.showToast("error", this.i18n.text("VIEW TO LOAD DOESN'T EXIST"), this.i18n.text("The view to load doesn't exist"));
2220
+ return;
2221
+ }
2222
+ this.columnSelectionCustomized = true;
2223
+ let viewData = viewToLoad.viewData;
2224
+ this.treeState?.restore(viewData.treeExpandedKeys, viewData.treeChildPages);
2225
+ this.treeStateRestored = !!this.treeState;
2226
+ this.columnsSelected = viewData.columnsShown
2227
+ .map(data => this.columns.find((col) => col.field === data.field))
2228
+ .filter((col) => col !== undefined)
2229
+ .filter(col => !this.columnsCantBeHidden.includes(col));
2230
+ this.tableOptions.columns.shown = this.tableService.orderColumnsWithFrozens(this.columnsCantBeHidden.concat(this.columnsSelected));
2231
+ this.currentPage = viewData.currentPage;
2232
+ this.currentRowsPerPage = viewData.currentRowsPerPage;
2233
+ this.restoreGlobalSearch(viewData.globalSearchText);
2234
+ this.tableOptions.isActive = false;
2235
+ this.tableLazyLoadEventInformation.multiSortMeta = [...(viewData.multiSortMeta ?? [])];
2236
+ this.dt.multiSortMeta = [...(viewData.multiSortMeta ?? [])];
2237
+ this.dt.sortMultiple();
2238
+ this.dt.first = this.currentPage * this.currentRowsPerPage;
2239
+ this.dt.rows = this.currentRowsPerPage;
2240
+ this.tableLazyLoadEventInformation.first = this.dt.first;
2241
+ this.tableLazyLoadEventInformation.rows = this.currentRowsPerPage;
2242
+ this.tableOptions.isActive = true;
2243
+ this.tableLazyLoadEventInformation.filters = structuredClone(viewData.filters);
2244
+ this.dt.filters = structuredClone(viewData.filters);
2245
+ this.restorePredefinedSelections(viewData.filters);
2246
+ this.dt.tableWidthState = viewData.tableWidth;
2247
+ this.dt.columnWidthsState = viewData.columnsWidth;
2248
+ this.tableViewCurrentSelectedAlias = tableViewAlias;
2249
+ this.notification.showToast("info", this.i18n.text("TABLE VIEW RESTORED"), this.i18n.text("The table view '{{value0}}' has been restored.", { value0: this.tableViewCurrentSelectedAlias }));
2250
+ this.viewsModalShow = false;
2251
+ this.fetchTableData(this.tableLazyLoadEventInformation);
2252
+ }
2253
+ viewCreate(viewAlias) {
2254
+ if (this.tableViewsList.length >= this.maxViews) {
2255
+ this.notification.showToast("error", this.i18n.text("NO MORE VIEWS ALLOWED"), this.i18n.text("You have created the maximum number of allowed views for this table"));
2256
+ return;
2257
+ }
2258
+ let viewData = this.generateViewData();
2259
+ let newView = {
2260
+ lastActive: false,
2261
+ viewAlias: viewAlias,
2262
+ viewData: viewData
2263
+ };
2264
+ this.tableViewsList.push(newView);
2265
+ this.tableService.sortViews(this.tableViewsList);
2266
+ this.tableViews_menuItems = [...this.tableService.updateViewsMenuItems(this.tableViewsList)];
2267
+ this.tableViewCurrentSelectedAlias = viewAlias;
2268
+ this.viewsSave(0);
2269
+ }
2270
+ viewDelete(viewAlias) {
2271
+ const index = this.tableViewsList.findIndex(v => v.viewAlias === viewAlias);
2272
+ if (index === -1) {
2273
+ this.notification.showToast("error", this.i18n.text("Table view delete failed"), this.i18n.text("The table view could not be deleted since it was not found."));
2274
+ return;
2275
+ }
2276
+ this.tableViewsList.splice(index, 1);
2277
+ this.tableViews_menuItems = [...this.tableService.updateViewsMenuItems(this.tableViewsList)];
2278
+ if (this.tableViewCurrentSelectedAlias === viewAlias) {
2279
+ this.tableViewCurrentSelectedAlias = null;
2280
+ }
2281
+ this.viewsSave(3);
2282
+ }
2283
+ viewEditAlias(event) {
2284
+ const index = this.tableViewsList.findIndex(v => v.viewAlias === event.viewAliasOld);
2285
+ if (index === -1) {
2286
+ this.notification.showToast("error", this.i18n.text("Table view alias change failed"), this.i18n.text("The table view alias could not be changed since it was not found."));
2287
+ return;
2288
+ }
2289
+ this.tableViewsList[index].viewAlias = event.viewAliasNew;
2290
+ this.tableService.sortViews(this.tableViewsList);
2291
+ this.tableViews_menuItems = [...this.tableService.updateViewsMenuItems(this.tableViewsList)];
2292
+ if (this.tableViewCurrentSelectedAlias === event.viewAliasOld) {
2293
+ this.tableViewCurrentSelectedAlias = event.viewAliasNew;
2294
+ }
2295
+ this.viewsSave(2);
2296
+ }
2297
+ viewUpdateData(viewAlias) {
2298
+ const index = this.tableViewsList.findIndex(v => v.viewAlias === viewAlias);
2299
+ if (index === -1) {
2300
+ this.notification.showToast("error", this.i18n.text("Table view not found"), this.i18n.text("The table view to update data from was not found."));
2301
+ return;
2302
+ }
2303
+ let viewData = this.generateViewData();
2304
+ this.tableViewsList[index].viewData = viewData;
2305
+ this.viewsSave(1);
2306
+ }
2307
+ viewUpdateActiveStartup(viewAlias) {
2308
+ const index = this.tableViewsList.findIndex(v => v.viewAlias === viewAlias);
2309
+ if (index === -1) {
2310
+ this.notification.showToast("error", this.i18n.text("Table view not found"), this.i18n.text("The table view to update data from was not found."));
2311
+ return;
2312
+ }
2313
+ let newStatus = !this.tableViewsList[index].lastActive;
2314
+ this.tableViewsList.forEach(v => v.lastActive = false);
2315
+ this.tableViewsList[index].lastActive = newStatus;
2316
+ this.tableViews_menuItems = [...this.tableService.updateViewsMenuItems(this.tableViewsList)];
2317
+ this.viewsSave(4);
2318
+ }
2319
+ viewsSave(endMessage) {
2320
+ let tableView = JSON.stringify(this.tableViewsList);
2321
+ switch (this.tableOptions.views.saveMode) {
2322
+ case TableViewSaveMode.SessionStorage:
2323
+ sessionStorage.setItem(this.tableOptions.views.saveKey, tableView);
2324
+ break;
2325
+ case TableViewSaveMode.LocalStorage:
2326
+ localStorage.setItem(this.tableOptions.views.saveKey, tableView);
2327
+ break;
2328
+ case TableViewSaveMode.DatabaseStorage:
2329
+ const saveObsv = this.tableService.viewsSaveToDatabase(this.tableViewsList, this.tableOptions.views.urlSave, this.tableOptions.views.saveKey);
2330
+ saveObsv.subscribe({
2331
+ next: (response) => {
2332
+ this.viewsSaveEnd(endMessage);
2333
+ },
2334
+ error: (err) => this.tableService.handleTableError(err, 'Views save error')
2335
+ });
2336
+ return;
2337
+ default:
2338
+ this.notification.showToast("error", this.i18n.text("NOT IMPLEMENTED"), this.i18n.text("This type os save view has not been implemented yet."));
2339
+ return;
2340
+ }
2341
+ this.viewsSaveEnd(endMessage);
2342
+ }
2343
+ viewsSaveEnd(endMessage) {
2344
+ this.changeDetector?.markForCheck();
2345
+ switch (endMessage) {
2346
+ case 0: // NEW VIEW
2347
+ this.notification.showToast("info", this.i18n.text("Table view created"), this.i18n.text("New table view has been created."));
2348
+ this.viewsModalShow = false;
2349
+ break;
2350
+ case 1: // UPDATE VIEW
2351
+ this.notification.showToast("info", this.i18n.text("Table view data updated"), this.i18n.text("The table view data was updated."));
2352
+ break;
2353
+ case 2: // UPDATE ALIAS
2354
+ this.notification.showToast("info", this.i18n.text("Table view name updated"), this.i18n.text("The table view alias was updated."));
2355
+ break;
2356
+ case 3: // DELETE VIEW
2357
+ this.notification.showToast("info", this.i18n.text("Table view delete"), this.i18n.text("The table view was deleted."));
2358
+ break;
2359
+ case 4: // DELETE VIEW
2360
+ this.notification.showToast("info", this.i18n.text("Table view active on startup"), this.i18n.text("Changed the view that will be active on startup."));
2361
+ break;
2362
+ }
2363
+ }
2364
+ fetchTableData(event) {
2365
+ if (!this.canFetchData()) {
2366
+ return;
2367
+ }
2368
+ if (!this.initialConfigurationFetched || !this.initialStateApplied) {
2369
+ return;
2370
+ }
2371
+ this.responsiveRowMenu?.hide();
2372
+ this.tableLazyLoadEventInformation = event; // Store the event information for later use
2373
+ if (event.rows != null && event.rows !== undefined) {
2374
+ this.currentRowsPerPage = event.rows;
2375
+ }
2376
+ if (event.first != null && event.first !== undefined && event.rows != null && event.rows !== undefined) {
2377
+ this.currentPage = event.first / event.rows;
2378
+ }
2379
+ let filtersWithoutGlobalAndSelectedRows = this.modifyFiltersWithoutGlobalAndSelectedRows(this.tableLazyLoadEventInformation.filters); // Create filters excluding the global filter
2380
+ filtersWithoutGlobalAndSelectedRows = this.revertDateTimeZoneFilters(filtersWithoutGlobalAndSelectedRows);
2381
+ const requestData = {
2382
+ page: this.currentPage,
2383
+ pageSize: this.currentRowsPerPage,
2384
+ sort: this.tableLazyLoadEventInformation.multiSortMeta,
2385
+ filter: filtersWithoutGlobalAndSelectedRows,
2386
+ globalFilter: this.effectiveGlobalSearchText,
2387
+ columns: this.tableOptions.columns.shown.map(col => col.field),
2388
+ dateFormat: this.dateFormat,
2389
+ dateTimezone: this.dateTimezone,
2390
+ dateCulture: this.dateCulture,
2391
+ exportDateFormat: this.exportDateFormat
2392
+ };
2393
+ const selectionKey = JSON.stringify({ ...requestData, page: 0, pageSize: 0, sort: null });
2394
+ if (selectionKey !== this.selectionQueryKey)
2395
+ this.matchingSelectionKeys = undefined;
2396
+ this.selectionQueryKey = selectionKey;
2397
+ this.selectionQuery = structuredClone(requestData);
2398
+ if (this.treeState) {
2399
+ const tree = this.treeState;
2400
+ if (!this.treeStateRestored)
2401
+ tree.restore([...tree.expanded], tree.snapshotPages());
2402
+ this.treeStateRestored = false;
2403
+ const structural = [tree.options.keyExpr, tree.options.parentIdExpr, tree.options.hasItemsExpr, 'rowID'];
2404
+ requestData.columns = [...new Set([...requestData.columns, ...structural.filter((field) => !!field)])];
2405
+ this.treeQuery = structuredClone(requestData);
2406
+ const loading = tree.load(this.currentPage, this.currentRowsPerPage, this.treeFetcher(requestData));
2407
+ this.tableOptions.data = [];
2408
+ loading.then(updated => {
2409
+ if (updated && !this.destroyed)
2410
+ this.syncTreeRows();
2411
+ }).catch(error => {
2412
+ if (!this.destroyed)
2413
+ this.tableService.handleTableError(error, 'Tree data error');
2414
+ }).finally(() => {
2415
+ if (!this.destroyed) {
2416
+ this.changeDetector?.markForCheck();
2417
+ this.onDataEndUpdate.emit();
2418
+ }
2419
+ });
2420
+ return;
2421
+ }
2422
+ this.tableService.fetchTableData(this.tableOptions.urlTableData, requestData)
2423
+ .pipe(takeUntil(this.destroy$), finalize(() => {
2424
+ if (this.destroyed)
2425
+ return;
2426
+ this.onDataEndUpdate.emit(); // This is always executed after data update.
2427
+ }))
2428
+ .subscribe({
2429
+ next: (response) => this.handleTableDataResponse(response.body),
2430
+ error: (err) => this.tableService.handleTableError(err, 'Columns Error')
2431
+ });
2432
+ }
2433
+ modifyFiltersWithoutGlobalAndSelectedRows(filters, overrideOption = -1) {
2434
+ let filtersWithoutGlobalAndSelectedRows = structuredClone(filters ?? {}); // Create a copy of filters to delete the global.
2435
+ if (filtersWithoutGlobalAndSelectedRows.hasOwnProperty('global')) { // If there is an entry with the global filter
2436
+ delete filtersWithoutGlobalAndSelectedRows['global']; // Remove the global filter
2437
+ }
2438
+ this.selectorRowFilterBuilder(filtersWithoutGlobalAndSelectedRows, overrideOption);
2439
+ return filtersWithoutGlobalAndSelectedRows; // Return the filters without global array
2440
+ }
2441
+ resetTableView() {
2442
+ this.cancelGlobalSearch();
2443
+ const key = this.tableOptions.statePersistence?.key?.trim();
2444
+ if (key)
2445
+ this.stateScope?.clear(key);
2446
+ this.treeState?.restore();
2447
+ this.treeStateRestored = !!this.treeState;
2448
+ this.initialStateApplied = false;
2449
+ this.tableViewCurrentSelectedAlias = '';
2450
+ this.fetchTableConfiguration(true);
2451
+ }
2452
+ selectorRowFilterBuilder(filtersWithoutGlobalAndSelectedRows, overrideOption = -1) {
2453
+ if (filtersWithoutGlobalAndSelectedRows.hasOwnProperty('selector') || overrideOption === 1 || overrideOption === 2) {
2454
+ const selectorFilter = filtersWithoutGlobalAndSelectedRows['selector']?.[0];
2455
+ let filterType = null;
2456
+ if (overrideOption < 0 || overrideOption > 2) {
2457
+ filterType = selectorFilter?.value ?? null;
2458
+ }
2459
+ else {
2460
+ switch (overrideOption) {
2461
+ case 0: // All
2462
+ filterType = null;
2463
+ break;
2464
+ case 1: // Only selected rows
2465
+ filterType = true;
2466
+ break;
2467
+ case 2: // Only NOT selected
2468
+ filterType = false;
2469
+ break;
2470
+ }
2471
+ }
2472
+ if (!filtersWithoutGlobalAndSelectedRows.hasOwnProperty('rowID')) {
2473
+ filtersWithoutGlobalAndSelectedRows['rowID'] = [
2474
+ {
2475
+ "value": null,
2476
+ "matchMode": "in",
2477
+ "operator": "or"
2478
+ }
2479
+ ];
2480
+ }
2481
+ const idFilter = filtersWithoutGlobalAndSelectedRows['rowID'][0];
2482
+ if (filterType === true) {
2483
+ idFilter.matchMode = "in";
2484
+ idFilter.value = this.selectedRowsCheckbox;
2485
+ }
2486
+ else if (filterType === false) {
2487
+ idFilter.operator = "and";
2488
+ idFilter.matchMode = "notIn";
2489
+ idFilter.value = this.selectedRowsCheckbox;
2490
+ }
2491
+ else if (filterType === null) {
2492
+ idFilter.value = null;
2493
+ idFilter.matchMode = "in";
2494
+ }
2495
+ }
2496
+ }
2497
+ revertDateTimeZoneFilters(inputFilter) {
2498
+ this.tableOptions.columns.shown.forEach((column) => {
2499
+ if (column.dataType === DataType.Date) { // If its date type
2500
+ if (inputFilter.hasOwnProperty(column.field)) {
2501
+ const originalDate = inputFilter[column.field][0].value;
2502
+ if (originalDate !== null && originalDate instanceof Date) {
2503
+ const utcDate = new Date(Date.UTC(originalDate.getFullYear(), originalDate.getMonth(), originalDate.getDate()));
2504
+ inputFilter[column.field][0].value = utcDate;
2505
+ }
2506
+ }
2507
+ }
2508
+ });
2509
+ return inputFilter;
2510
+ }
2511
+ handleTableDataResponse(body) {
2512
+ this.tableOptions.data = body.data; // Update the table data
2513
+ this.totalRecords = body.totalRecords; // Update the total number of records
2514
+ this.totalRecordsNotFiltered = body.totalRecordsNotFiltered; // Update the total records not filtered
2515
+ this.currentPage = body.page; // Update the current page
2516
+ }
2517
+ generateViewData() {
2518
+ const view = this.tableService.viewGenerateData(this.dt, this.effectiveGlobalSearchText, this.currentPage, this.currentRowsPerPage, this.modifyFiltersWithoutGlobalAndSelectedRows.bind(this));
2519
+ if (this.treeState) {
2520
+ view.treeExpandedKeys = [...this.treeState.expanded];
2521
+ view.treeChildPages = this.treeState.snapshotPages();
2522
+ }
2523
+ return view;
2524
+ }
2525
+ treeFetcher(query) {
2526
+ return async (request) => {
2527
+ const response = await firstValueFrom(this.tableService.fetchTableData(this.tableOptions.urlTableData, { ...structuredClone(query), ...request }).pipe(takeUntil(this.destroy$)));
2528
+ if (!response.body)
2529
+ throw new Error('Empty tree response.');
2530
+ return response.body;
2531
+ };
2532
+ }
2533
+ syncTreeRows() {
2534
+ const tree = this.treeState;
2535
+ this.tableOptions.data = tree.visible;
2536
+ this.totalRecords = tree.totalRecords;
2537
+ this.totalRecordsNotFiltered = tree.totalRecordsNotFiltered;
2538
+ this.currentPage = tree.page;
2539
+ this.changeDetector?.markForCheck();
2540
+ }
2541
+ async toggleTreeRow(event, row) {
2542
+ event.stopPropagation();
2543
+ if (!this.treeState || !this.treeQuery || this.treeState.loading)
2544
+ return;
2545
+ try {
2546
+ const update = this.treeState.toggle(row, this.treeFetcher(this.treeQuery));
2547
+ this.changeDetector?.markForCheck();
2548
+ await update;
2549
+ if (!this.destroyed)
2550
+ this.syncTreeRows();
2551
+ }
2552
+ catch (error) {
2553
+ if (!this.destroyed)
2554
+ this.tableService.handleTableError(error, 'Tree data error');
2555
+ }
2556
+ finally {
2557
+ if (!this.destroyed) {
2558
+ this.changeDetector?.markForCheck();
2559
+ this.onDataEndUpdate.emit();
2560
+ }
2561
+ }
2562
+ }
2563
+ async loadMoreTreeRows(event, row) {
2564
+ event.stopPropagation();
2565
+ if (!this.treeState || !this.treeQuery || this.treeState.loading)
2566
+ return;
2567
+ try {
2568
+ await this.treeState.loadMore(row, this.treeFetcher(this.treeQuery));
2569
+ if (!this.destroyed)
2570
+ this.syncTreeRows();
2571
+ }
2572
+ catch (error) {
2573
+ if (!this.destroyed)
2574
+ this.tableService.handleTableError(error, 'Tree data error');
2575
+ }
2576
+ }
2577
+ get treeColumn() {
2578
+ const columns = this.tableOptions.columns?.shown ?? [];
2579
+ return columns.find(column => column.field === this.treeState?.options.column)?.field ?? columns[0]?.field;
2580
+ }
2581
+ treePageChange(event) {
2582
+ this.fetchTableData({ ...this.tableLazyLoadEventInformation, first: event.first ?? 0,
2583
+ rows: event.rows ?? this.currentRowsPerPage });
2584
+ }
2585
+ clearFilters(dt, force = false, onlyGlobalFilter = false) {
2586
+ this.cancelGlobalSearch();
2587
+ let hasToClear = this.hasToClearFilters(dt, this.globalSearchText, force);
2588
+ if (hasToClear) {
2589
+ if (!onlyGlobalFilter) {
2590
+ this.predefinedFiltersSelectedValuesCollection = {};
2591
+ for (const key in dt.filters) {
2592
+ if (dt.filters.hasOwnProperty(key)) {
2593
+ const filters = dt.filters[key];
2594
+ if (Array.isArray(filters)) {
2595
+ filters.forEach(filter => {
2596
+ filter.value = null; // Set value to null
2597
+ });
2598
+ }
2599
+ else {
2600
+ filters.value = null; // Set value to null
2601
+ }
2602
+ }
2603
+ }
2604
+ let filters = { ...this.dt.filters };
2605
+ dt.columns?.forEach(element => {
2606
+ dt.filter(null, element.field, element.matchMode);
2607
+ });
2608
+ this.dt.filters = filters;
2609
+ }
2610
+ this.restoreGlobalSearch(null);
2611
+ if (this.globalSearchOption(this.tableOptions.globalFilter?.minLength) > 0 ||
2612
+ this.globalSearchOption(this.tableOptions.globalFilter?.debounceTime) > 0) {
2613
+ this.currentPage = 0;
2614
+ dt.first = 0;
2615
+ dt.filters = { ...dt.filters, global: { value: null, matchMode: 'contains' } };
2616
+ this.fetchTableData({ ...this.tableLazyLoadEventInformation, first: 0,
2617
+ rows: this.currentRowsPerPage, filters: dt.filters });
2618
+ }
2619
+ else
2620
+ dt.filterGlobal('', '');
2621
+ }
2622
+ }
2623
+ clearSorts(dt, force = false) {
2624
+ let hasToClear = this.hasToClearSorts(dt, force);
2625
+ if (hasToClear) {
2626
+ dt.multiSortMeta = [];
2627
+ dt.sortMultiple();
2628
+ }
2629
+ }
2630
+ hasToClearSorts(dt, force = false) {
2631
+ let hasToClear = false;
2632
+ const hasSorts = (dt.multiSortMeta && dt.multiSortMeta.length > 0);
2633
+ if (force || hasSorts) {
2634
+ hasToClear = true;
2635
+ }
2636
+ return hasToClear;
2637
+ }
2638
+ hasToClearFilters(dt, globalSearchText, force = false) {
2639
+ let hasToClear = false;
2640
+ const filtersWithoutGlobalAndSelectedRows = this.modifyFiltersWithoutGlobalAndSelectedRows(dt.filters);
2641
+ const hasFilters = this.hasFilters(filtersWithoutGlobalAndSelectedRows);
2642
+ const hasGlobalFilter = (globalSearchText && globalSearchText.trim() !== "");
2643
+ if (force || hasFilters || hasGlobalFilter) {
2644
+ hasToClear = true;
2645
+ }
2646
+ return hasToClear;
2647
+ }
2648
+ /**
2649
+ * Determines whether there are active filters based on the provided filter rules.
2650
+ *
2651
+ * @param {any} filterRules An object representing filter rules for each column.
2652
+ * The keys are column names, and the values are arrays of filter rules.
2653
+ * Each filter rule has the following properties:
2654
+ * - `field`: The field or property name of the column.
2655
+ * - `value`: The filter value entered by the user.
2656
+ * - Other properties depending on the type of filter (e.g., `matchMode` for string filters).
2657
+ * @returns {boolean} `true` if at least one active filter is found, otherwise `false`.
2658
+ */
2659
+ hasFilters(filterRules) {
2660
+ for (const columnName of Object.keys(filterRules)) { // Iterate over each column name in the filter rules
2661
+ const columnFilters = filterRules[columnName]; // Get the filter rules for the current column
2662
+ for (const filterRule of columnFilters) { // Iterate over each filter rule for the current column
2663
+ if (filterRule.value !== null && filterRule.value !== "") { // Check if the filter value is not null or an empty string
2664
+ return true; // At least one active filter found
2665
+ }
2666
+ }
2667
+ }
2668
+ return false; // No active filters found
2669
+ }
2670
+ getColumnStyle(col, headerCols = false) {
2671
+ return this.tableService.getColumnStyle(col, headerCols);
2672
+ }
2673
+ getPredefinedFilterValues(columnKeyName) {
2674
+ return this.tableOptions.predefinedFilters?.[columnKeyName] || []; // Return the predefined filter values or an empty array if the option name does not exist
2675
+ }
2676
+ getFrozenColumnAlignAsText(frozenColumnAlign) {
2677
+ return frozenColumnAlignAsText(frozenColumnAlign);
2678
+ }
2679
+ getDataTypeAsText(dataType) {
2680
+ return dataTypeAsText(dataType);
2681
+ }
2682
+ /**
2683
+ * Updates the filters of a PrimeNG data table based on predefined filter changes.
2684
+ *
2685
+ * @param {string} filterName - The name of the filter to be updated.
2686
+ * @param {IPrimengPredefinedFilter[]} selectedValues - An array of selected predefined filter values.
2687
+ */
2688
+ onPredefinedFilterChange(filterName, selectedValues) {
2689
+ const filters = { ...this.dt.filters }; // Create a shallow copy of the current filters to avoid mutating the original filters directly
2690
+ const newValue = selectedValues && selectedValues.length ? selectedValues.map(value => value.value) : null; // Convert empty selection to null so PrimeNG removes the filter instead of applying an empty array
2691
+ if (Array.isArray(filters[filterName])) { // Check if the filter for the given filterName is an array
2692
+ filters[filterName].forEach(criteria => {
2693
+ criteria.value = newValue; // Update the value of each criteria with the values from selectedValues
2694
+ });
2695
+ }
2696
+ else if (filters[filterName]) { // Check if the filter for the given filterName exists and is not an array
2697
+ const criteria = filters[filterName]; // Cast the filter criteria to FilterMetadata
2698
+ criteria.value = newValue; // Update the value of the criteria with the values from selectedValues
2699
+ }
2700
+ this.dt.filters = filters; // Update the data table's filters with the modified filters object
2701
+ this.dt._filter(); // Trigger the filtering operation on the data table to apply the new filters
2702
+ }
2703
+ /**
2704
+ * Checks if the provided column metadata matches a specific style of the predefined filters
2705
+ * that need to be applied to an item on a row.
2706
+ *
2707
+ * @param {IprimengColumnsMetadata} colMetadata - The metadata of the column being checked.
2708
+ * @param {any} value - The value to be matched against the predefined filter values.
2709
+ * @returns {any} The matching predefined filter value if found, otherwise null.
2710
+ */
2711
+ getPredfinedFilterMatch(colMetadata, value) {
2712
+ if (colMetadata.filterPredefinedValuesName && colMetadata.filterPredefinedValuesName.length > 0) { // Check if the column uses predefined filter values
2713
+ const options = this.getPredefinedFilterValues(colMetadata.filterPredefinedValuesName); // Get the predefined filter values based on the name
2714
+ return options.find(option => option.value === value); // Return the matching option if found
2715
+ }
2716
+ return null; // Return null if the column does not use predefined filter values
2717
+ }
2718
+ copyToClipboardStart(event) {
2719
+ if ((this.tableOptions.copyToClipboardTime ?? 0) > 0) {
2720
+ const cellContent = event.target.innerText;
2721
+ this.copyCellDataTimer = setTimeout(() => {
2722
+ navigator.clipboard.writeText(cellContent).then(() => {
2723
+ this.notification.clearToasts();
2724
+ this.notification.showToast("info", this.i18n.text("CELL CONTENT COPIED"), this.i18n.text("The cell content has been copied to your clipboard."));
2725
+ }).catch(err => {
2726
+ this.notification.clearToasts();
2727
+ this.notification.showToast("error", this.i18n.text("CELL CONTENT COPIED"), this.i18n.text("The cell content failed to copy to your clipboard with error: {{value0}}", { value0: err }));
2728
+ });
2729
+ }, (this.tableOptions.copyToClipboardTime ?? 0) * 1000);
2730
+ }
2731
+ }
2732
+ copyToClipboardCancel() {
2733
+ if ((this.tableOptions.copyToClipboardTime ?? 0) > 0) {
2734
+ clearTimeout(this.copyCellDataTimer);
2735
+ }
2736
+ }
2737
+ getDataAlignHorizontalAsText(dataAlignHorizontal) {
2738
+ return dataAlignHorizontalAsText(dataAlignHorizontal);
2739
+ }
2740
+ getDataAlignVerticalAsText(dataAlignVertical) {
2741
+ return dataAlignVerticalAsText(dataAlignVertical);
2742
+ }
2743
+ isRowCheckboxSelected(rowID) {
2744
+ return this.selectedRowsCheckbox.includes(rowID);
2745
+ }
2746
+ get allMatchingRowsSelected() {
2747
+ if (!this.matchingSelectionKeys?.length)
2748
+ return false;
2749
+ const selected = new Set(this.selectedRowsCheckbox);
2750
+ return this.matchingSelectionKeys.every(key => selected.has(key));
2751
+ }
2752
+ get matchingRowsPartiallySelected() {
2753
+ if (this.allMatchingRowsSelected)
2754
+ return false;
2755
+ if (!this.matchingSelectionKeys)
2756
+ return this.selectedRowsCheckbox.length > 0;
2757
+ const selected = new Set(this.selectedRowsCheckbox);
2758
+ return this.matchingSelectionKeys.some(key => selected.has(key));
2759
+ }
2760
+ async toggleAllMatchingRows(checked) {
2761
+ const options = this.tableOptions.rows?.checkboxSelector;
2762
+ if (!options?.enabled || !options.selectAllEnabled || !options.urlSelectAll ||
2763
+ !this.selectionQuery || this.selectAllLoading)
2764
+ return;
2765
+ const queryKey = this.selectionQueryKey;
2766
+ this.selectAllLoading = true;
2767
+ try {
2768
+ const response = await firstValueFrom(this.tableService.fetchSelectionKeys(options.urlSelectAll, structuredClone(this.selectionQuery)).pipe(takeUntil(this.destroy$)));
2769
+ if (this.destroyed || queryKey !== this.selectionQueryKey)
2770
+ return;
2771
+ if (!Array.isArray(response.body) || response.body.some(key => typeof key !== 'string' && typeof key !== 'number'))
2772
+ throw new Error('Invalid selection identifiers.');
2773
+ const disabledKeys = new Set((this.tableOptions.data ?? [])
2774
+ .filter(row => !(options.enabledCondition?.(row) ?? true)).map(row => row.rowID));
2775
+ const keys = [...new Set(response.body)].filter(key => !disabledKeys.has(key));
2776
+ this.matchingSelectionKeys = keys;
2777
+ const selected = new Set(this.selectedRowsCheckbox);
2778
+ const changed = keys.filter(key => selected.has(key) !== checked);
2779
+ for (const key of changed) {
2780
+ if (checked)
2781
+ selected.add(key);
2782
+ else
2783
+ selected.delete(key);
2784
+ }
2785
+ this.selectedRowsCheckbox = [...selected];
2786
+ for (const rowID of changed)
2787
+ this.onRowCheckboxChange.emit({ rowID, selected: checked });
2788
+ }
2789
+ catch (error) {
2790
+ if (!this.destroyed)
2791
+ this.tableService.handleTableError(error, 'Selection error');
2792
+ }
2793
+ finally {
2794
+ this.selectAllLoading = false;
2795
+ this.changeDetector?.markForCheck();
2796
+ }
2797
+ }
2798
+ onRowChekboxChange(event, rowID) {
2799
+ if (event.checked) { // Add the selected item
2800
+ if (!this.selectedRowsCheckbox.includes(rowID))
2801
+ this.selectedRowsCheckbox.push(rowID);
2802
+ }
2803
+ else { // Remove the selected item
2804
+ this.selectedRowsCheckbox = this.selectedRowsCheckbox.filter(selectedId => selectedId !== rowID);
2805
+ }
2806
+ this.onRowCheckboxChange.emit({
2807
+ rowID: rowID,
2808
+ selected: event.checked
2809
+ });
2810
+ }
2811
+ rowSelect(event) {
2812
+ this.onRowSelect.emit({
2813
+ rowID: event.data.rowID,
2814
+ rowData: event.data
2815
+ });
2816
+ }
2817
+ rowUnselect(event) {
2818
+ this.onRowUnselect.emit({
2819
+ rowID: event.data.rowID,
2820
+ rowData: event.data
2821
+ });
2822
+ }
2823
+ pageChange(event) {
2824
+ this.currentPage = event.rows ? event.first / event.rows : 0;
2825
+ this.currentRowsPerPage = event.rows ? event.rows : 0;
2826
+ }
2827
+ columnSelectorShow() {
2828
+ this.tableOptions.columns?.selectorOrderByColumnName;
2829
+ let tempData = this.columns.map(column => {
2830
+ const isSelected = this.columnsSelected.some(selectedColumn => selectedColumn.field === column.field) || this.columnsCantBeHidden.some(selectedColumn => selectedColumn.field === column.field);
2831
+ const isSelectDisabled = this.columnsCantBeHidden.some(selectedColumn => selectedColumn.field === column.field);
2832
+ return {
2833
+ field: column.field,
2834
+ header: column.header,
2835
+ selected: isSelected,
2836
+ selectDisabled: isSelectDisabled,
2837
+ cellOverflowBehaviour: column.cellOverflowBehaviour,
2838
+ cellOverflowBehaviourDisabled: !column.cellOverflowBehaviourAllowUserEdit,
2839
+ dataAlignHorizontal: column.dataAlignHorizontal,
2840
+ dataAlignHorizontalDisabled: !column.dataAlignHorizontalAllowUserEdit,
2841
+ dataAlignVertical: column.dataAlignVertical,
2842
+ dataAlignVerticalDisabled: !column.dataAlignVerticalAllowUserEdit
2843
+ };
2844
+ });
2845
+ this.columnModalData = [...tempData];
2846
+ this.filteredColumnData = this.columnModalData;
2847
+ this.showColumnSelector = true;
2848
+ }
2849
+ applyColumnModalChanges(selectedColumns) {
2850
+ this.columnSelectionCustomized = true;
2851
+ const existingColumns = this.dt.columns;
2852
+ const columnsToKeep = new Set();
2853
+ this.columnsCantBeHidden.forEach(col => columnsToKeep.add(col.field));
2854
+ selectedColumns.forEach(col => columnsToKeep.add(col.field));
2855
+ const finalColumns = [];
2856
+ existingColumns.forEach(col => {
2857
+ if (columnsToKeep.has(col.field)) {
2858
+ finalColumns.push(col);
2859
+ }
2860
+ });
2861
+ selectedColumns.forEach(col => {
2862
+ const matchingColumn = this.columns.find(c => c.field === col.field);
2863
+ if (matchingColumn && !finalColumns.find(c => c.field === matchingColumn.field)) {
2864
+ finalColumns.push(matchingColumn);
2865
+ }
2866
+ });
2867
+ let prevColsToShow = this.tableOptions.columns.shown;
2868
+ this.tableOptions.columns.shown = this.tableService.orderColumnsWithFrozens(finalColumns);
2869
+ let sameColumnsAsBefore = prevColsToShow.length === this.tableOptions.columns.shown.length &&
2870
+ prevColsToShow.every((prevCol, index) => prevCol.field === this.tableOptions.columns.shown[index].field);
2871
+ this.columnsSelected = this.tableOptions.columns.shown.filter(column => !this.columnsCantBeHidden.some(nonSelectable => nonSelectable.field === column.field));
2872
+ this.updateColumnsSpecialProperties(this.columnModalData);
2873
+ if (!sameColumnsAsBefore) {
2874
+ this.tableOptions.isActive = false;
2875
+ this.clearSorts(this.dt, true);
2876
+ this.clearFilters(this.dt, true, false);
2877
+ setTimeout(() => {
2878
+ this.tableOptions.isActive = true;
2879
+ }, 1);
2880
+ }
2881
+ }
2882
+ updateColumnsSpecialProperties(columnsSource) {
2883
+ const allColumns = [this.columns, this.tableOptions.columns.shown, this.columnsSelected, this.columnsCantBeHidden];
2884
+ const columnModalDataMap = new Map(columnsSource.map((item) => [item.field, {
2885
+ cellOverflowBehaviour: item.cellOverflowBehaviour,
2886
+ dataAlignHorizontal: item.dataAlignHorizontal,
2887
+ dataAlignVertical: item.dataAlignVertical,
2888
+ width: item.width
2889
+ }]));
2890
+ const updatedFields = new Set(); // To track updated fields
2891
+ allColumns.forEach((columnList) => {
2892
+ columnList.forEach((col) => {
2893
+ if (columnModalDataMap.has(col.field) && !updatedFields.has(col.field)) {
2894
+ const columnData = columnModalDataMap.get(col.field);
2895
+ if (columnData) {
2896
+ col.cellOverflowBehaviour = columnData.cellOverflowBehaviour;
2897
+ col.dataAlignHorizontal = columnData.dataAlignHorizontal;
2898
+ col.dataAlignVertical = columnData.dataAlignVertical;
2899
+ col.width = columnData.width;
2900
+ updatedFields.add(col.field);
2901
+ }
2902
+ }
2903
+ });
2904
+ });
2905
+ }
2906
+ openExcelExport() {
2907
+ const defaultTitle = this.tableOptions.excelReport?.defaultTitle?.trim();
2908
+ const allowEdit = this.tableOptions.excelReport?.titleAllowUserEdit === true;
2909
+ this.excelReportTitle = this.i18n.text((!defaultTitle && !allowEdit) ? 'Report' : defaultTitle);
2910
+ this.showExportModal = true;
2911
+ }
2912
+ generateExcelReport(event) {
2913
+ if (!this.tableOptions.excelReport?.url?.trim()) {
2914
+ return;
2915
+ }
2916
+ let filtersWithoutGlobalAndSelectedRows = this.modifyFiltersWithoutGlobalAndSelectedRows(this.tableLazyLoadEventInformation.filters, event.selectedRows); // Create filters excluding the global filter
2917
+ filtersWithoutGlobalAndSelectedRows = this.revertDateTimeZoneFilters(filtersWithoutGlobalAndSelectedRows);
2918
+ const filtersMustBeApplied = (event.selectedRows === 1 || event.selectedRows === 2)
2919
+ ? true
2920
+ : event.applyFilters;
2921
+ const requestData = {
2922
+ page: this.currentPage,
2923
+ pageSize: this.currentRowsPerPage,
2924
+ sort: this.tableLazyLoadEventInformation.multiSortMeta,
2925
+ filter: filtersWithoutGlobalAndSelectedRows,
2926
+ globalFilter: this.effectiveGlobalSearchText,
2927
+ columns: this.tableOptions.columns.shown.map(col => col.field),
2928
+ dateFormat: this.dateFormat,
2929
+ dateTimezone: this.dateTimezone,
2930
+ dateCulture: this.dateCulture,
2931
+ exportDateFormat: this.exportDateFormat,
2932
+ allColumns: event.allColumns,
2933
+ applyFilters: filtersMustBeApplied,
2934
+ applySorts: event.applySorts,
2935
+ filename: event.filename,
2936
+ useIconInBools: event.useIconInBools
2937
+ };
2938
+ if (this.treeState)
2939
+ Object.assign(requestData, { expandedKeys: [...this.treeState.expanded] });
2940
+ this.tableService.fetchExcelReport(this.tableOptions.excelReport.url, requestData).subscribe({
2941
+ next: (response) => {
2942
+ this.tableService.downloadFile(response.body, event.filename, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
2943
+ this.showExportModal = false;
2944
+ },
2945
+ error: (err) => this.tableService.handleTableError(err, 'Excel export error')
2946
+ });
2947
+ }
2948
+ updateIconBlobsForCollections() {
2949
+ Object.keys(this.tableOptions.predefinedFilters ?? {}).forEach(key => {
2950
+ const filters = this.tableOptions.predefinedFilters?.[key];
2951
+ if (Array.isArray(filters) && filters.length > 0) {
2952
+ filters.forEach(filter => {
2953
+ if (filter.imageBlobSourceEndpoint && !filter.imageBlob) {
2954
+ filter.imageBlob = undefined;
2955
+ filter.imageBlobFetchError = false;
2956
+ this.tableService.getIconBlob(filter.imageBlobSourceEndpoint).subscribe({
2957
+ next: (response) => {
2958
+ filter.imageBlob = response.body;
2959
+ this.showExportModal = false;
2960
+ },
2961
+ error: () => {
2962
+ filter.imageBlobFetchError = true;
2963
+ }
2964
+ });
2965
+ }
2966
+ });
2967
+ }
2968
+ else {
2969
+ console.warn(`Filters for key ${key} is not an array:`, filters);
2970
+ }
2971
+ });
2972
+ }
2973
+ ecsTrack1(index, button) { return button; }
2974
+ ecsTrack2(index, button) { return index; }
2975
+ ecsTrack3(index, group) { return group.field; }
2976
+ ecsTrack4(index, col) { return col.header; }
2977
+ ecsTrack5(index, col) { return col.field; }
2978
+ }
2979
+ ECSPrimengTable.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTable, deps: [{ token: ECSPrimengTableService }, { token: ECSPrimengTableNotificationService }], target: i0.ɵɵFactoryTarget.Component });
2980
+ ECSPrimengTable.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ECSPrimengTable, isStandalone: true, selector: "ecs-primeng-table", inputs: { tableOptions: "tableOptions" }, outputs: { onRowCheckboxChange: "onRowCheckboxChange", onRowSelect: "onRowSelect", onRowUnselect: "onRowUnselect", onDataEndUpdate: "onDataEndUpdate" }, host: { listeners: { "document:keydown.escape": "closeResponsiveMenus()", "window:resize": "onResize()" } }, viewQueries: [{ propertyName: "dt", first: true, predicate: ["dt"], descendants: true }, { propertyName: "tableContainer", first: true, predicate: ["tableContainer"], descendants: true }, { propertyName: "headerContainer", first: true, predicate: ["headerContainer"], descendants: true }, { propertyName: "paginatorContainer", first: true, predicate: ["paginatorContainer"], descendants: true }, { propertyName: "responsiveHeaderMenu", first: true, predicate: ["responsiveHeaderMenu"], descendants: true }, { propertyName: "responsiveRowMenu", first: true, predicate: ["responsiveRowMenu"], descendants: true }], ngImport: i0, template: "<div #tableContainer>\r\n <p-table #dt\r\n styleClass=\"p-datatable-sm p-datatable-gridlines p-datatable-striped\"\r\n sortMode=\"multiple\"\r\n [resizableColumns]=\"true\" columnResizeMode=\"expand\"\r\n [reorderableColumns]=\"true\"\r\n [scrollable]=\"true\" [scrollHeight]=\"scrollHeightValue\"\r\n [columns]=\"tableOptions.columns?.shown ?? []\" [value]=\"tableOptions.data ?? []\" dataKey=\"rowID\" \r\n [paginator]=\"!treeState\" [loading]=\"treeState?.loading ?? false\" paginatorDropdownAppendTo=\"body\" [first]=\"currentPage * currentRowsPerPage\" [rows]=\"currentRowsPerPage\" [totalRecords]=\"totalRecords\"\r\n [rowsPerPageOptions]=\"allowedRowsPerPage\" [showCurrentPageReport]=\"false\" (onPage)=\"pageChange($event)\"\r\n [selectionMode]=\"tableOptions.rows?.singleSelector?.enabled ? 'single' : ''\" [metaKeySelection]=\"tableOptions.rows?.singleSelector?.metakey ?? true\" [(selection)]=\"rowSelection\" (onRowSelect)=\"rowSelect($event)\" (onRowUnselect)=\"rowUnselect($event)\"\r\n [lazy]=\"true\" (onLazyLoad)=\"fetchTableData($event)\">\r\n\r\n <!--TEMPLATE FOR THE ACTIONS HEADER COLUMN-->\r\n <ng-template #actionColumnHeaderTemplate>\r\n <ng-container *ngIf=\"(tableOptions.rows?.action?.buttons?.length ?? 0) > 0\">\r\n <th [ngStyle]=\"{\r\n 'text-align': 'center',\r\n 'vertical-align': 'middle',\r\n 'max-width': actionColumnWidth + 'px',\r\n 'min-width': actionColumnWidth + 'px',\r\n 'width': actionColumnWidth + 'px'\r\n }\"\r\n pResizableColumn [pResizableColumnDisabled]=\"!tableOptions.rows?.action?.resizable\" pFrozenColumn [frozen]=\"tableOptions.rows?.action?.frozen ?? false\"\r\n [alignFrozen]=\"getFrozenColumnAlignAsText(tableOptions.rows?.action?.positionRight ? FrozenColumnAlign.Right : FrozenColumnAlign.Left)\" id=\"actions-header\"\r\n [attr.scope]=\"'col'\">\r\n {{ (tableOptions.rows?.action?.header ?? '') | ecsTranslate }}\r\n </th>\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!--TEMPLATE FOR THE ACTIONS ROW COLUMN-->\r\n <ng-template #actionColumnTemplate let-rowData=\"rowData\">\r\n <ng-container *ngIf=\"(tableOptions.rows?.action?.buttons?.length ?? 0) > 0\">\r\n <td \r\n [ngStyle]=\"{\r\n 'text-align': (getDataAlignHorizontalAsText(tableOptions.rows?.action?.horizontalAlignment ?? DataAlignHorizontal.Center)),\r\n 'vertical-align': (getDataAlignVerticalAsText(tableOptions.rows?.action?.verticalAlignment ?? DataAlignVertical.Middle)),\r\n 'max-width': actionColumnWidth + 'px',\r\n 'min-width': actionColumnWidth + 'px',\r\n 'width': actionColumnWidth + 'px'\r\n }\"\r\n pFrozenColumn [frozen]=\"tableOptions.rows?.action?.frozen ?? false\"\r\n [alignFrozen]=\"getFrozenColumnAlignAsText(tableOptions.rows?.action?.positionRight ? FrozenColumnAlign.Right : FrozenColumnAlign.Left)\">\r\n <ng-container *ngIf=\"compactRows; else ecsElse0\">\r\n <ng-container *ngIf=\"hasRowMenuActions(rowData)\">\r\n <button pButton type=\"button\" icon=\"pi pi-ellipsis-v\" [attr.aria-label]=\"(tableOptions.responsive?.rowMenuLabel || 'Row actions') | ecsTranslate\"\r\n aria-haspopup=\"menu\" [attr.aria-expanded]=\"responsiveRowMenu.visible && rowMenuRow === rowData\"\r\n (click)=\"openRowMenu($event, rowData)\" class=\"ecs-responsive-trigger\"></button>\r\n </ng-container>\r\n </ng-container><ng-template #ecsElse0>\r\n <ng-container *ngFor=\"let button of tableOptions.rows?.action?.buttons; trackBy: ecsTrack1; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count; let last = last\">\r\n <ecs-table-button [button]=\"button\" [rowData]=\"rowData\" [isActionButton]=\"true\" [isLastActionButton]=\"last\"></ecs-table-button>\r\n </ng-container>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- TEMPLATE FOR THE ROW CHECKBOX SELECTOR HEADER COLUMN -->\r\n <ng-template #rowSelectorColumnHeaderTemplate>\r\n <th \r\n [ngStyle]=\"{\r\n 'text-align': 'center',\r\n 'vertical-align': 'middle',\r\n 'max-width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px',\r\n 'min-width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px',\r\n 'width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px'\r\n }\"\r\n id=\"rowSelector-header\" [attr.scope]=\"'col'\" pResizableColumn [pResizableColumnDisabled]=\"!tableOptions.rows?.checkboxSelector?.resizable\" pFrozenColumn \r\n [frozen]=\"tableOptions.rows?.checkboxSelector?.frozen ?? false\" [alignFrozen]=\"getFrozenColumnAlignAsText(tableOptions.rows?.checkboxSelector?.positionRight ? FrozenColumnAlign.Right : FrozenColumnAlign.Left)\">\r\n <div style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.selectAllEnabled\">\r\n <input type=\"checkbox\" class=\"ecs-select-all\" [checked]=\"allMatchingRowsSelected\"\r\n [indeterminate]=\"matchingRowsPartiallySelected\"\r\n [disabled]=\"selectAllLoading || !tableOptions.rows?.checkboxSelector?.urlSelectAll\"\r\n [attr.aria-label]=\"'Select all filtered rows' | ecsTranslate\"\r\n [pTooltip]=\"'Select all filtered rows' | ecsTranslate\"\r\n (change)=\"toggleAllMatchingRows($any($event.target).checked)\">\r\n </ng-container>\r\n {{ (tableOptions.rows?.checkboxSelector?.header ?? '') | ecsTranslate }}\r\n <p-columnFilter type=\"boolean\" field=\"selector\" display=\"menu\" [showButtons]=\"false\"></p-columnFilter>\r\n </div>\r\n </th>\r\n </ng-template>\r\n\r\n <!--TEMPLATE FOR THE ROW CHECKBOX SELECTOR COLUMN-->\r\n <ng-template #rowSelectorColumnTemplate let-rowData=\"rowData\">\r\n <td \r\n [ngStyle]=\"{\r\n 'text-align': (getDataAlignHorizontalAsText(tableOptions.rows?.checkboxSelector?.horizontalAlignment ?? DataAlignHorizontal.Center)),\r\n 'vertical-align': (getDataAlignVerticalAsText(tableOptions.rows?.checkboxSelector?.verticalAlignment ?? DataAlignVertical.Middle)),\r\n 'max-width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px',\r\n 'min-width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px',\r\n 'width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px'\r\n }\"\r\n pFrozenColumn [frozen]=\"tableOptions.rows?.checkboxSelector?.frozen ?? false\" \r\n [alignFrozen]=\"getFrozenColumnAlignAsText(tableOptions.rows?.checkboxSelector?.positionRight ? FrozenColumnAlign.Right : FrozenColumnAlign.Left)\">\r\n <p-checkbox \r\n [disabled]=\"!(tableOptions.rows?.checkboxSelector?.enabledCondition?.(rowData) ?? true)\"\r\n [binary]=\"true\"\r\n [ngModel]=\"isRowCheckboxSelected(rowData.rowID)\"\r\n (onChange)=\"onRowChekboxChange($event, rowData.rowID)\"></p-checkbox>\r\n </td>\r\n </ng-template>\r\n\r\n\r\n <!-- LOGIC FOR DRAWING TABLE ACTIONS ABOVE THE HEADER -->\r\n <ng-template pTemplate=\"caption\">\r\n <div #headerContainer [class.ecs-compact-header]=\"compactHeader\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <ng-container *ngIf=\"compactHeader; else ecsElse1\">\r\n <ng-container *ngIf=\"tableOptions.globalFilter?.enabled\">\r\n <span class=\"ecs-global-search ecs-responsive-search\">\r\n <span class=\"ecs-input-icon\"><i class=\"pi pi-search\"></i></span>\r\n <input pInputText type=\"text\" [attr.aria-label]=\"'Search keyword' | ecsTranslate\" [placeholder]=\"'Search keyword' | ecsTranslate\" autocomplete=\"off\"\r\n [maxlength]=\"tableOptions.globalFilter?.maxLength ?? null\" [ngModel]=\"globalSearchText\"\r\n (ngModelChange)=\"onGlobalSearchInput($event)\"/>\r\n <ng-container *ngIf=\"globalSearchText\">\r\n <span class=\"ecs-input-icon\" position=\"right\"><button type=\"button\" class=\"ecs-clear-search\" [attr.aria-label]=\"'Clear search' | ecsTranslate\" (click)=\"clearFilters(dt, true, true)\"><i class=\"pi pi-times\"></i></button></span>\r\n </ng-container>\r\n </span>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.description?.text\">\r\n <i [class]=\"tableOptions.description!.icon\" [pTooltip]=\"(tableOptions.description!.text) | ecsTranslate\" [escape]=\"false\"></i>\r\n </ng-container>\r\n <button pButton type=\"button\" icon=\"pi pi-bars\" [attr.aria-label]=\"(tableOptions.responsive?.headerMenuLabel || 'Table actions') | ecsTranslate\"\r\n aria-haspopup=\"menu\" [attr.aria-expanded]=\"responsiveHeaderMenu.visible\"\r\n (click)=\"openHeaderMenu($event)\" class=\"ecs-responsive-trigger ecs-header-menu-trigger\"></button>\r\n </ng-container><ng-template #ecsElse1>\r\n\r\n <div style=\"display: flex; align-items: center; gap: 10px;\">\r\n <!--CHOOSE COLUMNS TO SHOW-->\r\n <ng-container *ngIf=\"tableOptions.columns?.selectorEnabled\">\r\n <p-button [icon]=\"tableOptions.columns?.selectorIcon ?? 'pi pi-pencil'\" (onClick)=\"columnSelectorShow()\" [pTooltip]=\"'Modify columns' | ecsTranslate\"\r\n [showDelay]=\"700\" tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n <!--CLEAR SORTS AND FILTERS-->\r\n <ng-container *ngIf=\"tableOptions.header?.clearSortsEnabled\">\r\n <p-button [icon]=\"tableOptions.header?.clearSortsIcon ?? 'pi pi-sort-alt-slash'\" (onClick)=\"clearSorts(dt)\" [disabled]=\"!hasToClearSorts(dt)\"\r\n [pTooltip]=\"'Clear sorts' | ecsTranslate\" [showDelay]=\"700\" tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.header?.clearFiltersEnabled\">\r\n <p-button\r\n [icon]=\"tableOptions.header?.clearFiltersIcon ?? 'pi pi-filter-slash'\" (onClick)=\"clearFilters(dt)\" [disabled]=\"!hasToClearFilters(dt, globalSearchText)\"\r\n [pTooltip]=\"'Clear filters' | ecsTranslate\" [showDelay]=\"700\" tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n\r\n <!--TABLE DESCRIPTION-->\r\n <ng-container *ngIf=\"tableOptions.description?.text\"> <!-- If a table description text is provided -->\r\n <ng-container *ngIf=\"!tableOptions.description!.tooltip; else ecsElse2\"> <!-- The table description must be shown as text next to the icon -->\r\n <i [class]=\"tableOptions.description!.icon\"></i>\r\n <span [innerHTML]=\"(tableOptions.description!.text) | ecsTranslate\"></span>\r\n </ng-container><ng-template #ecsElse2>\r\n <i [escape]=\"false\" [pTooltip]=\"(tableOptions.description!.text) | ecsTranslate\" tooltipPosition=\"right\" [class]=\"tableOptions.description!.icon\"></i>\r\n </ng-template>\r\n </ng-container>\r\n </div>\r\n\r\n <!--TABLE VIEWS-->\r\n <ng-container *ngIf=\"tableViewsEnabled()\">\r\n <div style=\"display: flex; align-items: center; gap: 10px;\">\r\n <span class=\"p-buttonset ecs-view-buttons\">\r\n <p-button (click)=\"viewsModalShow=true;\"\r\n [label]=\"tableViewCurrentSelectedAlias \r\n ? tableViewCurrentSelectedAlias \r\n : ((tableOptions.views?.noViewSelectedText || '--- Select a view ---') | ecsTranslate)\"\r\n [class]=\"'viewButton' + (tableOptions.views?.selectViewButtonClass ? ' ' + tableOptions.views!.selectViewButtonClass : '')\"></p-button>\r\n <p-button (click)=\"viewLoad(tableViewCurrentSelectedAlias!)\" [disabled]=\"!tableViewCurrentSelectedAlias\" [pTooltip]=\"'Apply view again' | ecsTranslate\" [showDelay]=\"700\" tooltipPosition=\"top\"\r\n [icon]=\"tableOptions.views?.reloadViewButtonIcon || 'pi pi-refresh'\"\r\n [class]=\"tableOptions.views?.reloadViewButtonClass || ''\"></p-button>\r\n </span>\r\n </div>\r\n </ng-container>\r\n\r\n <div style=\"display: flex; align-items: center; gap: 10px;\">\r\n <!--GLOBAL FILTER-->\r\n <ng-container *ngIf=\"tableOptions.globalFilter?.enabled\">\r\n <span class=\"ecs-global-search ml-auto\">\r\n <span class=\"ecs-input-icon\">\r\n <i class=\"pi pi-search\"></i>\r\n </span>\r\n <input pInputText type=\"text\" \r\n (ngModelChange)=\"onGlobalSearchInput($event)\" autocomplete=\"off\"\r\n [maxlength]=\"tableOptions.globalFilter?.maxLength ?? null\" [placeholder]=\"'Search keyword' | ecsTranslate\" [ngModel]=\"globalSearchText\"\r\n style=\"width: 220px;\"/>\r\n <!-- Right icon (only if there is text) -->\r\n <ng-container *ngIf=\"globalSearchText\">\r\n <span class=\"ecs-input-icon\" position=\"right\">\r\n <i class=\"pi pi-times\" style=\"cursor: pointer;\" (click)=\"clearFilters(dt, true, true); $event.stopPropagation()\"></i>\r\n </span>\r\n </ng-container>\r\n </span>\r\n </ng-container>\r\n\r\n <!--EXPORT DATA-->\r\n <ng-container *ngIf=\"tableOptions.excelReport?.url?.trim()\">\r\n <p-button icon=\"pi pi-file-excel\" (onClick)=\"openExcelExport()\"\r\n [pTooltip]=\"'Export to Excel' | ecsTranslate\" [showDelay]=\"700\" tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n\r\n <!--RESET TABLE VIEW-->\r\n <ng-container *ngIf=\"tableOptions.resetTableView?.enabled\">\r\n <p-button [icon]=\"tableOptions.resetTableView?.icon ?? 'pi pi-eraser'\" (click)=\"resetTableView()\" [pTooltip]=\"'Reset table view' | ecsTranslate\" [showDelay]=\"700\"\r\n tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n\r\n <!--REFRESH DATA-->\r\n <p-button icon=\"pi pi-refresh\" (onClick)=\"refreshData($event)\" [pTooltip]=\"'Refresh data' | ecsTranslate\" [showDelay]=\"700\"\r\n tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n \r\n <!-- HEADER ACTION BUTTONS -->\r\n <ng-container *ngIf=\"(tableOptions.header?.buttons?.length ?? 0) > 0\">\r\n <td style=\"display: flex; justify-content: center; align-items: center; gap: 10px;\">\r\n <ng-container *ngFor=\"let button of tableOptions.header?.buttons; trackBy: ecsTrack2; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <ecs-table-button [button]=\"button\" [rowData]=\"null\"></ecs-table-button>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n </div>\r\n </ng-template>\r\n </div>\r\n </ng-template>\r\n\r\n <!-- LOGIC FOR DRAWING TABLE HEADERS -->\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <ng-container *ngIf=\"getColumnHeaderGroups(columns) as headerGroups\">\r\n <ng-container *ngIf=\"headerGroups.length\">\r\n <tr class=\"ecs-column-groups\">\r\n <ng-container *ngIf=\"(tableOptions.rows?.action?.buttons?.length ?? 0) > 0 && !tableOptions.rows?.action?.positionRight\">\r\n <td aria-hidden=\"true\" pFrozenColumn [frozen]=\"tableOptions.rows?.action?.frozen ?? false\" alignFrozen=\"left\"\r\n [style.width.px]=\"actionColumnWidth\" [style.min-width.px]=\"actionColumnWidth\"></td>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && !tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <td aria-hidden=\"true\" pFrozenColumn [frozen]=\"tableOptions.rows?.checkboxSelector?.frozen ?? false\" alignFrozen=\"left\"\r\n [style.width.px]=\"tableOptions.rows?.checkboxSelector?.width ?? 150\" [style.min-width.px]=\"tableOptions.rows?.checkboxSelector?.width ?? 150\"></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let group of headerGroups; trackBy: ecsTrack3; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <td [attr.colspan]=\"group.colspan\" role=\"columnheader\" [attr.aria-colspan]=\"group.colspan\" style=\"text-align: center; vertical-align: middle;\"\r\n pFrozenColumn [frozen]=\"group.frozenColumnAlign !== FrozenColumnAlign.Noone\"\r\n [alignFrozen]=\"getFrozenColumnAlignAsText(group.frozenColumnAlign)\">\r\n {{ group.label | translate }}\r\n </td>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <td aria-hidden=\"true\" pFrozenColumn [frozen]=\"tableOptions.rows?.checkboxSelector?.frozen ?? false\" alignFrozen=\"right\"\r\n [style.width.px]=\"tableOptions.rows?.checkboxSelector?.width ?? 150\" [style.min-width.px]=\"tableOptions.rows?.checkboxSelector?.width ?? 150\"></td>\r\n </ng-container>\r\n <ng-container *ngIf=\"(tableOptions.rows?.action?.buttons?.length ?? 0) > 0 && tableOptions.rows?.action?.positionRight\">\r\n <td aria-hidden=\"true\" pFrozenColumn [frozen]=\"tableOptions.rows?.action?.frozen ?? false\" alignFrozen=\"right\"\r\n [style.width.px]=\"actionColumnWidth\" [style.min-width.px]=\"actionColumnWidth\"></td>\r\n </ng-container>\r\n </tr>\r\n </ng-container>\r\n <tr>\r\n <ng-container *ngIf=\"!tableOptions.rows?.action?.positionRight\">\r\n <ng-container *ngTemplateOutlet=\"actionColumnHeaderTemplate\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && !tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <ng-container [ngTemplateOutlet]=\"rowSelectorColumnHeaderTemplate\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let col of columns; trackBy: ecsTrack4; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <th [ngStyle]=\"getColumnStyle(col, true)\"\r\n pResizableColumn [pResizableColumnDisabled]=\"!col.canBeResized ? true : false\"\r\n pReorderableColumn [pReorderableColumnDisabled]=\"!col.canBeReordered ? true : false\"\r\n pFrozenColumn [frozen]=\"col.frozenColumnAlign === FrozenColumnAlign.Left || col.frozenColumnAlign === FrozenColumnAlign.Right\" [alignFrozen]=\"getFrozenColumnAlignAsText(col.frozenColumnAlign)\"\r\n [pSortableColumn]=\"col.field\" [pSortableColumnDisabled]=\"!col.canBeSorted ? true : false\"\r\n style=\"text-align: center;\"\r\n [id]=\"col.field + '-header'\" [attr.scope]=\"'col'\">\r\n <div style=\"display: flex; justify-content: space-between; align-items: center; width: 100%;\">\r\n <div style=\"margin-right: 15px;\">\r\n <span>{{ col.header | translate }}</span>\r\n </div>\r\n <div style=\"display: flex; align-items: center; gap: 5px;\">\r\n <ng-container *ngIf=\"col.canBeSorted\">\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n </ng-container>\r\n <ng-container *ngIf=\"col.canBeFiltered\">\r\n <ng-container *ngIf=\"!col.filterPredefinedValuesName || col.filterPredefinedValuesName.length === 0; else ecsElse3\">\r\n <p-columnFilter [type]=\"getDataTypeAsText(col.dataType)\" [field]=\"col.field\" display=\"menu\" [showButtons]=\"false\" (click)=\"$event.stopPropagation()\"></p-columnFilter>\r\n </ng-container><ng-template #ecsElse3>\r\n <p-columnFilter\r\n [type]=\"getDataTypeAsText(col.dataType)\" [field]=\"col.field\" display=\"menu\"\r\n (click)=\"$event.stopPropagation()\"\r\n [showButtons]=\"false\" matchMode=\"in\" operator=\"or\" [showMatchModes]=\"false\"\r\n [showOperator]=\"false\" [showAddButton]=\"false\" [showClearButton]=\"false\" [showApplyButton]=\"false\">\r\n <ng-template pTemplate=\"filter\">\r\n <p-multiSelect\r\n [style]=\"{ minWidth: '400px' }\" [(ngModel)]=\"predefinedFiltersSelectedValuesCollection[col.filterPredefinedValuesName]\"\r\n [options]=\"getPredefinedFilterValues(col.filterPredefinedValuesName)\" [placeholder]=\"'Any value' | ecsTranslate\"\r\n (onChange)=\"onPredefinedFilterChange(col.field, $event.value)\" optionLabel=\"name\">\r\n <ng-template pTemplate=\"item\" let-option >\r\n <div style=\"display: inline-block; vertical-align: middle;\">\r\n <ecs-table-predefined-filters [option]=\"option\" [col]=\"col\" [selectable]=\"false\" [rowData]=\"null\"></ecs-table-predefined-filters>\r\n </div>\r\n </ng-template>\r\n </p-multiSelect>\r\n </ng-template>\r\n </p-columnFilter>\r\n </ng-template>\r\n </ng-container>\r\n <ng-container *ngIf=\"col.columnDescription && col.columnDescription.length > 0\">\r\n <i [pTooltip]=\"(col.columnDescription) | ecsTranslate\" tooltipPosition=\"top\" [class]=\"tableOptions.columnDescriptionIcon || 'pi pi-info-circle'\"></i>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <ng-container [ngTemplateOutlet]=\"rowSelectorColumnHeaderTemplate\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.action?.positionRight\">\r\n <ng-container *ngTemplateOutlet=\"actionColumnHeaderTemplate\"></ng-container>\r\n </ng-container>\r\n </tr>\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- LOGIC FOR DRAWING TABLE DATA WHEN THERE IS CONTENTS -->\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\r\n <ng-container *ngIf=\"treeState?.isMore(rowData); else ecsElse4\">\r\n <tr class=\"ecs-tree-more-row\">\r\n <td colspan=\"999\">\r\n <p-button icon=\"pi pi-plus\" styleClass=\"p-button-text\" [label]=\"'Load more children' | ecsTranslate\"\r\n (onClick)=\"loadMoreTreeRows($event, rowData)\" ></p-button>\r\n </td>\r\n </tr>\r\n </ng-container><ng-template #ecsElse4>\r\n <tr [pSelectableRow]=\"rowData\" [ngClass]=\"tableOptions.rows?.class?.(rowData)\" [ngStyle]=\"tableOptions.rows?.style?.(rowData)\"\r\n [attr.aria-level]=\"treeState ? treeState.depth(rowData) + 1 : null\"\r\n [attr.aria-expanded]=\"treeState?.hasChildren(rowData) ? treeState?.isExpanded(rowData) : null\">\r\n <ng-container *ngIf=\"!tableOptions.rows?.action?.positionRight\">\r\n <ng-container *ngTemplateOutlet=\"actionColumnTemplate; context: { rowData: rowData }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && !tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <ng-container [ngTemplateOutlet]=\"rowSelectorColumnTemplate\" [ngTemplateOutletContext]=\"{ rowData: rowData }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let col of columns; trackBy: ecsTrack5; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <td (mousedown)=\"col.dataType !== DataType.Boolean && copyToClipboardStart($event)\" (mouseup)=\"copyToClipboardCancel()\"\r\n [ngStyle]=\"getColumnStyle(col)\" pFrozenColumn [frozen]=\"col.frozenColumnAlign === FrozenColumnAlign.Left || col.frozenColumnAlign === FrozenColumnAlign.Right\" \r\n [alignFrozen]=\"getFrozenColumnAlignAsText(col.frozenColumnAlign)\" [style.text-align]=\"getDataAlignHorizontalAsText(col.dataAlignHorizontal)\" [style.vertical-align]=\"getDataAlignVerticalAsText(col.dataAlignVertical)\">\r\n <ng-container *ngIf=\"treeState && col.field === treeColumn; else ecsElse5\">\r\n <div class=\"ecs-tree-cell\" [style.padding-inline-start.px]=\"treeState.depth(rowData) * 20\">\r\n <button type=\"button\" class=\"ecs-tree-toggle\" [class.ecs-tree-leaf]=\"!treeState.hasChildren(rowData)\"\r\n [disabled]=\"!treeState.hasChildren(rowData) || treeState.isLoading(rowData) || treeState.loading\"\r\n [attr.aria-label]=\"(treeState.isExpanded(rowData) ? 'Collapse node' : 'Expand node') | ecsTranslate\"\r\n [attr.aria-expanded]=\"treeState.hasChildren(rowData) ? treeState.isExpanded(rowData) : null\"\r\n [pTooltip]=\"(treeState.isExpanded(rowData) ? 'Collapse node' : 'Expand node') | ecsTranslate\"\r\n (mousedown)=\"$event.stopPropagation()\" (mouseup)=\"$event.stopPropagation()\"\r\n (click)=\"toggleTreeRow($event, rowData)\">\r\n <i [class]=\"treeState.isLoading(rowData) ? 'pi pi-spinner pi-spin' : treeState.isExpanded(rowData) ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\" aria-hidden=\"true\"></i>\r\n </button>\r\n <ecs-table-cell [col]=\"col\" [rowData]=\"rowData\" [globalSearchText]=\"effectiveGlobalSearchText\"\r\n [dateFormat]=\"dateFormat\" [dateTimezone]=\"dateTimezone\" [dateCulture]=\"dateCulture\"\r\n [predefinedFiltersCollection]=\"tableOptions.predefinedFilters\" ></ecs-table-cell>\r\n </div>\r\n </ng-container><ng-template #ecsElse5>\r\n <ecs-table-cell [col]=\"col\" [rowData]=\"rowData\" [globalSearchText]=\"effectiveGlobalSearchText\"\r\n [dateFormat]=\"dateFormat\" [dateTimezone]=\"dateTimezone\" [dateCulture]=\"dateCulture\"\r\n [predefinedFiltersCollection]=\"tableOptions.predefinedFilters\"></ecs-table-cell>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <ng-container [ngTemplateOutlet]=\"rowSelectorColumnTemplate\" [ngTemplateOutletContext]=\"{ rowData: rowData }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.action?.positionRight\">\r\n <ng-container *ngTemplateOutlet=\"actionColumnTemplate; context: { rowData: rowData }\"></ng-container>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </ng-template>\r\n\r\n <!-- LOGIC FOR DRAWING TABLE DATA WHEN THERE IS NO CONTENTS -->\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"999\">{{ 'No data found for the current filter criteria.' | ecsTranslate }}</td>\r\n </tr>\r\n </ng-template>\r\n\r\n <!-- SHOW CUSTOM RECORDS REPORT -->\r\n <ng-template pTemplate=\"paginatorleft\">\r\n <div #paginatorContainer>\r\n <div style=\"display: flex; align-items: center; gap: 10px;\">\r\n <ng-container *ngIf=\"tableOptions.legend?.content\">\r\n <ecs-table-button [button]=\"tableOptions.legend?.button\" [rowData]=\"null\" [overrideAction]=\"op.toggle.bind(op)\"></ecs-table-button>\r\n <p-overlayPanel #op>\r\n <div [innerHTML]=\"(tableOptions.legend?.content) | ecsTranslate\"></div>\r\n </p-overlayPanel>\r\n </ng-container>\r\n <span>{{ 'Showing {{count}} records of {{total}} available records' | ecsTranslate: { count: totalRecords, total: totalRecordsNotFiltered } }}</span>\r\n </div>\r\n </div>\r\n </ng-template>\r\n </p-table>\r\n <ng-container *ngIf=\"treeState\">\r\n <div #paginatorContainer class=\"ecs-tree-paginator\">\r\n <ng-container *ngIf=\"tableOptions.legend?.content\">\r\n <ecs-table-button [button]=\"tableOptions.legend?.button\" [rowData]=\"null\" [overrideAction]=\"treeLegend.toggle.bind(treeLegend)\" ></ecs-table-button>\r\n <p-overlayPanel #treeLegend><div [innerHTML]=\"(tableOptions.legend?.content) | ecsTranslate\"></div></p-overlayPanel>\r\n </ng-container>\r\n <span>{{ 'Showing {{count}} root nodes of {{total}} available root nodes' | ecsTranslate: { count: totalRecords, total: totalRecordsNotFiltered } }}</span>\r\n <p-paginator [first]=\"currentPage * currentRowsPerPage\" [rows]=\"currentRowsPerPage\" [totalRecords]=\"totalRecords\"\r\n [rowsPerPageOptions]=\"allowedRowsPerPage\" dropdownAppendTo=\"body\" (onPageChange)=\"treePageChange($event)\" ></p-paginator>\r\n </div>\r\n </ng-container>\r\n</div>\r\n<ecs-column-selector [visible]=\"showColumnSelector\" [columnModalData]=\"columnModalData\" [filteredColumnData]=\"filteredColumnData\" [orderByHeader]=\"tableOptions.columns?.selectorOrderByColumnName === true\" (visibleChange)=\"showColumnSelector=false\" (applyChanges)=\"applyColumnModalChanges($event)\"></ecs-column-selector>\r\n<ecs-export-excel [visible]=\"showExportModal\" [rowCheckboxSelectorActive]=\"tableOptions.rows?.checkboxSelector?.enabled ?? false\" [excelReportTitle]=\"excelReportTitle\" [allowTitleUserEdit]=\"tableOptions.excelReport?.titleAllowUserEdit ?? false\" (visibleChange)=\"showExportModal=false\" (exportToExcel)=\"generateExcelReport($event)\"></ecs-export-excel>\r\n<ecs-views-management [visible]=\"viewsModalShow\" [tableViews_menuItems]=\"tableViews_menuItems\" \r\n (onViewSelect)=\"viewLoad($event)\" (onViewCreate)=\"viewCreate($event)\" (onViewDelete)=\"viewDelete($event)\" (onViewEditAlias)=\"viewEditAlias($event)\" (onViewUpdateData)=\"viewUpdateData($event)\" (onViewUpdateActiveStartup)=\"viewUpdateActiveStartup($event)\"\r\n (visibleChange)=\"viewsModalShow=false\"></ecs-views-management>\r\n<!-- Body-level overlays avoid clipping inside scrollable and frozen table cells. -->\r\n<p-menu #responsiveHeaderMenu [model]=\"headerMenuItems\" [popup]=\"true\" appendTo=\"body\" styleClass=\"ecs-responsive-menu\"></p-menu>\r\n<p-menu #responsiveRowMenu [model]=\"rowMenuItems\" [popup]=\"true\" appendTo=\"body\" styleClass=\"ecs-responsive-menu\"></p-menu>\r\n", styles: [".highlighted-text{background-color:#ff0;color:#000;border-radius:2px}.excel-export-tooltip .bool-icon{text-shadow:0 0 2px white,0 0 3px white}.excel-export-tooltip .bool-true{color:green}.excel-export-tooltip .bool-false{color:red}.p-datatable-column-filter-button.p-button-icon-only.p-button-rounded,.p-datatable-column-filter-clear-button.p-button-icon-only.p-button-rounded{height:var(--p-icon-size)!important;width:var(--p-icon-size)!important;border-radius:0!important}.ecs-view-buttons{display:inline-flex;align-items:center;flex-wrap:nowrap}.ecs-view-buttons>p-button{display:inline-flex;flex:0 0 auto}.viewButton{width:200px}.viewButton .p-button{width:100%;justify-content:center}.viewButton .p-button-label{display:block;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}.ecs-compact-header{gap:.5rem;min-width:0}.ecs-header-menu-trigger{margin-left:auto;flex:0 0 auto}.ecs-responsive-trigger{min-width:44px;min-height:44px}.ecs-global-search{display:inline-flex;align-items:center;gap:8px;min-width:0}.ecs-global-search>.ecs-input-icon{display:inline-flex;flex:0 0 auto}.ecs-global-search input{min-width:0}.ecs-responsive-search{flex:1 1 220px;min-width:0;max-width:320px}.ecs-responsive-search input{width:100%;padding-right:2.5rem}.ecs-clear-search{border:0;background:transparent;color:inherit;cursor:pointer}.ecs-responsive-menu{max-width:calc(100vw - 16px);max-height:calc(100dvh - 32px);overflow-y:auto}.ecs-responsive-menu .p-menu-item-link{min-height:44px;white-space:normal}.ecs-tree-cell{display:flex;align-items:center;gap:4px;min-width:0}.ecs-tree-cell>ecs-table-cell{flex:1;min-width:0}.ecs-tree-toggle{width:32px;height:32px;flex:0 0 32px;border:0;background:transparent;color:inherit;cursor:pointer}.ecs-tree-toggle:focus-visible{outline:2px solid var(--p-primary-color);outline-offset:1px}.ecs-tree-leaf{visibility:hidden}.ecs-tree-paginator{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px}.p-datatable-thead>.ecs-column-groups>td{padding:var(--p-datatable-header-cell-padding);background:var(--p-datatable-header-cell-background);color:var(--p-datatable-header-cell-color);font-weight:var(--p-datatable-column-title-font-weight);border:1px solid var(--p-datatable-header-cell-border-color);white-space:normal;overflow-wrap:anywhere}\n"], dependencies: [{ kind: "pipe", type: ECSTableTranslatePipe, name: "ecsTranslate" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i6$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i6$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "virtualRowHeight", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i3$2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i6.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i6.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i6.SelectableRow, selector: "[pSelectableRow]", inputs: ["pSelectableRow", "pSelectableRowIndex", "pSelectableRowDisabled"] }, { kind: "directive", type: i6.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i6.ReorderableColumn, selector: "[pReorderableColumn]", inputs: ["pReorderableColumnDisabled"] }, { kind: "component", type: i6.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i6.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "showButtons"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i5.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "component", type: i5.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i3$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i10.InputText, selector: "[pInputText]" }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i11.MultiSelect, selector: "p-multiSelect", inputs: ["style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "appendTo", "dataKey", "name", "label", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "showClear", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i5$1.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "trueValue", "falseValue"], outputs: ["onChange"] }, { kind: "ngmodule", type: PaginatorModule }, { kind: "component", type: i13.Paginator, selector: "p-paginator", inputs: ["pageLinkSize", "style", "styleClass", "alwaysShow", "templateLeft", "templateRight", "dropdownAppendTo", "dropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showFirstLastIcon", "totalRecords", "rows", "rowsPerPageOptions", "showJumpToPageDropdown", "showJumpToPageInput", "showPageLinks", "dropdownItemTemplate", "first"], outputs: ["onPageChange"] }, { kind: "component", type: TableCell, selector: "ecs-table-cell", inputs: ["col", "rowData", "globalSearchText", "predefinedFiltersCollection", "dateFormat", "dateTimezone", "dateCulture"] }, { kind: "component", type: TablePredefinedFilters, selector: "ecs-table-predefined-filters", inputs: ["option", "col", "selectable", "rowData", "globalSearchText"] }, { kind: "component", type: TableButton, selector: "ecs-table-button", inputs: ["button", "rowData", "isActionButton", "isLastActionButton", "overrideAction"] }, { kind: "component", type: ColumnSelector, selector: "ecs-column-selector", inputs: ["orderByHeader", "visible", "columnModalData", "filteredColumnData"], outputs: ["visibleChange", "applyChanges"] }, { kind: "component", type: ExportExcel, selector: "ecs-export-excel", inputs: ["visible", "rowCheckboxSelectorActive", "excelReportTitle", "allowTitleUserEdit"], outputs: ["exportToExcel", "visibleChange"] }, { kind: "component", type: ViewsManagement, selector: "ecs-views-management", inputs: ["visible", "tableViews_menuItems"], outputs: ["onViewSelect", "onViewDelete", "onViewUpdateData", "onViewUpdateActiveStartup", "onViewEditAlias", "onViewCreate", "visibleChange"] }, { kind: "ngmodule", type: OverlayPanelModule }, { kind: "component", type: i14.OverlayPanel, selector: "p-overlayPanel", inputs: ["dismissable", "showCloseIcon", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: MenuModule }, { kind: "component", type: i15.Menu, selector: "p-menu", inputs: ["model", "popup", "style", "styleClass", "appendTo", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide"] }], encapsulation: i0.ViewEncapsulation.None });
2981
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ECSPrimengTable, decorators: [{
2982
+ type: Component,
2983
+ args: [{ selector: 'ecs-primeng-table', imports: [
2984
+ ECSTableTranslatePipe,
2985
+ TranslateModule,
2986
+ CommonModule,
2987
+ FormsModule,
2988
+ TableModule,
2989
+ ButtonModule,
2990
+ TooltipModule,
2991
+ InputTextModule,
2992
+ MultiSelectModule,
2993
+ CheckboxModule,
2994
+ PaginatorModule,
2995
+ TableCell,
2996
+ TablePredefinedFilters,
2997
+ TableButton,
2998
+ ColumnSelector,
2999
+ ExportExcel,
3000
+ ViewsManagement,
3001
+ OverlayPanelModule,
3002
+ MenuModule
3003
+ ], standalone: true, encapsulation: ViewEncapsulation.None, template: "<div #tableContainer>\r\n <p-table #dt\r\n styleClass=\"p-datatable-sm p-datatable-gridlines p-datatable-striped\"\r\n sortMode=\"multiple\"\r\n [resizableColumns]=\"true\" columnResizeMode=\"expand\"\r\n [reorderableColumns]=\"true\"\r\n [scrollable]=\"true\" [scrollHeight]=\"scrollHeightValue\"\r\n [columns]=\"tableOptions.columns?.shown ?? []\" [value]=\"tableOptions.data ?? []\" dataKey=\"rowID\" \r\n [paginator]=\"!treeState\" [loading]=\"treeState?.loading ?? false\" paginatorDropdownAppendTo=\"body\" [first]=\"currentPage * currentRowsPerPage\" [rows]=\"currentRowsPerPage\" [totalRecords]=\"totalRecords\"\r\n [rowsPerPageOptions]=\"allowedRowsPerPage\" [showCurrentPageReport]=\"false\" (onPage)=\"pageChange($event)\"\r\n [selectionMode]=\"tableOptions.rows?.singleSelector?.enabled ? 'single' : ''\" [metaKeySelection]=\"tableOptions.rows?.singleSelector?.metakey ?? true\" [(selection)]=\"rowSelection\" (onRowSelect)=\"rowSelect($event)\" (onRowUnselect)=\"rowUnselect($event)\"\r\n [lazy]=\"true\" (onLazyLoad)=\"fetchTableData($event)\">\r\n\r\n <!--TEMPLATE FOR THE ACTIONS HEADER COLUMN-->\r\n <ng-template #actionColumnHeaderTemplate>\r\n <ng-container *ngIf=\"(tableOptions.rows?.action?.buttons?.length ?? 0) > 0\">\r\n <th [ngStyle]=\"{\r\n 'text-align': 'center',\r\n 'vertical-align': 'middle',\r\n 'max-width': actionColumnWidth + 'px',\r\n 'min-width': actionColumnWidth + 'px',\r\n 'width': actionColumnWidth + 'px'\r\n }\"\r\n pResizableColumn [pResizableColumnDisabled]=\"!tableOptions.rows?.action?.resizable\" pFrozenColumn [frozen]=\"tableOptions.rows?.action?.frozen ?? false\"\r\n [alignFrozen]=\"getFrozenColumnAlignAsText(tableOptions.rows?.action?.positionRight ? FrozenColumnAlign.Right : FrozenColumnAlign.Left)\" id=\"actions-header\"\r\n [attr.scope]=\"'col'\">\r\n {{ (tableOptions.rows?.action?.header ?? '') | ecsTranslate }}\r\n </th>\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!--TEMPLATE FOR THE ACTIONS ROW COLUMN-->\r\n <ng-template #actionColumnTemplate let-rowData=\"rowData\">\r\n <ng-container *ngIf=\"(tableOptions.rows?.action?.buttons?.length ?? 0) > 0\">\r\n <td \r\n [ngStyle]=\"{\r\n 'text-align': (getDataAlignHorizontalAsText(tableOptions.rows?.action?.horizontalAlignment ?? DataAlignHorizontal.Center)),\r\n 'vertical-align': (getDataAlignVerticalAsText(tableOptions.rows?.action?.verticalAlignment ?? DataAlignVertical.Middle)),\r\n 'max-width': actionColumnWidth + 'px',\r\n 'min-width': actionColumnWidth + 'px',\r\n 'width': actionColumnWidth + 'px'\r\n }\"\r\n pFrozenColumn [frozen]=\"tableOptions.rows?.action?.frozen ?? false\"\r\n [alignFrozen]=\"getFrozenColumnAlignAsText(tableOptions.rows?.action?.positionRight ? FrozenColumnAlign.Right : FrozenColumnAlign.Left)\">\r\n <ng-container *ngIf=\"compactRows; else ecsElse0\">\r\n <ng-container *ngIf=\"hasRowMenuActions(rowData)\">\r\n <button pButton type=\"button\" icon=\"pi pi-ellipsis-v\" [attr.aria-label]=\"(tableOptions.responsive?.rowMenuLabel || 'Row actions') | ecsTranslate\"\r\n aria-haspopup=\"menu\" [attr.aria-expanded]=\"responsiveRowMenu.visible && rowMenuRow === rowData\"\r\n (click)=\"openRowMenu($event, rowData)\" class=\"ecs-responsive-trigger\"></button>\r\n </ng-container>\r\n </ng-container><ng-template #ecsElse0>\r\n <ng-container *ngFor=\"let button of tableOptions.rows?.action?.buttons; trackBy: ecsTrack1; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count; let last = last\">\r\n <ecs-table-button [button]=\"button\" [rowData]=\"rowData\" [isActionButton]=\"true\" [isLastActionButton]=\"last\"></ecs-table-button>\r\n </ng-container>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- TEMPLATE FOR THE ROW CHECKBOX SELECTOR HEADER COLUMN -->\r\n <ng-template #rowSelectorColumnHeaderTemplate>\r\n <th \r\n [ngStyle]=\"{\r\n 'text-align': 'center',\r\n 'vertical-align': 'middle',\r\n 'max-width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px',\r\n 'min-width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px',\r\n 'width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px'\r\n }\"\r\n id=\"rowSelector-header\" [attr.scope]=\"'col'\" pResizableColumn [pResizableColumnDisabled]=\"!tableOptions.rows?.checkboxSelector?.resizable\" pFrozenColumn \r\n [frozen]=\"tableOptions.rows?.checkboxSelector?.frozen ?? false\" [alignFrozen]=\"getFrozenColumnAlignAsText(tableOptions.rows?.checkboxSelector?.positionRight ? FrozenColumnAlign.Right : FrozenColumnAlign.Left)\">\r\n <div style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.selectAllEnabled\">\r\n <input type=\"checkbox\" class=\"ecs-select-all\" [checked]=\"allMatchingRowsSelected\"\r\n [indeterminate]=\"matchingRowsPartiallySelected\"\r\n [disabled]=\"selectAllLoading || !tableOptions.rows?.checkboxSelector?.urlSelectAll\"\r\n [attr.aria-label]=\"'Select all filtered rows' | ecsTranslate\"\r\n [pTooltip]=\"'Select all filtered rows' | ecsTranslate\"\r\n (change)=\"toggleAllMatchingRows($any($event.target).checked)\">\r\n </ng-container>\r\n {{ (tableOptions.rows?.checkboxSelector?.header ?? '') | ecsTranslate }}\r\n <p-columnFilter type=\"boolean\" field=\"selector\" display=\"menu\" [showButtons]=\"false\"></p-columnFilter>\r\n </div>\r\n </th>\r\n </ng-template>\r\n\r\n <!--TEMPLATE FOR THE ROW CHECKBOX SELECTOR COLUMN-->\r\n <ng-template #rowSelectorColumnTemplate let-rowData=\"rowData\">\r\n <td \r\n [ngStyle]=\"{\r\n 'text-align': (getDataAlignHorizontalAsText(tableOptions.rows?.checkboxSelector?.horizontalAlignment ?? DataAlignHorizontal.Center)),\r\n 'vertical-align': (getDataAlignVerticalAsText(tableOptions.rows?.checkboxSelector?.verticalAlignment ?? DataAlignVertical.Middle)),\r\n 'max-width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px',\r\n 'min-width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px',\r\n 'width': (tableOptions.rows?.checkboxSelector?.width ?? 150) + 'px'\r\n }\"\r\n pFrozenColumn [frozen]=\"tableOptions.rows?.checkboxSelector?.frozen ?? false\" \r\n [alignFrozen]=\"getFrozenColumnAlignAsText(tableOptions.rows?.checkboxSelector?.positionRight ? FrozenColumnAlign.Right : FrozenColumnAlign.Left)\">\r\n <p-checkbox \r\n [disabled]=\"!(tableOptions.rows?.checkboxSelector?.enabledCondition?.(rowData) ?? true)\"\r\n [binary]=\"true\"\r\n [ngModel]=\"isRowCheckboxSelected(rowData.rowID)\"\r\n (onChange)=\"onRowChekboxChange($event, rowData.rowID)\"></p-checkbox>\r\n </td>\r\n </ng-template>\r\n\r\n\r\n <!-- LOGIC FOR DRAWING TABLE ACTIONS ABOVE THE HEADER -->\r\n <ng-template pTemplate=\"caption\">\r\n <div #headerContainer [class.ecs-compact-header]=\"compactHeader\" style=\"display: flex; justify-content: space-between; align-items: center;\">\r\n <ng-container *ngIf=\"compactHeader; else ecsElse1\">\r\n <ng-container *ngIf=\"tableOptions.globalFilter?.enabled\">\r\n <span class=\"ecs-global-search ecs-responsive-search\">\r\n <span class=\"ecs-input-icon\"><i class=\"pi pi-search\"></i></span>\r\n <input pInputText type=\"text\" [attr.aria-label]=\"'Search keyword' | ecsTranslate\" [placeholder]=\"'Search keyword' | ecsTranslate\" autocomplete=\"off\"\r\n [maxlength]=\"tableOptions.globalFilter?.maxLength ?? null\" [ngModel]=\"globalSearchText\"\r\n (ngModelChange)=\"onGlobalSearchInput($event)\"/>\r\n <ng-container *ngIf=\"globalSearchText\">\r\n <span class=\"ecs-input-icon\" position=\"right\"><button type=\"button\" class=\"ecs-clear-search\" [attr.aria-label]=\"'Clear search' | ecsTranslate\" (click)=\"clearFilters(dt, true, true)\"><i class=\"pi pi-times\"></i></button></span>\r\n </ng-container>\r\n </span>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.description?.text\">\r\n <i [class]=\"tableOptions.description!.icon\" [pTooltip]=\"(tableOptions.description!.text) | ecsTranslate\" [escape]=\"false\"></i>\r\n </ng-container>\r\n <button pButton type=\"button\" icon=\"pi pi-bars\" [attr.aria-label]=\"(tableOptions.responsive?.headerMenuLabel || 'Table actions') | ecsTranslate\"\r\n aria-haspopup=\"menu\" [attr.aria-expanded]=\"responsiveHeaderMenu.visible\"\r\n (click)=\"openHeaderMenu($event)\" class=\"ecs-responsive-trigger ecs-header-menu-trigger\"></button>\r\n </ng-container><ng-template #ecsElse1>\r\n\r\n <div style=\"display: flex; align-items: center; gap: 10px;\">\r\n <!--CHOOSE COLUMNS TO SHOW-->\r\n <ng-container *ngIf=\"tableOptions.columns?.selectorEnabled\">\r\n <p-button [icon]=\"tableOptions.columns?.selectorIcon ?? 'pi pi-pencil'\" (onClick)=\"columnSelectorShow()\" [pTooltip]=\"'Modify columns' | ecsTranslate\"\r\n [showDelay]=\"700\" tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n <!--CLEAR SORTS AND FILTERS-->\r\n <ng-container *ngIf=\"tableOptions.header?.clearSortsEnabled\">\r\n <p-button [icon]=\"tableOptions.header?.clearSortsIcon ?? 'pi pi-sort-alt-slash'\" (onClick)=\"clearSorts(dt)\" [disabled]=\"!hasToClearSorts(dt)\"\r\n [pTooltip]=\"'Clear sorts' | ecsTranslate\" [showDelay]=\"700\" tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.header?.clearFiltersEnabled\">\r\n <p-button\r\n [icon]=\"tableOptions.header?.clearFiltersIcon ?? 'pi pi-filter-slash'\" (onClick)=\"clearFilters(dt)\" [disabled]=\"!hasToClearFilters(dt, globalSearchText)\"\r\n [pTooltip]=\"'Clear filters' | ecsTranslate\" [showDelay]=\"700\" tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n\r\n <!--TABLE DESCRIPTION-->\r\n <ng-container *ngIf=\"tableOptions.description?.text\"> <!-- If a table description text is provided -->\r\n <ng-container *ngIf=\"!tableOptions.description!.tooltip; else ecsElse2\"> <!-- The table description must be shown as text next to the icon -->\r\n <i [class]=\"tableOptions.description!.icon\"></i>\r\n <span [innerHTML]=\"(tableOptions.description!.text) | ecsTranslate\"></span>\r\n </ng-container><ng-template #ecsElse2>\r\n <i [escape]=\"false\" [pTooltip]=\"(tableOptions.description!.text) | ecsTranslate\" tooltipPosition=\"right\" [class]=\"tableOptions.description!.icon\"></i>\r\n </ng-template>\r\n </ng-container>\r\n </div>\r\n\r\n <!--TABLE VIEWS-->\r\n <ng-container *ngIf=\"tableViewsEnabled()\">\r\n <div style=\"display: flex; align-items: center; gap: 10px;\">\r\n <span class=\"p-buttonset ecs-view-buttons\">\r\n <p-button (click)=\"viewsModalShow=true;\"\r\n [label]=\"tableViewCurrentSelectedAlias \r\n ? tableViewCurrentSelectedAlias \r\n : ((tableOptions.views?.noViewSelectedText || '--- Select a view ---') | ecsTranslate)\"\r\n [class]=\"'viewButton' + (tableOptions.views?.selectViewButtonClass ? ' ' + tableOptions.views!.selectViewButtonClass : '')\"></p-button>\r\n <p-button (click)=\"viewLoad(tableViewCurrentSelectedAlias!)\" [disabled]=\"!tableViewCurrentSelectedAlias\" [pTooltip]=\"'Apply view again' | ecsTranslate\" [showDelay]=\"700\" tooltipPosition=\"top\"\r\n [icon]=\"tableOptions.views?.reloadViewButtonIcon || 'pi pi-refresh'\"\r\n [class]=\"tableOptions.views?.reloadViewButtonClass || ''\"></p-button>\r\n </span>\r\n </div>\r\n </ng-container>\r\n\r\n <div style=\"display: flex; align-items: center; gap: 10px;\">\r\n <!--GLOBAL FILTER-->\r\n <ng-container *ngIf=\"tableOptions.globalFilter?.enabled\">\r\n <span class=\"ecs-global-search ml-auto\">\r\n <span class=\"ecs-input-icon\">\r\n <i class=\"pi pi-search\"></i>\r\n </span>\r\n <input pInputText type=\"text\" \r\n (ngModelChange)=\"onGlobalSearchInput($event)\" autocomplete=\"off\"\r\n [maxlength]=\"tableOptions.globalFilter?.maxLength ?? null\" [placeholder]=\"'Search keyword' | ecsTranslate\" [ngModel]=\"globalSearchText\"\r\n style=\"width: 220px;\"/>\r\n <!-- Right icon (only if there is text) -->\r\n <ng-container *ngIf=\"globalSearchText\">\r\n <span class=\"ecs-input-icon\" position=\"right\">\r\n <i class=\"pi pi-times\" style=\"cursor: pointer;\" (click)=\"clearFilters(dt, true, true); $event.stopPropagation()\"></i>\r\n </span>\r\n </ng-container>\r\n </span>\r\n </ng-container>\r\n\r\n <!--EXPORT DATA-->\r\n <ng-container *ngIf=\"tableOptions.excelReport?.url?.trim()\">\r\n <p-button icon=\"pi pi-file-excel\" (onClick)=\"openExcelExport()\"\r\n [pTooltip]=\"'Export to Excel' | ecsTranslate\" [showDelay]=\"700\" tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n\r\n <!--RESET TABLE VIEW-->\r\n <ng-container *ngIf=\"tableOptions.resetTableView?.enabled\">\r\n <p-button [icon]=\"tableOptions.resetTableView?.icon ?? 'pi pi-eraser'\" (click)=\"resetTableView()\" [pTooltip]=\"'Reset table view' | ecsTranslate\" [showDelay]=\"700\"\r\n tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n </ng-container>\r\n\r\n <!--REFRESH DATA-->\r\n <p-button icon=\"pi pi-refresh\" (onClick)=\"refreshData($event)\" [pTooltip]=\"'Refresh data' | ecsTranslate\" [showDelay]=\"700\"\r\n tooltipPosition=\"top\" styleClass=\"p-button-icon-only\"></p-button>\r\n \r\n <!-- HEADER ACTION BUTTONS -->\r\n <ng-container *ngIf=\"(tableOptions.header?.buttons?.length ?? 0) > 0\">\r\n <td style=\"display: flex; justify-content: center; align-items: center; gap: 10px;\">\r\n <ng-container *ngFor=\"let button of tableOptions.header?.buttons; trackBy: ecsTrack2; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <ecs-table-button [button]=\"button\" [rowData]=\"null\"></ecs-table-button>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n </div>\r\n </ng-template>\r\n </div>\r\n </ng-template>\r\n\r\n <!-- LOGIC FOR DRAWING TABLE HEADERS -->\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <ng-container *ngIf=\"getColumnHeaderGroups(columns) as headerGroups\">\r\n <ng-container *ngIf=\"headerGroups.length\">\r\n <tr class=\"ecs-column-groups\">\r\n <ng-container *ngIf=\"(tableOptions.rows?.action?.buttons?.length ?? 0) > 0 && !tableOptions.rows?.action?.positionRight\">\r\n <td aria-hidden=\"true\" pFrozenColumn [frozen]=\"tableOptions.rows?.action?.frozen ?? false\" alignFrozen=\"left\"\r\n [style.width.px]=\"actionColumnWidth\" [style.min-width.px]=\"actionColumnWidth\"></td>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && !tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <td aria-hidden=\"true\" pFrozenColumn [frozen]=\"tableOptions.rows?.checkboxSelector?.frozen ?? false\" alignFrozen=\"left\"\r\n [style.width.px]=\"tableOptions.rows?.checkboxSelector?.width ?? 150\" [style.min-width.px]=\"tableOptions.rows?.checkboxSelector?.width ?? 150\"></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let group of headerGroups; trackBy: ecsTrack3; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <td [attr.colspan]=\"group.colspan\" role=\"columnheader\" [attr.aria-colspan]=\"group.colspan\" style=\"text-align: center; vertical-align: middle;\"\r\n pFrozenColumn [frozen]=\"group.frozenColumnAlign !== FrozenColumnAlign.Noone\"\r\n [alignFrozen]=\"getFrozenColumnAlignAsText(group.frozenColumnAlign)\">\r\n {{ group.label | translate }}\r\n </td>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <td aria-hidden=\"true\" pFrozenColumn [frozen]=\"tableOptions.rows?.checkboxSelector?.frozen ?? false\" alignFrozen=\"right\"\r\n [style.width.px]=\"tableOptions.rows?.checkboxSelector?.width ?? 150\" [style.min-width.px]=\"tableOptions.rows?.checkboxSelector?.width ?? 150\"></td>\r\n </ng-container>\r\n <ng-container *ngIf=\"(tableOptions.rows?.action?.buttons?.length ?? 0) > 0 && tableOptions.rows?.action?.positionRight\">\r\n <td aria-hidden=\"true\" pFrozenColumn [frozen]=\"tableOptions.rows?.action?.frozen ?? false\" alignFrozen=\"right\"\r\n [style.width.px]=\"actionColumnWidth\" [style.min-width.px]=\"actionColumnWidth\"></td>\r\n </ng-container>\r\n </tr>\r\n </ng-container>\r\n <tr>\r\n <ng-container *ngIf=\"!tableOptions.rows?.action?.positionRight\">\r\n <ng-container *ngTemplateOutlet=\"actionColumnHeaderTemplate\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && !tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <ng-container [ngTemplateOutlet]=\"rowSelectorColumnHeaderTemplate\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let col of columns; trackBy: ecsTrack4; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <th [ngStyle]=\"getColumnStyle(col, true)\"\r\n pResizableColumn [pResizableColumnDisabled]=\"!col.canBeResized ? true : false\"\r\n pReorderableColumn [pReorderableColumnDisabled]=\"!col.canBeReordered ? true : false\"\r\n pFrozenColumn [frozen]=\"col.frozenColumnAlign === FrozenColumnAlign.Left || col.frozenColumnAlign === FrozenColumnAlign.Right\" [alignFrozen]=\"getFrozenColumnAlignAsText(col.frozenColumnAlign)\"\r\n [pSortableColumn]=\"col.field\" [pSortableColumnDisabled]=\"!col.canBeSorted ? true : false\"\r\n style=\"text-align: center;\"\r\n [id]=\"col.field + '-header'\" [attr.scope]=\"'col'\">\r\n <div style=\"display: flex; justify-content: space-between; align-items: center; width: 100%;\">\r\n <div style=\"margin-right: 15px;\">\r\n <span>{{ col.header | translate }}</span>\r\n </div>\r\n <div style=\"display: flex; align-items: center; gap: 5px;\">\r\n <ng-container *ngIf=\"col.canBeSorted\">\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n </ng-container>\r\n <ng-container *ngIf=\"col.canBeFiltered\">\r\n <ng-container *ngIf=\"!col.filterPredefinedValuesName || col.filterPredefinedValuesName.length === 0; else ecsElse3\">\r\n <p-columnFilter [type]=\"getDataTypeAsText(col.dataType)\" [field]=\"col.field\" display=\"menu\" [showButtons]=\"false\" (click)=\"$event.stopPropagation()\"></p-columnFilter>\r\n </ng-container><ng-template #ecsElse3>\r\n <p-columnFilter\r\n [type]=\"getDataTypeAsText(col.dataType)\" [field]=\"col.field\" display=\"menu\"\r\n (click)=\"$event.stopPropagation()\"\r\n [showButtons]=\"false\" matchMode=\"in\" operator=\"or\" [showMatchModes]=\"false\"\r\n [showOperator]=\"false\" [showAddButton]=\"false\" [showClearButton]=\"false\" [showApplyButton]=\"false\">\r\n <ng-template pTemplate=\"filter\">\r\n <p-multiSelect\r\n [style]=\"{ minWidth: '400px' }\" [(ngModel)]=\"predefinedFiltersSelectedValuesCollection[col.filterPredefinedValuesName]\"\r\n [options]=\"getPredefinedFilterValues(col.filterPredefinedValuesName)\" [placeholder]=\"'Any value' | ecsTranslate\"\r\n (onChange)=\"onPredefinedFilterChange(col.field, $event.value)\" optionLabel=\"name\">\r\n <ng-template pTemplate=\"item\" let-option >\r\n <div style=\"display: inline-block; vertical-align: middle;\">\r\n <ecs-table-predefined-filters [option]=\"option\" [col]=\"col\" [selectable]=\"false\" [rowData]=\"null\"></ecs-table-predefined-filters>\r\n </div>\r\n </ng-template>\r\n </p-multiSelect>\r\n </ng-template>\r\n </p-columnFilter>\r\n </ng-template>\r\n </ng-container>\r\n <ng-container *ngIf=\"col.columnDescription && col.columnDescription.length > 0\">\r\n <i [pTooltip]=\"(col.columnDescription) | ecsTranslate\" tooltipPosition=\"top\" [class]=\"tableOptions.columnDescriptionIcon || 'pi pi-info-circle'\"></i>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <ng-container [ngTemplateOutlet]=\"rowSelectorColumnHeaderTemplate\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.action?.positionRight\">\r\n <ng-container *ngTemplateOutlet=\"actionColumnHeaderTemplate\"></ng-container>\r\n </ng-container>\r\n </tr>\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- LOGIC FOR DRAWING TABLE DATA WHEN THERE IS CONTENTS -->\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\">\r\n <ng-container *ngIf=\"treeState?.isMore(rowData); else ecsElse4\">\r\n <tr class=\"ecs-tree-more-row\">\r\n <td colspan=\"999\">\r\n <p-button icon=\"pi pi-plus\" styleClass=\"p-button-text\" [label]=\"'Load more children' | ecsTranslate\"\r\n (onClick)=\"loadMoreTreeRows($event, rowData)\" ></p-button>\r\n </td>\r\n </tr>\r\n </ng-container><ng-template #ecsElse4>\r\n <tr [pSelectableRow]=\"rowData\" [ngClass]=\"tableOptions.rows?.class?.(rowData)\" [ngStyle]=\"tableOptions.rows?.style?.(rowData)\"\r\n [attr.aria-level]=\"treeState ? treeState.depth(rowData) + 1 : null\"\r\n [attr.aria-expanded]=\"treeState?.hasChildren(rowData) ? treeState?.isExpanded(rowData) : null\">\r\n <ng-container *ngIf=\"!tableOptions.rows?.action?.positionRight\">\r\n <ng-container *ngTemplateOutlet=\"actionColumnTemplate; context: { rowData: rowData }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && !tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <ng-container [ngTemplateOutlet]=\"rowSelectorColumnTemplate\" [ngTemplateOutletContext]=\"{ rowData: rowData }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let col of columns; trackBy: ecsTrack5; let $index = index; let $first = first; let $last = last; let $even = even; let $odd = odd; let $count = count\">\r\n <td (mousedown)=\"col.dataType !== DataType.Boolean && copyToClipboardStart($event)\" (mouseup)=\"copyToClipboardCancel()\"\r\n [ngStyle]=\"getColumnStyle(col)\" pFrozenColumn [frozen]=\"col.frozenColumnAlign === FrozenColumnAlign.Left || col.frozenColumnAlign === FrozenColumnAlign.Right\" \r\n [alignFrozen]=\"getFrozenColumnAlignAsText(col.frozenColumnAlign)\" [style.text-align]=\"getDataAlignHorizontalAsText(col.dataAlignHorizontal)\" [style.vertical-align]=\"getDataAlignVerticalAsText(col.dataAlignVertical)\">\r\n <ng-container *ngIf=\"treeState && col.field === treeColumn; else ecsElse5\">\r\n <div class=\"ecs-tree-cell\" [style.padding-inline-start.px]=\"treeState.depth(rowData) * 20\">\r\n <button type=\"button\" class=\"ecs-tree-toggle\" [class.ecs-tree-leaf]=\"!treeState.hasChildren(rowData)\"\r\n [disabled]=\"!treeState.hasChildren(rowData) || treeState.isLoading(rowData) || treeState.loading\"\r\n [attr.aria-label]=\"(treeState.isExpanded(rowData) ? 'Collapse node' : 'Expand node') | ecsTranslate\"\r\n [attr.aria-expanded]=\"treeState.hasChildren(rowData) ? treeState.isExpanded(rowData) : null\"\r\n [pTooltip]=\"(treeState.isExpanded(rowData) ? 'Collapse node' : 'Expand node') | ecsTranslate\"\r\n (mousedown)=\"$event.stopPropagation()\" (mouseup)=\"$event.stopPropagation()\"\r\n (click)=\"toggleTreeRow($event, rowData)\">\r\n <i [class]=\"treeState.isLoading(rowData) ? 'pi pi-spinner pi-spin' : treeState.isExpanded(rowData) ? 'pi pi-chevron-down' : 'pi pi-chevron-right'\" aria-hidden=\"true\"></i>\r\n </button>\r\n <ecs-table-cell [col]=\"col\" [rowData]=\"rowData\" [globalSearchText]=\"effectiveGlobalSearchText\"\r\n [dateFormat]=\"dateFormat\" [dateTimezone]=\"dateTimezone\" [dateCulture]=\"dateCulture\"\r\n [predefinedFiltersCollection]=\"tableOptions.predefinedFilters\" ></ecs-table-cell>\r\n </div>\r\n </ng-container><ng-template #ecsElse5>\r\n <ecs-table-cell [col]=\"col\" [rowData]=\"rowData\" [globalSearchText]=\"effectiveGlobalSearchText\"\r\n [dateFormat]=\"dateFormat\" [dateTimezone]=\"dateTimezone\" [dateCulture]=\"dateCulture\"\r\n [predefinedFiltersCollection]=\"tableOptions.predefinedFilters\"></ecs-table-cell>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.checkboxSelector?.enabled && tableOptions.rows?.checkboxSelector?.positionRight\">\r\n <ng-container [ngTemplateOutlet]=\"rowSelectorColumnTemplate\" [ngTemplateOutletContext]=\"{ rowData: rowData }\"></ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"tableOptions.rows?.action?.positionRight\">\r\n <ng-container *ngTemplateOutlet=\"actionColumnTemplate; context: { rowData: rowData }\"></ng-container>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </ng-template>\r\n\r\n <!-- LOGIC FOR DRAWING TABLE DATA WHEN THERE IS NO CONTENTS -->\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"999\">{{ 'No data found for the current filter criteria.' | ecsTranslate }}</td>\r\n </tr>\r\n </ng-template>\r\n\r\n <!-- SHOW CUSTOM RECORDS REPORT -->\r\n <ng-template pTemplate=\"paginatorleft\">\r\n <div #paginatorContainer>\r\n <div style=\"display: flex; align-items: center; gap: 10px;\">\r\n <ng-container *ngIf=\"tableOptions.legend?.content\">\r\n <ecs-table-button [button]=\"tableOptions.legend?.button\" [rowData]=\"null\" [overrideAction]=\"op.toggle.bind(op)\"></ecs-table-button>\r\n <p-overlayPanel #op>\r\n <div [innerHTML]=\"(tableOptions.legend?.content) | ecsTranslate\"></div>\r\n </p-overlayPanel>\r\n </ng-container>\r\n <span>{{ 'Showing {{count}} records of {{total}} available records' | ecsTranslate: { count: totalRecords, total: totalRecordsNotFiltered } }}</span>\r\n </div>\r\n </div>\r\n </ng-template>\r\n </p-table>\r\n <ng-container *ngIf=\"treeState\">\r\n <div #paginatorContainer class=\"ecs-tree-paginator\">\r\n <ng-container *ngIf=\"tableOptions.legend?.content\">\r\n <ecs-table-button [button]=\"tableOptions.legend?.button\" [rowData]=\"null\" [overrideAction]=\"treeLegend.toggle.bind(treeLegend)\" ></ecs-table-button>\r\n <p-overlayPanel #treeLegend><div [innerHTML]=\"(tableOptions.legend?.content) | ecsTranslate\"></div></p-overlayPanel>\r\n </ng-container>\r\n <span>{{ 'Showing {{count}} root nodes of {{total}} available root nodes' | ecsTranslate: { count: totalRecords, total: totalRecordsNotFiltered } }}</span>\r\n <p-paginator [first]=\"currentPage * currentRowsPerPage\" [rows]=\"currentRowsPerPage\" [totalRecords]=\"totalRecords\"\r\n [rowsPerPageOptions]=\"allowedRowsPerPage\" dropdownAppendTo=\"body\" (onPageChange)=\"treePageChange($event)\" ></p-paginator>\r\n </div>\r\n </ng-container>\r\n</div>\r\n<ecs-column-selector [visible]=\"showColumnSelector\" [columnModalData]=\"columnModalData\" [filteredColumnData]=\"filteredColumnData\" [orderByHeader]=\"tableOptions.columns?.selectorOrderByColumnName === true\" (visibleChange)=\"showColumnSelector=false\" (applyChanges)=\"applyColumnModalChanges($event)\"></ecs-column-selector>\r\n<ecs-export-excel [visible]=\"showExportModal\" [rowCheckboxSelectorActive]=\"tableOptions.rows?.checkboxSelector?.enabled ?? false\" [excelReportTitle]=\"excelReportTitle\" [allowTitleUserEdit]=\"tableOptions.excelReport?.titleAllowUserEdit ?? false\" (visibleChange)=\"showExportModal=false\" (exportToExcel)=\"generateExcelReport($event)\"></ecs-export-excel>\r\n<ecs-views-management [visible]=\"viewsModalShow\" [tableViews_menuItems]=\"tableViews_menuItems\" \r\n (onViewSelect)=\"viewLoad($event)\" (onViewCreate)=\"viewCreate($event)\" (onViewDelete)=\"viewDelete($event)\" (onViewEditAlias)=\"viewEditAlias($event)\" (onViewUpdateData)=\"viewUpdateData($event)\" (onViewUpdateActiveStartup)=\"viewUpdateActiveStartup($event)\"\r\n (visibleChange)=\"viewsModalShow=false\"></ecs-views-management>\r\n<!-- Body-level overlays avoid clipping inside scrollable and frozen table cells. -->\r\n<p-menu #responsiveHeaderMenu [model]=\"headerMenuItems\" [popup]=\"true\" appendTo=\"body\" styleClass=\"ecs-responsive-menu\"></p-menu>\r\n<p-menu #responsiveRowMenu [model]=\"rowMenuItems\" [popup]=\"true\" appendTo=\"body\" styleClass=\"ecs-responsive-menu\"></p-menu>\r\n", styles: [".highlighted-text{background-color:#ff0;color:#000;border-radius:2px}.excel-export-tooltip .bool-icon{text-shadow:0 0 2px white,0 0 3px white}.excel-export-tooltip .bool-true{color:green}.excel-export-tooltip .bool-false{color:red}.p-datatable-column-filter-button.p-button-icon-only.p-button-rounded,.p-datatable-column-filter-clear-button.p-button-icon-only.p-button-rounded{height:var(--p-icon-size)!important;width:var(--p-icon-size)!important;border-radius:0!important}.ecs-view-buttons{display:inline-flex;align-items:center;flex-wrap:nowrap}.ecs-view-buttons>p-button{display:inline-flex;flex:0 0 auto}.viewButton{width:200px}.viewButton .p-button{width:100%;justify-content:center}.viewButton .p-button-label{display:block;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center}.ecs-compact-header{gap:.5rem;min-width:0}.ecs-header-menu-trigger{margin-left:auto;flex:0 0 auto}.ecs-responsive-trigger{min-width:44px;min-height:44px}.ecs-global-search{display:inline-flex;align-items:center;gap:8px;min-width:0}.ecs-global-search>.ecs-input-icon{display:inline-flex;flex:0 0 auto}.ecs-global-search input{min-width:0}.ecs-responsive-search{flex:1 1 220px;min-width:0;max-width:320px}.ecs-responsive-search input{width:100%;padding-right:2.5rem}.ecs-clear-search{border:0;background:transparent;color:inherit;cursor:pointer}.ecs-responsive-menu{max-width:calc(100vw - 16px);max-height:calc(100dvh - 32px);overflow-y:auto}.ecs-responsive-menu .p-menu-item-link{min-height:44px;white-space:normal}.ecs-tree-cell{display:flex;align-items:center;gap:4px;min-width:0}.ecs-tree-cell>ecs-table-cell{flex:1;min-width:0}.ecs-tree-toggle{width:32px;height:32px;flex:0 0 32px;border:0;background:transparent;color:inherit;cursor:pointer}.ecs-tree-toggle:focus-visible{outline:2px solid var(--p-primary-color);outline-offset:1px}.ecs-tree-leaf{visibility:hidden}.ecs-tree-paginator{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px}.p-datatable-thead>.ecs-column-groups>td{padding:var(--p-datatable-header-cell-padding);background:var(--p-datatable-header-cell-background);color:var(--p-datatable-header-cell-color);font-weight:var(--p-datatable-column-title-font-weight);border:1px solid var(--p-datatable-header-cell-border-color);white-space:normal;overflow-wrap:anywhere}\n"] }]
3004
+ }], ctorParameters: function () { return [{ type: ECSPrimengTableService }, { type: ECSPrimengTableNotificationService }]; }, propDecorators: { tableOptions: [{
3005
+ type: Input
3006
+ }], onRowCheckboxChange: [{
3007
+ type: Output
3008
+ }], onRowSelect: [{
3009
+ type: Output
3010
+ }], onRowUnselect: [{
3011
+ type: Output
3012
+ }], onDataEndUpdate: [{
3013
+ type: Output
3014
+ }], dt: [{
3015
+ type: ViewChild,
3016
+ args: ['dt']
3017
+ }], tableContainer: [{
3018
+ type: ViewChild,
3019
+ args: ['tableContainer', { static: false }]
3020
+ }], headerContainer: [{
3021
+ type: ViewChild,
3022
+ args: ['headerContainer', { static: false }]
3023
+ }], paginatorContainer: [{
3024
+ type: ViewChild,
3025
+ args: ['paginatorContainer', { static: false }]
3026
+ }], responsiveHeaderMenu: [{
3027
+ type: ViewChild,
3028
+ args: ['responsiveHeaderMenu']
3029
+ }], responsiveRowMenu: [{
3030
+ type: ViewChild,
3031
+ args: ['responsiveRowMenu']
3032
+ }], closeResponsiveMenus: [{
3033
+ type: HostListener,
3034
+ args: ['document:keydown.escape']
3035
+ }], onResize: [{
3036
+ type: HostListener,
3037
+ args: ['window:resize']
3038
+ }] } });
3039
+
3040
+ /*
3041
+ * Public API Surface of ecs-primeng-table
3042
+ */
3043
+
3044
+ /**
3045
+ * Generated bundle index. Do not edit.
3046
+ */
3047
+
3048
+ export { CellDisplay, CellOverflowBehaviour, DEFAULT_TABLE_OPTIONS, DataAlignHorizontal, DataAlignVertical, DataType, DeviceType, ECSPrimengTable, ECSPrimengTableHttpService, ECSPrimengTableI18nService, ECSPrimengTableNotificationService, ECSPrimengTableService, ECSPrimengTableStateService, FrozenColumnAlign, TableViewSaveMode, TreeTableState, createTableOptions };
3049
+ //# sourceMappingURL=competer-primeng-table.mjs.map