@alaarab/ogrid-angular-primeng 2.0.5 → 2.0.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.
@@ -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, Output, EventEmitter, ViewChild } from '@angular/core';
7
+ import { Component, input, computed, viewChild, ChangeDetectionStrategy } from '@angular/core';
8
8
  import { ButtonModule } from 'primeng/button';
9
9
  import { MenuModule } from 'primeng/menu';
10
10
  import { COLUMN_HEADER_MENU_ITEMS } from '@alaarab/ogrid-core';
@@ -14,93 +14,54 @@ import { COLUMN_HEADER_MENU_ITEMS } from '@alaarab/ogrid-core';
14
14
  */
15
15
  let ColumnHeaderMenuComponent = class ColumnHeaderMenuComponent {
16
16
  constructor() {
17
- this.pinLeft = new EventEmitter();
18
- this.pinRight = new EventEmitter();
19
- this.unpin = new EventEmitter();
20
- this._canPinLeft = true;
21
- this._canPinRight = true;
22
- this._canUnpin = false;
23
- this.menuModel = [];
24
- }
25
- set canPinLeft(value) {
26
- this._canPinLeft = value;
27
- this.updateMenuModel();
28
- }
29
- set canPinRight(value) {
30
- this._canPinRight = value;
31
- this.updateMenuModel();
32
- }
33
- set canUnpin(value) {
34
- this._canUnpin = value;
35
- this.updateMenuModel();
36
- }
37
- ngOnInit() {
38
- this.updateMenuModel();
39
- }
40
- updateMenuModel() {
41
- this.menuModel = [
17
+ this.columnId = input.required();
18
+ this.canPinLeft = input(true);
19
+ this.canPinRight = input(true);
20
+ this.canUnpin = input(false);
21
+ this.onPinLeft = input(undefined);
22
+ this.onPinRight = input(undefined);
23
+ this.onUnpin = input(undefined);
24
+ this.menuRef = viewChild('menu');
25
+ this.menuModel = computed(() => [
42
26
  {
43
27
  label: COLUMN_HEADER_MENU_ITEMS[0].label,
44
- disabled: !this._canPinLeft,
28
+ disabled: !this.canPinLeft(),
45
29
  command: () => this.handlePinLeft(),
46
30
  },
47
31
  {
48
32
  label: COLUMN_HEADER_MENU_ITEMS[1].label,
49
- disabled: !this._canPinRight,
33
+ disabled: !this.canPinRight(),
50
34
  command: () => this.handlePinRight(),
51
35
  },
52
36
  {
53
37
  label: COLUMN_HEADER_MENU_ITEMS[2].label,
54
- disabled: !this._canUnpin,
38
+ disabled: !this.canUnpin(),
55
39
  command: () => this.handleUnpin(),
56
40
  },
57
- ];
41
+ ]);
58
42
  }
59
43
  handlePinLeft() {
60
- if (this._canPinLeft) {
61
- this.pinLeft.emit();
44
+ if (this.canPinLeft()) {
45
+ this.onPinLeft()?.();
62
46
  }
63
47
  }
64
48
  handlePinRight() {
65
- if (this._canPinRight) {
66
- this.pinRight.emit();
49
+ if (this.canPinRight()) {
50
+ this.onPinRight()?.();
67
51
  }
68
52
  }
69
53
  handleUnpin() {
70
- if (this._canUnpin) {
71
- this.unpin.emit();
54
+ if (this.canUnpin()) {
55
+ this.onUnpin()?.();
72
56
  }
73
57
  }
74
58
  };
75
- __decorate([
76
- Input()
77
- ], ColumnHeaderMenuComponent.prototype, "columnId", void 0);
78
- __decorate([
79
- Input()
80
- ], ColumnHeaderMenuComponent.prototype, "canPinLeft", null);
81
- __decorate([
82
- Input()
83
- ], ColumnHeaderMenuComponent.prototype, "canPinRight", null);
84
- __decorate([
85
- Input()
86
- ], ColumnHeaderMenuComponent.prototype, "canUnpin", null);
87
- __decorate([
88
- Output()
89
- ], ColumnHeaderMenuComponent.prototype, "pinLeft", void 0);
90
- __decorate([
91
- Output()
92
- ], ColumnHeaderMenuComponent.prototype, "pinRight", void 0);
93
- __decorate([
94
- Output()
95
- ], ColumnHeaderMenuComponent.prototype, "unpin", void 0);
96
- __decorate([
97
- ViewChild('menu')
98
- ], ColumnHeaderMenuComponent.prototype, "menu", void 0);
99
59
  ColumnHeaderMenuComponent = __decorate([
100
60
  Component({
101
61
  selector: 'column-header-menu',
102
62
  standalone: true,
103
63
  imports: [ButtonModule, MenuModule],
64
+ changeDetection: ChangeDetectionStrategy.OnPush,
104
65
  template: `
105
66
  <button
106
67
  pButton
@@ -108,12 +69,12 @@ ColumnHeaderMenuComponent = __decorate([
108
69
  icon="pi pi-ellipsis-v"
109
70
  class="p-button-text p-button-sm column-header-menu-trigger"
110
71
  (click)="menu.toggle($event)"
111
- [attr.aria-label]="'Column options for ' + columnId"
72
+ [attr.aria-label]="'Column options for ' + columnId()"
112
73
  ></button>
113
74
 
114
75
  <p-menu
115
76
  #menu
116
- [model]="menuModel"
77
+ [model]="menuModel()"
117
78
  [popup]="true"
118
79
  appendTo="body"
119
80
  ></p-menu>
@@ -4,23 +4,20 @@ 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, inject, signal, computed, effect, viewChild, ChangeDetectionStrategy, } from '@angular/core';
8
- import { CommonModule } from '@angular/common';
9
- import { DataGridStateService, ColumnReorderService, VirtualScrollService, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, DEFAULT_MIN_COLUMN_WIDTH, buildHeaderRows, getCellValue, getHeaderFilterConfig, resolveCellDisplayContent, resolveCellStyle, } from '@alaarab/ogrid-angular';
7
+ import { Component, input, signal, computed, effect, viewChild, ChangeDetectionStrategy, } from '@angular/core';
8
+ import { BaseDataGridTableComponent, DataGridStateService, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, DEFAULT_MIN_COLUMN_WIDTH, getCellValue, resolveCellDisplayContent, resolveCellStyle, } from '@alaarab/ogrid-angular';
10
9
  import { ColumnHeaderFilterComponent } from '../column-header-filter/column-header-filter.component';
11
10
  import { ColumnHeaderMenuComponent } from '../column-header-menu/column-header-menu.component';
12
11
  import { InlineCellEditorComponent } from './inline-cell-editor.component';
13
- let DataGridTableComponent = class DataGridTableComponent {
12
+ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTableComponent {
14
13
  constructor() {
15
- this.stateService = inject(DataGridStateService);
16
- this.columnReorderService = new ColumnReorderService();
17
- this.virtualScrollService = new VirtualScrollService();
14
+ super();
18
15
  this.wrapperRef = viewChild('wrapper');
19
- this.tableContainerRef = viewChild('tableContainer');
16
+ this.tableContainerRefEl = viewChild('tableContainer');
20
17
  // Inputs mapped from IOGridDataGridProps
21
- this.items = input.required();
18
+ this.itemsInput = input.required({ alias: 'items' });
22
19
  this.columns = input.required();
23
- this.getRowIdFn = input.required({ alias: 'getRowId' });
20
+ this.getRowIdInput = input.required({ alias: 'getRowId' });
24
21
  this.sortBy = input(undefined);
25
22
  this.sortDirection = input('asc');
26
23
  this.onColumnSort = input.required();
@@ -29,21 +26,21 @@ let DataGridTableComponent = class DataGridTableComponent {
29
26
  this.onColumnOrderChange = input(undefined);
30
27
  this.onColumnResized = input(undefined);
31
28
  this.onColumnPinned = input(undefined);
32
- this.pinnedColumns = input(undefined);
29
+ this.pinnedColumnsInput = input(undefined, { alias: 'pinnedColumns' });
33
30
  this.initialColumnWidths = input(undefined);
34
- this.freezeRows = input(undefined);
35
- this.freezeCols = input(undefined);
31
+ this.freezeRowsInput = input(undefined, { alias: 'freezeRows' });
32
+ this.freezeColsInput = input(undefined, { alias: 'freezeCols' });
36
33
  this.layoutMode = input('fill');
37
34
  this.suppressHorizontalScroll = input(undefined);
38
- this.isLoading = input(false);
39
- this.loadingMessage = input('Loading\u2026');
35
+ this.isLoadingInput = input(false, { alias: 'isLoading' });
36
+ this.loadingMessageInput = input('Loading\u2026', { alias: 'loadingMessage' });
40
37
  this.editable = input(undefined);
41
38
  this.cellSelection = input(undefined);
42
39
  this.onCellValueChanged = input(undefined);
43
- this.onUndo = input(undefined);
44
- this.onRedo = input(undefined);
45
- this.canUndo = input(undefined);
46
- this.canRedo = input(undefined);
40
+ this.onUndoInput = input(undefined, { alias: 'onUndo' });
41
+ this.onRedoInput = input(undefined, { alias: 'onRedo' });
42
+ this.canUndoInput = input(undefined, { alias: 'canUndo' });
43
+ this.canRedoInput = input(undefined, { alias: 'canRedo' });
47
44
  this.rowSelectionMode = input('none', { alias: 'rowSelection' });
48
45
  this.selectedRows = input(undefined);
49
46
  this.onSelectionChange = input(undefined);
@@ -54,13 +51,13 @@ let DataGridTableComponent = class DataGridTableComponent {
54
51
  this.loadingFilterOptions = input({});
55
52
  this.peopleSearch = input(undefined);
56
53
  this.getUserByEmail = input(undefined);
57
- this.emptyState = input(undefined);
54
+ this.emptyStateInput = input(undefined, { alias: 'emptyState' });
58
55
  this.onCellError = input(undefined);
59
- this.ariaLabel = input(undefined, { alias: 'aria-label' });
60
- this.ariaLabelledBy = input(undefined, { alias: 'aria-labelledby' });
56
+ this.ariaLabelInput = input(undefined, { alias: 'aria-label' });
57
+ this.ariaLabelledByInput = input(undefined, { alias: 'aria-labelledby' });
61
58
  this.showRowNumbers = input(false);
62
- this.currentPage = input(1);
63
- this.pageSize = input(25);
59
+ this.currentPageInput = input(1, { alias: 'currentPage' });
60
+ this.pageSizeInput = input(25, { alias: 'pageSize' });
64
61
  this.defaultMinWidth = DEFAULT_MIN_COLUMN_WIDTH;
65
62
  this.statusBarClasses = {
66
63
  statusBar: 'ogrid-status-bar',
@@ -68,27 +65,15 @@ let DataGridTableComponent = class DataGridTableComponent {
68
65
  statusBarLabel: 'ogrid-status-bar-label',
69
66
  statusBarValue: 'ogrid-status-bar-value',
70
67
  };
71
- // Column sizing
72
- this.columnSizingOverrides = signal({});
68
+ // PrimeNG uses flat number overrides for column sizing
69
+ this.primengColumnSizingOverrides = signal({});
73
70
  this.resizeStartX = 0;
74
71
  this.resizeColumnId = '';
75
72
  this.resizeStartWidth = 0;
76
- // Last shift state for row checkbox
77
- this.lastMouseShift = false;
78
- this.columnSizingVersion = signal(0);
79
- this.state = computed(() => this.stateService.getState());
80
- this.tableContainerEl = computed(() => this.tableContainerRef()?.nativeElement ?? null);
81
- this.resolvedAriaLabel = computed(() => this.ariaLabel() ?? (this.ariaLabelledBy() ? undefined : 'Data grid'));
82
- this.rowNumberOffset = computed(() => this.state().layout.hasRowNumbersCol ? (this.currentPage() - 1) * this.pageSize() : 0);
83
- this.headerRows = computed(() => buildHeaderRows(this.columns(), this.visibleColumns()));
84
- this.allowOverflowX = computed(() => {
85
- const s = this.state();
86
- return !this.suppressHorizontalScroll() && s.layout.containerWidth > 0 &&
87
- (s.layout.minTableWidth > s.layout.containerWidth || s.layout.desiredTableWidth > s.layout.containerWidth);
88
- });
73
+ // --- PrimeNG-specific computed signals ---
74
+ this.resolvedAriaLabel = computed(() => this.ariaLabelInput() ?? (this.ariaLabelledByInput() ? undefined : 'Data grid'));
89
75
  this.tableWidthStyle = computed(() => {
90
- const s = this.state();
91
- if (s.viewModels.showEmptyInGrid)
76
+ if (this.showEmptyInGrid())
92
77
  return '100%';
93
78
  if (this.allowOverflowX())
94
79
  return 'fit-content';
@@ -97,8 +82,7 @@ let DataGridTableComponent = class DataGridTableComponent {
97
82
  return '100%';
98
83
  });
99
84
  this.tableMinWidthStyle = computed(() => {
100
- const s = this.state();
101
- if (s.viewModels.showEmptyInGrid)
85
+ if (this.showEmptyInGrid())
102
86
  return '100%';
103
87
  if (this.allowOverflowX())
104
88
  return 'max-content';
@@ -106,55 +90,35 @@ let DataGridTableComponent = class DataGridTableComponent {
106
90
  return 'max-content';
107
91
  return '100%';
108
92
  });
109
- this.selectedCellCount = computed(() => {
110
- const range = this.state().interaction.selectionRange;
111
- if (!range)
112
- return undefined;
113
- return (Math.abs(range.endRow - range.startRow) + 1) *
114
- (Math.abs(range.endCol - range.startCol) + 1);
115
- });
116
- // Wire inputs to DataGridStateService
117
- effect(() => {
118
- const props = this.buildProps();
119
- this.stateService.props.set(props);
120
- });
121
- effect(() => {
122
- const el = this.wrapperRef()?.nativeElement ?? null;
123
- this.stateService.wrapperEl.set(el);
124
- this.columnReorderService.wrapperEl.set(el);
125
- });
126
- // Wire column reorder service inputs
127
- effect(() => {
128
- const cols = this.state().layout.visibleCols;
129
- this.columnReorderService.columns.set(cols);
130
- this.columnReorderService.columnOrder.set(this.columnOrder());
131
- this.columnReorderService.onColumnOrderChange.set(this.onColumnOrderChange());
132
- this.columnReorderService.enabled.set(!!this.onColumnOrderChange());
133
- });
134
- // Wire virtual scroll service inputs
135
- effect(() => {
136
- this.virtualScrollService.totalRows.set(this.items().length);
137
- });
93
+ this.initBase();
138
94
  // Initialize column sizing from initial widths
139
95
  effect(() => {
140
96
  const iw = this.initialColumnWidths();
141
97
  if (iw) {
142
- this.columnSizingOverrides.set({ ...iw });
98
+ this.primengColumnSizingOverrides.set({ ...iw });
143
99
  }
144
100
  });
145
101
  }
146
- trackByRowId(_index, item) {
147
- return this.getRowIdFn()(item);
102
+ // --- Abstract method implementations ---
103
+ getProps() {
104
+ return this.buildProps();
105
+ }
106
+ getWrapperRef() {
107
+ return this.wrapperRef();
148
108
  }
109
+ getTableContainerRef() {
110
+ return this.tableContainerRefEl();
111
+ }
112
+ // --- Column width override (PrimeNG uses flat number instead of { widthPx }) ---
149
113
  getColumnWidth(col) {
150
- const override = this.columnSizingOverrides()[col.columnId];
114
+ const override = this.primengColumnSizingOverrides()[col.columnId];
151
115
  if (override)
152
116
  return override;
153
- return col.idealWidth ?? col.defaultWidth ?? undefined;
117
+ return col.idealWidth ?? col.defaultWidth ?? col.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH;
154
118
  }
155
- getFilterConfig(col) {
156
- const s = this.state();
157
- return getHeaderFilterConfig(col, s.viewModels.headerFilterInput);
119
+ // --- PrimeNG-specific helpers ---
120
+ trackByRowId(_index, item) {
121
+ return this.getRowIdInput()(item);
158
122
  }
159
123
  getCellValueFn(item, col) {
160
124
  return getCellValue(item, col);
@@ -171,10 +135,10 @@ let DataGridTableComponent = class DataGridTableComponent {
171
135
  return this.editable() !== false && !!colEditable && this.onCellValueChanged() != null && typeof col.cellEditor !== 'function';
172
136
  }
173
137
  isEditingCell(item, col) {
174
- const editing = this.state().editing.editingCell;
138
+ const editing = this.editingCell();
175
139
  if (!editing)
176
140
  return false;
177
- return editing.rowId === this.getRowIdFn()(item) && editing.columnId === col.columnId;
141
+ return editing.rowId === this.getRowIdInput()(item) && editing.columnId === col.columnId;
178
142
  }
179
143
  getEditorType(col, _item) {
180
144
  if (col.cellEditor === 'text' || col.cellEditor === 'select' || col.cellEditor === 'checkbox' || col.cellEditor === 'date' || col.cellEditor === 'richSelect') {
@@ -187,13 +151,13 @@ let DataGridTableComponent = class DataGridTableComponent {
187
151
  return 'text';
188
152
  }
189
153
  isActiveCell(rowIndex, colIdx) {
190
- const ac = this.state().interaction.activeCell;
154
+ const ac = this.activeCell();
191
155
  if (!ac)
192
156
  return false;
193
- return ac.rowIndex === rowIndex && ac.columnIndex === colIdx + this.state().layout.colOffset;
157
+ return ac.rowIndex === rowIndex && ac.columnIndex === colIdx + this.colOffset();
194
158
  }
195
159
  isInSelectionRange(rowIndex, colIdx) {
196
- const range = this.state().interaction.selectionRange;
160
+ const range = this.selectionRange();
197
161
  if (!range)
198
162
  return false;
199
163
  const minR = Math.min(range.startRow, range.endRow);
@@ -203,9 +167,8 @@ let DataGridTableComponent = class DataGridTableComponent {
203
167
  return rowIndex >= minR && rowIndex <= maxR && colIdx >= minC && colIdx <= maxC;
204
168
  }
205
169
  isSelectionEndCell(rowIndex, colIdx) {
206
- const s = this.state();
207
- const range = s.interaction.selectionRange;
208
- if (!range || s.interaction.isDragging || s.interaction.copyRange || s.interaction.cutRange)
170
+ const range = this.selectionRange();
171
+ if (!range || this.isDragging() || this.copyRange() || this.cutRange())
209
172
  return false;
210
173
  return rowIndex === range.endRow && colIdx === range.endCol;
211
174
  }
@@ -214,71 +177,50 @@ let DataGridTableComponent = class DataGridTableComponent {
214
177
  return 'var(--ogrid-range-bg, rgba(33, 115, 70, 0.08))';
215
178
  return null;
216
179
  }
217
- // --- Event handlers ---
218
- onMouseDown(e) {
219
- this.lastMouseShift = e.shiftKey;
220
- }
221
- onGridKeyDown(e) {
222
- this.state().interaction.handleGridKeyDown(e);
223
- }
224
- onCellMouseDown(e, rowIndex, globalColIndex) {
225
- this.state().interaction.handleCellMouseDown(e, rowIndex, globalColIndex);
226
- }
227
- onCellDblClick(item, col, rowIndex, colIdx) {
180
+ // --- PrimeNG-specific event handlers ---
181
+ onCellDblClickPrimeng(item, col, _rowIndex, _colIdx) {
228
182
  if (this.canEditCell(col, item)) {
229
- this.stateService.setEditingCell({ rowId: this.getRowIdFn()(item), columnId: col.columnId });
183
+ this.stateService.setEditingCell({ rowId: this.getRowIdInput()(item), columnId: col.columnId });
230
184
  }
231
185
  }
232
- onCellContextMenu(e) {
233
- this.state().contextMenu.handleCellContextMenu(e);
234
- }
235
186
  onCellEditorCommit(item, col, rowIndex, colIdx, newValue) {
236
187
  const oldValue = getCellValue(item, col);
237
- this.stateService.commitCellEdit(item, col.columnId, oldValue, newValue, rowIndex, colIdx + this.state().layout.colOffset);
188
+ this.stateService.commitCellEdit(item, col.columnId, oldValue, newValue, rowIndex, colIdx + this.colOffset());
238
189
  }
239
- onFillHandleMouseDown(e) {
240
- this.state().interaction.handleFillHandleMouseDown(e);
241
- }
242
- onSelectAllChange(checked) {
190
+ onSelectAllChangePrimeng(checked) {
243
191
  this.state().rowSelection.handleSelectAll(checked);
244
192
  }
245
- onRowClick(e, item) {
193
+ onRowClickPrimeng(e, item) {
246
194
  if (this.rowSelectionMode() !== 'single')
247
195
  return;
248
- const rowId = this.getRowIdFn()(item);
249
- const ids = this.state().rowSelection.selectedRowIds;
196
+ const rowId = this.getRowIdInput()(item);
197
+ const ids = this.selectedRowIds();
250
198
  this.state().rowSelection.updateSelection(ids.has(rowId) ? new Set() : new Set([rowId]));
251
199
  }
252
- onRowCheckboxChange(item, checked, rowIndex, e) {
253
- const rowId = this.getRowIdFn()(item);
200
+ onRowCheckboxChangePrimeng(item, checked, rowIndex, _e) {
201
+ const rowId = this.getRowIdInput()(item);
254
202
  this.state().rowSelection.handleRowCheckboxChange(rowId, checked, rowIndex, this.lastMouseShift);
255
203
  }
256
- handlePaste() {
257
- void this.state().interaction.handlePaste();
258
- }
259
- onHeaderMouseDown(columnId, event) {
260
- this.columnReorderService.handleHeaderMouseDown(columnId, event);
261
- }
262
- onResizeStart(e, col) {
204
+ onResizeStartPrimeng(e, col) {
263
205
  e.preventDefault();
264
206
  this.resizeStartX = e.clientX;
265
207
  this.resizeColumnId = col.columnId;
266
- this.resizeStartWidth = this.getColumnWidth(col) ?? col.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH;
208
+ this.resizeStartWidth = this.getColumnWidth(col);
267
209
  const onMove = (me) => {
268
210
  const delta = me.clientX - this.resizeStartX;
269
211
  const minW = col.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH;
270
212
  const newWidth = Math.max(minW, this.resizeStartWidth + delta);
271
- this.columnSizingOverrides.update((prev) => ({ ...prev, [this.resizeColumnId]: newWidth }));
213
+ this.primengColumnSizingOverrides.update((prev) => ({ ...prev, [this.resizeColumnId]: newWidth }));
272
214
  this.columnSizingVersion.update(v => v + 1);
273
215
  };
274
216
  const onUp = () => {
275
217
  window.removeEventListener('mousemove', onMove, true);
276
218
  window.removeEventListener('mouseup', onUp, true);
277
- const finalWidth = this.columnSizingOverrides()[this.resizeColumnId];
219
+ const finalWidth = this.primengColumnSizingOverrides()[this.resizeColumnId];
278
220
  if (finalWidth) {
279
221
  this.onColumnResized()?.(this.resizeColumnId, finalWidth);
280
222
  const overrides = {};
281
- for (const [id, w] of Object.entries(this.columnSizingOverrides())) {
223
+ for (const [id, w] of Object.entries(this.primengColumnSizingOverrides())) {
282
224
  overrides[id] = { widthPx: w };
283
225
  }
284
226
  this.state().layout.setColumnSizingOverrides(overrides);
@@ -287,29 +229,12 @@ let DataGridTableComponent = class DataGridTableComponent {
287
229
  window.addEventListener('mousemove', onMove, true);
288
230
  window.addEventListener('mouseup', onUp, true);
289
231
  }
290
- // --- Column pinning methods ---
291
- onPinColumn(columnId, side) {
292
- this.onColumnPinned()?.(columnId, side);
293
- }
294
- onUnpinColumn(columnId) {
295
- this.onColumnPinned()?.(columnId, null);
296
- }
297
- isPinned(columnId) {
298
- return this.pinnedColumns()?.[columnId];
299
- }
300
- getPinState(columnId) {
301
- const pinned = this.isPinned(columnId);
302
- return {
303
- canPinLeft: pinned !== 'left',
304
- canPinRight: pinned !== 'right',
305
- canUnpin: !!pinned,
306
- };
307
- }
232
+ // --- Build props ---
308
233
  buildProps() {
309
234
  return {
310
- items: this.items(),
235
+ items: this.itemsInput(),
311
236
  columns: this.columns(),
312
- getRowId: this.getRowIdFn(),
237
+ getRowId: this.getRowIdInput(),
313
238
  sortBy: this.sortBy(),
314
239
  sortDirection: this.sortDirection(),
315
240
  onColumnSort: this.onColumnSort(),
@@ -318,27 +243,27 @@ let DataGridTableComponent = class DataGridTableComponent {
318
243
  onColumnOrderChange: this.onColumnOrderChange(),
319
244
  onColumnResized: this.onColumnResized(),
320
245
  onColumnPinned: this.onColumnPinned(),
321
- pinnedColumns: this.pinnedColumns(),
246
+ pinnedColumns: this.pinnedColumnsInput(),
322
247
  initialColumnWidths: this.initialColumnWidths(),
323
- freezeRows: this.freezeRows(),
324
- freezeCols: this.freezeCols(),
248
+ freezeRows: this.freezeRowsInput(),
249
+ freezeCols: this.freezeColsInput(),
325
250
  layoutMode: this.layoutMode(),
326
251
  suppressHorizontalScroll: this.suppressHorizontalScroll(),
327
- isLoading: this.isLoading(),
328
- loadingMessage: this.loadingMessage(),
252
+ isLoading: this.isLoadingInput(),
253
+ loadingMessage: this.loadingMessageInput(),
329
254
  editable: this.editable(),
330
255
  cellSelection: this.cellSelection(),
331
256
  onCellValueChanged: this.onCellValueChanged(),
332
- onUndo: this.onUndo(),
333
- onRedo: this.onRedo(),
334
- canUndo: this.canUndo(),
335
- canRedo: this.canRedo(),
257
+ onUndo: this.onUndoInput(),
258
+ onRedo: this.onRedoInput(),
259
+ canUndo: this.canUndoInput(),
260
+ canRedo: this.canRedoInput(),
336
261
  rowSelection: this.rowSelectionMode(),
337
262
  selectedRows: this.selectedRows(),
338
263
  onSelectionChange: this.onSelectionChange(),
339
264
  showRowNumbers: this.showRowNumbers(),
340
- currentPage: this.currentPage(),
341
- pageSize: this.pageSize(),
265
+ currentPage: this.currentPageInput(),
266
+ pageSize: this.pageSizeInput(),
342
267
  statusBar: this.statusBar(),
343
268
  filters: this.filters(),
344
269
  onFilterChange: this.onFilterChange(),
@@ -346,10 +271,10 @@ let DataGridTableComponent = class DataGridTableComponent {
346
271
  loadingFilterOptions: this.loadingFilterOptions(),
347
272
  peopleSearch: this.peopleSearch(),
348
273
  getUserByEmail: this.getUserByEmail(),
349
- emptyState: this.emptyState(),
274
+ emptyState: this.emptyStateInput(),
350
275
  onCellError: this.onCellError(),
351
- 'aria-label': this.ariaLabel(),
352
- 'aria-labelledby': this.ariaLabelledBy(),
276
+ 'aria-label': this.ariaLabelInput(),
277
+ 'aria-labelledby': this.ariaLabelledByInput(),
353
278
  };
354
279
  }
355
280
  };
@@ -358,7 +283,6 @@ DataGridTableComponent = __decorate([
358
283
  selector: 'ogrid-primeng-datagrid-table',
359
284
  standalone: true,
360
285
  imports: [
361
- CommonModule,
362
286
  StatusBarComponent,
363
287
  GridContextMenuComponent,
364
288
  MarchingAntsOverlayComponent,
@@ -377,7 +301,7 @@ DataGridTableComponent = __decorate([
377
301
  role="region"
378
302
  [attr.aria-label]="resolvedAriaLabel()"
379
303
  [attr.aria-labelledby]="ariaLabelledBy()"
380
- [attr.data-empty]="state().viewModels.showEmptyInGrid ? 'true' : null"
304
+ [attr.data-empty]="showEmptyInGrid() ? 'true' : null"
381
305
  [attr.data-column-count]="state().layout.totalColCount"
382
306
  [attr.data-freeze-rows]="freezeRows() != null && freezeRows()! >= 1 ? freezeRows() : null"
383
307
  [attr.data-freeze-cols]="freezeCols() != null && freezeCols()! >= 1 ? freezeCols() : null"
@@ -385,7 +309,7 @@ DataGridTableComponent = __decorate([
385
309
  [attr.data-has-selection]="rowSelectionMode() !== 'none' ? 'true' : null"
386
310
  (contextmenu)="$event.preventDefault()"
387
311
  (keydown)="onGridKeyDown($event)"
388
- (mousedown)="onMouseDown($event)"
312
+ (mousedown)="onWrapperMouseDown($event)"
389
313
  style="flex:1;min-height:0;overflow:auto;outline:none;position:relative;font-size:13px;color:var(--ogrid-fg, #242424)"
390
314
  [style.--data-table-column-count]="state().layout.totalColCount"
391
315
  [style.--data-table-width]="tableWidthStyle()"
@@ -400,7 +324,7 @@ DataGridTableComponent = __decorate([
400
324
  <thead style="position:sticky;top:0;z-index:3;background:var(--ogrid-header-bg, #f5f5f5)">
401
325
  @for (row of headerRows(); track $index; let rowIdx = $index) {
402
326
  <tr>
403
- @if (rowIdx === headerRows().length - 1 && state().layout.hasCheckboxCol) {
327
+ @if (rowIdx === headerRows().length - 1 && hasCheckboxCol()) {
404
328
  <th
405
329
  scope="col"
406
330
  rowSpan="1"
@@ -408,17 +332,17 @@ DataGridTableComponent = __decorate([
408
332
  >
409
333
  <input
410
334
  type="checkbox"
411
- [checked]="state().rowSelection.allSelected"
412
- [indeterminate]="state().rowSelection.someSelected && !state().rowSelection.allSelected"
413
- (change)="onSelectAllChange($any($event.target).checked)"
335
+ [checked]="allSelected()"
336
+ [indeterminate]="someSelected() && !allSelected()"
337
+ (change)="onSelectAllChangePrimeng($any($event.target).checked)"
414
338
  aria-label="Select all rows"
415
339
  />
416
340
  </th>
417
341
  }
418
- @if (rowIdx === 0 && rowIdx < headerRows().length - 1 && state().layout.hasCheckboxCol) {
342
+ @if (rowIdx === 0 && rowIdx < headerRows().length - 1 && hasCheckboxCol()) {
419
343
  <th [attr.rowSpan]="headerRows().length - 1"></th>
420
344
  }
421
- @if (rowIdx === headerRows().length - 1 && state().layout.hasRowNumbersCol) {
345
+ @if (rowIdx === headerRows().length - 1 && hasRowNumbersCol()) {
422
346
  <th
423
347
  scope="col"
424
348
  rowSpan="1"
@@ -427,7 +351,7 @@ DataGridTableComponent = __decorate([
427
351
  #
428
352
  </th>
429
353
  }
430
- @if (rowIdx === 0 && rowIdx < headerRows().length - 1 && state().layout.hasRowNumbersCol) {
354
+ @if (rowIdx === 0 && rowIdx < headerRows().length - 1 && hasRowNumbersCol()) {
431
355
  <th [attr.rowSpan]="headerRows().length - 1" style="width:50px;min-width:50px"></th>
432
356
  }
433
357
  @for (cell of row; track $index; let cellIdx = $index) {
@@ -440,55 +364,56 @@ DataGridTableComponent = __decorate([
440
364
  {{ cell.label }}
441
365
  </th>
442
366
  } @else {
443
- @let pinned = isPinned(cell.columnDef!.columnId);
367
+ @let col = asColumnDef(cell.columnDef);
368
+ @let pinned = isPinned(col.columnId);
444
369
  <th
445
370
  scope="col"
446
- [attr.data-column-id]="cell.columnDef!.columnId"
371
+ [attr.data-column-id]="col.columnId"
447
372
  [attr.rowSpan]="headerRows().length > 1 && rowIdx < headerRows().length - 1 ? headerRows().length - rowIdx : null"
448
373
  [class.ogrid-th-pinned-left]="pinned === 'left'"
449
374
  [class.ogrid-th-pinned-right]="pinned === 'right'"
450
375
  style="padding:6px 8px;text-align:left;font-weight:600;border-bottom:1px solid var(--ogrid-border, #e0e0e0);position:relative"
451
- [style.min-width.px]="cell.columnDef!.minWidth ?? defaultMinWidth"
452
- [style.width.px]="getColumnWidth(cell.columnDef!)"
453
- [style.max-width.px]="getColumnWidth(cell.columnDef!)"
376
+ [style.min-width.px]="col.minWidth ?? defaultMinWidth"
377
+ [style.width.px]="getColumnWidth(col)"
378
+ [style.max-width.px]="getColumnWidth(col)"
454
379
  [style.cursor]="columnReorderService.isDragging() ? 'grabbing' : 'grab'"
455
- (mousedown)="onHeaderMouseDown(cell.columnDef!.columnId, $event)"
380
+ (mousedown)="onHeaderMouseDown(col.columnId, $event)"
456
381
  >
457
382
  <div style="display:flex;align-items:center;gap:4px;">
458
383
  <ogrid-primeng-column-header-filter
459
- [columnKey]="cell.columnDef!.columnId"
460
- [columnName]="cell.columnDef!.name"
461
- [filterType]="getFilterConfig(cell.columnDef!).filterType"
462
- [isSorted]="getFilterConfig(cell.columnDef!).isSorted ?? false"
463
- [isSortedDescending]="getFilterConfig(cell.columnDef!).isSortedDescending ?? false"
464
- [onSort]="getFilterConfig(cell.columnDef!).onSort"
465
- [selectedValues]="getFilterConfig(cell.columnDef!).selectedValues"
466
- [onFilterChange]="getFilterConfig(cell.columnDef!).onFilterChange"
467
- [options]="getFilterConfig(cell.columnDef!).options ?? []"
468
- [isLoadingOptions]="getFilterConfig(cell.columnDef!).isLoadingOptions ?? false"
469
- [textValue]="getFilterConfig(cell.columnDef!).textValue ?? ''"
470
- [onTextChange]="getFilterConfig(cell.columnDef!).onTextChange"
471
- [selectedUser]="getFilterConfig(cell.columnDef!).selectedUser"
472
- [onUserChange]="getFilterConfig(cell.columnDef!).onUserChange"
473
- [peopleSearch]="getFilterConfig(cell.columnDef!).peopleSearch"
474
- [dateValue]="getFilterConfig(cell.columnDef!).dateValue"
475
- [onDateChange]="getFilterConfig(cell.columnDef!).onDateChange"
384
+ [columnKey]="col.columnId"
385
+ [columnName]="col.name"
386
+ [filterType]="getFilterConfig(col).filterType"
387
+ [isSorted]="getFilterConfig(col).isSorted ?? false"
388
+ [isSortedDescending]="getFilterConfig(col).isSortedDescending ?? false"
389
+ [onSort]="getFilterConfig(col).onSort"
390
+ [selectedValues]="getFilterConfig(col).selectedValues"
391
+ [onFilterChange]="getFilterConfig(col).onFilterChange"
392
+ [options]="getFilterConfig(col).options ?? []"
393
+ [isLoadingOptions]="getFilterConfig(col).isLoadingOptions ?? false"
394
+ [textValue]="getFilterConfig(col).textValue ?? ''"
395
+ [onTextChange]="getFilterConfig(col).onTextChange"
396
+ [selectedUser]="getFilterConfig(col).selectedUser"
397
+ [onUserChange]="getFilterConfig(col).onUserChange"
398
+ [peopleSearch]="getFilterConfig(col).peopleSearch"
399
+ [dateValue]="getFilterConfig(col).dateValue"
400
+ [onDateChange]="getFilterConfig(col).onDateChange"
476
401
  ></ogrid-primeng-column-header-filter>
477
- @let pinState = getPinState(cell.columnDef!.columnId);
402
+ @let colPinState = getPinState(col.columnId);
478
403
  <column-header-menu
479
- [columnId]="cell.columnDef!.columnId"
480
- [onPinLeft]="() => onPinColumn(cell.columnDef!.columnId, 'left')"
481
- [onPinRight]="() => onPinColumn(cell.columnDef!.columnId, 'right')"
482
- [onUnpin]="() => onUnpinColumn(cell.columnDef!.columnId)"
483
- [canPinLeft]="pinState.canPinLeft"
484
- [canPinRight]="pinState.canPinRight"
485
- [canUnpin]="pinState.canUnpin"
404
+ [columnId]="col.columnId"
405
+ [onPinLeft]="() => onPinColumn(col.columnId, 'left')"
406
+ [onPinRight]="() => onPinColumn(col.columnId, 'right')"
407
+ [onUnpin]="() => onUnpinColumn(col.columnId)"
408
+ [canPinLeft]="colPinState.canPinLeft"
409
+ [canPinRight]="colPinState.canPinRight"
410
+ [canUnpin]="colPinState.canUnpin"
486
411
  />
487
412
  </div>
488
413
  <div
489
414
  style="position:absolute;top:0;right:0;bottom:0;width:4px;cursor:col-resize"
490
- (mousedown)="onResizeStart($event, cell.columnDef!)"
491
- [attr.aria-label]="'Resize ' + cell.columnDef!.name"
415
+ (mousedown)="onResizeStartPrimeng($event, col)"
416
+ [attr.aria-label]="'Resize ' + col.name"
492
417
  ></div>
493
418
  </th>
494
419
  }
@@ -497,15 +422,17 @@ DataGridTableComponent = __decorate([
497
422
  }
498
423
  </thead>
499
424
 
500
- @if (!state().viewModels.showEmptyInGrid) {
425
+ @if (!showEmptyInGrid()) {
501
426
  <tbody>
502
427
  @for (item of items(); track trackByRowId($index, item); let rowIndex = $index) {
428
+ @let rowId = getRowIdInput()(item);
429
+ @let isSelected = selectedRowIds().has(rowId);
503
430
  <tr
504
- [attr.data-row-id]="getRowIdFn()(item)"
505
- [style.background]="state().rowSelection.selectedRowIds.has(getRowIdFn()(item)) ? 'var(--ogrid-selected-bg, #e8f0fe)' : null"
506
- (click)="onRowClick($event, item)"
431
+ [attr.data-row-id]="rowId"
432
+ [style.background]="isSelected ? 'var(--ogrid-selected-bg, #e8f0fe)' : null"
433
+ (click)="onRowClickPrimeng($event, item)"
507
434
  >
508
- @if (state().layout.hasCheckboxCol) {
435
+ @if (hasCheckboxCol()) {
509
436
  <td
510
437
  style="width:48px;min-width:48px;max-width:48px;padding:6px 4px;text-align:center;border-bottom:1px solid var(--ogrid-border, #f0f0f0)"
511
438
  [attr.data-row-index]="rowIndex"
@@ -514,20 +441,20 @@ DataGridTableComponent = __decorate([
514
441
  >
515
442
  <input
516
443
  type="checkbox"
517
- [checked]="state().rowSelection.selectedRowIds.has(getRowIdFn()(item))"
518
- (change)="onRowCheckboxChange(item, $any($event.target).checked, rowIndex, $event)"
444
+ [checked]="isSelected"
445
+ (change)="onRowCheckboxChangePrimeng(item, $any($event.target).checked, rowIndex, $event)"
519
446
  [attr.aria-label]="'Select row ' + (rowIndex + 1)"
520
447
  />
521
448
  </td>
522
449
  }
523
- @if (state().layout.hasRowNumbersCol) {
450
+ @if (hasRowNumbersCol()) {
524
451
  <td
525
452
  style="width:50px;min-width:50px;max-width:50px;padding:6px;text-align:center;font-weight:600;font-variant-numeric:tabular-nums;color:var(--ogrid-text-secondary,#666);background:var(--ogrid-bg-subtle,#fafafa);border-bottom:1px solid var(--ogrid-border,#f0f0f0);position:sticky;left:0;z-index:3"
526
453
  >
527
454
  {{ rowNumberOffset() + rowIndex + 1 }}
528
455
  </td>
529
456
  }
530
- @for (col of state().layout.visibleCols; track col.columnId; let colIdx = $index) {
457
+ @for (col of visibleCols(); track col.columnId; let colIdx = $index) {
531
458
  @let pinned = isPinned(col.columnId);
532
459
  <td
533
460
  [class.ogrid-td-pinned-left]="pinned === 'left'"
@@ -546,14 +473,14 @@ DataGridTableComponent = __decorate([
546
473
  [rowIndex]="rowIndex"
547
474
  [editorType]="getEditorType(col, item)"
548
475
  (commit)="onCellEditorCommit(item, col, rowIndex, colIdx, $event)"
549
- (cancel)="state().editing.setEditingCell(null)"
476
+ (cancel)="cancelEdit()"
550
477
  ></ogrid-primeng-inline-cell-editor>
551
478
  } @else {
552
479
  <div
553
480
  [attr.data-row-index]="rowIndex"
554
- [attr.data-col-index]="colIdx + state().layout.colOffset"
555
- (mousedown)="onCellMouseDown($event, rowIndex, colIdx + state().layout.colOffset)"
556
- (dblclick)="onCellDblClick(item, col, rowIndex, colIdx)"
481
+ [attr.data-col-index]="colIdx + colOffset()"
482
+ (mousedown)="onCellMouseDown($event, rowIndex, colIdx + colOffset())"
483
+ (dblclick)="onCellDblClickPrimeng(item, col, rowIndex, colIdx)"
557
484
  (contextmenu)="onCellContextMenu($event)"
558
485
  style="padding:6px 10px;min-height:20px;cursor:default;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"
559
486
  [style.cursor]="canEditCell(col, item) ? 'cell' : 'default'"
@@ -588,7 +515,7 @@ DataGridTableComponent = __decorate([
588
515
  [columnSizingVersion]="columnSizingVersion()"
589
516
  ></ogrid-marching-ants-overlay>
590
517
 
591
- @if (state().viewModels.showEmptyInGrid && emptyState()) {
518
+ @if (showEmptyInGrid() && emptyState()) {
592
519
  <div style="display:flex;align-items:center;justify-content:center;padding:48px 24px;text-align:center;color:var(--ogrid-muted, #999)">
593
520
  <div>
594
521
  <div style="font-weight:600;margin-bottom:8px">No results found</div>
@@ -610,31 +537,31 @@ DataGridTableComponent = __decorate([
610
537
  <div class="ogrid-drop-indicator" [style.left.px]="columnReorderService.dropIndicatorX()"></div>
611
538
  }
612
539
 
613
- @if (state().contextMenu.menuPosition) {
540
+ @if (menuPosition()) {
614
541
  <ogrid-context-menu
615
- [x]="state().contextMenu.menuPosition!.x"
616
- [y]="state().contextMenu.menuPosition!.y"
617
- [hasSelection]="state().interaction.hasCellSelection"
618
- [canUndoProp]="state().interaction.canUndo"
619
- [canRedoProp]="state().interaction.canRedo"
620
- (copy)="state().interaction.handleCopy()"
621
- (cut)="state().interaction.handleCut()"
542
+ [x]="menuPosition()!.x"
543
+ [y]="menuPosition()!.y"
544
+ [hasSelection]="hasCellSelection()"
545
+ [canUndoProp]="canUndo()"
546
+ [canRedoProp]="canRedo()"
547
+ (copy)="handleCopy()"
548
+ (cut)="handleCut()"
622
549
  (paste)="handlePaste()"
623
- (selectAll)="state().interaction.handleSelectAllCells()"
624
- (undoAction)="state().interaction.onUndo?.()"
625
- (redoAction)="state().interaction.onRedo?.()"
626
- (close)="state().contextMenu.closeContextMenu()"
550
+ (selectAll)="handleSelectAllCells()"
551
+ (undoAction)="onUndo()"
552
+ (redoAction)="onRedo()"
553
+ (close)="closeContextMenu()"
627
554
  ></ogrid-context-menu>
628
555
  }
629
556
 
630
- @if (state().viewModels.statusBarConfig) {
557
+ @if (statusBarConfig()) {
631
558
  <ogrid-status-bar
632
- [totalCount]="state().viewModels.statusBarConfig!.totalCount"
633
- [filteredCount]="state().viewModels.statusBarConfig!.filteredCount"
634
- [selectedCount]="state().viewModels.statusBarConfig!.selectedCount ?? state().rowSelection.selectedRowIds.size"
635
- [selectedCellCount]="selectedCellCount()"
636
- [aggregation]="state().viewModels.statusBarConfig!.aggregation"
637
- [suppressRowCount]="state().viewModels.statusBarConfig!.suppressRowCount"
559
+ [totalCount]="statusBarConfig()!.totalCount"
560
+ [filteredCount]="statusBarConfig()!.filteredCount"
561
+ [selectedCount]="statusBarConfig()!.selectedCount ?? selectedRowIds().size"
562
+ [selectedCellCount]="selectionCellCount()"
563
+ [aggregation]="statusBarConfig()!.aggregation"
564
+ [suppressRowCount]="statusBarConfig()!.suppressRowCount"
638
565
  [classNames]="statusBarClasses"
639
566
  ></ogrid-status-bar>
640
567
  }
@@ -1,4 +1,3 @@
1
- import { EventEmitter } from '@angular/core';
2
1
  import type { Menu } from 'primeng/menu';
3
2
  import type { MenuItem } from 'primeng/api';
4
3
  /**
@@ -6,20 +5,15 @@ import type { MenuItem } from 'primeng/api';
6
5
  * Uses PrimeNG Menu component.
7
6
  */
8
7
  export declare class ColumnHeaderMenuComponent {
9
- columnId: string;
10
- set canPinLeft(value: boolean);
11
- set canPinRight(value: boolean);
12
- set canUnpin(value: boolean);
13
- pinLeft: EventEmitter<void>;
14
- pinRight: EventEmitter<void>;
15
- unpin: EventEmitter<void>;
16
- menu: Menu;
17
- private _canPinLeft;
18
- private _canPinRight;
19
- private _canUnpin;
20
- menuModel: MenuItem[];
21
- ngOnInit(): void;
22
- private updateMenuModel;
8
+ readonly columnId: import("@angular/core").InputSignal<string>;
9
+ readonly canPinLeft: import("@angular/core").InputSignal<boolean>;
10
+ readonly canPinRight: import("@angular/core").InputSignal<boolean>;
11
+ readonly canUnpin: import("@angular/core").InputSignal<boolean>;
12
+ readonly onPinLeft: import("@angular/core").InputSignal<(() => void) | undefined>;
13
+ readonly onPinRight: import("@angular/core").InputSignal<(() => void) | undefined>;
14
+ readonly onUnpin: import("@angular/core").InputSignal<(() => void) | undefined>;
15
+ readonly menuRef: import("@angular/core").Signal<Menu | undefined>;
16
+ readonly menuModel: import("@angular/core").Signal<MenuItem[]>;
23
17
  handlePinLeft(): void;
24
18
  handlePinRight(): void;
25
19
  handleUnpin(): void;
@@ -1,15 +1,12 @@
1
1
  import { ElementRef } from '@angular/core';
2
- import { ColumnReorderService, VirtualScrollService } from '@alaarab/ogrid-angular';
3
- import type { IColumnDef, IColumnGroupDef, RowId, HeaderFilterConfig } from '@alaarab/ogrid-angular';
4
- export declare class DataGridTableComponent<T = unknown> {
5
- private readonly stateService;
6
- readonly columnReorderService: ColumnReorderService<T>;
7
- readonly virtualScrollService: VirtualScrollService;
8
- readonly wrapperRef: import("@angular/core").Signal<ElementRef<HTMLDivElement> | undefined>;
9
- readonly tableContainerRef: import("@angular/core").Signal<ElementRef<HTMLDivElement> | undefined>;
10
- readonly items: import("@angular/core").InputSignal<T[]>;
2
+ import { BaseDataGridTableComponent } from '@alaarab/ogrid-angular';
3
+ import type { IOGridDataGridProps, IColumnDef, IColumnGroupDef, RowId } from '@alaarab/ogrid-angular';
4
+ export declare class DataGridTableComponent<T = unknown> extends BaseDataGridTableComponent<T> {
5
+ private readonly wrapperRef;
6
+ private readonly tableContainerRefEl;
7
+ readonly itemsInput: import("@angular/core").InputSignal<T[]>;
11
8
  readonly columns: import("@angular/core").InputSignal<(IColumnDef<T> | IColumnGroupDef<T>)[]>;
12
- readonly getRowIdFn: import("@angular/core").InputSignal<(item: T) => RowId>;
9
+ readonly getRowIdInput: import("@angular/core").InputSignal<(item: T) => RowId>;
13
10
  readonly sortBy: import("@angular/core").InputSignal<string | undefined>;
14
11
  readonly sortDirection: import("@angular/core").InputSignal<"asc" | "desc">;
15
12
  readonly onColumnSort: import("@angular/core").InputSignal<(columnKey: string) => void>;
@@ -18,14 +15,14 @@ export declare class DataGridTableComponent<T = unknown> {
18
15
  readonly onColumnOrderChange: import("@angular/core").InputSignal<((order: string[]) => void) | undefined>;
19
16
  readonly onColumnResized: import("@angular/core").InputSignal<((columnId: string, width: number) => void) | undefined>;
20
17
  readonly onColumnPinned: import("@angular/core").InputSignal<((columnId: string, pinned: "left" | "right" | null) => void) | undefined>;
21
- readonly pinnedColumns: import("@angular/core").InputSignal<Record<string, "left" | "right"> | undefined>;
18
+ readonly pinnedColumnsInput: import("@angular/core").InputSignal<Record<string, "left" | "right"> | undefined>;
22
19
  readonly initialColumnWidths: import("@angular/core").InputSignal<Record<string, number> | undefined>;
23
- readonly freezeRows: import("@angular/core").InputSignal<number | undefined>;
24
- readonly freezeCols: import("@angular/core").InputSignal<number | undefined>;
20
+ readonly freezeRowsInput: import("@angular/core").InputSignal<number | undefined>;
21
+ readonly freezeColsInput: import("@angular/core").InputSignal<number | undefined>;
25
22
  readonly layoutMode: import("@angular/core").InputSignal<"fill" | "content">;
26
23
  readonly suppressHorizontalScroll: import("@angular/core").InputSignal<boolean | undefined>;
27
- readonly isLoading: import("@angular/core").InputSignal<boolean>;
28
- readonly loadingMessage: import("@angular/core").InputSignal<string>;
24
+ readonly isLoadingInput: import("@angular/core").InputSignal<boolean>;
25
+ readonly loadingMessageInput: import("@angular/core").InputSignal<string>;
29
26
  readonly editable: import("@angular/core").InputSignal<boolean | undefined>;
30
27
  readonly cellSelection: import("@angular/core").InputSignal<boolean | undefined>;
31
28
  readonly onCellValueChanged: import("@angular/core").InputSignal<((event: {
@@ -35,10 +32,10 @@ export declare class DataGridTableComponent<T = unknown> {
35
32
  newValue: unknown;
36
33
  rowIndex: number;
37
34
  }) => void) | undefined>;
38
- readonly onUndo: import("@angular/core").InputSignal<(() => void) | undefined>;
39
- readonly onRedo: import("@angular/core").InputSignal<(() => void) | undefined>;
40
- readonly canUndo: import("@angular/core").InputSignal<boolean | undefined>;
41
- readonly canRedo: import("@angular/core").InputSignal<boolean | undefined>;
35
+ readonly onUndoInput: import("@angular/core").InputSignal<(() => void) | undefined>;
36
+ readonly onRedoInput: import("@angular/core").InputSignal<(() => void) | undefined>;
37
+ readonly canUndoInput: import("@angular/core").InputSignal<boolean | undefined>;
38
+ readonly canRedoInput: import("@angular/core").InputSignal<boolean | undefined>;
42
39
  readonly rowSelectionMode: import("@angular/core").InputSignal<"none" | "single" | "multiple">;
43
40
  readonly selectedRows: import("@angular/core").InputSignal<Set<RowId> | undefined>;
44
41
  readonly onSelectionChange: import("@angular/core").InputSignal<((event: {
@@ -52,18 +49,18 @@ export declare class DataGridTableComponent<T = unknown> {
52
49
  readonly loadingFilterOptions: import("@angular/core").InputSignal<Record<string, boolean>>;
53
50
  readonly peopleSearch: import("@angular/core").InputSignal<((query: string) => Promise<unknown[]>) | undefined>;
54
51
  readonly getUserByEmail: import("@angular/core").InputSignal<((email: string) => Promise<unknown>) | undefined>;
55
- readonly emptyState: import("@angular/core").InputSignal<{
52
+ readonly emptyStateInput: import("@angular/core").InputSignal<{
56
53
  onClearAll: () => void;
57
54
  hasActiveFilters: boolean;
58
55
  message?: string;
59
56
  render?: unknown;
60
57
  } | undefined>;
61
58
  readonly onCellError: import("@angular/core").InputSignal<((error: Error) => void) | undefined>;
62
- readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
63
- readonly ariaLabelledBy: import("@angular/core").InputSignal<string | undefined>;
59
+ readonly ariaLabelInput: import("@angular/core").InputSignal<string | undefined>;
60
+ readonly ariaLabelledByInput: import("@angular/core").InputSignal<string | undefined>;
64
61
  readonly showRowNumbers: import("@angular/core").InputSignal<boolean>;
65
- readonly currentPage: import("@angular/core").InputSignal<number>;
66
- readonly pageSize: import("@angular/core").InputSignal<number>;
62
+ readonly currentPageInput: import("@angular/core").InputSignal<number>;
63
+ readonly pageSizeInput: import("@angular/core").InputSignal<number>;
67
64
  readonly defaultMinWidth = 80;
68
65
  readonly statusBarClasses: {
69
66
  statusBar: string;
@@ -71,25 +68,19 @@ export declare class DataGridTableComponent<T = unknown> {
71
68
  statusBarLabel: string;
72
69
  statusBarValue: string;
73
70
  };
74
- private readonly columnSizingOverrides;
71
+ private readonly primengColumnSizingOverrides;
75
72
  private resizeStartX;
76
73
  private resizeColumnId;
77
74
  private resizeStartWidth;
78
- private lastMouseShift;
79
- private columnSizingVersion;
80
75
  constructor();
81
- readonly state: import("@angular/core").Signal<import("@alaarab/ogrid-angular").DataGridStateResult<T>>;
82
- readonly tableContainerEl: import("@angular/core").Signal<HTMLDivElement | null>;
76
+ protected getProps(): IOGridDataGridProps<T> | undefined;
77
+ protected getWrapperRef(): ElementRef<HTMLElement> | undefined;
78
+ protected getTableContainerRef(): ElementRef<HTMLElement> | undefined;
83
79
  readonly resolvedAriaLabel: import("@angular/core").Signal<string | undefined>;
84
- readonly rowNumberOffset: import("@angular/core").Signal<number>;
85
- readonly headerRows: import("@angular/core").Signal<import("@alaarab/ogrid-core").HeaderRow<T>[]>;
86
- readonly allowOverflowX: import("@angular/core").Signal<boolean>;
87
80
  readonly tableWidthStyle: import("@angular/core").Signal<"100%" | "fit-content">;
88
81
  readonly tableMinWidthStyle: import("@angular/core").Signal<"100%" | "max-content">;
89
- readonly selectedCellCount: import("@angular/core").Signal<number | undefined>;
82
+ getColumnWidth(col: IColumnDef<T>): number;
90
83
  trackByRowId(_index: number, item: T): RowId;
91
- getColumnWidth(col: IColumnDef<T>): number | undefined;
92
- getFilterConfig(col: IColumnDef<T>): HeaderFilterConfig;
93
84
  getCellValueFn(item: T, col: IColumnDef<T>): unknown;
94
85
  resolveCellDisplay(col: IColumnDef<T>, item: T): string;
95
86
  getCellStyleObj(col: IColumnDef<T>, item: T): Record<string, string> | null;
@@ -100,26 +91,11 @@ export declare class DataGridTableComponent<T = unknown> {
100
91
  isInSelectionRange(rowIndex: number, colIdx: number): boolean;
101
92
  isSelectionEndCell(rowIndex: number, colIdx: number): boolean;
102
93
  getCellBackground(rowIndex: number, colIdx: number): string | null;
103
- onMouseDown(e: MouseEvent): void;
104
- onGridKeyDown(e: KeyboardEvent): void;
105
- onCellMouseDown(e: MouseEvent, rowIndex: number, globalColIndex: number): void;
106
- onCellDblClick(item: T, col: IColumnDef<T>, rowIndex: number, colIdx: number): void;
107
- onCellContextMenu(e: MouseEvent): void;
94
+ onCellDblClickPrimeng(item: T, col: IColumnDef<T>, _rowIndex: number, _colIdx: number): void;
108
95
  onCellEditorCommit(item: T, col: IColumnDef<T>, rowIndex: number, colIdx: number, newValue: unknown): void;
109
- onFillHandleMouseDown(e: MouseEvent): void;
110
- onSelectAllChange(checked: boolean): void;
111
- onRowClick(e: MouseEvent, item: T): void;
112
- onRowCheckboxChange(item: T, checked: boolean, rowIndex: number, e: Event): void;
113
- handlePaste(): void;
114
- onHeaderMouseDown(columnId: string, event: MouseEvent): void;
115
- onResizeStart(e: MouseEvent, col: IColumnDef<T>): void;
116
- onPinColumn(columnId: string, side: 'left' | 'right'): void;
117
- onUnpinColumn(columnId: string): void;
118
- isPinned(columnId: string): 'left' | 'right' | undefined;
119
- getPinState(columnId: string): {
120
- canPinLeft: boolean;
121
- canPinRight: boolean;
122
- canUnpin: boolean;
123
- };
96
+ onSelectAllChangePrimeng(checked: boolean): void;
97
+ onRowClickPrimeng(e: MouseEvent, item: T): void;
98
+ onRowCheckboxChangePrimeng(item: T, checked: boolean, rowIndex: number, _e: Event): void;
99
+ onResizeStartPrimeng(e: MouseEvent, col: IColumnDef<T>): void;
124
100
  private buildProps;
125
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular-primeng",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "OGrid PrimeNG – PrimeNG Table-based data grid with sorting, filtering, pagination, column chooser, and CSV export.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -22,7 +22,7 @@
22
22
  "files": ["dist", "README.md", "LICENSE"],
23
23
  "engines": { "node": ">=18" },
24
24
  "dependencies": {
25
- "@alaarab/ogrid-angular": "2.0.5"
25
+ "@alaarab/ogrid-angular": "2.0.7"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@angular/core": "^21.0.0",
@@ -37,9 +37,10 @@
37
37
  "@angular/platform-browser-dynamic": "^21.1.4",
38
38
  "@angular/animations": "^21.1.4",
39
39
  "primeng": "^21.1.1",
40
- "rxjs": "^7.8.0",
40
+ "rxjs": "^7.8.2",
41
41
  "zone.js": "^0.15.0",
42
- "typescript": "^5.7.3"
42
+ "typescript": "^5.9.3"
43
43
  },
44
+ "sideEffects": false,
44
45
  "publishConfig": { "access": "public" }
45
46
  }