ngx-core-components 0.3.5 → 0.3.7
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/charts/combo-chart/combo-chart.component.d.ts +58 -0
- package/charts/public-api.d.ts +3 -0
- package/charts/scatter-plot/scatter-plot.component.d.ts +66 -0
- package/fesm2022/ngx-core-components-charts.mjs +821 -1
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-grid.mjs +1085 -145
- package/fesm2022/ngx-core-components-grid.mjs.map +1 -1
- package/fesm2022/ngx-core-components-inputs.mjs +545 -63
- package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
- package/fesm2022/ngx-core-components-navigation.mjs +122 -1
- package/fesm2022/ngx-core-components-navigation.mjs.map +1 -1
- package/fesm2022/ngx-core-components-views.mjs +1043 -445
- package/fesm2022/ngx-core-components-views.mjs.map +1 -1
- package/fesm2022/ngx-core-components.mjs +5 -5
- package/fesm2022/ngx-core-components.mjs.map +1 -1
- package/grid/data-grid/data-grid.component.d.ts +74 -6
- package/grid/pivot-grid/pivot-grid.component.d.ts +32 -0
- package/grid/public-api.d.ts +2 -0
- package/inputs/date-range-picker/date-range-picker.component.d.ts +41 -5
- package/inputs/form-builder/form-builder.component.d.ts +36 -0
- package/inputs/public-api.d.ts +3 -0
- package/inputs/signature-pad/signature-pad.component.d.ts +24 -0
- package/navigation/context-menu/context-menu.component.d.ts +23 -0
- package/navigation/public-api.d.ts +2 -0
- package/package.json +1 -1
- package/public-api.d.ts +13 -8
- package/views/json-viewer/json-viewer.component.d.ts +18 -0
- package/views/kanban/kanban.component.d.ts +38 -18
- package/views/kanban/models.d.ts +21 -0
- package/views/org-chart/org-chart.component.d.ts +18 -0
- package/views/public-api.d.ts +5 -2
- package/views/scheduler/models.d.ts +12 -1
- package/views/scheduler/scheduler.component.d.ts +58 -10
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, signal, effect, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import { input, output, signal, inject, ElementRef, effect, untracked, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
4
4
|
|
|
5
5
|
class DataGridComponent {
|
|
6
6
|
data = input([]);
|
|
7
7
|
columns = input([]);
|
|
8
|
+
stateKey = input('');
|
|
9
|
+
reorderable = input(false);
|
|
10
|
+
multiSort = input(false);
|
|
11
|
+
columnReorder = output();
|
|
12
|
+
rowReorderable = input(false);
|
|
13
|
+
showGlobalSearch = input(false);
|
|
14
|
+
globalSearchPlaceholder = input('Search...');
|
|
15
|
+
rowReorder = output();
|
|
8
16
|
pageSize = input(10);
|
|
9
17
|
page = input(1);
|
|
10
18
|
total = input(0);
|
|
@@ -37,12 +45,41 @@ class DataGridComponent {
|
|
|
37
45
|
collapsedGroups = signal(new Set());
|
|
38
46
|
editingRowKey = signal(null);
|
|
39
47
|
editingDraft = signal({});
|
|
40
|
-
|
|
48
|
+
// Enterprise Extensions
|
|
49
|
+
elementRef = inject(ElementRef);
|
|
50
|
+
columnWidths = signal({});
|
|
51
|
+
filterStates = signal(new Map());
|
|
52
|
+
sortStates = signal([]);
|
|
53
|
+
columnOrder = signal([]);
|
|
54
|
+
// Drag and drop state
|
|
55
|
+
draggingField = signal(null);
|
|
56
|
+
dragOverField = signal(null);
|
|
57
|
+
draggingRowIndex = signal(null);
|
|
58
|
+
dragOverRowIndex = signal(null);
|
|
59
|
+
// Resizing state
|
|
60
|
+
resizeStartWidth = 0;
|
|
61
|
+
resizeStartX = 0;
|
|
62
|
+
resizingField = null;
|
|
63
|
+
isInitialPageSync = true;
|
|
64
|
+
// Filter Popover state
|
|
65
|
+
activeFilterPopover = signal(null);
|
|
66
|
+
tempFilterValue = signal('');
|
|
67
|
+
tempFilterOperator = signal('contains');
|
|
68
|
+
tempSelectedValues = signal(new Set());
|
|
69
|
+
// Global search state
|
|
70
|
+
searchText = signal('');
|
|
41
71
|
constructor() {
|
|
42
72
|
effect(() => {
|
|
43
73
|
const externalPage = this.page();
|
|
44
|
-
|
|
45
|
-
|
|
74
|
+
const current = untracked(() => this.currentPage());
|
|
75
|
+
if (this.isInitialPageSync) {
|
|
76
|
+
this.isInitialPageSync = false;
|
|
77
|
+
if (this.stateKey()) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (externalPage > 0 && externalPage !== current) {
|
|
82
|
+
untracked(() => this.currentPage.set(externalPage));
|
|
46
83
|
}
|
|
47
84
|
});
|
|
48
85
|
effect(() => {
|
|
@@ -51,39 +88,208 @@ class DataGridComponent {
|
|
|
51
88
|
this.currentPage.set(max);
|
|
52
89
|
}
|
|
53
90
|
});
|
|
91
|
+
effect(() => {
|
|
92
|
+
const states = this.sortStates();
|
|
93
|
+
const current = untracked(() => this.sortState());
|
|
94
|
+
const first = states.length > 0 ? states[0] : null;
|
|
95
|
+
if (JSON.stringify(first) !== JSON.stringify(current)) {
|
|
96
|
+
untracked(() => this.sortState.set(first));
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
effect(() => {
|
|
100
|
+
const single = this.sortState();
|
|
101
|
+
const current = untracked(() => this.sortStates());
|
|
102
|
+
const first = current.length > 0 ? current[0] : null;
|
|
103
|
+
if (JSON.stringify(single) !== JSON.stringify(first)) {
|
|
104
|
+
untracked(() => this.sortStates.set(single ? [single] : []));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
effect(() => {
|
|
108
|
+
const key = this.stateKey();
|
|
109
|
+
if (!key || typeof window === 'undefined' || typeof localStorage === 'undefined') {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const state = {
|
|
113
|
+
columnWidths: this.columnWidths(),
|
|
114
|
+
sortState: this.sortState(),
|
|
115
|
+
sortStates: this.sortStates(),
|
|
116
|
+
columnOrder: this.columnOrder(),
|
|
117
|
+
currentPage: this.currentPage(),
|
|
118
|
+
filters: Array.from(this.filterStates().values()),
|
|
119
|
+
searchText: this.searchText()
|
|
120
|
+
};
|
|
121
|
+
try {
|
|
122
|
+
localStorage.setItem(`ngx_grid_state_${key}`, JSON.stringify(state));
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
console.warn('Failed to save grid state to localStorage', e);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
ngOnInit() {
|
|
130
|
+
this.loadState();
|
|
54
131
|
}
|
|
132
|
+
loadState() {
|
|
133
|
+
const key = this.stateKey();
|
|
134
|
+
if (!key || typeof window === 'undefined' || typeof localStorage === 'undefined') {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
const saved = localStorage.getItem(`ngx_grid_state_${key}`);
|
|
139
|
+
if (saved) {
|
|
140
|
+
const state = JSON.parse(saved);
|
|
141
|
+
if (state.columnWidths) {
|
|
142
|
+
this.columnWidths.set(state.columnWidths);
|
|
143
|
+
}
|
|
144
|
+
if (state.columnOrder) {
|
|
145
|
+
this.columnOrder.set(state.columnOrder);
|
|
146
|
+
}
|
|
147
|
+
if (state.sortStates) {
|
|
148
|
+
this.sortStates.set(state.sortStates);
|
|
149
|
+
this.sortState.set(state.sortStates.length > 0 ? state.sortStates[0] : null);
|
|
150
|
+
}
|
|
151
|
+
else if (state.sortState !== undefined) {
|
|
152
|
+
this.sortState.set(state.sortState);
|
|
153
|
+
this.sortStates.set(state.sortState ? [state.sortState] : []);
|
|
154
|
+
}
|
|
155
|
+
if (state.currentPage !== undefined) {
|
|
156
|
+
this.currentPage.set(state.currentPage);
|
|
157
|
+
}
|
|
158
|
+
if (state.filters) {
|
|
159
|
+
const map = new Map();
|
|
160
|
+
state.filters.forEach((f) => {
|
|
161
|
+
map.set(f.field, f);
|
|
162
|
+
});
|
|
163
|
+
this.filterStates.set(map);
|
|
164
|
+
}
|
|
165
|
+
if (state.searchText !== undefined) {
|
|
166
|
+
this.searchText.set(state.searchText);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
console.warn('Failed to load grid state from localStorage', e);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
orderedColumns = computed(() => {
|
|
175
|
+
const cols = this.columns();
|
|
176
|
+
const order = this.columnOrder();
|
|
177
|
+
let mapped = [...cols];
|
|
178
|
+
if (order.length > 0) {
|
|
179
|
+
mapped.sort((a, b) => {
|
|
180
|
+
const idxA = order.indexOf(a.field);
|
|
181
|
+
const idxB = order.indexOf(b.field);
|
|
182
|
+
if (idxA === -1 && idxB === -1)
|
|
183
|
+
return 0;
|
|
184
|
+
if (idxA === -1)
|
|
185
|
+
return 1;
|
|
186
|
+
if (idxB === -1)
|
|
187
|
+
return -1;
|
|
188
|
+
return idxA - idxB;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
const pinned = mapped.filter(c => c.pinned === 'left');
|
|
192
|
+
const normal = mapped.filter(c => c.pinned !== 'left');
|
|
193
|
+
return [...pinned, ...normal];
|
|
194
|
+
});
|
|
195
|
+
hasPinnedColumns = computed(() => this.columns().some(c => c.pinned === 'left'));
|
|
196
|
+
lastPinnedColumnField = computed(() => {
|
|
197
|
+
const pinned = this.orderedColumns().filter(c => c.pinned === 'left');
|
|
198
|
+
return pinned.length > 0 ? pinned[pinned.length - 1].field : null;
|
|
199
|
+
});
|
|
200
|
+
columnOffsets = computed(() => {
|
|
201
|
+
const offsets = {};
|
|
202
|
+
let currentOffset = 0;
|
|
203
|
+
if (this.rowReorderable()) {
|
|
204
|
+
currentOffset += 44;
|
|
205
|
+
}
|
|
206
|
+
if (this.showDetailToggle()) {
|
|
207
|
+
currentOffset += 44;
|
|
208
|
+
}
|
|
209
|
+
if (this.selectable()) {
|
|
210
|
+
currentOffset += 44;
|
|
211
|
+
}
|
|
212
|
+
const cols = this.orderedColumns();
|
|
213
|
+
for (const col of cols) {
|
|
214
|
+
if (col.pinned === 'left') {
|
|
215
|
+
offsets[col.field] = currentOffset;
|
|
216
|
+
currentOffset += this.getColumnWidth(col) ?? 120;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return offsets;
|
|
220
|
+
});
|
|
55
221
|
hasFilterableColumns = computed(() => this.columns().some(column => column.filterable));
|
|
56
222
|
isAnyServerMode = computed(() => this.sortMode() === 'server' ||
|
|
57
223
|
this.filterMode() === 'server' ||
|
|
58
224
|
this.groupMode() === 'server' ||
|
|
59
225
|
this.pagingMode() === 'server');
|
|
60
226
|
showDetailToggle = computed(() => this.detailRowTemplate() !== null);
|
|
61
|
-
activeFilters = computed(() => Array.from(this.
|
|
227
|
+
activeFilters = computed(() => Array.from(this.filterStates().values()));
|
|
62
228
|
clientFilteredData = computed(() => {
|
|
63
229
|
if (this.filterMode() !== 'client') {
|
|
64
230
|
return this.data();
|
|
65
231
|
}
|
|
66
232
|
let rows = this.data();
|
|
67
233
|
for (const filter of this.activeFilters()) {
|
|
68
|
-
if (
|
|
69
|
-
|
|
234
|
+
if (filter.operator === 'in') {
|
|
235
|
+
const selected = filter.selectedValues ?? [];
|
|
236
|
+
if (selected.length > 0) {
|
|
237
|
+
rows = rows.filter(row => {
|
|
238
|
+
const cellVal = String(row[filter.field] ?? '');
|
|
239
|
+
const displayVal = cellVal === '' || cellVal == null ? '(Blank)' : cellVal;
|
|
240
|
+
return selected.includes(displayVal);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
70
243
|
}
|
|
71
|
-
|
|
72
|
-
|
|
244
|
+
else {
|
|
245
|
+
if (!filter.value) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
const query = filter.value.toLowerCase();
|
|
249
|
+
const operator = filter.operator ?? 'contains';
|
|
250
|
+
rows = rows.filter(row => {
|
|
251
|
+
const cellVal = String(row[filter.field] ?? '').toLowerCase();
|
|
252
|
+
if (operator === 'eq')
|
|
253
|
+
return cellVal === query;
|
|
254
|
+
if (operator === 'startsWith')
|
|
255
|
+
return cellVal.startsWith(query);
|
|
256
|
+
if (operator === 'endsWith')
|
|
257
|
+
return cellVal.endsWith(query);
|
|
258
|
+
return cellVal.includes(query); // contains
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
const searchVal = this.searchText().trim().toLowerCase();
|
|
263
|
+
if (searchVal) {
|
|
264
|
+
const cols = this.orderedColumns();
|
|
265
|
+
rows = rows.filter(row => {
|
|
266
|
+
return cols.some(col => {
|
|
267
|
+
const cellVal = String(row[col.field] ?? '').toLowerCase();
|
|
268
|
+
return cellVal.includes(searchVal);
|
|
269
|
+
});
|
|
270
|
+
});
|
|
73
271
|
}
|
|
74
272
|
return rows;
|
|
75
273
|
});
|
|
76
274
|
clientSortedData = computed(() => {
|
|
77
275
|
const rows = this.clientFilteredData();
|
|
78
|
-
if (this.sortMode() !== 'client'
|
|
276
|
+
if (this.sortMode() !== 'client') {
|
|
277
|
+
return rows;
|
|
278
|
+
}
|
|
279
|
+
const activeSorts = this.sortStates();
|
|
280
|
+
if (activeSorts.length === 0) {
|
|
79
281
|
return rows;
|
|
80
282
|
}
|
|
81
|
-
const state = this.sortState();
|
|
82
283
|
return [...rows].sort((left, right) => {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
284
|
+
for (const state of activeSorts) {
|
|
285
|
+
const leftValue = left[state.field];
|
|
286
|
+
const rightValue = right[state.field];
|
|
287
|
+
const compared = this.compareValues(leftValue, rightValue);
|
|
288
|
+
if (compared !== 0) {
|
|
289
|
+
return state.dir === 'asc' ? compared : -compared;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return 0;
|
|
87
293
|
});
|
|
88
294
|
});
|
|
89
295
|
baseFlatData = computed(() => {
|
|
@@ -183,13 +389,14 @@ class DataGridComponent {
|
|
|
183
389
|
}
|
|
184
390
|
return pages;
|
|
185
391
|
});
|
|
186
|
-
renderColumnCount = computed(() => this.
|
|
392
|
+
renderColumnCount = computed(() => this.orderedColumns().length +
|
|
187
393
|
(this.selectable() ? 1 : 0) +
|
|
188
394
|
(this.showDetailToggle() ? 1 : 0) +
|
|
395
|
+
(this.rowReorderable() ? 1 : 0) +
|
|
189
396
|
(this.editable() ? 1 : 0));
|
|
190
397
|
showPager = computed(() => this.totalItems() > 0);
|
|
191
398
|
getFilter(field) {
|
|
192
|
-
return this.
|
|
399
|
+
return this.filterStates().get(field)?.value ?? '';
|
|
193
400
|
}
|
|
194
401
|
exportToJson() {
|
|
195
402
|
const dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(this.data(), null, 2));
|
|
@@ -203,7 +410,7 @@ class DataGridComponent {
|
|
|
203
410
|
exportToCsv() {
|
|
204
411
|
if (this.data().length === 0)
|
|
205
412
|
return;
|
|
206
|
-
const cols = this.
|
|
413
|
+
const cols = this.orderedColumns();
|
|
207
414
|
const headers = cols.map(c => c.title);
|
|
208
415
|
const fields = cols.map(c => c.field);
|
|
209
416
|
const rows = this.data().map(row => {
|
|
@@ -225,31 +432,317 @@ class DataGridComponent {
|
|
|
225
432
|
downloadAnchor.remove();
|
|
226
433
|
}
|
|
227
434
|
setFilter(field, value) {
|
|
228
|
-
const
|
|
435
|
+
const nextStates = new Map(this.filterStates());
|
|
229
436
|
if (value) {
|
|
230
|
-
|
|
437
|
+
nextStates.set(field, { field, value, operator: 'contains' });
|
|
231
438
|
}
|
|
232
439
|
else {
|
|
233
|
-
|
|
440
|
+
nextStates.delete(field);
|
|
234
441
|
}
|
|
235
|
-
this.
|
|
442
|
+
this.filterStates.set(nextStates);
|
|
236
443
|
this.currentPage.set(1);
|
|
237
444
|
const filters = this.activeFilters();
|
|
238
445
|
this.filterChange.emit({ filters });
|
|
239
446
|
this.emitDataState();
|
|
240
447
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
448
|
+
getColumnWidth(col) {
|
|
449
|
+
return this.columnWidths()[col.field] ?? col.width;
|
|
450
|
+
}
|
|
451
|
+
onResizeStart(event, col) {
|
|
452
|
+
event.stopPropagation();
|
|
453
|
+
event.preventDefault();
|
|
454
|
+
this.resizingField = col.field;
|
|
455
|
+
this.resizeStartX = event.clientX;
|
|
456
|
+
this.resizeStartWidth = this.columnWidths()[col.field] ?? col.width ?? 120;
|
|
457
|
+
const onMouseMove = (moveEvent) => {
|
|
458
|
+
if (!this.resizingField)
|
|
459
|
+
return;
|
|
460
|
+
const deltaX = moveEvent.clientX - this.resizeStartX;
|
|
461
|
+
const newWidth = Math.max(50, this.resizeStartWidth + deltaX);
|
|
462
|
+
this.columnWidths.update(widths => ({
|
|
463
|
+
...widths,
|
|
464
|
+
[this.resizingField]: newWidth
|
|
465
|
+
}));
|
|
466
|
+
};
|
|
467
|
+
const onMouseUp = () => {
|
|
468
|
+
this.resizingField = null;
|
|
469
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
470
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
471
|
+
};
|
|
472
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
473
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
474
|
+
}
|
|
475
|
+
openFilterPopover(event, field) {
|
|
476
|
+
event.stopPropagation();
|
|
477
|
+
if (this.activeFilterPopover()?.field === field) {
|
|
478
|
+
this.activeFilterPopover.set(null);
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
const current = this.filterStates().get(field);
|
|
482
|
+
this.tempFilterValue.set(current?.value ?? '');
|
|
483
|
+
this.tempFilterOperator.set((current?.operator === 'in' ? 'contains' : current?.operator) ?? 'contains');
|
|
484
|
+
const distinct = this.getDistinctValues(field);
|
|
485
|
+
if (current?.selectedValues) {
|
|
486
|
+
this.tempSelectedValues.set(new Set(current.selectedValues));
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
this.tempSelectedValues.set(new Set(distinct));
|
|
490
|
+
}
|
|
491
|
+
const buttonEl = event.currentTarget;
|
|
492
|
+
const gridEl = this.elementRef.nativeElement.querySelector('.ngx-data-grid');
|
|
493
|
+
const buttonRect = buttonEl.getBoundingClientRect();
|
|
494
|
+
const gridRect = gridEl.getBoundingClientRect();
|
|
495
|
+
const top = buttonRect.bottom - gridRect.top;
|
|
496
|
+
const left = buttonRect.left - gridRect.left;
|
|
497
|
+
this.activeFilterPopover.set({
|
|
498
|
+
field,
|
|
499
|
+
top,
|
|
500
|
+
left: Math.min(left, gridRect.width - 260)
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
getDistinctValues(field) {
|
|
504
|
+
const vals = new Set();
|
|
505
|
+
this.data().forEach(row => {
|
|
506
|
+
const val = row[field];
|
|
507
|
+
vals.add(val == null || val === '' ? '(Blank)' : String(val));
|
|
508
|
+
});
|
|
509
|
+
return Array.from(vals).sort();
|
|
510
|
+
}
|
|
511
|
+
toggleChecklistItem(val) {
|
|
512
|
+
const next = new Set(this.tempSelectedValues());
|
|
513
|
+
if (next.has(val)) {
|
|
514
|
+
next.delete(val);
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
next.add(val);
|
|
518
|
+
}
|
|
519
|
+
this.tempSelectedValues.set(next);
|
|
520
|
+
}
|
|
521
|
+
toggleSelectAllChecklist() {
|
|
522
|
+
const pop = this.activeFilterPopover();
|
|
523
|
+
if (!pop)
|
|
524
|
+
return;
|
|
525
|
+
const distinct = this.getDistinctValues(pop.field);
|
|
526
|
+
if (this.tempSelectedValues().size === distinct.length) {
|
|
527
|
+
this.tempSelectedValues.set(new Set());
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
this.tempSelectedValues.set(new Set(distinct));
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
applyPopoverFilter() {
|
|
534
|
+
const pop = this.activeFilterPopover();
|
|
535
|
+
if (!pop)
|
|
536
|
+
return;
|
|
537
|
+
const field = pop.field;
|
|
538
|
+
const distinct = this.getDistinctValues(field);
|
|
539
|
+
const selected = this.tempSelectedValues();
|
|
540
|
+
let filterState = null;
|
|
541
|
+
if (this.tempFilterValue()) {
|
|
542
|
+
filterState = {
|
|
543
|
+
field,
|
|
544
|
+
value: this.tempFilterValue(),
|
|
545
|
+
operator: this.tempFilterOperator()
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
else if (selected.size < distinct.length) {
|
|
549
|
+
filterState = {
|
|
550
|
+
field,
|
|
551
|
+
value: '',
|
|
552
|
+
operator: 'in',
|
|
553
|
+
selectedValues: Array.from(selected)
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
const nextStates = new Map(this.filterStates());
|
|
557
|
+
if (filterState) {
|
|
558
|
+
nextStates.set(field, filterState);
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
nextStates.delete(field);
|
|
562
|
+
}
|
|
563
|
+
this.filterStates.set(nextStates);
|
|
564
|
+
this.currentPage.set(1);
|
|
565
|
+
this.activeFilterPopover.set(null);
|
|
566
|
+
this.filterChange.emit({ filters: this.activeFilters() });
|
|
567
|
+
this.emitDataState();
|
|
568
|
+
}
|
|
569
|
+
clearPopoverFilter() {
|
|
570
|
+
const pop = this.activeFilterPopover();
|
|
571
|
+
if (!pop)
|
|
572
|
+
return;
|
|
573
|
+
const field = pop.field;
|
|
574
|
+
const nextStates = new Map(this.filterStates());
|
|
575
|
+
nextStates.delete(field);
|
|
576
|
+
this.filterStates.set(nextStates);
|
|
577
|
+
this.currentPage.set(1);
|
|
578
|
+
this.activeFilterPopover.set(null);
|
|
579
|
+
this.filterChange.emit({ filters: this.activeFilters() });
|
|
580
|
+
this.emitDataState();
|
|
581
|
+
}
|
|
582
|
+
hasAggregation = computed(() => this.columns().some(col => col.aggregation));
|
|
583
|
+
getAggregationValue(col) {
|
|
584
|
+
const rows = this.clientFilteredData();
|
|
585
|
+
if (rows.length === 0)
|
|
586
|
+
return '-';
|
|
587
|
+
const values = rows.map(r => {
|
|
588
|
+
const val = r[col.field];
|
|
589
|
+
return typeof val === 'number' ? val : Number(val);
|
|
590
|
+
}).filter(v => !isNaN(v));
|
|
591
|
+
if (col.aggregation === 'count') {
|
|
592
|
+
return String(rows.length);
|
|
593
|
+
}
|
|
594
|
+
if (values.length === 0)
|
|
595
|
+
return '-';
|
|
596
|
+
switch (col.aggregation) {
|
|
597
|
+
case 'sum': {
|
|
598
|
+
const sum = values.reduce((acc, v) => acc + v, 0);
|
|
599
|
+
return this.formatAggValue(sum);
|
|
600
|
+
}
|
|
601
|
+
case 'avg': {
|
|
602
|
+
const sum = values.reduce((acc, v) => acc + v, 0);
|
|
603
|
+
const avg = sum / values.length;
|
|
604
|
+
return this.formatAggValue(avg);
|
|
605
|
+
}
|
|
606
|
+
case 'min': {
|
|
607
|
+
return this.formatAggValue(Math.min(...values));
|
|
608
|
+
}
|
|
609
|
+
case 'max': {
|
|
610
|
+
return this.formatAggValue(Math.max(...values));
|
|
611
|
+
}
|
|
612
|
+
default:
|
|
613
|
+
return '-';
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
formatAggValue(val) {
|
|
617
|
+
return val % 1 === 0 ? String(val) : val.toFixed(2);
|
|
618
|
+
}
|
|
619
|
+
onSort(column, event) {
|
|
620
|
+
const isMulti = this.multiSort() && event && (event.ctrlKey || event.shiftKey);
|
|
621
|
+
const currentStates = [...this.sortStates()];
|
|
622
|
+
const index = currentStates.findIndex(s => s.field === column.field);
|
|
623
|
+
if (isMulti) {
|
|
624
|
+
if (index !== -1) {
|
|
625
|
+
const current = currentStates[index];
|
|
626
|
+
if (current.dir === 'asc') {
|
|
627
|
+
currentStates[index] = { field: column.field, dir: 'desc' };
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
currentStates.splice(index, 1);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
else {
|
|
634
|
+
currentStates.push({ field: column.field, dir: 'asc' });
|
|
635
|
+
}
|
|
636
|
+
this.sortStates.set(currentStates);
|
|
245
637
|
}
|
|
246
638
|
else {
|
|
247
|
-
|
|
639
|
+
if (index !== -1 && currentStates.length === 1) {
|
|
640
|
+
const current = currentStates[0];
|
|
641
|
+
if (current.dir === 'asc') {
|
|
642
|
+
this.sortStates.set([{ field: column.field, dir: 'desc' }]);
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
this.sortStates.set([]);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
this.sortStates.set([{ field: column.field, dir: 'asc' }]);
|
|
650
|
+
}
|
|
248
651
|
}
|
|
249
652
|
this.currentPage.set(1);
|
|
250
|
-
this.sortChange.emit({ sort: this.sortState() });
|
|
653
|
+
this.sortChange.emit({ sort: this.sortState(), sorts: this.sortStates() });
|
|
251
654
|
this.emitDataState();
|
|
252
655
|
}
|
|
656
|
+
onDragStart(event, col) {
|
|
657
|
+
if (!this.reorderable())
|
|
658
|
+
return;
|
|
659
|
+
this.draggingField.set(col.field);
|
|
660
|
+
if (event.dataTransfer) {
|
|
661
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
662
|
+
event.dataTransfer.setData('text/plain', col.field);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
onDragOver(event, col) {
|
|
666
|
+
if (!this.reorderable() || this.draggingField() === col.field)
|
|
667
|
+
return;
|
|
668
|
+
event.preventDefault();
|
|
669
|
+
this.dragOverField.set(col.field);
|
|
670
|
+
}
|
|
671
|
+
onDrop(event, targetCol) {
|
|
672
|
+
if (!this.reorderable())
|
|
673
|
+
return;
|
|
674
|
+
const sourceField = this.draggingField();
|
|
675
|
+
const targetField = targetCol.field;
|
|
676
|
+
if (sourceField && sourceField !== targetField) {
|
|
677
|
+
const currentOrder = this.columnOrder().length > 0
|
|
678
|
+
? [...this.columnOrder()]
|
|
679
|
+
: this.columns().map(c => c.field);
|
|
680
|
+
const sourceIndex = currentOrder.indexOf(sourceField);
|
|
681
|
+
const targetIndex = currentOrder.indexOf(targetField);
|
|
682
|
+
if (sourceIndex !== -1 && targetIndex !== -1) {
|
|
683
|
+
currentOrder.splice(sourceIndex, 1);
|
|
684
|
+
currentOrder.splice(targetIndex, 0, sourceField);
|
|
685
|
+
this.columnOrder.set(currentOrder);
|
|
686
|
+
this.columnReorder.emit({ columns: this.orderedColumns() });
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
this.draggingField.set(null);
|
|
690
|
+
this.dragOverField.set(null);
|
|
691
|
+
}
|
|
692
|
+
onDragEnd() {
|
|
693
|
+
this.draggingField.set(null);
|
|
694
|
+
this.dragOverField.set(null);
|
|
695
|
+
}
|
|
696
|
+
onRowDragStart(event, index) {
|
|
697
|
+
if (!this.rowReorderable())
|
|
698
|
+
return;
|
|
699
|
+
this.draggingRowIndex.set(index);
|
|
700
|
+
if (event.dataTransfer) {
|
|
701
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
702
|
+
event.dataTransfer.setData('text/plain', String(index));
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
onRowDragOver(event, index) {
|
|
706
|
+
if (!this.rowReorderable() || this.draggingRowIndex() === index)
|
|
707
|
+
return;
|
|
708
|
+
event.preventDefault();
|
|
709
|
+
this.dragOverRowIndex.set(index);
|
|
710
|
+
}
|
|
711
|
+
onRowDrop(event, targetIndex) {
|
|
712
|
+
if (!this.rowReorderable())
|
|
713
|
+
return;
|
|
714
|
+
const sourceIndex = this.draggingRowIndex();
|
|
715
|
+
if (sourceIndex !== null && sourceIndex !== targetIndex) {
|
|
716
|
+
const rendered = this.flatRenderedRows();
|
|
717
|
+
const sourceItem = rendered[sourceIndex];
|
|
718
|
+
const targetItem = rendered[targetIndex];
|
|
719
|
+
const currentData = [...this.data()];
|
|
720
|
+
const actualSourceIdx = currentData.indexOf(sourceItem);
|
|
721
|
+
const actualTargetIdx = currentData.indexOf(targetItem);
|
|
722
|
+
if (actualSourceIdx !== -1 && actualTargetIdx !== -1) {
|
|
723
|
+
currentData.splice(actualSourceIdx, 1);
|
|
724
|
+
currentData.splice(actualTargetIdx, 0, sourceItem);
|
|
725
|
+
this.rowReorder.emit({
|
|
726
|
+
previousIndex: actualSourceIdx,
|
|
727
|
+
currentIndex: actualTargetIdx,
|
|
728
|
+
data: currentData
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
this.draggingRowIndex.set(null);
|
|
733
|
+
this.dragOverRowIndex.set(null);
|
|
734
|
+
}
|
|
735
|
+
onRowDragEnd() {
|
|
736
|
+
this.draggingRowIndex.set(null);
|
|
737
|
+
this.dragOverRowIndex.set(null);
|
|
738
|
+
}
|
|
739
|
+
getSortIndex(col) {
|
|
740
|
+
return this.sortStates().findIndex(s => s.field === col.field) + 1;
|
|
741
|
+
}
|
|
742
|
+
getSortDirection(col) {
|
|
743
|
+
const found = this.sortStates().find(s => s.field === col.field);
|
|
744
|
+
return found ? found.dir : null;
|
|
745
|
+
}
|
|
253
746
|
setGroup(state) {
|
|
254
747
|
this.groupChange.emit({ group: state });
|
|
255
748
|
this.currentPage.set(1);
|
|
@@ -366,6 +859,33 @@ class DataGridComponent {
|
|
|
366
859
|
toStringSafe(value) {
|
|
367
860
|
return value == null ? '' : String(value);
|
|
368
861
|
}
|
|
862
|
+
highlightSearchText(value) {
|
|
863
|
+
const rawVal = value == null ? '' : String(value);
|
|
864
|
+
const searchVal = this.searchText().trim();
|
|
865
|
+
if (!searchVal || !this.showGlobalSearch()) {
|
|
866
|
+
return this.escapeHtml(rawVal);
|
|
867
|
+
}
|
|
868
|
+
const escapedVal = this.escapeHtml(rawVal);
|
|
869
|
+
const escapedSearch = this.escapeRegExp(searchVal);
|
|
870
|
+
try {
|
|
871
|
+
const regex = new RegExp(`(${escapedSearch})`, 'gi');
|
|
872
|
+
return escapedVal.replace(regex, '<mark class="search-highlight">$1</mark>');
|
|
873
|
+
}
|
|
874
|
+
catch {
|
|
875
|
+
return escapedVal;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
escapeHtml(text) {
|
|
879
|
+
return text
|
|
880
|
+
.replace(/&/g, '&')
|
|
881
|
+
.replace(/</g, '<')
|
|
882
|
+
.replace(/>/g, '>')
|
|
883
|
+
.replace(/"/g, '"')
|
|
884
|
+
.replace(/'/g, ''');
|
|
885
|
+
}
|
|
886
|
+
escapeRegExp(text) {
|
|
887
|
+
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
888
|
+
}
|
|
369
889
|
getKey(row, index) {
|
|
370
890
|
const source = row;
|
|
371
891
|
return String(source['id'] ?? source['key'] ?? index);
|
|
@@ -426,74 +946,98 @@ class DataGridComponent {
|
|
|
426
946
|
});
|
|
427
947
|
}
|
|
428
948
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DataGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
429
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DataGridComponent, isStandalone: true, selector: "ngx-data-grid", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, striped: { classPropertyName: "striped", publicName: "striped", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, sortMode: { classPropertyName: "sortMode", publicName: "sortMode", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, groupMode: { classPropertyName: "groupMode", publicName: "groupMode", isSignal: true, isRequired: false, transformFunction: null }, pagingMode: { classPropertyName: "pagingMode", publicName: "pagingMode", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, groupedData: { classPropertyName: "groupedData", publicName: "groupedData", isSignal: true, isRequired: false, transformFunction: null }, headerTemplate: { classPropertyName: "headerTemplate", publicName: "headerTemplate", isSignal: true, isRequired: false, transformFunction: null }, cellTemplate: { classPropertyName: "cellTemplate", publicName: "cellTemplate", isSignal: true, isRequired: false, transformFunction: null }, rowTemplate: { classPropertyName: "rowTemplate", publicName: "rowTemplate", isSignal: true, isRequired: false, transformFunction: null }, detailRowTemplate: { classPropertyName: "detailRowTemplate", publicName: "detailRowTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { rowClick: "rowClick", selectionChange: "selectionChange", sortChange: "sortChange", filterChange: "filterChange", groupChange: "groupChange", pageChange: "pageChange", dataStateChange: "dataStateChange", rowUpdate: "rowUpdate" }, ngImport: i0, template: `
|
|
949
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DataGridComponent, isStandalone: true, selector: "ngx-data-grid", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, stateKey: { classPropertyName: "stateKey", publicName: "stateKey", isSignal: true, isRequired: false, transformFunction: null }, reorderable: { classPropertyName: "reorderable", publicName: "reorderable", isSignal: true, isRequired: false, transformFunction: null }, multiSort: { classPropertyName: "multiSort", publicName: "multiSort", isSignal: true, isRequired: false, transformFunction: null }, rowReorderable: { classPropertyName: "rowReorderable", publicName: "rowReorderable", isSignal: true, isRequired: false, transformFunction: null }, showGlobalSearch: { classPropertyName: "showGlobalSearch", publicName: "showGlobalSearch", isSignal: true, isRequired: false, transformFunction: null }, globalSearchPlaceholder: { classPropertyName: "globalSearchPlaceholder", publicName: "globalSearchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, page: { classPropertyName: "page", publicName: "page", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, striped: { classPropertyName: "striped", publicName: "striped", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, sortMode: { classPropertyName: "sortMode", publicName: "sortMode", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, groupMode: { classPropertyName: "groupMode", publicName: "groupMode", isSignal: true, isRequired: false, transformFunction: null }, pagingMode: { classPropertyName: "pagingMode", publicName: "pagingMode", isSignal: true, isRequired: false, transformFunction: null }, groupBy: { classPropertyName: "groupBy", publicName: "groupBy", isSignal: true, isRequired: false, transformFunction: null }, groupedData: { classPropertyName: "groupedData", publicName: "groupedData", isSignal: true, isRequired: false, transformFunction: null }, headerTemplate: { classPropertyName: "headerTemplate", publicName: "headerTemplate", isSignal: true, isRequired: false, transformFunction: null }, cellTemplate: { classPropertyName: "cellTemplate", publicName: "cellTemplate", isSignal: true, isRequired: false, transformFunction: null }, rowTemplate: { classPropertyName: "rowTemplate", publicName: "rowTemplate", isSignal: true, isRequired: false, transformFunction: null }, detailRowTemplate: { classPropertyName: "detailRowTemplate", publicName: "detailRowTemplate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { columnReorder: "columnReorder", rowReorder: "rowReorder", rowClick: "rowClick", selectionChange: "selectionChange", sortChange: "sortChange", filterChange: "filterChange", groupChange: "groupChange", pageChange: "pageChange", dataStateChange: "dataStateChange", rowUpdate: "rowUpdate" }, ngImport: i0, template: `
|
|
430
950
|
<div class="ngx-data-grid" [class.loading]="loading()">
|
|
431
951
|
|
|
432
952
|
<div class="grid-toolbar">
|
|
433
953
|
<span class="grid-toolbar-title">Data Grid</span>
|
|
434
954
|
<div class="grid-toolbar-actions">
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
</div>
|
|
438
|
-
</div>
|
|
439
|
-
|
|
440
|
-
@if (hasFilterableColumns()) {
|
|
441
|
-
<div class="grid-filter-bar">
|
|
442
|
-
@for (col of columns(); track col.field) {
|
|
443
|
-
@if (col.filterable) {
|
|
955
|
+
@if (showGlobalSearch()) {
|
|
956
|
+
<div class="grid-search-wrap">
|
|
444
957
|
<input
|
|
445
|
-
class="grid-
|
|
446
|
-
|
|
447
|
-
[
|
|
448
|
-
|
|
449
|
-
|
|
958
|
+
class="grid-search-input"
|
|
959
|
+
type="text"
|
|
960
|
+
[placeholder]="globalSearchPlaceholder()"
|
|
961
|
+
[value]="searchText()"
|
|
962
|
+
(input)="searchText.set($any($event.target).value)"
|
|
450
963
|
/>
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
964
|
+
@if (searchText()) {
|
|
965
|
+
<button class="grid-search-clear" (click)="searchText.set('')" title="Clear search">×</button>
|
|
966
|
+
}
|
|
967
|
+
</div>
|
|
454
968
|
}
|
|
969
|
+
<button class="grid-action-btn" (click)="exportToJson()" title="Export JSON">JSON</button>
|
|
970
|
+
<button class="grid-action-btn" (click)="exportToCsv()" title="Export CSV">CSV</button>
|
|
455
971
|
</div>
|
|
456
|
-
|
|
972
|
+
</div>
|
|
457
973
|
|
|
458
974
|
<div class="grid-table-wrap">
|
|
459
975
|
<table class="grid-table" [class.striped]="striped()">
|
|
460
976
|
<thead>
|
|
461
977
|
<tr>
|
|
978
|
+
@if (rowReorderable()) {
|
|
979
|
+
<th class="grid-th grid-th-reorder pinned-left" style="width:44px; left:0px"></th>
|
|
980
|
+
}
|
|
462
981
|
@if (showDetailToggle()) {
|
|
463
|
-
<th class="grid-th grid-th-toggle" style="width:
|
|
982
|
+
<th class="grid-th grid-th-toggle pinned-left" [style.left.px]="rowReorderable() ? 44 : 0" style="width:44px"></th>
|
|
464
983
|
}
|
|
465
984
|
@if (selectable()) {
|
|
466
|
-
<th class="grid-th grid-th-check" style="width:
|
|
985
|
+
<th class="grid-th grid-th-check pinned-left" [style.left.px]="(rowReorderable() ? 44 : 0) + (showDetailToggle() ? 44 : 0)" style="width:44px">
|
|
467
986
|
<input type="checkbox" [checked]="allSelected()" [indeterminate]="someSelected() && !allSelected()" (change)="toggleAll()" />
|
|
468
987
|
</th>
|
|
469
988
|
}
|
|
470
|
-
@for (col of
|
|
989
|
+
@for (col of orderedColumns(); track col.field) {
|
|
471
990
|
<th
|
|
472
991
|
class="grid-th"
|
|
473
|
-
[
|
|
992
|
+
[class.pinned-left]="col.pinned === 'left'"
|
|
993
|
+
[class.pinned-left-last]="col.pinned === 'left' && lastPinnedColumnField() === col.field"
|
|
994
|
+
[style.left.px]="col.pinned === 'left' ? columnOffsets()[col.field] : null"
|
|
995
|
+
[style.width.px]="getColumnWidth(col)"
|
|
474
996
|
[class.sortable]="col.sortable"
|
|
475
|
-
[class.sort-asc]="
|
|
476
|
-
[class.sort-desc]="
|
|
477
|
-
|
|
997
|
+
[class.sort-asc]="getSortDirection(col) === 'asc'"
|
|
998
|
+
[class.sort-desc]="getSortDirection(col) === 'desc'"
|
|
999
|
+
[class.dragging]="draggingField() === col.field"
|
|
1000
|
+
[class.drag-over]="dragOverField() === col.field"
|
|
1001
|
+
[attr.draggable]="reorderable() ? true : null"
|
|
1002
|
+
(dragstart)="onDragStart($event, col)"
|
|
1003
|
+
(dragover)="onDragOver($event, col)"
|
|
1004
|
+
(drop)="onDrop($event, col)"
|
|
1005
|
+
(dragend)="onDragEnd()"
|
|
1006
|
+
(click)="col.sortable ? onSort(col, $event) : null"
|
|
478
1007
|
>
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
@if (
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
1008
|
+
<div class="th-content-wrapper">
|
|
1009
|
+
@if (resolveHeaderTemplate(col); as activeHeaderTemplate) {
|
|
1010
|
+
<ng-container *ngTemplateOutlet="activeHeaderTemplate; context: {
|
|
1011
|
+
$implicit: col,
|
|
1012
|
+
column: col,
|
|
1013
|
+
sort: sortState(),
|
|
1014
|
+
filters: activeFilters(),
|
|
1015
|
+
isServerMode: isAnyServerMode()
|
|
1016
|
+
}" />
|
|
1017
|
+
} @else {
|
|
1018
|
+
<span class="th-text">{{ col.title }}</span>
|
|
1019
|
+
@if (col.sortable) {
|
|
1020
|
+
@if (getSortDirection(col); as dir) {
|
|
1021
|
+
<span class="sort-icon active">
|
|
1022
|
+
{{ dir === 'asc' ? '↑' : '↓' }}
|
|
1023
|
+
@if (multiSort() && sortStates().length > 1) {
|
|
1024
|
+
<sub class="sort-order-badge">{{ getSortIndex(col) }}</sub>
|
|
1025
|
+
}
|
|
1026
|
+
</span>
|
|
1027
|
+
} @else {
|
|
1028
|
+
<span class="sort-icon">↕</span>
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
495
1031
|
}
|
|
496
|
-
|
|
1032
|
+
@if (col.filterable) {
|
|
1033
|
+
<button class="grid-filter-btn" [class.active]="filterStates().has(col.field)" (click)="openFilterPopover($event, col.field); $event.stopPropagation()" title="Filter column">
|
|
1034
|
+
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1035
|
+
<polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"></polygon>
|
|
1036
|
+
</svg>
|
|
1037
|
+
</button>
|
|
1038
|
+
}
|
|
1039
|
+
</div>
|
|
1040
|
+
<div class="grid-resize-handle" (mousedown)="onResizeStart($event, col)" (click)="$event.stopPropagation()"></div>
|
|
497
1041
|
</th>
|
|
498
1042
|
}
|
|
499
1043
|
@if (editable()) {
|
|
@@ -529,11 +1073,27 @@ class DataGridComponent {
|
|
|
529
1073
|
<tr
|
|
530
1074
|
class="grid-row"
|
|
531
1075
|
[class.selected]="isRowSelected(row)"
|
|
1076
|
+
[class.dragging-row]="draggingRowIndex() === i"
|
|
1077
|
+
[class.drag-over-row]="dragOverRowIndex() === i"
|
|
1078
|
+
(dragover)="onRowDragOver($event, i)"
|
|
1079
|
+
(drop)="onRowDrop($event, i)"
|
|
1080
|
+
(dragend)="onRowDragEnd()"
|
|
532
1081
|
(click)="onRowClick(row, i)"
|
|
533
1082
|
(dblclick)="editable() ? beginEdit(row, i) : null"
|
|
534
1083
|
>
|
|
1084
|
+
@if (rowReorderable()) {
|
|
1085
|
+
<td class="grid-td grid-td-reorder pinned-left" style="left:0px; text-align:center; width:44px">
|
|
1086
|
+
<span
|
|
1087
|
+
class="row-drag-handle"
|
|
1088
|
+
draggable="true"
|
|
1089
|
+
(dragstart)="onRowDragStart($event, i)"
|
|
1090
|
+
(dragend)="onRowDragEnd()"
|
|
1091
|
+
>⋮⋮</span>
|
|
1092
|
+
</td>
|
|
1093
|
+
}
|
|
1094
|
+
|
|
535
1095
|
@if (showDetailToggle()) {
|
|
536
|
-
<td class="grid-td grid-td-toggle">
|
|
1096
|
+
<td class="grid-td grid-td-toggle pinned-left" [style.left.px]="rowReorderable() ? 44 : 0">
|
|
537
1097
|
<button class="toggle-btn" type="button" (click)="toggleDetail(row); $event.stopPropagation()">
|
|
538
1098
|
{{ isExpanded(row) ? '▾' : '▸' }}
|
|
539
1099
|
</button>
|
|
@@ -541,13 +1101,13 @@ class DataGridComponent {
|
|
|
541
1101
|
}
|
|
542
1102
|
|
|
543
1103
|
@if (selectable()) {
|
|
544
|
-
<td class="grid-td grid-td-check">
|
|
1104
|
+
<td class="grid-td grid-td-check pinned-left" [style.left.px]="(rowReorderable() ? 44 : 0) + (showDetailToggle() ? 44 : 0)">
|
|
545
1105
|
<input type="checkbox" [checked]="isRowSelected(row)" (change)="toggleRow(row)" (click)="$event.stopPropagation()" />
|
|
546
1106
|
</td>
|
|
547
1107
|
}
|
|
548
1108
|
|
|
549
1109
|
@if (rowTemplate()) {
|
|
550
|
-
<td class="grid-td" [attr.colspan]="
|
|
1110
|
+
<td class="grid-td" [attr.colspan]="orderedColumns().length + (editable() ? 1 : 0)">
|
|
551
1111
|
<ng-container *ngTemplateOutlet="rowTemplate(); context: {
|
|
552
1112
|
$implicit: row,
|
|
553
1113
|
row: row,
|
|
@@ -557,8 +1117,15 @@ class DataGridComponent {
|
|
|
557
1117
|
}" />
|
|
558
1118
|
</td>
|
|
559
1119
|
} @else {
|
|
560
|
-
@for (col of
|
|
561
|
-
<td
|
|
1120
|
+
@for (col of orderedColumns(); track col.field) {
|
|
1121
|
+
<td
|
|
1122
|
+
class="grid-td"
|
|
1123
|
+
[class.pinned-left]="col.pinned === 'left'"
|
|
1124
|
+
[class.pinned-left-last]="col.pinned === 'left' && lastPinnedColumnField() === col.field"
|
|
1125
|
+
[style.left.px]="col.pinned === 'left' ? columnOffsets()[col.field] : null"
|
|
1126
|
+
[style.text-align]="col.align ?? 'left'"
|
|
1127
|
+
[style.width.px]="getColumnWidth(col)"
|
|
1128
|
+
>
|
|
562
1129
|
@if (isEditing(row) && editable() && col.editable) {
|
|
563
1130
|
<input
|
|
564
1131
|
class="grid-edit-input"
|
|
@@ -576,13 +1143,17 @@ class DataGridComponent {
|
|
|
576
1143
|
editing: isEditing(row)
|
|
577
1144
|
}" />
|
|
578
1145
|
} @else {
|
|
579
|
-
|
|
1146
|
+
@if (showGlobalSearch() && searchText()) {
|
|
1147
|
+
<span [innerHTML]="highlightSearchText(getCellValue(row, col.field))"></span>
|
|
1148
|
+
} @else {
|
|
1149
|
+
{{ getCellValue(row, col.field) }}
|
|
1150
|
+
}
|
|
580
1151
|
}
|
|
581
1152
|
</td>
|
|
582
1153
|
}
|
|
583
1154
|
|
|
584
1155
|
@if (editable()) {
|
|
585
|
-
<td class="grid-td grid-actions">
|
|
1156
|
+
<td class="grid-td grid-actions" style="width:120px">
|
|
586
1157
|
@if (!isEditing(row)) {
|
|
587
1158
|
<button class="action-btn" type="button" (click)="beginEdit(row, i); $event.stopPropagation()">Edit</button>
|
|
588
1159
|
} @else {
|
|
@@ -613,11 +1184,27 @@ class DataGridComponent {
|
|
|
613
1184
|
<tr
|
|
614
1185
|
class="grid-row"
|
|
615
1186
|
[class.selected]="isRowSelected(row)"
|
|
1187
|
+
[class.dragging-row]="draggingRowIndex() === i"
|
|
1188
|
+
[class.drag-over-row]="dragOverRowIndex() === i"
|
|
1189
|
+
(dragover)="onRowDragOver($event, i)"
|
|
1190
|
+
(drop)="onRowDrop($event, i)"
|
|
1191
|
+
(dragend)="onRowDragEnd()"
|
|
616
1192
|
(click)="onRowClick(row, i)"
|
|
617
1193
|
(dblclick)="editable() ? beginEdit(row, i) : null"
|
|
618
1194
|
>
|
|
1195
|
+
@if (rowReorderable()) {
|
|
1196
|
+
<td class="grid-td grid-td-reorder pinned-left" style="left:0px; text-align:center; width:44px">
|
|
1197
|
+
<span
|
|
1198
|
+
class="row-drag-handle"
|
|
1199
|
+
draggable="true"
|
|
1200
|
+
(dragstart)="onRowDragStart($event, i)"
|
|
1201
|
+
(dragend)="onRowDragEnd()"
|
|
1202
|
+
>⋮⋮</span>
|
|
1203
|
+
</td>
|
|
1204
|
+
}
|
|
1205
|
+
|
|
619
1206
|
@if (showDetailToggle()) {
|
|
620
|
-
<td class="grid-td grid-td-toggle">
|
|
1207
|
+
<td class="grid-td grid-td-toggle pinned-left" [style.left.px]="rowReorderable() ? 44 : 0">
|
|
621
1208
|
<button class="toggle-btn" type="button" (click)="toggleDetail(row); $event.stopPropagation()">
|
|
622
1209
|
{{ isExpanded(row) ? '▾' : '▸' }}
|
|
623
1210
|
</button>
|
|
@@ -625,13 +1212,13 @@ class DataGridComponent {
|
|
|
625
1212
|
}
|
|
626
1213
|
|
|
627
1214
|
@if (selectable()) {
|
|
628
|
-
<td class="grid-td grid-td-check">
|
|
1215
|
+
<td class="grid-td grid-td-check pinned-left" [style.left.px]="(rowReorderable() ? 44 : 0) + (showDetailToggle() ? 44 : 0)">
|
|
629
1216
|
<input type="checkbox" [checked]="isRowSelected(row)" (change)="toggleRow(row)" (click)="$event.stopPropagation()" />
|
|
630
1217
|
</td>
|
|
631
1218
|
}
|
|
632
1219
|
|
|
633
1220
|
@if (rowTemplate()) {
|
|
634
|
-
<td class="grid-td" [attr.colspan]="
|
|
1221
|
+
<td class="grid-td" [attr.colspan]="orderedColumns().length + (editable() ? 1 : 0)">
|
|
635
1222
|
<ng-container *ngTemplateOutlet="rowTemplate(); context: {
|
|
636
1223
|
$implicit: row,
|
|
637
1224
|
row: row,
|
|
@@ -641,8 +1228,15 @@ class DataGridComponent {
|
|
|
641
1228
|
}" />
|
|
642
1229
|
</td>
|
|
643
1230
|
} @else {
|
|
644
|
-
@for (col of
|
|
645
|
-
<td
|
|
1231
|
+
@for (col of orderedColumns(); track col.field) {
|
|
1232
|
+
<td
|
|
1233
|
+
class="grid-td"
|
|
1234
|
+
[class.pinned-left]="col.pinned === 'left'"
|
|
1235
|
+
[class.pinned-left-last]="col.pinned === 'left' && lastPinnedColumnField() === col.field"
|
|
1236
|
+
[style.left.px]="col.pinned === 'left' ? columnOffsets()[col.field] : null"
|
|
1237
|
+
[style.text-align]="col.align ?? 'left'"
|
|
1238
|
+
[style.width.px]="getColumnWidth(col)"
|
|
1239
|
+
>
|
|
646
1240
|
@if (isEditing(row) && editable() && col.editable) {
|
|
647
1241
|
<input
|
|
648
1242
|
class="grid-edit-input"
|
|
@@ -660,13 +1254,17 @@ class DataGridComponent {
|
|
|
660
1254
|
editing: isEditing(row)
|
|
661
1255
|
}" />
|
|
662
1256
|
} @else {
|
|
663
|
-
|
|
1257
|
+
@if (showGlobalSearch() && searchText()) {
|
|
1258
|
+
<span [innerHTML]="highlightSearchText(getCellValue(row, col.field))"></span>
|
|
1259
|
+
} @else {
|
|
1260
|
+
{{ getCellValue(row, col.field) }}
|
|
1261
|
+
}
|
|
664
1262
|
}
|
|
665
1263
|
</td>
|
|
666
1264
|
}
|
|
667
1265
|
|
|
668
1266
|
@if (editable()) {
|
|
669
|
-
<td class="grid-td grid-actions">
|
|
1267
|
+
<td class="grid-td grid-actions" style="width:120px">
|
|
670
1268
|
@if (!isEditing(row)) {
|
|
671
1269
|
<button class="action-btn" type="button" (click)="beginEdit(row, i); $event.stopPropagation()">Edit</button>
|
|
672
1270
|
} @else {
|
|
@@ -692,6 +1290,36 @@ class DataGridComponent {
|
|
|
692
1290
|
}
|
|
693
1291
|
}
|
|
694
1292
|
</tbody>
|
|
1293
|
+
@if (hasAggregation()) {
|
|
1294
|
+
<tfoot>
|
|
1295
|
+
<tr class="grid-footer-row">
|
|
1296
|
+
@if (showDetailToggle()) {
|
|
1297
|
+
<td class="grid-td-toggle" [class.sticky-toggle]="hasPinnedColumns()" style="left:0px"></td>
|
|
1298
|
+
}
|
|
1299
|
+
@if (selectable()) {
|
|
1300
|
+
<td class="grid-td-check" [class.sticky-check]="hasPinnedColumns()" [style.left.px]="showDetailToggle() ? 44 : 0"></td>
|
|
1301
|
+
}
|
|
1302
|
+
@for (col of orderedColumns(); track col.field) {
|
|
1303
|
+
<td
|
|
1304
|
+
class="grid-td grid-footer-cell"
|
|
1305
|
+
[class.pinned-left]="col.pinned === 'left'"
|
|
1306
|
+
[class.pinned-left-last]="col.pinned === 'left' && lastPinnedColumnField() === col.field"
|
|
1307
|
+
[style.left.px]="col.pinned === 'left' ? columnOffsets()[col.field] : null"
|
|
1308
|
+
[style.text-align]="col.align ?? 'left'"
|
|
1309
|
+
[style.width.px]="getColumnWidth(col)"
|
|
1310
|
+
>
|
|
1311
|
+
@if (col.aggregation) {
|
|
1312
|
+
<span class="agg-label">{{ col.aggregation }}: </span>
|
|
1313
|
+
<strong class="agg-value">{{ getAggregationValue(col) }}</strong>
|
|
1314
|
+
}
|
|
1315
|
+
</td>
|
|
1316
|
+
}
|
|
1317
|
+
@if (editable()) {
|
|
1318
|
+
<td></td>
|
|
1319
|
+
}
|
|
1320
|
+
</tr>
|
|
1321
|
+
</tfoot>
|
|
1322
|
+
}
|
|
695
1323
|
</table>
|
|
696
1324
|
</div>
|
|
697
1325
|
|
|
@@ -711,8 +1339,52 @@ class DataGridComponent {
|
|
|
711
1339
|
</div>
|
|
712
1340
|
</div>
|
|
713
1341
|
}
|
|
1342
|
+
|
|
1343
|
+
<!-- Excel-Style Filter Popover Overlay -->
|
|
1344
|
+
@if (activeFilterPopover(); as pop) {
|
|
1345
|
+
<div class="grid-filter-popover" [style.top.px]="pop.top" [style.left.px]="pop.left" (click)="$event.stopPropagation()">
|
|
1346
|
+
<div class="popover-section text-filter-section">
|
|
1347
|
+
<label class="popover-label">Text Filter</label>
|
|
1348
|
+
<div class="text-filter-row">
|
|
1349
|
+
<select class="popover-select" [value]="tempFilterOperator()" (change)="tempFilterOperator.set($any($event.target).value)">
|
|
1350
|
+
<option value="contains">Contains</option>
|
|
1351
|
+
<option value="eq">Equals</option>
|
|
1352
|
+
<option value="startsWith">Starts With</option>
|
|
1353
|
+
<option value="endsWith">Ends With</option>
|
|
1354
|
+
</select>
|
|
1355
|
+
<input class="popover-input" type="text" [value]="tempFilterValue()" (input)="tempFilterValue.set($any($event.target).value)" placeholder="Filter value..." />
|
|
1356
|
+
</div>
|
|
1357
|
+
</div>
|
|
1358
|
+
|
|
1359
|
+
<div class="popover-section checklist-section">
|
|
1360
|
+
<label class="popover-label">Checklist Filter</label>
|
|
1361
|
+
<div class="checklist-actions">
|
|
1362
|
+
<label class="checklist-item select-all">
|
|
1363
|
+
<input type="checkbox" [checked]="tempSelectedValues().size === getDistinctValues(pop.field).length" [indeterminate]="tempSelectedValues().size > 0 && tempSelectedValues().size < getDistinctValues(pop.field).length" (change)="toggleSelectAllChecklist()" />
|
|
1364
|
+
<span>(Select All)</span>
|
|
1365
|
+
</label>
|
|
1366
|
+
</div>
|
|
1367
|
+
<div class="checklist-scroll">
|
|
1368
|
+
@for (val of getDistinctValues(pop.field); track val) {
|
|
1369
|
+
<label class="checklist-item">
|
|
1370
|
+
<input type="checkbox" [checked]="tempSelectedValues().has(val)" (change)="toggleChecklistItem(val)" />
|
|
1371
|
+
<span>{{ val }}</span>
|
|
1372
|
+
</label>
|
|
1373
|
+
}
|
|
1374
|
+
</div>
|
|
1375
|
+
</div>
|
|
1376
|
+
|
|
1377
|
+
<div class="popover-footer">
|
|
1378
|
+
<button class="popover-btn clear" (click)="clearPopoverFilter()">Clear</button>
|
|
1379
|
+
<div class="footer-actions">
|
|
1380
|
+
<button class="popover-btn cancel" (click)="activeFilterPopover.set(null)">Cancel</button>
|
|
1381
|
+
<button class="popover-btn apply" (click)="applyPopoverFilter()">Apply</button>
|
|
1382
|
+
</div>
|
|
1383
|
+
</div>
|
|
1384
|
+
</div>
|
|
1385
|
+
}
|
|
714
1386
|
</div>
|
|
715
|
-
`, isInline: true, styles: [":host{display:block}.ngx-data-grid{font-family:inherit;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:var(--ngx-grid-radius, 12px);overflow:hidden;background:var(--ngx-grid-bg, #ffffff);box-shadow:0 4px 6px -1px #0000000d,0 2px 4px -2px #0000000d;transition:background-color .3s,border-color .3s,box-shadow .3s}.grid-toolbar{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0);flex-wrap:wrap;gap:12px}.grid-toolbar-title{font-family:var(--ngx-heading-font-family, \"Outfit\", sans-serif);font-weight:700;font-size:14px;color:var(--ngx-grid-text, #0f172a)}.grid-toolbar-actions{display:flex;gap:6px}.grid-action-btn{padding:6px 14px;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:8px;background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);font-size:12px;font-weight:500;cursor:pointer;font-family:inherit;transition:all .2s cubic-bezier(.4,0,.2,1);outline:none}.grid-action-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1);transform:translateY(-.5px)}.grid-action-btn:active{transform:scale(.97)}.grid-filter-bar{display:flex;gap:8px;padding:10px 16px;background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0)}.grid-filter-input{padding:6px 12px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:8px;font-size:12px;outline:none;font-family:inherit;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);transition:border-color .2s,box-shadow .2s}.grid-filter-input:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.grid-filter-spacer{flex-shrink:0}.grid-table-wrap{overflow-x:auto}.grid-table{width:100%;border-collapse:collapse;font-size:13px}.grid-th{padding:12px 16px;text-align:left;font-size:11px;font-weight:700;color:var(--ngx-grid-text-secondary, #64748b);background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:2px solid var(--ngx-grid-border, #e2e8f0);white-space:nowrap;-webkit-user-select:none;user-select:none;text-transform:uppercase;letter-spacing:.05em;font-family:var(--ngx-heading-font-family, \"Outfit\", sans-serif)}.grid-th.sortable{cursor:pointer;transition:background-color .2s}.grid-th.sortable:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-th.sort-asc,.grid-th.sort-desc{color:var(--ngx-input-focus, #4f46e5)}.th-text{margin-right:4px}.sort-icon{font-size:10px;color:#cbd5e1}.sort-asc .sort-icon,.sort-desc .sort-icon{color:var(--ngx-input-focus, #4f46e5)}.grid-group-row td{background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1.5px solid var(--ngx-grid-border, #e2e8f0);color:var(--ngx-grid-text, #0f172a);font-size:12px;font-weight:600;padding:11px 16px;cursor:pointer}.group-toggle{border:none;background:transparent;margin-right:6px;cursor:pointer;color:var(--ngx-grid-text-secondary, #64748b);font-size:12px}.group-count{color:var(--ngx-grid-text-secondary, #64748b);margin-left:6px;font-weight:500}.grid-row{border-bottom:1px solid var(--ngx-grid-border, #e2e8f0);transition:background-color .15s}.grid-row:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-row.selected{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-table.striped .grid-row:nth-child(2n){background:var(--ngx-grid-stripe-bg, #f8fafc)}.grid-table.striped .grid-row:nth-child(2n):hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-table.striped .grid-row.selected{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-td{padding:11px 16px;color:var(--ngx-grid-text, #0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}.grid-th-check,.grid-td-check,.grid-th-toggle,.grid-td-toggle{width:44px!important;text-align:center}.toggle-btn{border:none;background:transparent;color:var(--ngx-grid-text-secondary, #64748b);cursor:pointer;font-size:13px;transition:color .15s}.toggle-btn:hover{color:var(--ngx-grid-text, #0f172a)}.grid-detail-row td{background:var(--ngx-grid-stripe-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0)}.grid-detail-cell{padding:16px 24px;white-space:normal}.grid-edit-input{width:100%;min-width:80px;padding:6px 10px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:6px;font-size:12px;font-family:inherit;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);box-sizing:border-box;outline:none;transition:border-color .2s,box-shadow .2s}.grid-edit-input:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.grid-actions{white-space:nowrap}.action-btn{border:1px solid var(--ngx-grid-border, #cbd5e1);background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);border-radius:6px;padding:5px 10px;font-size:12px;font-weight:500;margin-right:6px;cursor:pointer;transition:all .2s;outline:none}.action-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1)}.action-btn.save{border-color:var(--ngx-btn-primary-bg, #4f46e5);background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff}.action-btn.save:hover{background:var(--ngx-btn-primary-hover, #4338ca);border-color:var(--ngx-btn-primary-hover, #4338ca)}.action-btn:last-child{margin-right:0}.grid-loading-cell,.grid-empty-cell{padding:48px;text-align:center;color:var(--ngx-grid-text-secondary, #64748b);font-weight:500}.grid-spinner{width:28px;height:28px;border:3.5px solid var(--ngx-grid-border, #e2e8f0);border-top-color:var(--ngx-btn-primary-bg, #4f46e5);border-radius:50%;animation:spin .8s cubic-bezier(.4,0,.2,1) infinite;margin:0 auto}@keyframes spin{to{transform:rotate(360deg)}}.grid-pagination{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;border-top:1px solid var(--ngx-grid-border, #e2e8f0);background:var(--ngx-grid-bg, #ffffff);flex-wrap:wrap;gap:8px}.page-info{font-size:12px;color:var(--ngx-grid-text-secondary, #64748b);font-weight:500}.page-btns{display:flex;gap:4px}.page-btn{min-width:32px;height:32px;padding:0 8px;font-size:12px;font-weight:500;border:1px solid var(--ngx-grid-border, #e2e8f0);background:var(--ngx-grid-bg, #ffffff);border-radius:8px;cursor:pointer;font-family:inherit;color:var(--ngx-grid-text, #0f172a);transition:all .2s;outline:none}.page-btn:hover:not(:disabled){background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1)}.page-btn.active{background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff;border-color:var(--ngx-btn-primary-bg, #4f46e5);box-shadow:0 2px 4px #4f46e533}.page-btn:disabled{opacity:.4;cursor:not-allowed}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1387
|
+
`, isInline: true, styles: [":host{display:block}.ngx-data-grid{position:relative;font-family:inherit;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:var(--ngx-grid-radius, 12px);overflow:visible;background:var(--ngx-grid-bg, #ffffff);box-shadow:0 4px 6px -1px #0000000d,0 2px 4px -2px #0000000d;transition:background-color .3s,border-color .3s,box-shadow .3s}.grid-toolbar{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:var(--ngx-grid-radius, 12px) var(--ngx-grid-radius, 12px) 0 0;flex-wrap:wrap;gap:12px}.grid-toolbar-title{font-family:var(--ngx-heading-font-family, \"Outfit\", sans-serif);font-weight:700;font-size:14px;color:var(--ngx-grid-text, #0f172a)}.grid-toolbar-actions{display:flex;gap:6px}.grid-action-btn{padding:6px 14px;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:8px;background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);font-size:12px;font-weight:500;cursor:pointer;font-family:inherit;transition:all .2s cubic-bezier(.4,0,.2,1);outline:none}.grid-action-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1);transform:translateY(-.5px)}.grid-action-btn:active{transform:scale(.97)}.grid-table-wrap{overflow-x:auto;overflow-y:hidden}.grid-table{width:100%;border-collapse:collapse;font-size:13px;table-layout:fixed}.grid-th{position:relative;padding:12px 16px;text-align:left;font-size:11px;font-weight:700;color:var(--ngx-grid-text-secondary, #64748b);background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:2px solid var(--ngx-grid-border, #e2e8f0);white-space:nowrap;-webkit-user-select:none;user-select:none;text-transform:uppercase;letter-spacing:.05em;font-family:var(--ngx-heading-font-family, \"Outfit\", sans-serif)}.grid-th.sortable{cursor:pointer;transition:background-color .2s}.grid-th.sortable:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-th.sort-asc,.grid-th.sort-desc{color:var(--ngx-input-focus, #4f46e5)}.th-text{margin-right:4px}.sort-icon{font-size:10px;color:#cbd5e1}.sort-asc .sort-icon,.sort-desc .sort-icon{color:var(--ngx-input-focus, #4f46e5)}.th-content-wrapper{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%}.grid-filter-btn{background:transparent;border:none;color:var(--ngx-grid-text-secondary, #64748b);cursor:pointer;padding:2px;border-radius:4px;display:flex;align-items:center;justify-content:center;transition:all .2s}.grid-filter-btn:hover{background:var(--ngx-grid-hover-bg, #e2e8f0);color:var(--ngx-grid-text, #0f172a)}.grid-filter-btn.active{color:var(--ngx-input-focus, #4f46e5);background:#4f46e51a}.grid-resize-handle{position:absolute;right:0;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background-color .2s}.grid-resize-handle:hover,.grid-resize-handle.resizing{background:var(--ngx-input-focus, #4f46e5)}.grid-filter-popover{position:absolute;width:250px;background:var(--ngx-grid-bg, #ffffff);border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:12px;box-shadow:0 10px 25px -5px #0000001a,0 8px 10px -6px #0000001a;z-index:1000;padding:12px;box-sizing:border-box;display:flex;flex-direction:column;gap:12px;font-family:inherit}.popover-section{display:flex;flex-direction:column;gap:6px}.popover-label{font-size:11px;font-weight:700;color:var(--ngx-grid-text-secondary, #64748b);text-transform:uppercase;letter-spacing:.05em}.text-filter-row{display:flex;flex-direction:column;gap:6px}.popover-select{padding:6px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:6px;font-size:12px;font-family:inherit;outline:none;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a)}.popover-input{padding:6px 10px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:6px;font-size:12px;font-family:inherit;outline:none;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a)}.checklist-section{border-top:1px solid var(--ngx-grid-border, #e2e8f0);padding-top:10px}.checklist-scroll{max-height:120px;overflow-y:auto;display:flex;flex-direction:column;gap:4px;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:6px;padding:6px}.checklist-item{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--ngx-grid-text, #0f172a);cursor:pointer;-webkit-user-select:none;user-select:none}.checklist-item input{margin:0}.popover-footer{display:flex;justify-content:space-between;align-items:center;border-top:1px solid var(--ngx-grid-border, #e2e8f0);padding-top:10px;margin-top:4px}.footer-actions{display:flex;gap:6px}.popover-btn{padding:5px 10px;font-size:11px;font-weight:600;border-radius:6px;cursor:pointer;border:1px solid var(--ngx-grid-border, #cbd5e1);background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);transition:all .2s}.popover-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.popover-btn.apply{background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff;border-color:var(--ngx-btn-primary-bg, #4f46e5)}.popover-btn.apply:hover{background:var(--ngx-btn-primary-hover, #4338ca);border-color:var(--ngx-btn-primary-hover, #4338ca)}.popover-btn.clear{color:#ef4444;border-color:transparent;background:transparent}.popover-btn.clear:hover{background:#fef2f2}.grid-group-row td{background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1.5px solid var(--ngx-grid-border, #e2e8f0);color:var(--ngx-grid-text, #0f172a);font-size:12px;font-weight:600;padding:11px 16px;cursor:pointer}.group-toggle{border:none;background:transparent;margin-right:6px;cursor:pointer;color:var(--ngx-grid-text-secondary, #64748b);font-size:12px}.group-count{color:var(--ngx-grid-text-secondary, #64748b);margin-left:6px;font-weight:500}.grid-row{border-bottom:1px solid var(--ngx-grid-border, #e2e8f0);transition:background-color .15s}.grid-row:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-row.selected{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-table.striped .grid-row:nth-child(2n){background:var(--ngx-grid-stripe-bg, #f8fafc)}.grid-table.striped .grid-row:nth-child(2n):hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-table.striped .grid-row.selected{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-td{padding:11px 16px;color:var(--ngx-grid-text, #0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;box-sizing:border-box}.grid-th-check,.grid-td-check,.grid-th-toggle,.grid-td-toggle{width:44px!important;text-align:center}.toggle-btn{border:none;background:transparent;color:var(--ngx-grid-text-secondary, #64748b);cursor:pointer;font-size:13px;transition:color .15s}.toggle-btn:hover{color:var(--ngx-grid-text, #0f172a)}.grid-detail-row td{background:var(--ngx-grid-stripe-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0)}.grid-detail-cell{padding:16px 24px;white-space:normal}.grid-edit-input{width:100%;min-width:80px;padding:6px 10px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:6px;font-size:12px;font-family:inherit;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);box-sizing:border-box;outline:none;transition:border-color .2s,box-shadow .2s}.grid-edit-input:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.grid-actions{white-space:nowrap}.action-btn{border:1px solid var(--ngx-grid-border, #cbd5e1);background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);border-radius:6px;padding:5px 10px;font-size:12px;font-weight:500;margin-right:6px;cursor:pointer;transition:all .2s;outline:none}.action-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1)}.action-btn.save{border-color:var(--ngx-btn-primary-bg, #4f46e5);background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff}.action-btn.save:hover{background:var(--ngx-btn-primary-hover, #4338ca);border-color:var(--ngx-btn-primary-hover, #4338ca)}.action-btn:last-child{margin-right:0}.grid-loading-cell,.grid-empty-cell{padding:48px;text-align:center;color:var(--ngx-grid-text-secondary, #64748b);font-weight:500}.grid-spinner{width:28px;height:28px;border:3.5px solid var(--ngx-grid-border, #e2e8f0);border-top-color:var(--ngx-btn-primary-bg, #4f46e5);border-radius:50%;animation:spin .8s cubic-bezier(.4,0,.2,1) infinite;margin:0 auto}@keyframes spin{to{transform:rotate(360deg)}}.grid-pagination{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;border-top:1px solid var(--ngx-grid-border, #e2e8f0);background:var(--ngx-grid-bg, #ffffff);border-radius:0 0 var(--ngx-grid-radius, 12px) var(--ngx-grid-radius, 12px);flex-wrap:wrap;gap:8px}.page-info{font-size:12px;color:var(--ngx-grid-text-secondary, #64748b);font-weight:500}.page-btns{display:flex;gap:4px}.page-btn{min-width:32px;height:32px;padding:0 8px;font-size:12px;font-weight:500;border:1px solid var(--ngx-grid-border, #e2e8f0);background:var(--ngx-grid-bg, #ffffff);border-radius:8px;cursor:pointer;font-family:inherit;color:var(--ngx-grid-text, #0f172a);transition:all .2s;outline:none}.page-btn:hover:not(:disabled){background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1)}.page-btn.active{background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff;border-color:var(--ngx-btn-primary-bg, #4f46e5);box-shadow:0 2px 4px #4f46e533}.page-btn:disabled{opacity:.4;cursor:not-allowed}.grid-footer-row td{background:var(--ngx-grid-header-bg, #f8fafc);border-top:2px solid var(--ngx-grid-border, #e2e8f0);font-size:12px;padding:12px 16px;color:var(--ngx-grid-text, #0f172a)}.agg-label{font-size:10px;font-weight:700;color:var(--ngx-grid-text-secondary, #64748b);text-transform:uppercase;letter-spacing:.05em}.agg-value{font-weight:700;color:var(--ngx-input-focus, #4f46e5)}.pinned-left{position:sticky!important;z-index:2;background:var(--ngx-grid-bg, #ffffff)}th.pinned-left{z-index:4;background:var(--ngx-grid-header-bg, #f8fafc)}.sticky-toggle{position:sticky!important;left:0;z-index:3;background:var(--ngx-grid-bg, #ffffff)}th.sticky-toggle{z-index:5;background:var(--ngx-grid-header-bg, #f8fafc)}.sticky-check{position:sticky!important;z-index:3;background:var(--ngx-grid-bg, #ffffff)}th.sticky-check{z-index:5;background:var(--ngx-grid-header-bg, #f8fafc)}.pinned-left-last,.sticky-toggle-last,.sticky-check-last{border-right:2px solid var(--ngx-grid-border, #cbd5e1)!important}.grid-table.striped .grid-row:nth-child(2n) .pinned-left,.grid-table.striped .grid-row:nth-child(2n) .sticky-toggle,.grid-table.striped .grid-row:nth-child(2n) .sticky-check{background:var(--ngx-grid-stripe-bg, #f8fafc)}.grid-row:hover .pinned-left,.grid-row:hover .sticky-toggle,.grid-row:hover .sticky-check{background:var(--ngx-grid-hover-bg, #f1f5f9)!important}.grid-row.selected .pinned-left,.grid-row.selected .sticky-toggle,.grid-row.selected .sticky-check{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-footer-row .pinned-left,.grid-footer-row .sticky-toggle,.grid-footer-row .sticky-check{background:var(--ngx-grid-header-bg, #f8fafc)}.grid-th[draggable=true]{cursor:grab}.grid-th[draggable=true]:active{cursor:grabbing}.grid-th.dragging{opacity:.4;background:var(--ngx-grid-hover-bg, #f1f5f9)!important;border:1.5px dashed var(--ngx-input-border, #cbd5e1)}.grid-th.drag-over{border-left:3px solid var(--ngx-input-focus, #4f46e5)!important}.sort-icon.active{color:var(--ngx-input-focus, #4f46e5);font-weight:700}.sort-order-badge{font-size:8px;line-height:1;background:var(--ngx-input-focus, #4f46e5);color:#fff;padding:1px 3.5px;border-radius:4px;vertical-align:super;margin-left:2px}.grid-search-wrap{position:relative;display:inline-flex;align-items:center}.grid-search-input{padding:6px 30px 6px 12px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:8px;font-size:13px;font-family:inherit;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);outline:none;transition:all .2s cubic-bezier(.4,0,.2,1);width:180px}.grid-search-input:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15));width:220px}.grid-search-clear{position:absolute;right:8px;background:transparent;border:none;color:var(--ngx-grid-text-secondary, #94a3b8);font-size:16px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:2px;line-height:1}.grid-search-clear:hover{color:var(--ngx-grid-text, #0f172a)}.search-highlight{background-color:#fbbf244d;color:inherit;font-weight:600;padding:1px 2px;border-radius:4px}.row-drag-handle{cursor:grab;-webkit-user-select:none;user-select:none;color:var(--ngx-grid-text-secondary, #94a3b8);font-size:15px;font-weight:700;display:inline-block;padding:4px 8px;transition:color .15s ease}.row-drag-handle:hover{color:var(--ngx-grid-text, #0f172a)}.row-drag-handle:active{cursor:grabbing}.grid-row.dragging-row{opacity:.4;background:var(--ngx-grid-hover-bg, #f1f5f9)!important;border:1.5px dashed var(--ngx-input-border, #cbd5e1)}.grid-row.drag-over-row{border-top:2px solid var(--ngx-input-focus, #4f46e5)!important}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
716
1388
|
}
|
|
717
1389
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DataGridComponent, decorators: [{
|
|
718
1390
|
type: Component,
|
|
@@ -722,68 +1394,92 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
722
1394
|
<div class="grid-toolbar">
|
|
723
1395
|
<span class="grid-toolbar-title">Data Grid</span>
|
|
724
1396
|
<div class="grid-toolbar-actions">
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
</div>
|
|
728
|
-
</div>
|
|
729
|
-
|
|
730
|
-
@if (hasFilterableColumns()) {
|
|
731
|
-
<div class="grid-filter-bar">
|
|
732
|
-
@for (col of columns(); track col.field) {
|
|
733
|
-
@if (col.filterable) {
|
|
1397
|
+
@if (showGlobalSearch()) {
|
|
1398
|
+
<div class="grid-search-wrap">
|
|
734
1399
|
<input
|
|
735
|
-
class="grid-
|
|
736
|
-
|
|
737
|
-
[
|
|
738
|
-
|
|
739
|
-
|
|
1400
|
+
class="grid-search-input"
|
|
1401
|
+
type="text"
|
|
1402
|
+
[placeholder]="globalSearchPlaceholder()"
|
|
1403
|
+
[value]="searchText()"
|
|
1404
|
+
(input)="searchText.set($any($event.target).value)"
|
|
740
1405
|
/>
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
1406
|
+
@if (searchText()) {
|
|
1407
|
+
<button class="grid-search-clear" (click)="searchText.set('')" title="Clear search">×</button>
|
|
1408
|
+
}
|
|
1409
|
+
</div>
|
|
744
1410
|
}
|
|
1411
|
+
<button class="grid-action-btn" (click)="exportToJson()" title="Export JSON">JSON</button>
|
|
1412
|
+
<button class="grid-action-btn" (click)="exportToCsv()" title="Export CSV">CSV</button>
|
|
745
1413
|
</div>
|
|
746
|
-
|
|
1414
|
+
</div>
|
|
747
1415
|
|
|
748
1416
|
<div class="grid-table-wrap">
|
|
749
1417
|
<table class="grid-table" [class.striped]="striped()">
|
|
750
1418
|
<thead>
|
|
751
1419
|
<tr>
|
|
1420
|
+
@if (rowReorderable()) {
|
|
1421
|
+
<th class="grid-th grid-th-reorder pinned-left" style="width:44px; left:0px"></th>
|
|
1422
|
+
}
|
|
752
1423
|
@if (showDetailToggle()) {
|
|
753
|
-
<th class="grid-th grid-th-toggle" style="width:
|
|
1424
|
+
<th class="grid-th grid-th-toggle pinned-left" [style.left.px]="rowReorderable() ? 44 : 0" style="width:44px"></th>
|
|
754
1425
|
}
|
|
755
1426
|
@if (selectable()) {
|
|
756
|
-
<th class="grid-th grid-th-check" style="width:
|
|
1427
|
+
<th class="grid-th grid-th-check pinned-left" [style.left.px]="(rowReorderable() ? 44 : 0) + (showDetailToggle() ? 44 : 0)" style="width:44px">
|
|
757
1428
|
<input type="checkbox" [checked]="allSelected()" [indeterminate]="someSelected() && !allSelected()" (change)="toggleAll()" />
|
|
758
1429
|
</th>
|
|
759
1430
|
}
|
|
760
|
-
@for (col of
|
|
1431
|
+
@for (col of orderedColumns(); track col.field) {
|
|
761
1432
|
<th
|
|
762
1433
|
class="grid-th"
|
|
763
|
-
[
|
|
1434
|
+
[class.pinned-left]="col.pinned === 'left'"
|
|
1435
|
+
[class.pinned-left-last]="col.pinned === 'left' && lastPinnedColumnField() === col.field"
|
|
1436
|
+
[style.left.px]="col.pinned === 'left' ? columnOffsets()[col.field] : null"
|
|
1437
|
+
[style.width.px]="getColumnWidth(col)"
|
|
764
1438
|
[class.sortable]="col.sortable"
|
|
765
|
-
[class.sort-asc]="
|
|
766
|
-
[class.sort-desc]="
|
|
767
|
-
|
|
1439
|
+
[class.sort-asc]="getSortDirection(col) === 'asc'"
|
|
1440
|
+
[class.sort-desc]="getSortDirection(col) === 'desc'"
|
|
1441
|
+
[class.dragging]="draggingField() === col.field"
|
|
1442
|
+
[class.drag-over]="dragOverField() === col.field"
|
|
1443
|
+
[attr.draggable]="reorderable() ? true : null"
|
|
1444
|
+
(dragstart)="onDragStart($event, col)"
|
|
1445
|
+
(dragover)="onDragOver($event, col)"
|
|
1446
|
+
(drop)="onDrop($event, col)"
|
|
1447
|
+
(dragend)="onDragEnd()"
|
|
1448
|
+
(click)="col.sortable ? onSort(col, $event) : null"
|
|
768
1449
|
>
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
@if (
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1450
|
+
<div class="th-content-wrapper">
|
|
1451
|
+
@if (resolveHeaderTemplate(col); as activeHeaderTemplate) {
|
|
1452
|
+
<ng-container *ngTemplateOutlet="activeHeaderTemplate; context: {
|
|
1453
|
+
$implicit: col,
|
|
1454
|
+
column: col,
|
|
1455
|
+
sort: sortState(),
|
|
1456
|
+
filters: activeFilters(),
|
|
1457
|
+
isServerMode: isAnyServerMode()
|
|
1458
|
+
}" />
|
|
1459
|
+
} @else {
|
|
1460
|
+
<span class="th-text">{{ col.title }}</span>
|
|
1461
|
+
@if (col.sortable) {
|
|
1462
|
+
@if (getSortDirection(col); as dir) {
|
|
1463
|
+
<span class="sort-icon active">
|
|
1464
|
+
{{ dir === 'asc' ? '↑' : '↓' }}
|
|
1465
|
+
@if (multiSort() && sortStates().length > 1) {
|
|
1466
|
+
<sub class="sort-order-badge">{{ getSortIndex(col) }}</sub>
|
|
1467
|
+
}
|
|
1468
|
+
</span>
|
|
1469
|
+
} @else {
|
|
1470
|
+
<span class="sort-icon">↕</span>
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
785
1473
|
}
|
|
786
|
-
|
|
1474
|
+
@if (col.filterable) {
|
|
1475
|
+
<button class="grid-filter-btn" [class.active]="filterStates().has(col.field)" (click)="openFilterPopover($event, col.field); $event.stopPropagation()" title="Filter column">
|
|
1476
|
+
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1477
|
+
<polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"></polygon>
|
|
1478
|
+
</svg>
|
|
1479
|
+
</button>
|
|
1480
|
+
}
|
|
1481
|
+
</div>
|
|
1482
|
+
<div class="grid-resize-handle" (mousedown)="onResizeStart($event, col)" (click)="$event.stopPropagation()"></div>
|
|
787
1483
|
</th>
|
|
788
1484
|
}
|
|
789
1485
|
@if (editable()) {
|
|
@@ -819,11 +1515,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
819
1515
|
<tr
|
|
820
1516
|
class="grid-row"
|
|
821
1517
|
[class.selected]="isRowSelected(row)"
|
|
1518
|
+
[class.dragging-row]="draggingRowIndex() === i"
|
|
1519
|
+
[class.drag-over-row]="dragOverRowIndex() === i"
|
|
1520
|
+
(dragover)="onRowDragOver($event, i)"
|
|
1521
|
+
(drop)="onRowDrop($event, i)"
|
|
1522
|
+
(dragend)="onRowDragEnd()"
|
|
822
1523
|
(click)="onRowClick(row, i)"
|
|
823
1524
|
(dblclick)="editable() ? beginEdit(row, i) : null"
|
|
824
1525
|
>
|
|
1526
|
+
@if (rowReorderable()) {
|
|
1527
|
+
<td class="grid-td grid-td-reorder pinned-left" style="left:0px; text-align:center; width:44px">
|
|
1528
|
+
<span
|
|
1529
|
+
class="row-drag-handle"
|
|
1530
|
+
draggable="true"
|
|
1531
|
+
(dragstart)="onRowDragStart($event, i)"
|
|
1532
|
+
(dragend)="onRowDragEnd()"
|
|
1533
|
+
>⋮⋮</span>
|
|
1534
|
+
</td>
|
|
1535
|
+
}
|
|
1536
|
+
|
|
825
1537
|
@if (showDetailToggle()) {
|
|
826
|
-
<td class="grid-td grid-td-toggle">
|
|
1538
|
+
<td class="grid-td grid-td-toggle pinned-left" [style.left.px]="rowReorderable() ? 44 : 0">
|
|
827
1539
|
<button class="toggle-btn" type="button" (click)="toggleDetail(row); $event.stopPropagation()">
|
|
828
1540
|
{{ isExpanded(row) ? '▾' : '▸' }}
|
|
829
1541
|
</button>
|
|
@@ -831,13 +1543,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
831
1543
|
}
|
|
832
1544
|
|
|
833
1545
|
@if (selectable()) {
|
|
834
|
-
<td class="grid-td grid-td-check">
|
|
1546
|
+
<td class="grid-td grid-td-check pinned-left" [style.left.px]="(rowReorderable() ? 44 : 0) + (showDetailToggle() ? 44 : 0)">
|
|
835
1547
|
<input type="checkbox" [checked]="isRowSelected(row)" (change)="toggleRow(row)" (click)="$event.stopPropagation()" />
|
|
836
1548
|
</td>
|
|
837
1549
|
}
|
|
838
1550
|
|
|
839
1551
|
@if (rowTemplate()) {
|
|
840
|
-
<td class="grid-td" [attr.colspan]="
|
|
1552
|
+
<td class="grid-td" [attr.colspan]="orderedColumns().length + (editable() ? 1 : 0)">
|
|
841
1553
|
<ng-container *ngTemplateOutlet="rowTemplate(); context: {
|
|
842
1554
|
$implicit: row,
|
|
843
1555
|
row: row,
|
|
@@ -847,8 +1559,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
847
1559
|
}" />
|
|
848
1560
|
</td>
|
|
849
1561
|
} @else {
|
|
850
|
-
@for (col of
|
|
851
|
-
<td
|
|
1562
|
+
@for (col of orderedColumns(); track col.field) {
|
|
1563
|
+
<td
|
|
1564
|
+
class="grid-td"
|
|
1565
|
+
[class.pinned-left]="col.pinned === 'left'"
|
|
1566
|
+
[class.pinned-left-last]="col.pinned === 'left' && lastPinnedColumnField() === col.field"
|
|
1567
|
+
[style.left.px]="col.pinned === 'left' ? columnOffsets()[col.field] : null"
|
|
1568
|
+
[style.text-align]="col.align ?? 'left'"
|
|
1569
|
+
[style.width.px]="getColumnWidth(col)"
|
|
1570
|
+
>
|
|
852
1571
|
@if (isEditing(row) && editable() && col.editable) {
|
|
853
1572
|
<input
|
|
854
1573
|
class="grid-edit-input"
|
|
@@ -866,13 +1585,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
866
1585
|
editing: isEditing(row)
|
|
867
1586
|
}" />
|
|
868
1587
|
} @else {
|
|
869
|
-
|
|
1588
|
+
@if (showGlobalSearch() && searchText()) {
|
|
1589
|
+
<span [innerHTML]="highlightSearchText(getCellValue(row, col.field))"></span>
|
|
1590
|
+
} @else {
|
|
1591
|
+
{{ getCellValue(row, col.field) }}
|
|
1592
|
+
}
|
|
870
1593
|
}
|
|
871
1594
|
</td>
|
|
872
1595
|
}
|
|
873
1596
|
|
|
874
1597
|
@if (editable()) {
|
|
875
|
-
<td class="grid-td grid-actions">
|
|
1598
|
+
<td class="grid-td grid-actions" style="width:120px">
|
|
876
1599
|
@if (!isEditing(row)) {
|
|
877
1600
|
<button class="action-btn" type="button" (click)="beginEdit(row, i); $event.stopPropagation()">Edit</button>
|
|
878
1601
|
} @else {
|
|
@@ -903,11 +1626,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
903
1626
|
<tr
|
|
904
1627
|
class="grid-row"
|
|
905
1628
|
[class.selected]="isRowSelected(row)"
|
|
1629
|
+
[class.dragging-row]="draggingRowIndex() === i"
|
|
1630
|
+
[class.drag-over-row]="dragOverRowIndex() === i"
|
|
1631
|
+
(dragover)="onRowDragOver($event, i)"
|
|
1632
|
+
(drop)="onRowDrop($event, i)"
|
|
1633
|
+
(dragend)="onRowDragEnd()"
|
|
906
1634
|
(click)="onRowClick(row, i)"
|
|
907
1635
|
(dblclick)="editable() ? beginEdit(row, i) : null"
|
|
908
1636
|
>
|
|
1637
|
+
@if (rowReorderable()) {
|
|
1638
|
+
<td class="grid-td grid-td-reorder pinned-left" style="left:0px; text-align:center; width:44px">
|
|
1639
|
+
<span
|
|
1640
|
+
class="row-drag-handle"
|
|
1641
|
+
draggable="true"
|
|
1642
|
+
(dragstart)="onRowDragStart($event, i)"
|
|
1643
|
+
(dragend)="onRowDragEnd()"
|
|
1644
|
+
>⋮⋮</span>
|
|
1645
|
+
</td>
|
|
1646
|
+
}
|
|
1647
|
+
|
|
909
1648
|
@if (showDetailToggle()) {
|
|
910
|
-
<td class="grid-td grid-td-toggle">
|
|
1649
|
+
<td class="grid-td grid-td-toggle pinned-left" [style.left.px]="rowReorderable() ? 44 : 0">
|
|
911
1650
|
<button class="toggle-btn" type="button" (click)="toggleDetail(row); $event.stopPropagation()">
|
|
912
1651
|
{{ isExpanded(row) ? '▾' : '▸' }}
|
|
913
1652
|
</button>
|
|
@@ -915,13 +1654,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
915
1654
|
}
|
|
916
1655
|
|
|
917
1656
|
@if (selectable()) {
|
|
918
|
-
<td class="grid-td grid-td-check">
|
|
1657
|
+
<td class="grid-td grid-td-check pinned-left" [style.left.px]="(rowReorderable() ? 44 : 0) + (showDetailToggle() ? 44 : 0)">
|
|
919
1658
|
<input type="checkbox" [checked]="isRowSelected(row)" (change)="toggleRow(row)" (click)="$event.stopPropagation()" />
|
|
920
1659
|
</td>
|
|
921
1660
|
}
|
|
922
1661
|
|
|
923
1662
|
@if (rowTemplate()) {
|
|
924
|
-
<td class="grid-td" [attr.colspan]="
|
|
1663
|
+
<td class="grid-td" [attr.colspan]="orderedColumns().length + (editable() ? 1 : 0)">
|
|
925
1664
|
<ng-container *ngTemplateOutlet="rowTemplate(); context: {
|
|
926
1665
|
$implicit: row,
|
|
927
1666
|
row: row,
|
|
@@ -931,8 +1670,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
931
1670
|
}" />
|
|
932
1671
|
</td>
|
|
933
1672
|
} @else {
|
|
934
|
-
@for (col of
|
|
935
|
-
<td
|
|
1673
|
+
@for (col of orderedColumns(); track col.field) {
|
|
1674
|
+
<td
|
|
1675
|
+
class="grid-td"
|
|
1676
|
+
[class.pinned-left]="col.pinned === 'left'"
|
|
1677
|
+
[class.pinned-left-last]="col.pinned === 'left' && lastPinnedColumnField() === col.field"
|
|
1678
|
+
[style.left.px]="col.pinned === 'left' ? columnOffsets()[col.field] : null"
|
|
1679
|
+
[style.text-align]="col.align ?? 'left'"
|
|
1680
|
+
[style.width.px]="getColumnWidth(col)"
|
|
1681
|
+
>
|
|
936
1682
|
@if (isEditing(row) && editable() && col.editable) {
|
|
937
1683
|
<input
|
|
938
1684
|
class="grid-edit-input"
|
|
@@ -950,13 +1696,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
950
1696
|
editing: isEditing(row)
|
|
951
1697
|
}" />
|
|
952
1698
|
} @else {
|
|
953
|
-
|
|
1699
|
+
@if (showGlobalSearch() && searchText()) {
|
|
1700
|
+
<span [innerHTML]="highlightSearchText(getCellValue(row, col.field))"></span>
|
|
1701
|
+
} @else {
|
|
1702
|
+
{{ getCellValue(row, col.field) }}
|
|
1703
|
+
}
|
|
954
1704
|
}
|
|
955
1705
|
</td>
|
|
956
1706
|
}
|
|
957
1707
|
|
|
958
1708
|
@if (editable()) {
|
|
959
|
-
<td class="grid-td grid-actions">
|
|
1709
|
+
<td class="grid-td grid-actions" style="width:120px">
|
|
960
1710
|
@if (!isEditing(row)) {
|
|
961
1711
|
<button class="action-btn" type="button" (click)="beginEdit(row, i); $event.stopPropagation()">Edit</button>
|
|
962
1712
|
} @else {
|
|
@@ -982,6 +1732,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
982
1732
|
}
|
|
983
1733
|
}
|
|
984
1734
|
</tbody>
|
|
1735
|
+
@if (hasAggregation()) {
|
|
1736
|
+
<tfoot>
|
|
1737
|
+
<tr class="grid-footer-row">
|
|
1738
|
+
@if (showDetailToggle()) {
|
|
1739
|
+
<td class="grid-td-toggle" [class.sticky-toggle]="hasPinnedColumns()" style="left:0px"></td>
|
|
1740
|
+
}
|
|
1741
|
+
@if (selectable()) {
|
|
1742
|
+
<td class="grid-td-check" [class.sticky-check]="hasPinnedColumns()" [style.left.px]="showDetailToggle() ? 44 : 0"></td>
|
|
1743
|
+
}
|
|
1744
|
+
@for (col of orderedColumns(); track col.field) {
|
|
1745
|
+
<td
|
|
1746
|
+
class="grid-td grid-footer-cell"
|
|
1747
|
+
[class.pinned-left]="col.pinned === 'left'"
|
|
1748
|
+
[class.pinned-left-last]="col.pinned === 'left' && lastPinnedColumnField() === col.field"
|
|
1749
|
+
[style.left.px]="col.pinned === 'left' ? columnOffsets()[col.field] : null"
|
|
1750
|
+
[style.text-align]="col.align ?? 'left'"
|
|
1751
|
+
[style.width.px]="getColumnWidth(col)"
|
|
1752
|
+
>
|
|
1753
|
+
@if (col.aggregation) {
|
|
1754
|
+
<span class="agg-label">{{ col.aggregation }}: </span>
|
|
1755
|
+
<strong class="agg-value">{{ getAggregationValue(col) }}</strong>
|
|
1756
|
+
}
|
|
1757
|
+
</td>
|
|
1758
|
+
}
|
|
1759
|
+
@if (editable()) {
|
|
1760
|
+
<td></td>
|
|
1761
|
+
}
|
|
1762
|
+
</tr>
|
|
1763
|
+
</tfoot>
|
|
1764
|
+
}
|
|
985
1765
|
</table>
|
|
986
1766
|
</div>
|
|
987
1767
|
|
|
@@ -1001,10 +1781,170 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1001
1781
|
</div>
|
|
1002
1782
|
</div>
|
|
1003
1783
|
}
|
|
1784
|
+
|
|
1785
|
+
<!-- Excel-Style Filter Popover Overlay -->
|
|
1786
|
+
@if (activeFilterPopover(); as pop) {
|
|
1787
|
+
<div class="grid-filter-popover" [style.top.px]="pop.top" [style.left.px]="pop.left" (click)="$event.stopPropagation()">
|
|
1788
|
+
<div class="popover-section text-filter-section">
|
|
1789
|
+
<label class="popover-label">Text Filter</label>
|
|
1790
|
+
<div class="text-filter-row">
|
|
1791
|
+
<select class="popover-select" [value]="tempFilterOperator()" (change)="tempFilterOperator.set($any($event.target).value)">
|
|
1792
|
+
<option value="contains">Contains</option>
|
|
1793
|
+
<option value="eq">Equals</option>
|
|
1794
|
+
<option value="startsWith">Starts With</option>
|
|
1795
|
+
<option value="endsWith">Ends With</option>
|
|
1796
|
+
</select>
|
|
1797
|
+
<input class="popover-input" type="text" [value]="tempFilterValue()" (input)="tempFilterValue.set($any($event.target).value)" placeholder="Filter value..." />
|
|
1798
|
+
</div>
|
|
1799
|
+
</div>
|
|
1800
|
+
|
|
1801
|
+
<div class="popover-section checklist-section">
|
|
1802
|
+
<label class="popover-label">Checklist Filter</label>
|
|
1803
|
+
<div class="checklist-actions">
|
|
1804
|
+
<label class="checklist-item select-all">
|
|
1805
|
+
<input type="checkbox" [checked]="tempSelectedValues().size === getDistinctValues(pop.field).length" [indeterminate]="tempSelectedValues().size > 0 && tempSelectedValues().size < getDistinctValues(pop.field).length" (change)="toggleSelectAllChecklist()" />
|
|
1806
|
+
<span>(Select All)</span>
|
|
1807
|
+
</label>
|
|
1808
|
+
</div>
|
|
1809
|
+
<div class="checklist-scroll">
|
|
1810
|
+
@for (val of getDistinctValues(pop.field); track val) {
|
|
1811
|
+
<label class="checklist-item">
|
|
1812
|
+
<input type="checkbox" [checked]="tempSelectedValues().has(val)" (change)="toggleChecklistItem(val)" />
|
|
1813
|
+
<span>{{ val }}</span>
|
|
1814
|
+
</label>
|
|
1815
|
+
}
|
|
1816
|
+
</div>
|
|
1817
|
+
</div>
|
|
1818
|
+
|
|
1819
|
+
<div class="popover-footer">
|
|
1820
|
+
<button class="popover-btn clear" (click)="clearPopoverFilter()">Clear</button>
|
|
1821
|
+
<div class="footer-actions">
|
|
1822
|
+
<button class="popover-btn cancel" (click)="activeFilterPopover.set(null)">Cancel</button>
|
|
1823
|
+
<button class="popover-btn apply" (click)="applyPopoverFilter()">Apply</button>
|
|
1824
|
+
</div>
|
|
1825
|
+
</div>
|
|
1826
|
+
</div>
|
|
1827
|
+
}
|
|
1004
1828
|
</div>
|
|
1005
|
-
`, styles: [":host{display:block}.ngx-data-grid{font-family:inherit;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:var(--ngx-grid-radius, 12px);overflow:hidden;background:var(--ngx-grid-bg, #ffffff);box-shadow:0 4px 6px -1px #0000000d,0 2px 4px -2px #0000000d;transition:background-color .3s,border-color .3s,box-shadow .3s}.grid-toolbar{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0);flex-wrap:wrap;gap:12px}.grid-toolbar-title{font-family:var(--ngx-heading-font-family, \"Outfit\", sans-serif);font-weight:700;font-size:14px;color:var(--ngx-grid-text, #0f172a)}.grid-toolbar-actions{display:flex;gap:6px}.grid-action-btn{padding:6px 14px;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:8px;background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);font-size:12px;font-weight:500;cursor:pointer;font-family:inherit;transition:all .2s cubic-bezier(.4,0,.2,1);outline:none}.grid-action-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1);transform:translateY(-.5px)}.grid-action-btn:active{transform:scale(.97)}.grid-filter-bar{display:flex;gap:8px;padding:10px 16px;background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0)}.grid-filter-input{padding:6px 12px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:8px;font-size:12px;outline:none;font-family:inherit;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);transition:border-color .2s,box-shadow .2s}.grid-filter-input:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.grid-filter-spacer{flex-shrink:0}.grid-table-wrap{overflow-x:auto}.grid-table{width:100%;border-collapse:collapse;font-size:13px}.grid-th{padding:12px 16px;text-align:left;font-size:11px;font-weight:700;color:var(--ngx-grid-text-secondary, #64748b);background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:2px solid var(--ngx-grid-border, #e2e8f0);white-space:nowrap;-webkit-user-select:none;user-select:none;text-transform:uppercase;letter-spacing:.05em;font-family:var(--ngx-heading-font-family, \"Outfit\", sans-serif)}.grid-th.sortable{cursor:pointer;transition:background-color .2s}.grid-th.sortable:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-th.sort-asc,.grid-th.sort-desc{color:var(--ngx-input-focus, #4f46e5)}.th-text{margin-right:4px}.sort-icon{font-size:10px;color:#cbd5e1}.sort-asc .sort-icon,.sort-desc .sort-icon{color:var(--ngx-input-focus, #4f46e5)}.grid-group-row td{background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1.5px solid var(--ngx-grid-border, #e2e8f0);color:var(--ngx-grid-text, #0f172a);font-size:12px;font-weight:600;padding:11px 16px;cursor:pointer}.group-toggle{border:none;background:transparent;margin-right:6px;cursor:pointer;color:var(--ngx-grid-text-secondary, #64748b);font-size:12px}.group-count{color:var(--ngx-grid-text-secondary, #64748b);margin-left:6px;font-weight:500}.grid-row{border-bottom:1px solid var(--ngx-grid-border, #e2e8f0);transition:background-color .15s}.grid-row:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-row.selected{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-table.striped .grid-row:nth-child(2n){background:var(--ngx-grid-stripe-bg, #f8fafc)}.grid-table.striped .grid-row:nth-child(2n):hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-table.striped .grid-row.selected{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-td{padding:11px 16px;color:var(--ngx-grid-text, #0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}.grid-th-check,.grid-td-check,.grid-th-toggle,.grid-td-toggle{width:44px!important;text-align:center}.toggle-btn{border:none;background:transparent;color:var(--ngx-grid-text-secondary, #64748b);cursor:pointer;font-size:13px;transition:color .15s}.toggle-btn:hover{color:var(--ngx-grid-text, #0f172a)}.grid-detail-row td{background:var(--ngx-grid-stripe-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0)}.grid-detail-cell{padding:16px 24px;white-space:normal}.grid-edit-input{width:100%;min-width:80px;padding:6px 10px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:6px;font-size:12px;font-family:inherit;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);box-sizing:border-box;outline:none;transition:border-color .2s,box-shadow .2s}.grid-edit-input:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.grid-actions{white-space:nowrap}.action-btn{border:1px solid var(--ngx-grid-border, #cbd5e1);background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);border-radius:6px;padding:5px 10px;font-size:12px;font-weight:500;margin-right:6px;cursor:pointer;transition:all .2s;outline:none}.action-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1)}.action-btn.save{border-color:var(--ngx-btn-primary-bg, #4f46e5);background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff}.action-btn.save:hover{background:var(--ngx-btn-primary-hover, #4338ca);border-color:var(--ngx-btn-primary-hover, #4338ca)}.action-btn:last-child{margin-right:0}.grid-loading-cell,.grid-empty-cell{padding:48px;text-align:center;color:var(--ngx-grid-text-secondary, #64748b);font-weight:500}.grid-spinner{width:28px;height:28px;border:3.5px solid var(--ngx-grid-border, #e2e8f0);border-top-color:var(--ngx-btn-primary-bg, #4f46e5);border-radius:50%;animation:spin .8s cubic-bezier(.4,0,.2,1) infinite;margin:0 auto}@keyframes spin{to{transform:rotate(360deg)}}.grid-pagination{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;border-top:1px solid var(--ngx-grid-border, #e2e8f0);background:var(--ngx-grid-bg, #ffffff);flex-wrap:wrap;gap:8px}.page-info{font-size:12px;color:var(--ngx-grid-text-secondary, #64748b);font-weight:500}.page-btns{display:flex;gap:4px}.page-btn{min-width:32px;height:32px;padding:0 8px;font-size:12px;font-weight:500;border:1px solid var(--ngx-grid-border, #e2e8f0);background:var(--ngx-grid-bg, #ffffff);border-radius:8px;cursor:pointer;font-family:inherit;color:var(--ngx-grid-text, #0f172a);transition:all .2s;outline:none}.page-btn:hover:not(:disabled){background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1)}.page-btn.active{background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff;border-color:var(--ngx-btn-primary-bg, #4f46e5);box-shadow:0 2px 4px #4f46e533}.page-btn:disabled{opacity:.4;cursor:not-allowed}\n"] }]
|
|
1829
|
+
`, styles: [":host{display:block}.ngx-data-grid{position:relative;font-family:inherit;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:var(--ngx-grid-radius, 12px);overflow:visible;background:var(--ngx-grid-bg, #ffffff);box-shadow:0 4px 6px -1px #0000000d,0 2px 4px -2px #0000000d;transition:background-color .3s,border-color .3s,box-shadow .3s}.grid-toolbar{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:var(--ngx-grid-radius, 12px) var(--ngx-grid-radius, 12px) 0 0;flex-wrap:wrap;gap:12px}.grid-toolbar-title{font-family:var(--ngx-heading-font-family, \"Outfit\", sans-serif);font-weight:700;font-size:14px;color:var(--ngx-grid-text, #0f172a)}.grid-toolbar-actions{display:flex;gap:6px}.grid-action-btn{padding:6px 14px;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:8px;background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);font-size:12px;font-weight:500;cursor:pointer;font-family:inherit;transition:all .2s cubic-bezier(.4,0,.2,1);outline:none}.grid-action-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1);transform:translateY(-.5px)}.grid-action-btn:active{transform:scale(.97)}.grid-table-wrap{overflow-x:auto;overflow-y:hidden}.grid-table{width:100%;border-collapse:collapse;font-size:13px;table-layout:fixed}.grid-th{position:relative;padding:12px 16px;text-align:left;font-size:11px;font-weight:700;color:var(--ngx-grid-text-secondary, #64748b);background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:2px solid var(--ngx-grid-border, #e2e8f0);white-space:nowrap;-webkit-user-select:none;user-select:none;text-transform:uppercase;letter-spacing:.05em;font-family:var(--ngx-heading-font-family, \"Outfit\", sans-serif)}.grid-th.sortable{cursor:pointer;transition:background-color .2s}.grid-th.sortable:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-th.sort-asc,.grid-th.sort-desc{color:var(--ngx-input-focus, #4f46e5)}.th-text{margin-right:4px}.sort-icon{font-size:10px;color:#cbd5e1}.sort-asc .sort-icon,.sort-desc .sort-icon{color:var(--ngx-input-focus, #4f46e5)}.th-content-wrapper{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%}.grid-filter-btn{background:transparent;border:none;color:var(--ngx-grid-text-secondary, #64748b);cursor:pointer;padding:2px;border-radius:4px;display:flex;align-items:center;justify-content:center;transition:all .2s}.grid-filter-btn:hover{background:var(--ngx-grid-hover-bg, #e2e8f0);color:var(--ngx-grid-text, #0f172a)}.grid-filter-btn.active{color:var(--ngx-input-focus, #4f46e5);background:#4f46e51a}.grid-resize-handle{position:absolute;right:0;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background-color .2s}.grid-resize-handle:hover,.grid-resize-handle.resizing{background:var(--ngx-input-focus, #4f46e5)}.grid-filter-popover{position:absolute;width:250px;background:var(--ngx-grid-bg, #ffffff);border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:12px;box-shadow:0 10px 25px -5px #0000001a,0 8px 10px -6px #0000001a;z-index:1000;padding:12px;box-sizing:border-box;display:flex;flex-direction:column;gap:12px;font-family:inherit}.popover-section{display:flex;flex-direction:column;gap:6px}.popover-label{font-size:11px;font-weight:700;color:var(--ngx-grid-text-secondary, #64748b);text-transform:uppercase;letter-spacing:.05em}.text-filter-row{display:flex;flex-direction:column;gap:6px}.popover-select{padding:6px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:6px;font-size:12px;font-family:inherit;outline:none;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a)}.popover-input{padding:6px 10px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:6px;font-size:12px;font-family:inherit;outline:none;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a)}.checklist-section{border-top:1px solid var(--ngx-grid-border, #e2e8f0);padding-top:10px}.checklist-scroll{max-height:120px;overflow-y:auto;display:flex;flex-direction:column;gap:4px;border:1px solid var(--ngx-grid-border, #e2e8f0);border-radius:6px;padding:6px}.checklist-item{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--ngx-grid-text, #0f172a);cursor:pointer;-webkit-user-select:none;user-select:none}.checklist-item input{margin:0}.popover-footer{display:flex;justify-content:space-between;align-items:center;border-top:1px solid var(--ngx-grid-border, #e2e8f0);padding-top:10px;margin-top:4px}.footer-actions{display:flex;gap:6px}.popover-btn{padding:5px 10px;font-size:11px;font-weight:600;border-radius:6px;cursor:pointer;border:1px solid var(--ngx-grid-border, #cbd5e1);background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);transition:all .2s}.popover-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.popover-btn.apply{background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff;border-color:var(--ngx-btn-primary-bg, #4f46e5)}.popover-btn.apply:hover{background:var(--ngx-btn-primary-hover, #4338ca);border-color:var(--ngx-btn-primary-hover, #4338ca)}.popover-btn.clear{color:#ef4444;border-color:transparent;background:transparent}.popover-btn.clear:hover{background:#fef2f2}.grid-group-row td{background:var(--ngx-grid-header-bg, #f8fafc);border-bottom:1.5px solid var(--ngx-grid-border, #e2e8f0);color:var(--ngx-grid-text, #0f172a);font-size:12px;font-weight:600;padding:11px 16px;cursor:pointer}.group-toggle{border:none;background:transparent;margin-right:6px;cursor:pointer;color:var(--ngx-grid-text-secondary, #64748b);font-size:12px}.group-count{color:var(--ngx-grid-text-secondary, #64748b);margin-left:6px;font-weight:500}.grid-row{border-bottom:1px solid var(--ngx-grid-border, #e2e8f0);transition:background-color .15s}.grid-row:hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-row.selected{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-table.striped .grid-row:nth-child(2n){background:var(--ngx-grid-stripe-bg, #f8fafc)}.grid-table.striped .grid-row:nth-child(2n):hover{background:var(--ngx-grid-hover-bg, #f1f5f9)}.grid-table.striped .grid-row.selected{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-td{padding:11px 16px;color:var(--ngx-grid-text, #0f172a);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;box-sizing:border-box}.grid-th-check,.grid-td-check,.grid-th-toggle,.grid-td-toggle{width:44px!important;text-align:center}.toggle-btn{border:none;background:transparent;color:var(--ngx-grid-text-secondary, #64748b);cursor:pointer;font-size:13px;transition:color .15s}.toggle-btn:hover{color:var(--ngx-grid-text, #0f172a)}.grid-detail-row td{background:var(--ngx-grid-stripe-bg, #f8fafc);border-bottom:1px solid var(--ngx-grid-border, #e2e8f0)}.grid-detail-cell{padding:16px 24px;white-space:normal}.grid-edit-input{width:100%;min-width:80px;padding:6px 10px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:6px;font-size:12px;font-family:inherit;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);box-sizing:border-box;outline:none;transition:border-color .2s,box-shadow .2s}.grid-edit-input:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.grid-actions{white-space:nowrap}.action-btn{border:1px solid var(--ngx-grid-border, #cbd5e1);background:var(--ngx-grid-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);border-radius:6px;padding:5px 10px;font-size:12px;font-weight:500;margin-right:6px;cursor:pointer;transition:all .2s;outline:none}.action-btn:hover{background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1)}.action-btn.save{border-color:var(--ngx-btn-primary-bg, #4f46e5);background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff}.action-btn.save:hover{background:var(--ngx-btn-primary-hover, #4338ca);border-color:var(--ngx-btn-primary-hover, #4338ca)}.action-btn:last-child{margin-right:0}.grid-loading-cell,.grid-empty-cell{padding:48px;text-align:center;color:var(--ngx-grid-text-secondary, #64748b);font-weight:500}.grid-spinner{width:28px;height:28px;border:3.5px solid var(--ngx-grid-border, #e2e8f0);border-top-color:var(--ngx-btn-primary-bg, #4f46e5);border-radius:50%;animation:spin .8s cubic-bezier(.4,0,.2,1) infinite;margin:0 auto}@keyframes spin{to{transform:rotate(360deg)}}.grid-pagination{display:flex;align-items:center;justify-content:space-between;padding:10px 16px;border-top:1px solid var(--ngx-grid-border, #e2e8f0);background:var(--ngx-grid-bg, #ffffff);border-radius:0 0 var(--ngx-grid-radius, 12px) var(--ngx-grid-radius, 12px);flex-wrap:wrap;gap:8px}.page-info{font-size:12px;color:var(--ngx-grid-text-secondary, #64748b);font-weight:500}.page-btns{display:flex;gap:4px}.page-btn{min-width:32px;height:32px;padding:0 8px;font-size:12px;font-weight:500;border:1px solid var(--ngx-grid-border, #e2e8f0);background:var(--ngx-grid-bg, #ffffff);border-radius:8px;cursor:pointer;font-family:inherit;color:var(--ngx-grid-text, #0f172a);transition:all .2s;outline:none}.page-btn:hover:not(:disabled){background:var(--ngx-grid-hover-bg, #f1f5f9);border-color:var(--ngx-input-border, #cbd5e1)}.page-btn.active{background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff;border-color:var(--ngx-btn-primary-bg, #4f46e5);box-shadow:0 2px 4px #4f46e533}.page-btn:disabled{opacity:.4;cursor:not-allowed}.grid-footer-row td{background:var(--ngx-grid-header-bg, #f8fafc);border-top:2px solid var(--ngx-grid-border, #e2e8f0);font-size:12px;padding:12px 16px;color:var(--ngx-grid-text, #0f172a)}.agg-label{font-size:10px;font-weight:700;color:var(--ngx-grid-text-secondary, #64748b);text-transform:uppercase;letter-spacing:.05em}.agg-value{font-weight:700;color:var(--ngx-input-focus, #4f46e5)}.pinned-left{position:sticky!important;z-index:2;background:var(--ngx-grid-bg, #ffffff)}th.pinned-left{z-index:4;background:var(--ngx-grid-header-bg, #f8fafc)}.sticky-toggle{position:sticky!important;left:0;z-index:3;background:var(--ngx-grid-bg, #ffffff)}th.sticky-toggle{z-index:5;background:var(--ngx-grid-header-bg, #f8fafc)}.sticky-check{position:sticky!important;z-index:3;background:var(--ngx-grid-bg, #ffffff)}th.sticky-check{z-index:5;background:var(--ngx-grid-header-bg, #f8fafc)}.pinned-left-last,.sticky-toggle-last,.sticky-check-last{border-right:2px solid var(--ngx-grid-border, #cbd5e1)!important}.grid-table.striped .grid-row:nth-child(2n) .pinned-left,.grid-table.striped .grid-row:nth-child(2n) .sticky-toggle,.grid-table.striped .grid-row:nth-child(2n) .sticky-check{background:var(--ngx-grid-stripe-bg, #f8fafc)}.grid-row:hover .pinned-left,.grid-row:hover .sticky-toggle,.grid-row:hover .sticky-check{background:var(--ngx-grid-hover-bg, #f1f5f9)!important}.grid-row.selected .pinned-left,.grid-row.selected .sticky-toggle,.grid-row.selected .sticky-check{background:var(--ngx-grid-selected-bg, #e0e7ff)!important}.grid-footer-row .pinned-left,.grid-footer-row .sticky-toggle,.grid-footer-row .sticky-check{background:var(--ngx-grid-header-bg, #f8fafc)}.grid-th[draggable=true]{cursor:grab}.grid-th[draggable=true]:active{cursor:grabbing}.grid-th.dragging{opacity:.4;background:var(--ngx-grid-hover-bg, #f1f5f9)!important;border:1.5px dashed var(--ngx-input-border, #cbd5e1)}.grid-th.drag-over{border-left:3px solid var(--ngx-input-focus, #4f46e5)!important}.sort-icon.active{color:var(--ngx-input-focus, #4f46e5);font-weight:700}.sort-order-badge{font-size:8px;line-height:1;background:var(--ngx-input-focus, #4f46e5);color:#fff;padding:1px 3.5px;border-radius:4px;vertical-align:super;margin-left:2px}.grid-search-wrap{position:relative;display:inline-flex;align-items:center}.grid-search-input{padding:6px 30px 6px 12px;border:1px solid var(--ngx-grid-border, #cbd5e1);border-radius:8px;font-size:13px;font-family:inherit;background:var(--ngx-input-bg, #ffffff);color:var(--ngx-grid-text, #0f172a);outline:none;transition:all .2s cubic-bezier(.4,0,.2,1);width:180px}.grid-search-input:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15));width:220px}.grid-search-clear{position:absolute;right:8px;background:transparent;border:none;color:var(--ngx-grid-text-secondary, #94a3b8);font-size:16px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:2px;line-height:1}.grid-search-clear:hover{color:var(--ngx-grid-text, #0f172a)}.search-highlight{background-color:#fbbf244d;color:inherit;font-weight:600;padding:1px 2px;border-radius:4px}.row-drag-handle{cursor:grab;-webkit-user-select:none;user-select:none;color:var(--ngx-grid-text-secondary, #94a3b8);font-size:15px;font-weight:700;display:inline-block;padding:4px 8px;transition:color .15s ease}.row-drag-handle:hover{color:var(--ngx-grid-text, #0f172a)}.row-drag-handle:active{cursor:grabbing}.grid-row.dragging-row{opacity:.4;background:var(--ngx-grid-hover-bg, #f1f5f9)!important;border:1.5px dashed var(--ngx-input-border, #cbd5e1)}.grid-row.drag-over-row{border-top:2px solid var(--ngx-input-focus, #4f46e5)!important}\n"] }]
|
|
1006
1830
|
}], ctorParameters: () => [] });
|
|
1007
1831
|
|
|
1832
|
+
class PivotGridComponent {
|
|
1833
|
+
data = input([]);
|
|
1834
|
+
rows = input([]);
|
|
1835
|
+
columns = input([]);
|
|
1836
|
+
values = input([{ field: 'value', aggregate: 'sum' }]);
|
|
1837
|
+
emptyValue = input('-');
|
|
1838
|
+
pivotColumns = computed(() => {
|
|
1839
|
+
const keys = new Map();
|
|
1840
|
+
for (const item of this.data()) {
|
|
1841
|
+
const key = this.keyFor(item, this.columns());
|
|
1842
|
+
keys.set(key, this.labelFor(item, this.columns()));
|
|
1843
|
+
}
|
|
1844
|
+
return Array.from(keys, ([key, label]) => ({ key, label }));
|
|
1845
|
+
});
|
|
1846
|
+
pivotRows = computed(() => {
|
|
1847
|
+
const rows = new Map();
|
|
1848
|
+
for (const item of this.data()) {
|
|
1849
|
+
const key = this.keyFor(item, this.rows());
|
|
1850
|
+
if (!rows.has(key)) {
|
|
1851
|
+
rows.set(key, { key, label: this.labelFor(item, this.rows()), values: item });
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
return Array.from(rows.values());
|
|
1855
|
+
});
|
|
1856
|
+
rowHeaderLabel() {
|
|
1857
|
+
return this.rows().join(' / ') || 'Rows';
|
|
1858
|
+
}
|
|
1859
|
+
aggregateCell(row, column, value) {
|
|
1860
|
+
const items = this.data().filter(item => this.keyFor(item, this.rows()) === row.key && this.keyFor(item, this.columns()) === column.key);
|
|
1861
|
+
if (!items.length)
|
|
1862
|
+
return this.emptyValue();
|
|
1863
|
+
const aggregate = value.aggregate ?? 'sum';
|
|
1864
|
+
if (aggregate === 'count')
|
|
1865
|
+
return items.length;
|
|
1866
|
+
const numbers = items.map(item => Number(item[value.field])).filter(item => Number.isFinite(item));
|
|
1867
|
+
if (!numbers.length)
|
|
1868
|
+
return this.emptyValue();
|
|
1869
|
+
if (aggregate === 'avg')
|
|
1870
|
+
return this.round(numbers.reduce((sum, item) => sum + item, 0) / numbers.length);
|
|
1871
|
+
if (aggregate === 'min')
|
|
1872
|
+
return Math.min(...numbers);
|
|
1873
|
+
if (aggregate === 'max')
|
|
1874
|
+
return Math.max(...numbers);
|
|
1875
|
+
return this.round(numbers.reduce((sum, item) => sum + item, 0));
|
|
1876
|
+
}
|
|
1877
|
+
keyFor(item, fields) {
|
|
1878
|
+
return fields.map(field => String(item[field] ?? '')).join('||') || '__total__';
|
|
1879
|
+
}
|
|
1880
|
+
labelFor(item, fields) {
|
|
1881
|
+
return fields.map(field => String(item[field] ?? '')).filter(Boolean).join(' / ') || 'Total';
|
|
1882
|
+
}
|
|
1883
|
+
round(value) {
|
|
1884
|
+
return Math.round(value * 100) / 100;
|
|
1885
|
+
}
|
|
1886
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PivotGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1887
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: PivotGridComponent, isStandalone: true, selector: "ngx-pivot-grid", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, values: { classPropertyName: "values", publicName: "values", isSignal: true, isRequired: false, transformFunction: null }, emptyValue: { classPropertyName: "emptyValue", publicName: "emptyValue", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1888
|
+
<div class="ngx-pivot-grid">
|
|
1889
|
+
<table>
|
|
1890
|
+
<thead>
|
|
1891
|
+
<tr>
|
|
1892
|
+
<th class="row-header">{{ rowHeaderLabel() }}</th>
|
|
1893
|
+
@for (column of pivotColumns(); track column.key) {
|
|
1894
|
+
@for (value of values(); track value.field) {
|
|
1895
|
+
<th>{{ column.label }}@if (values().length > 1) { <span> / {{ value.label || value.field }}</span> }</th>
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
</tr>
|
|
1899
|
+
</thead>
|
|
1900
|
+
<tbody>
|
|
1901
|
+
@for (row of pivotRows(); track row.key) {
|
|
1902
|
+
<tr>
|
|
1903
|
+
<th class="row-label">{{ row.label }}</th>
|
|
1904
|
+
@for (column of pivotColumns(); track column.key) {
|
|
1905
|
+
@for (value of values(); track value.field) {
|
|
1906
|
+
<td>{{ aggregateCell(row, column, value) }}</td>
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
</tr>
|
|
1910
|
+
}
|
|
1911
|
+
</tbody>
|
|
1912
|
+
</table>
|
|
1913
|
+
</div>
|
|
1914
|
+
`, isInline: true, styles: [":host{display:block}.ngx-pivot-grid{width:100%;overflow:auto;border:1px solid var(--border-color, #dbe3ee);border-radius:8px;background:var(--bg-secondary, #ffffff)}table{width:100%;border-collapse:collapse;min-width:520px;font-family:var(--ngx-font-family, inherit);font-size:13px;color:var(--text-primary, #0f172a)}th,td{padding:10px 12px;border-bottom:1px solid var(--border-light, #edf2f7);border-right:1px solid var(--border-light, #edf2f7);text-align:right;white-space:nowrap}thead th{position:sticky;top:0;z-index:1;background:var(--border-light, #f8fafc);color:var(--text-secondary, #475569);font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.4px}thead th span{color:var(--text-primary, #0f172a)}.row-header,.row-label{position:sticky;left:0;z-index:2;text-align:left;background:var(--bg-secondary, #ffffff)}thead .row-header{z-index:3;background:var(--border-light, #f8fafc)}tbody tr:hover td,tbody tr:hover .row-label{background:var(--primary-glow, rgba(79, 70, 229, .04))}tr:last-child th,tr:last-child td{border-bottom:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
1915
|
+
}
|
|
1916
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: PivotGridComponent, decorators: [{
|
|
1917
|
+
type: Component,
|
|
1918
|
+
args: [{ selector: 'ngx-pivot-grid', standalone: true, imports: [CommonModule], template: `
|
|
1919
|
+
<div class="ngx-pivot-grid">
|
|
1920
|
+
<table>
|
|
1921
|
+
<thead>
|
|
1922
|
+
<tr>
|
|
1923
|
+
<th class="row-header">{{ rowHeaderLabel() }}</th>
|
|
1924
|
+
@for (column of pivotColumns(); track column.key) {
|
|
1925
|
+
@for (value of values(); track value.field) {
|
|
1926
|
+
<th>{{ column.label }}@if (values().length > 1) { <span> / {{ value.label || value.field }}</span> }</th>
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
</tr>
|
|
1930
|
+
</thead>
|
|
1931
|
+
<tbody>
|
|
1932
|
+
@for (row of pivotRows(); track row.key) {
|
|
1933
|
+
<tr>
|
|
1934
|
+
<th class="row-label">{{ row.label }}</th>
|
|
1935
|
+
@for (column of pivotColumns(); track column.key) {
|
|
1936
|
+
@for (value of values(); track value.field) {
|
|
1937
|
+
<td>{{ aggregateCell(row, column, value) }}</td>
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
</tr>
|
|
1941
|
+
}
|
|
1942
|
+
</tbody>
|
|
1943
|
+
</table>
|
|
1944
|
+
</div>
|
|
1945
|
+
`, styles: [":host{display:block}.ngx-pivot-grid{width:100%;overflow:auto;border:1px solid var(--border-color, #dbe3ee);border-radius:8px;background:var(--bg-secondary, #ffffff)}table{width:100%;border-collapse:collapse;min-width:520px;font-family:var(--ngx-font-family, inherit);font-size:13px;color:var(--text-primary, #0f172a)}th,td{padding:10px 12px;border-bottom:1px solid var(--border-light, #edf2f7);border-right:1px solid var(--border-light, #edf2f7);text-align:right;white-space:nowrap}thead th{position:sticky;top:0;z-index:1;background:var(--border-light, #f8fafc);color:var(--text-secondary, #475569);font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.4px}thead th span{color:var(--text-primary, #0f172a)}.row-header,.row-label{position:sticky;left:0;z-index:2;text-align:left;background:var(--bg-secondary, #ffffff)}thead .row-header{z-index:3;background:var(--border-light, #f8fafc)}tbody tr:hover td,tbody tr:hover .row-label{background:var(--primary-glow, rgba(79, 70, 229, .04))}tr:last-child th,tr:last-child td{border-bottom:none}\n"] }]
|
|
1946
|
+
}] });
|
|
1947
|
+
|
|
1008
1948
|
/*
|
|
1009
1949
|
* Public API Surface — secondary entry point: ngx-core-components/grid
|
|
1010
1950
|
*/
|
|
@@ -1013,5 +1953,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
1013
1953
|
* Generated bundle index. Do not edit.
|
|
1014
1954
|
*/
|
|
1015
1955
|
|
|
1016
|
-
export { DataGridComponent };
|
|
1956
|
+
export { DataGridComponent, PivotGridComponent };
|
|
1017
1957
|
//# sourceMappingURL=ngx-core-components-grid.mjs.map
|