@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.
@@ -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, input, signal, computed, effect, viewChild, ChangeDetectionStrategy, } from '@angular/core';
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.wrapperRef = viewChild('wrapper');
17
- this.tableContainerRefEl = viewChild('tableContainer');
18
- // Inputs mapped from IOGridDataGridProps
19
- this.itemsInput = input.required({ alias: 'items' });
20
- this.columns = input.required();
21
- this.getRowIdInput = input.required({ alias: 'getRowId' });
22
- this.sortBy = input(undefined);
23
- this.sortDirection = input('asc');
24
- this.onColumnSort = input.required();
25
- this.visibleColumns = input.required();
26
- this.columnOrder = input(undefined);
27
- this.onColumnOrderChange = input(undefined);
28
- this.onColumnResized = input(undefined);
29
- this.onColumnPinned = input(undefined);
30
- this.pinnedColumnsInput = input(undefined, { alias: 'pinnedColumns' });
31
- this.initialColumnWidths = input(undefined);
32
- this.freezeRowsInput = input(undefined, { alias: 'freezeRows' });
33
- this.freezeColsInput = input(undefined, { alias: 'freezeCols' });
34
- this.layoutMode = input('fill');
35
- this.suppressHorizontalScroll = input(undefined);
36
- this.isLoadingInput = input(false, { alias: 'isLoading' });
37
- this.loadingMessageInput = input('Loading\u2026', { alias: 'loadingMessage' });
38
- this.editable = input(undefined);
39
- this.cellSelection = input(undefined);
40
- this.onCellValueChanged = input(undefined);
41
- this.onUndoInput = input(undefined, { alias: 'onUndo' });
42
- this.onRedoInput = input(undefined, { alias: 'onRedo' });
43
- this.canUndoInput = input(undefined, { alias: 'canUndo' });
44
- this.canRedoInput = input(undefined, { alias: 'canRedo' });
45
- this.rowSelectionMode = input('none', { alias: 'rowSelection' });
46
- this.selectedRows = input(undefined);
47
- this.onSelectionChange = input(undefined);
48
- this.statusBar = input(undefined);
49
- this.filters = input.required();
50
- this.onFilterChange = input.required();
51
- this.filterOptions = input({});
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() ?? (this.ariaLabelledByInput() ? undefined : 'Data grid'));
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() === 'content')
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() === 'content')
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
- effect(() => {
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.buildProps();
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()(item);
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() !== false && !!colEditable && this.onCellValueChanged() != null && typeof col.cellEditor !== 'function';
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()(item) && editing.columnId === col.columnId;
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()(item), columnId: col.columnId });
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() !== 'single')
213
+ if (this.rowSelectionMode !== 'single')
217
214
  return;
218
- const rowId = this.getRowIdInput()(item);
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()(item);
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()?.(this.resizeColumnId, finalWidth);
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() !== 'none' ? 'true' : null"
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="position:sticky;top:0;z-index:3;background:var(--ogrid-header-bg, #f5f5f5)">
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:relative"
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()(item);
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]="() => cancelEdit()"
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);