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