@alaarab/ogrid-angular-primeng 2.0.8 → 2.0.11
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/dist/esm/column-chooser/column-chooser.component.js +8 -28
- package/dist/esm/column-header-filter/column-header-filter.component.js +44 -162
- package/dist/esm/column-header-menu/column-header-menu.component.js +77 -44
- package/dist/esm/datagrid-table/datagrid-table.component.js +286 -115
- package/dist/esm/datagrid-table/inline-cell-editor.component.js +32 -14
- package/dist/esm/datagrid-table/popover-cell-editor.component.js +38 -18
- package/dist/esm/index.js +2 -0
- package/dist/esm/ogrid/ogrid.component.js +22 -10
- package/dist/esm/pagination-controls/pagination-controls.component.js +13 -27
- package/dist/types/column-chooser/column-chooser.component.d.ts +3 -19
- package/dist/types/column-header-filter/column-header-filter.component.d.ts +5 -62
- package/dist/types/column-header-menu/column-header-menu.component.d.ts +11 -12
- package/dist/types/datagrid-table/datagrid-table.component.d.ts +64 -50
- package/dist/types/datagrid-table/inline-cell-editor.component.d.ts +9 -9
- package/dist/types/datagrid-table/popover-cell-editor.component.d.ts +9 -9
- package/dist/types/index.d.ts +0 -2
- package/dist/types/ogrid/ogrid.component.d.ts +6 -5
- package/dist/types/pagination-controls/pagination-controls.component.d.ts +2 -11
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { Component,
|
|
7
|
+
import { Component, Input, signal, computed, ViewChild, ChangeDetectionStrategy, } from '@angular/core';
|
|
8
8
|
import { BaseDataGridTableComponent, DataGridStateService, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, DEFAULT_MIN_COLUMN_WIDTH, getCellValue, resolveCellDisplayContent, resolveCellStyle, } from '@alaarab/ogrid-angular';
|
|
9
9
|
import { ColumnHeaderFilterComponent } from '../column-header-filter/column-header-filter.component';
|
|
10
10
|
import { ColumnHeaderMenuComponent } from '../column-header-menu/column-header-menu.component';
|
|
@@ -13,52 +13,42 @@ import { PopoverCellEditorComponent } from './popover-cell-editor.component';
|
|
|
13
13
|
let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTableComponent {
|
|
14
14
|
constructor() {
|
|
15
15
|
super();
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
this.loadingFilterOptions = input({});
|
|
53
|
-
this.peopleSearch = input(undefined);
|
|
54
|
-
this.getUserByEmail = input(undefined);
|
|
55
|
-
this.emptyStateInput = input(undefined, { alias: 'emptyState' });
|
|
56
|
-
this.onCellError = input(undefined);
|
|
57
|
-
this.ariaLabelInput = input(undefined, { alias: 'aria-label' });
|
|
58
|
-
this.ariaLabelledByInput = input(undefined, { alias: 'aria-labelledby' });
|
|
59
|
-
this.showRowNumbers = input(false);
|
|
60
|
-
this.currentPageInput = input(1, { alias: 'currentPage' });
|
|
61
|
-
this.pageSizeInput = input(25, { alias: 'pageSize' });
|
|
16
|
+
this.sortBy = undefined;
|
|
17
|
+
this.sortDirection = 'asc';
|
|
18
|
+
this.columnOrder = undefined;
|
|
19
|
+
this.onColumnOrderChange = undefined;
|
|
20
|
+
this.onColumnResized = undefined;
|
|
21
|
+
this.onColumnPinned = undefined;
|
|
22
|
+
this.pinnedColumnsInput = undefined;
|
|
23
|
+
this.initialColumnWidths = undefined;
|
|
24
|
+
this.freezeRowsInput = undefined;
|
|
25
|
+
this.freezeColsInput = undefined;
|
|
26
|
+
this.layoutMode = 'fill';
|
|
27
|
+
this.suppressHorizontalScroll = undefined;
|
|
28
|
+
this.isLoadingInput = false;
|
|
29
|
+
this.loadingMessageInput = 'Loading\u2026';
|
|
30
|
+
this.editable = undefined;
|
|
31
|
+
this.cellSelection = undefined;
|
|
32
|
+
this.onCellValueChanged = undefined;
|
|
33
|
+
this.onUndoInput = undefined;
|
|
34
|
+
this.onRedoInput = undefined;
|
|
35
|
+
this.canUndoInput = undefined;
|
|
36
|
+
this.canRedoInput = undefined;
|
|
37
|
+
this.rowSelectionMode = 'none';
|
|
38
|
+
this.selectedRows = undefined;
|
|
39
|
+
this.onSelectionChange = undefined;
|
|
40
|
+
this.statusBar = undefined;
|
|
41
|
+
this.filterOptions = {};
|
|
42
|
+
this.loadingFilterOptions = {};
|
|
43
|
+
this.peopleSearch = undefined;
|
|
44
|
+
this.getUserByEmail = undefined;
|
|
45
|
+
this.emptyStateInput = undefined;
|
|
46
|
+
this.onCellError = undefined;
|
|
47
|
+
this.ariaLabelInput = undefined;
|
|
48
|
+
this.ariaLabelledByInput = undefined;
|
|
49
|
+
this.showRowNumbers = false;
|
|
50
|
+
this.currentPageInput = 1;
|
|
51
|
+
this.pageSizeInput = 25;
|
|
62
52
|
this.defaultMinWidth = DEFAULT_MIN_COLUMN_WIDTH;
|
|
63
53
|
this.statusBarClasses = {
|
|
64
54
|
statusBar: 'ogrid-status-bar',
|
|
@@ -68,17 +58,20 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
68
58
|
};
|
|
69
59
|
// PrimeNG uses flat number overrides for column sizing
|
|
70
60
|
this.primengColumnSizingOverrides = signal({});
|
|
61
|
+
this.propsSignal = signal(undefined);
|
|
71
62
|
this.resizeStartX = 0;
|
|
72
63
|
this.resizeColumnId = '';
|
|
73
64
|
this.resizeStartWidth = 0;
|
|
65
|
+
// Bound method reference for template
|
|
66
|
+
this.cancelEditHandler = () => this.cancelEdit();
|
|
74
67
|
// --- PrimeNG-specific computed signals ---
|
|
75
|
-
this.resolvedAriaLabel = computed(() => this.ariaLabelInput
|
|
68
|
+
this.resolvedAriaLabel = computed(() => this.ariaLabelInput ?? (this.ariaLabelledByInput ? undefined : 'Data grid'));
|
|
76
69
|
this.tableWidthStyle = computed(() => {
|
|
77
70
|
if (this.showEmptyInGrid())
|
|
78
71
|
return '100%';
|
|
79
72
|
if (this.allowOverflowX())
|
|
80
73
|
return 'fit-content';
|
|
81
|
-
if (this.layoutMode
|
|
74
|
+
if (this.layoutMode === 'content')
|
|
82
75
|
return 'fit-content';
|
|
83
76
|
return '100%';
|
|
84
77
|
});
|
|
@@ -87,28 +80,32 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
87
80
|
return '100%';
|
|
88
81
|
if (this.allowOverflowX())
|
|
89
82
|
return 'max-content';
|
|
90
|
-
if (this.layoutMode
|
|
83
|
+
if (this.layoutMode === 'content')
|
|
91
84
|
return 'max-content';
|
|
92
85
|
return '100%';
|
|
93
86
|
});
|
|
94
87
|
this.initBase();
|
|
88
|
+
}
|
|
89
|
+
ngOnChanges(changes) {
|
|
95
90
|
// Initialize column sizing from initial widths
|
|
96
|
-
|
|
97
|
-
const iw = this.initialColumnWidths
|
|
91
|
+
if (changes['initialColumnWidths']) {
|
|
92
|
+
const iw = this.initialColumnWidths;
|
|
98
93
|
if (iw) {
|
|
99
94
|
this.primengColumnSizingOverrides.set({ ...iw });
|
|
100
95
|
}
|
|
101
|
-
}
|
|
96
|
+
}
|
|
97
|
+
// Rebuild props signal whenever any input changes so computed chains track it
|
|
98
|
+
this.propsSignal.set(this.buildProps());
|
|
102
99
|
}
|
|
103
100
|
// --- Abstract method implementations ---
|
|
104
101
|
getProps() {
|
|
105
|
-
return this.
|
|
102
|
+
return this.propsSignal();
|
|
106
103
|
}
|
|
107
104
|
getWrapperRef() {
|
|
108
|
-
return this.wrapperRef
|
|
105
|
+
return this.wrapperRef;
|
|
109
106
|
}
|
|
110
107
|
getTableContainerRef() {
|
|
111
|
-
return this.tableContainerRefEl
|
|
108
|
+
return this.tableContainerRefEl;
|
|
112
109
|
}
|
|
113
110
|
// --- Column width override (PrimeNG uses flat number instead of { widthPx }) ---
|
|
114
111
|
getColumnWidth(col) {
|
|
@@ -119,7 +116,7 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
119
116
|
}
|
|
120
117
|
// --- PrimeNG-specific helpers ---
|
|
121
118
|
trackByRowId(_index, item) {
|
|
122
|
-
return this.getRowIdInput(
|
|
119
|
+
return this.getRowIdInput(item);
|
|
123
120
|
}
|
|
124
121
|
getCellValueFn(item, col) {
|
|
125
122
|
return getCellValue(item, col);
|
|
@@ -134,13 +131,13 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
134
131
|
}
|
|
135
132
|
canEditCell(col, item) {
|
|
136
133
|
const colEditable = col.editable === true || (typeof col.editable === 'function' && col.editable(item));
|
|
137
|
-
return this.editable
|
|
134
|
+
return this.editable !== false && !!colEditable && this.onCellValueChanged != null && typeof col.cellEditor !== 'function';
|
|
138
135
|
}
|
|
139
136
|
isEditingCell(item, col) {
|
|
140
137
|
const editing = this.editingCell();
|
|
141
138
|
if (!editing)
|
|
142
139
|
return false;
|
|
143
|
-
return editing.rowId === this.getRowIdInput(
|
|
140
|
+
return editing.rowId === this.getRowIdInput(item) && editing.columnId === col.columnId;
|
|
144
141
|
}
|
|
145
142
|
isEditingCellInline(item, col) {
|
|
146
143
|
return this.isEditingCell(item, col) && typeof col.cellEditor !== 'function';
|
|
@@ -202,7 +199,7 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
202
199
|
// --- PrimeNG-specific event handlers ---
|
|
203
200
|
onCellDblClickPrimeng(item, col, _rowIndex, _colIdx) {
|
|
204
201
|
if (this.canEditCell(col, item)) {
|
|
205
|
-
this.stateService.setEditingCell({ rowId: this.getRowIdInput(
|
|
202
|
+
this.stateService.setEditingCell({ rowId: this.getRowIdInput(item), columnId: col.columnId });
|
|
206
203
|
}
|
|
207
204
|
}
|
|
208
205
|
onCellEditorCommit(item, col, rowIndex, colIdx, newValue) {
|
|
@@ -213,14 +210,27 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
213
210
|
this.state().rowSelection.handleSelectAll(checked);
|
|
214
211
|
}
|
|
215
212
|
onRowClickPrimeng(e, item) {
|
|
216
|
-
if (this.rowSelectionMode
|
|
213
|
+
if (this.rowSelectionMode !== 'single')
|
|
217
214
|
return;
|
|
218
|
-
const rowId = this.getRowIdInput(
|
|
215
|
+
const rowId = this.getRowIdInput(item);
|
|
219
216
|
const ids = this.selectedRowIds();
|
|
220
217
|
this.state().rowSelection.updateSelection(ids.has(rowId) ? new Set() : new Set([rowId]));
|
|
221
218
|
}
|
|
219
|
+
getColumnHeaderMenuHandlers(columnId) {
|
|
220
|
+
return {
|
|
221
|
+
onPinLeft: () => this.onPinColumn(columnId, 'left'),
|
|
222
|
+
onPinRight: () => this.onPinColumn(columnId, 'right'),
|
|
223
|
+
onUnpin: () => this.onUnpinColumn(columnId),
|
|
224
|
+
onSortAsc: () => this.onSortAsc(columnId),
|
|
225
|
+
onSortDesc: () => this.onSortDesc(columnId),
|
|
226
|
+
onClearSort: () => this.onClearSort(),
|
|
227
|
+
onAutosizeThis: () => this.onAutosizeColumn(columnId),
|
|
228
|
+
onAutosizeAll: () => this.onAutosizeAllColumns(),
|
|
229
|
+
onClose: () => { }
|
|
230
|
+
};
|
|
231
|
+
}
|
|
222
232
|
onRowCheckboxChangePrimeng(item, checked, rowIndex, _e) {
|
|
223
|
-
const rowId = this.getRowIdInput(
|
|
233
|
+
const rowId = this.getRowIdInput(item);
|
|
224
234
|
this.state().rowSelection.handleRowCheckboxChange(rowId, checked, rowIndex, this.lastMouseShift);
|
|
225
235
|
}
|
|
226
236
|
onResizeStartPrimeng(e, col) {
|
|
@@ -240,7 +250,7 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
240
250
|
window.removeEventListener('mouseup', onUp, true);
|
|
241
251
|
const finalWidth = this.primengColumnSizingOverrides()[this.resizeColumnId];
|
|
242
252
|
if (finalWidth) {
|
|
243
|
-
this.onColumnResized
|
|
253
|
+
this.onColumnResized?.(this.resizeColumnId, finalWidth);
|
|
244
254
|
const overrides = {};
|
|
245
255
|
for (const [id, w] of Object.entries(this.primengColumnSizingOverrides())) {
|
|
246
256
|
overrides[id] = { widthPx: w };
|
|
@@ -254,52 +264,187 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
254
264
|
// --- Build props ---
|
|
255
265
|
buildProps() {
|
|
256
266
|
return {
|
|
257
|
-
items: this.itemsInput
|
|
258
|
-
columns: this.columns
|
|
259
|
-
getRowId: this.getRowIdInput
|
|
260
|
-
sortBy: this.sortBy
|
|
261
|
-
sortDirection: this.sortDirection
|
|
262
|
-
onColumnSort: this.onColumnSort
|
|
263
|
-
visibleColumns: this.visibleColumns
|
|
264
|
-
columnOrder: this.columnOrder
|
|
265
|
-
onColumnOrderChange: this.onColumnOrderChange
|
|
266
|
-
onColumnResized: this.onColumnResized
|
|
267
|
-
onColumnPinned: this.onColumnPinned
|
|
268
|
-
pinnedColumns: this.pinnedColumnsInput
|
|
269
|
-
initialColumnWidths: this.initialColumnWidths
|
|
270
|
-
freezeRows: this.freezeRowsInput
|
|
271
|
-
freezeCols: this.freezeColsInput
|
|
272
|
-
layoutMode: this.layoutMode
|
|
273
|
-
suppressHorizontalScroll: this.suppressHorizontalScroll
|
|
274
|
-
isLoading: this.isLoadingInput
|
|
275
|
-
loadingMessage: this.loadingMessageInput
|
|
276
|
-
editable: this.editable
|
|
277
|
-
cellSelection: this.cellSelection
|
|
278
|
-
onCellValueChanged: this.onCellValueChanged
|
|
279
|
-
onUndo: this.onUndoInput
|
|
280
|
-
onRedo: this.onRedoInput
|
|
281
|
-
canUndo: this.canUndoInput
|
|
282
|
-
canRedo: this.canRedoInput
|
|
283
|
-
rowSelection: this.rowSelectionMode
|
|
284
|
-
selectedRows: this.selectedRows
|
|
285
|
-
onSelectionChange: this.onSelectionChange
|
|
286
|
-
showRowNumbers: this.showRowNumbers
|
|
287
|
-
currentPage: this.currentPageInput
|
|
288
|
-
pageSize: this.pageSizeInput
|
|
289
|
-
statusBar: this.statusBar
|
|
290
|
-
filters: this.filters
|
|
291
|
-
onFilterChange: this.onFilterChange
|
|
292
|
-
filterOptions: this.filterOptions
|
|
293
|
-
loadingFilterOptions: this.loadingFilterOptions
|
|
294
|
-
peopleSearch: this.peopleSearch
|
|
295
|
-
getUserByEmail: this.getUserByEmail
|
|
296
|
-
emptyState: this.emptyStateInput
|
|
297
|
-
onCellError: this.onCellError
|
|
298
|
-
'aria-label': this.ariaLabelInput
|
|
299
|
-
'aria-labelledby': this.ariaLabelledByInput
|
|
267
|
+
items: this.itemsInput,
|
|
268
|
+
columns: this.columns,
|
|
269
|
+
getRowId: this.getRowIdInput,
|
|
270
|
+
sortBy: this.sortBy,
|
|
271
|
+
sortDirection: this.sortDirection,
|
|
272
|
+
onColumnSort: this.onColumnSort,
|
|
273
|
+
visibleColumns: this.visibleColumns,
|
|
274
|
+
columnOrder: this.columnOrder,
|
|
275
|
+
onColumnOrderChange: this.onColumnOrderChange,
|
|
276
|
+
onColumnResized: this.onColumnResized,
|
|
277
|
+
onColumnPinned: this.onColumnPinned,
|
|
278
|
+
pinnedColumns: this.pinnedColumnsInput,
|
|
279
|
+
initialColumnWidths: this.initialColumnWidths,
|
|
280
|
+
freezeRows: this.freezeRowsInput,
|
|
281
|
+
freezeCols: this.freezeColsInput,
|
|
282
|
+
layoutMode: this.layoutMode,
|
|
283
|
+
suppressHorizontalScroll: this.suppressHorizontalScroll,
|
|
284
|
+
isLoading: this.isLoadingInput,
|
|
285
|
+
loadingMessage: this.loadingMessageInput,
|
|
286
|
+
editable: this.editable,
|
|
287
|
+
cellSelection: this.cellSelection,
|
|
288
|
+
onCellValueChanged: this.onCellValueChanged,
|
|
289
|
+
onUndo: this.onUndoInput,
|
|
290
|
+
onRedo: this.onRedoInput,
|
|
291
|
+
canUndo: this.canUndoInput,
|
|
292
|
+
canRedo: this.canRedoInput,
|
|
293
|
+
rowSelection: this.rowSelectionMode,
|
|
294
|
+
selectedRows: this.selectedRows,
|
|
295
|
+
onSelectionChange: this.onSelectionChange,
|
|
296
|
+
showRowNumbers: this.showRowNumbers,
|
|
297
|
+
currentPage: this.currentPageInput,
|
|
298
|
+
pageSize: this.pageSizeInput,
|
|
299
|
+
statusBar: this.statusBar,
|
|
300
|
+
filters: this.filters,
|
|
301
|
+
onFilterChange: this.onFilterChange,
|
|
302
|
+
filterOptions: this.filterOptions,
|
|
303
|
+
loadingFilterOptions: this.loadingFilterOptions,
|
|
304
|
+
peopleSearch: this.peopleSearch,
|
|
305
|
+
getUserByEmail: this.getUserByEmail,
|
|
306
|
+
emptyState: this.emptyStateInput,
|
|
307
|
+
onCellError: this.onCellError,
|
|
308
|
+
'aria-label': this.ariaLabelInput,
|
|
309
|
+
'aria-labelledby': this.ariaLabelledByInput,
|
|
300
310
|
};
|
|
301
311
|
}
|
|
302
312
|
};
|
|
313
|
+
__decorate([
|
|
314
|
+
ViewChild('wrapper')
|
|
315
|
+
], DataGridTableComponent.prototype, "wrapperRef", void 0);
|
|
316
|
+
__decorate([
|
|
317
|
+
ViewChild('tableContainer')
|
|
318
|
+
], DataGridTableComponent.prototype, "tableContainerRefEl", void 0);
|
|
319
|
+
__decorate([
|
|
320
|
+
Input({ required: true, alias: 'items' })
|
|
321
|
+
], DataGridTableComponent.prototype, "itemsInput", void 0);
|
|
322
|
+
__decorate([
|
|
323
|
+
Input({ required: true })
|
|
324
|
+
], DataGridTableComponent.prototype, "columns", void 0);
|
|
325
|
+
__decorate([
|
|
326
|
+
Input({ required: true, alias: 'getRowId' })
|
|
327
|
+
], DataGridTableComponent.prototype, "getRowIdInput", void 0);
|
|
328
|
+
__decorate([
|
|
329
|
+
Input()
|
|
330
|
+
], DataGridTableComponent.prototype, "sortBy", void 0);
|
|
331
|
+
__decorate([
|
|
332
|
+
Input()
|
|
333
|
+
], DataGridTableComponent.prototype, "sortDirection", void 0);
|
|
334
|
+
__decorate([
|
|
335
|
+
Input({ required: true })
|
|
336
|
+
], DataGridTableComponent.prototype, "onColumnSort", void 0);
|
|
337
|
+
__decorate([
|
|
338
|
+
Input({ required: true })
|
|
339
|
+
], DataGridTableComponent.prototype, "visibleColumns", void 0);
|
|
340
|
+
__decorate([
|
|
341
|
+
Input()
|
|
342
|
+
], DataGridTableComponent.prototype, "columnOrder", void 0);
|
|
343
|
+
__decorate([
|
|
344
|
+
Input()
|
|
345
|
+
], DataGridTableComponent.prototype, "onColumnOrderChange", void 0);
|
|
346
|
+
__decorate([
|
|
347
|
+
Input()
|
|
348
|
+
], DataGridTableComponent.prototype, "onColumnResized", void 0);
|
|
349
|
+
__decorate([
|
|
350
|
+
Input()
|
|
351
|
+
], DataGridTableComponent.prototype, "onColumnPinned", void 0);
|
|
352
|
+
__decorate([
|
|
353
|
+
Input({ alias: 'pinnedColumns' })
|
|
354
|
+
], DataGridTableComponent.prototype, "pinnedColumnsInput", void 0);
|
|
355
|
+
__decorate([
|
|
356
|
+
Input()
|
|
357
|
+
], DataGridTableComponent.prototype, "initialColumnWidths", void 0);
|
|
358
|
+
__decorate([
|
|
359
|
+
Input({ alias: 'freezeRows' })
|
|
360
|
+
], DataGridTableComponent.prototype, "freezeRowsInput", void 0);
|
|
361
|
+
__decorate([
|
|
362
|
+
Input({ alias: 'freezeCols' })
|
|
363
|
+
], DataGridTableComponent.prototype, "freezeColsInput", void 0);
|
|
364
|
+
__decorate([
|
|
365
|
+
Input()
|
|
366
|
+
], DataGridTableComponent.prototype, "layoutMode", void 0);
|
|
367
|
+
__decorate([
|
|
368
|
+
Input()
|
|
369
|
+
], DataGridTableComponent.prototype, "suppressHorizontalScroll", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
Input({ alias: 'isLoading' })
|
|
372
|
+
], DataGridTableComponent.prototype, "isLoadingInput", void 0);
|
|
373
|
+
__decorate([
|
|
374
|
+
Input({ alias: 'loadingMessage' })
|
|
375
|
+
], DataGridTableComponent.prototype, "loadingMessageInput", void 0);
|
|
376
|
+
__decorate([
|
|
377
|
+
Input()
|
|
378
|
+
], DataGridTableComponent.prototype, "editable", void 0);
|
|
379
|
+
__decorate([
|
|
380
|
+
Input()
|
|
381
|
+
], DataGridTableComponent.prototype, "cellSelection", void 0);
|
|
382
|
+
__decorate([
|
|
383
|
+
Input()
|
|
384
|
+
], DataGridTableComponent.prototype, "onCellValueChanged", void 0);
|
|
385
|
+
__decorate([
|
|
386
|
+
Input({ alias: 'onUndo' })
|
|
387
|
+
], DataGridTableComponent.prototype, "onUndoInput", void 0);
|
|
388
|
+
__decorate([
|
|
389
|
+
Input({ alias: 'onRedo' })
|
|
390
|
+
], DataGridTableComponent.prototype, "onRedoInput", void 0);
|
|
391
|
+
__decorate([
|
|
392
|
+
Input({ alias: 'canUndo' })
|
|
393
|
+
], DataGridTableComponent.prototype, "canUndoInput", void 0);
|
|
394
|
+
__decorate([
|
|
395
|
+
Input({ alias: 'canRedo' })
|
|
396
|
+
], DataGridTableComponent.prototype, "canRedoInput", void 0);
|
|
397
|
+
__decorate([
|
|
398
|
+
Input({ alias: 'rowSelection' })
|
|
399
|
+
], DataGridTableComponent.prototype, "rowSelectionMode", void 0);
|
|
400
|
+
__decorate([
|
|
401
|
+
Input()
|
|
402
|
+
], DataGridTableComponent.prototype, "selectedRows", void 0);
|
|
403
|
+
__decorate([
|
|
404
|
+
Input()
|
|
405
|
+
], DataGridTableComponent.prototype, "onSelectionChange", void 0);
|
|
406
|
+
__decorate([
|
|
407
|
+
Input()
|
|
408
|
+
], DataGridTableComponent.prototype, "statusBar", void 0);
|
|
409
|
+
__decorate([
|
|
410
|
+
Input({ required: true })
|
|
411
|
+
], DataGridTableComponent.prototype, "filters", void 0);
|
|
412
|
+
__decorate([
|
|
413
|
+
Input({ required: true })
|
|
414
|
+
], DataGridTableComponent.prototype, "onFilterChange", void 0);
|
|
415
|
+
__decorate([
|
|
416
|
+
Input()
|
|
417
|
+
], DataGridTableComponent.prototype, "filterOptions", void 0);
|
|
418
|
+
__decorate([
|
|
419
|
+
Input()
|
|
420
|
+
], DataGridTableComponent.prototype, "loadingFilterOptions", void 0);
|
|
421
|
+
__decorate([
|
|
422
|
+
Input()
|
|
423
|
+
], DataGridTableComponent.prototype, "peopleSearch", void 0);
|
|
424
|
+
__decorate([
|
|
425
|
+
Input()
|
|
426
|
+
], DataGridTableComponent.prototype, "getUserByEmail", void 0);
|
|
427
|
+
__decorate([
|
|
428
|
+
Input({ alias: 'emptyState' })
|
|
429
|
+
], DataGridTableComponent.prototype, "emptyStateInput", void 0);
|
|
430
|
+
__decorate([
|
|
431
|
+
Input()
|
|
432
|
+
], DataGridTableComponent.prototype, "onCellError", void 0);
|
|
433
|
+
__decorate([
|
|
434
|
+
Input({ alias: 'aria-label' })
|
|
435
|
+
], DataGridTableComponent.prototype, "ariaLabelInput", void 0);
|
|
436
|
+
__decorate([
|
|
437
|
+
Input({ alias: 'aria-labelledby' })
|
|
438
|
+
], DataGridTableComponent.prototype, "ariaLabelledByInput", void 0);
|
|
439
|
+
__decorate([
|
|
440
|
+
Input()
|
|
441
|
+
], DataGridTableComponent.prototype, "showRowNumbers", void 0);
|
|
442
|
+
__decorate([
|
|
443
|
+
Input({ alias: 'currentPage' })
|
|
444
|
+
], DataGridTableComponent.prototype, "currentPageInput", void 0);
|
|
445
|
+
__decorate([
|
|
446
|
+
Input({ alias: 'pageSize' })
|
|
447
|
+
], DataGridTableComponent.prototype, "pageSizeInput", void 0);
|
|
303
448
|
DataGridTableComponent = __decorate([
|
|
304
449
|
Component({
|
|
305
450
|
selector: 'ogrid-primeng-datagrid-table',
|
|
@@ -329,7 +474,7 @@ DataGridTableComponent = __decorate([
|
|
|
329
474
|
[attr.data-freeze-rows]="freezeRows() != null && freezeRows()! >= 1 ? freezeRows() : null"
|
|
330
475
|
[attr.data-freeze-cols]="freezeCols() != null && freezeCols()! >= 1 ? freezeCols() : null"
|
|
331
476
|
[attr.data-overflow-x]="allowOverflowX() ? 'true' : 'false'"
|
|
332
|
-
[attr.data-has-selection]="rowSelectionMode
|
|
477
|
+
[attr.data-has-selection]="rowSelectionMode !== 'none' ? 'true' : null"
|
|
333
478
|
(contextmenu)="$event.preventDefault()"
|
|
334
479
|
(keydown)="onGridKeyDown($event)"
|
|
335
480
|
(mousedown)="onWrapperMouseDown($event)"
|
|
@@ -345,7 +490,7 @@ DataGridTableComponent = __decorate([
|
|
|
345
490
|
<table
|
|
346
491
|
style="width:var(--data-table-width, 100%);min-width:var(--data-table-min-width, 100%);border-collapse:collapse;table-layout:fixed"
|
|
347
492
|
>
|
|
348
|
-
<thead style="
|
|
493
|
+
<thead style="z-index:3;background:var(--ogrid-header-bg, #f5f5f5)">
|
|
349
494
|
@for (row of headerRows(); track $index; let rowIdx = $index) {
|
|
350
495
|
<tr>
|
|
351
496
|
@if (rowIdx === headerRows().length - 1 && hasCheckboxCol()) {
|
|
@@ -396,10 +541,12 @@ DataGridTableComponent = __decorate([
|
|
|
396
541
|
[attr.rowSpan]="headerRows().length > 1 && rowIdx < headerRows().length - 1 ? headerRows().length - rowIdx : null"
|
|
397
542
|
[class.ogrid-th-pinned-left]="pinned === 'left'"
|
|
398
543
|
[class.ogrid-th-pinned-right]="pinned === 'right'"
|
|
399
|
-
style="padding:6px 8px;text-align:left;font-weight:600;border-bottom:1px solid var(--ogrid-border, #e0e0e0);position:
|
|
544
|
+
style="padding:6px 8px;text-align:left;font-weight:600;border-bottom:1px solid var(--ogrid-border, #e0e0e0);position:sticky;top:0;background:var(--ogrid-header-bg, #f5f5f5);z-index:3"
|
|
400
545
|
[style.min-width.px]="col.minWidth ?? defaultMinWidth"
|
|
401
546
|
[style.width.px]="getColumnWidth(col)"
|
|
402
547
|
[style.max-width.px]="getColumnWidth(col)"
|
|
548
|
+
[style.left.px]="pinned === 'left' ? getPinnedLeftOffset(col.columnId) : null"
|
|
549
|
+
[style.right.px]="pinned === 'right' ? getPinnedRightOffset(col.columnId) : null"
|
|
403
550
|
[style.cursor]="columnReorderService.isDragging() ? 'grabbing' : 'grab'"
|
|
404
551
|
(mousedown)="onHeaderMouseDown(col.columnId, $event)"
|
|
405
552
|
>
|
|
@@ -424,14 +571,16 @@ DataGridTableComponent = __decorate([
|
|
|
424
571
|
[onDateChange]="getFilterConfig(col).onDateChange"
|
|
425
572
|
></ogrid-primeng-column-header-filter>
|
|
426
573
|
@let colPinState = getPinState(col.columnId);
|
|
574
|
+
@let colSortState = getSortState(col.columnId);
|
|
427
575
|
<column-header-menu
|
|
428
576
|
[columnId]="col.columnId"
|
|
429
|
-
[onPinLeft]="() => onPinColumn(col.columnId, 'left')"
|
|
430
|
-
[onPinRight]="() => onPinColumn(col.columnId, 'right')"
|
|
431
|
-
[onUnpin]="() => onUnpinColumn(col.columnId)"
|
|
432
577
|
[canPinLeft]="colPinState.canPinLeft"
|
|
433
578
|
[canPinRight]="colPinState.canPinRight"
|
|
434
579
|
[canUnpin]="colPinState.canUnpin"
|
|
580
|
+
[currentSort]="colSortState"
|
|
581
|
+
[isSortable]="col.sortable !== false"
|
|
582
|
+
[isResizable]="col.resizable !== false"
|
|
583
|
+
[handlers]="getColumnHeaderMenuHandlers(col.columnId)"
|
|
435
584
|
/>
|
|
436
585
|
</div>
|
|
437
586
|
<div
|
|
@@ -453,7 +602,7 @@ DataGridTableComponent = __decorate([
|
|
|
453
602
|
}
|
|
454
603
|
@for (item of vsVisibleItems(); track trackByRowId($index, item); let localIdx = $index) {
|
|
455
604
|
@let rowIndex = vsStartIndex() + localIdx;
|
|
456
|
-
@let rowId = getRowIdInput(
|
|
605
|
+
@let rowId = getRowIdInput(item);
|
|
457
606
|
@let isSelected = selectedRowIds().has(rowId);
|
|
458
607
|
<tr
|
|
459
608
|
[attr.data-row-id]="rowId"
|
|
@@ -491,6 +640,8 @@ DataGridTableComponent = __decorate([
|
|
|
491
640
|
[style.min-width.px]="col.minWidth ?? defaultMinWidth"
|
|
492
641
|
[style.width.px]="getColumnWidth(col)"
|
|
493
642
|
[style.max-width.px]="getColumnWidth(col)"
|
|
643
|
+
[style.left.px]="pinned === 'left' ? getPinnedLeftOffset(col.columnId) : null"
|
|
644
|
+
[style.right.px]="pinned === 'right' ? getPinnedRightOffset(col.columnId) : null"
|
|
494
645
|
[style.text-align]="col.type === 'numeric' ? 'right' : col.type === 'boolean' ? 'center' : null"
|
|
495
646
|
>
|
|
496
647
|
@if (isEditingCellInline(item, col)) {
|
|
@@ -512,7 +663,7 @@ DataGridTableComponent = __decorate([
|
|
|
512
663
|
[globalColIndex]="colIdx + colOffset()"
|
|
513
664
|
[displayValue]="getCellValueFn(item, col)"
|
|
514
665
|
[editorProps]="editorProps"
|
|
515
|
-
[onCancel]="
|
|
666
|
+
[onCancel]="cancelEditHandler"
|
|
516
667
|
></ogrid-primeng-popover-cell-editor>
|
|
517
668
|
} @else {
|
|
518
669
|
<div
|
|
@@ -555,6 +706,9 @@ DataGridTableComponent = __decorate([
|
|
|
555
706
|
[cutRange]="state().interaction.cutRange"
|
|
556
707
|
[colOffset]="state().layout.colOffset"
|
|
557
708
|
[columnSizingVersion]="columnSizingVersion()"
|
|
709
|
+
[items]="items()"
|
|
710
|
+
[visibleColumns]="propsVisibleColumns()"
|
|
711
|
+
[columnOrder]="propsColumnOrder()"
|
|
558
712
|
></ogrid-marching-ants-overlay>
|
|
559
713
|
|
|
560
714
|
@if (showEmptyInGrid() && emptyState()) {
|
|
@@ -637,6 +791,7 @@ DataGridTableComponent = __decorate([
|
|
|
637
791
|
}
|
|
638
792
|
.ogrid-th-pinned-left {
|
|
639
793
|
position: sticky;
|
|
794
|
+
top: 0;
|
|
640
795
|
left: 0;
|
|
641
796
|
z-index: 10;
|
|
642
797
|
background: var(--ogrid-header-bg, #f5f5f5);
|
|
@@ -644,6 +799,7 @@ DataGridTableComponent = __decorate([
|
|
|
644
799
|
}
|
|
645
800
|
.ogrid-th-pinned-right {
|
|
646
801
|
position: sticky;
|
|
802
|
+
top: 0;
|
|
647
803
|
right: 0;
|
|
648
804
|
z-index: 10;
|
|
649
805
|
background: var(--ogrid-header-bg, #f5f5f5);
|
|
@@ -663,6 +819,21 @@ DataGridTableComponent = __decorate([
|
|
|
663
819
|
background: var(--ogrid-bg, #fff);
|
|
664
820
|
border-right: 2px solid var(--ogrid-primary, #217346);
|
|
665
821
|
}
|
|
822
|
+
::ng-deep th:focus-visible,
|
|
823
|
+
::ng-deep td:focus-visible {
|
|
824
|
+
outline: 2px solid var(--primary-color, #6366f1);
|
|
825
|
+
outline-offset: -2px;
|
|
826
|
+
z-index: 11;
|
|
827
|
+
}
|
|
828
|
+
::ng-deep .p-button:focus-visible,
|
|
829
|
+
::ng-deep button:focus-visible {
|
|
830
|
+
outline: 2px solid var(--primary-color, #6366f1);
|
|
831
|
+
outline-offset: 2px;
|
|
832
|
+
}
|
|
833
|
+
::ng-deep .p-checkbox:focus-visible {
|
|
834
|
+
outline: 2px solid var(--primary-color, #6366f1);
|
|
835
|
+
outline-offset: 2px;
|
|
836
|
+
}
|
|
666
837
|
`],
|
|
667
838
|
})
|
|
668
839
|
], DataGridTableComponent);
|