@alaarab/ogrid-angular-primeng 2.2.0 → 2.3.0

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { INLINE_CELL_EDITOR_STYLES, INLINE_CELL_EDITOR_TEMPLATE, POPOVER_CELL_EDITOR_OVERLAY_STYLES, POPOVER_CELL_EDITOR_TEMPLATE, OGRID_THEME_VARS_CSS, DataGridStateService, ColumnReorderService, VirtualScrollService, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, OGridService, OGridLayoutComponent, BaseColumnHeaderFilterComponent, getColumnHeaderMenuItems, BaseInlineCellEditorComponent, BasePopoverCellEditorComponent, BaseDataGridTableComponent, DEFAULT_MIN_COLUMN_WIDTH, BaseColumnChooserComponent, BasePaginationControlsComponent } from '@alaarab/ogrid-angular';
1
+ import { INLINE_CELL_EDITOR_STYLES, INLINE_CELL_EDITOR_TEMPLATE, POPOVER_CELL_EDITOR_OVERLAY_STYLES, POPOVER_CELL_EDITOR_TEMPLATE, OGRID_THEME_VARS_CSS, DataGridStateService, ColumnReorderService, VirtualScrollService, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, OGridService, OGridLayoutComponent, BaseColumnHeaderFilterComponent, getColumnHeaderMenuItems, BaseInlineCellEditorComponent, BasePopoverCellEditorComponent, BaseDataGridTableComponent, DEFAULT_MIN_COLUMN_WIDTH, formatCellReference, indexToColumnLetter, BaseColumnChooserComponent, BasePaginationControlsComponent } from '@alaarab/ogrid-angular';
2
2
  export { AUTOSIZE_EXTRA_PX, AUTOSIZE_MAX_PX, BaseColumnChooserComponent, BaseColumnHeaderFilterComponent, BaseDataGridTableComponent, BaseInlineCellEditorComponent, BaseOGridComponent, BasePaginationControlsComponent, BasePopoverCellEditorComponent, CELL_PADDING, CHECKBOX_COLUMN_WIDTH, COLUMN_HEADER_MENU_ITEMS, ColumnReorderService, DEFAULT_DEBOUNCE_MS, DEFAULT_MIN_COLUMN_WIDTH, DataGridEditingHelper, DataGridInteractionHelper, DataGridLayoutHelper, DataGridStateService, EmptyStateComponent, GRID_BORDER_RADIUS, GRID_CONTEXT_MENU_ITEMS, GridContextMenuComponent, INLINE_CELL_EDITOR_STYLES, INLINE_CELL_EDITOR_TEMPLATE, MAX_PAGE_BUTTONS, MarchingAntsOverlayComponent, OGRID_THEME_VARS_CSS, OGridLayoutComponent, OGridService, PAGE_SIZE_OPTIONS, PEOPLE_SEARCH_DEBOUNCE_MS, POPOVER_CELL_EDITOR_OVERLAY_STYLES, POPOVER_CELL_EDITOR_TEMPLATE, ROW_NUMBER_COLUMN_WIDTH, SIDEBAR_TRANSITION_MS, SideBarComponent, StatusBarComponent, UndoRedoStack, VirtualScrollService, Z_INDEX, applyCellDeletion, applyCutClear, applyFillValues, applyPastedValues, applyRangeRowSelection, areGridRowPropsEqual, booleanParser, buildCsvHeader, buildCsvRows, buildHeaderRows, buildInlineEditorProps, buildPopoverEditorProps, calculateDropTarget, clampSelectionToBounds, computeAggregations, computeArrowNavigation, computeAutoScrollSpeed, computeNextSortState, computeRowSelectionState, computeTabNavigation, computeTotalHeight, computeVisibleRange, createDebouncedCallback, createDebouncedSignal, createLatestCallback, currencyParser, dateParser, debounce, deriveFilterOptionsFromData, emailParser, escapeCsvValue, exportToCsv, findCtrlArrowTarget, flattenColumns, formatCellValueForTsv, formatSelectionAsTsv, formatShortcut, getCellRenderDescriptor, getCellValue, getColumnHeaderMenuItems, getContextMenuHandlers, getDataGridStatusBarConfig, getFilterField, getHeaderFilterConfig, getMultiSelectFilterFields, getPaginationViewModel, getPinStateForColumn, getScrollTopForRow, getStatusBarParts, injectGlobalStyles, isFilterConfig, isInSelectionRange, isRowInRange, measureColumnContentWidth, measureRange, mergeFilter, normalizeSelectionRange, numberParser, parseTsvClipboard, parseValue, processClientSideData, rangesEqual, reorderColumnArray, resolveCellDisplayContent, resolveCellStyle, toUserLike, triggerCsvDownload, validateColumns, validateRowIds } from '@alaarab/ogrid-angular';
3
3
  import { ViewChild, Component, ChangeDetectionStrategy, Input, ViewEncapsulation, inject, DestroyRef, effect, computed, signal } from '@angular/core';
4
4
  import { ButtonModule } from 'primeng/button';
@@ -443,6 +443,9 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
443
443
  this.ariaLabelInput = void 0;
444
444
  this.ariaLabelledByInput = void 0;
445
445
  this.showRowNumbers = false;
446
+ this.showColumnLettersInput = false;
447
+ this.showNameBoxInput = false;
448
+ this.onActiveCellChange = void 0;
446
449
  this.currentPageInput = 1;
447
450
  this.pageSizeInput = 25;
448
451
  this.defaultMinWidth = DEFAULT_MIN_COLUMN_WIDTH;
@@ -467,6 +470,7 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
467
470
  this.resizeStartWidth = 0;
468
471
  // Bound method reference for template
469
472
  this.cancelEditHandler = () => this.cancelEdit();
473
+ this.showColumnLetters = computed(() => !!this.getProps()?.showColumnLetters);
470
474
  // --- PrimeNG-specific computed signals ---
471
475
  this.resolvedAriaLabel = computed(
472
476
  () => this.ariaLabelInput ?? (this.ariaLabelledByInput ? void 0 : "Data grid")
@@ -484,6 +488,19 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
484
488
  return "100%";
485
489
  });
486
490
  this.initBase();
491
+ effect(() => {
492
+ const props = this.getProps();
493
+ const onActiveCellChange = props?.onActiveCellChange;
494
+ if (!onActiveCellChange) return;
495
+ const ac = this.activeCell();
496
+ if (ac) {
497
+ const colIndex = ac.columnIndex - this.colOffset();
498
+ const rowNumber = ac.rowIndex + 1;
499
+ onActiveCellChange(formatCellReference(colIndex, rowNumber));
500
+ } else {
501
+ onActiveCellChange(null);
502
+ }
503
+ });
487
504
  }
488
505
  ngOnChanges(changes) {
489
506
  if (changes["initialColumnWidths"]) {
@@ -607,6 +624,9 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
607
624
  selectedRows: this.selectedRows,
608
625
  onSelectionChange: this.onSelectionChange,
609
626
  showRowNumbers: this.showRowNumbers,
627
+ showColumnLetters: this.showColumnLettersInput,
628
+ showNameBox: this.showNameBoxInput,
629
+ onActiveCellChange: this.onActiveCellChange,
610
630
  currentPage: this.currentPageInput,
611
631
  pageSize: this.pageSizeInput,
612
632
  statusBar: this.statusBar,
@@ -623,6 +643,9 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
623
643
  "aria-labelledby": this.ariaLabelledByInput
624
644
  };
625
645
  }
646
+ getColumnLetter(colIdx) {
647
+ return indexToColumnLetter(colIdx);
648
+ }
626
649
  };
627
650
  __decorateClass([
628
651
  ViewChild("wrapper")
@@ -753,6 +776,15 @@ __decorateClass([
753
776
  __decorateClass([
754
777
  Input()
755
778
  ], DataGridTableComponent.prototype, "showRowNumbers", 2);
779
+ __decorateClass([
780
+ Input({ alias: "showColumnLetters" })
781
+ ], DataGridTableComponent.prototype, "showColumnLettersInput", 2);
782
+ __decorateClass([
783
+ Input({ alias: "showNameBox" })
784
+ ], DataGridTableComponent.prototype, "showNameBoxInput", 2);
785
+ __decorateClass([
786
+ Input()
787
+ ], DataGridTableComponent.prototype, "onActiveCellChange", 2);
756
788
  __decorateClass([
757
789
  Input({ alias: "currentPage" })
758
790
  ], DataGridTableComponent.prototype, "currentPageInput", 2);
@@ -802,6 +834,21 @@ DataGridTableComponent = __decorateClass([
802
834
  <div #tableContainer class="ogrid-table-wrapper">
803
835
  <table class="ogrid-table" role="grid" [attr.data-virtual-scroll]="vsEnabled() ? '' : null">
804
836
  <thead [class]="stickyHeader() ? 'ogrid-thead ogrid-sticky-header' : 'ogrid-thead'">
837
+ @if (showColumnLetters()) {
838
+ <tr class="ogrid-column-letter-row">
839
+ @if (hasCheckboxCol()) {
840
+ <th class="ogrid-column-letter-cell"></th>
841
+ }
842
+ @if (hasRowNumbersCol()) {
843
+ <th class="ogrid-column-letter-cell"></th>
844
+ }
845
+ @for (col of visibleCols(); track col.columnId; let colIdx = $index) {
846
+ <th class="ogrid-column-letter-cell">
847
+ {{ getColumnLetter(colIdx) }}
848
+ </th>
849
+ }
850
+ </tr>
851
+ }
805
852
  @for (row of headerRows(); track $index; let rowIdx = $index) {
806
853
  <tr>
807
854
  @if (rowIdx === headerRows().length - 1 && hasCheckboxCol()) {
@@ -983,16 +1030,20 @@ DataGridTableComponent = __decorateClass([
983
1030
  <div
984
1031
  [attr.data-row-index]="rowIndex"
985
1032
  [attr.data-col-index]="descriptor.globalColIndex"
1033
+ [attr.data-active-cell]="descriptor.isActive ? 'true' : null"
1034
+ [attr.data-in-range]="descriptor.isInRange ? 'true' : null"
1035
+ [attr.tabindex]="descriptor.isActive ? 0 : -1"
986
1036
  (mousedown)="onCellMouseDown($event, rowIndex, descriptor.globalColIndex)"
1037
+ (click)="onCellClick(rowIndex, descriptor.globalColIndex)"
987
1038
  (dblclick)="descriptor.canEditAny ? onCellDblClick(descriptor.rowId, col.columnId) : null"
988
1039
  (contextmenu)="onCellContextMenu($event)"
989
1040
  class="ogrid-cell-content"
990
1041
  [style.cursor]="descriptor.canEditAny ? 'cell' : 'default'"
991
- [style.background]="descriptor.isInRange && !descriptor.isActive ? 'var(--ogrid-range-bg, rgba(33, 115, 70, 0.08))' : null"
992
- [style.outline]="descriptor.isActive ? '2px solid var(--ogrid-selection, #217346)' : null"
993
- [style.outline-offset]="descriptor.isActive ? '-2px' : null"
1042
+ [style.background]="descriptor.isInRange && !descriptor.isActive ? 'var(--ogrid-range-bg, rgba(33, 115, 70, 0.08))' : (descriptor.isActive && descriptor.isInRange ? 'var(--ogrid-bg, #fff)' : null)"
1043
+ [style.outline]="descriptor.isActive && !descriptor.isInRange ? '2px solid var(--ogrid-selection, #217346)' : null"
1044
+ [style.outline-offset]="descriptor.isActive && !descriptor.isInRange ? '-2px' : null"
994
1045
  >
995
- <span [style]="resolveCellStyleFn(col, item)">{{ resolveCellContent(col, item, descriptor.displayValue) }}</span>
1046
+ <span [style]="resolveCellStyleFn(col, item, descriptor.displayValue)">{{ resolveCellContent(col, item, descriptor.displayValue) }}</span>
996
1047
  @if (descriptor.canEditAny && descriptor.isSelectionEndCell) {
997
1048
  <div
998
1049
  (mousedown)="onFillHandleMouseDown($event)"
@@ -1402,6 +1453,17 @@ DataGridTableComponent = __decorateClass([
1402
1453
  border-color: var(--ogrid-border, rgba(0, 0, 0, 0.12));
1403
1454
  margin: 4px 0;
1404
1455
  }
1456
+ .ogrid-column-letter-cell {
1457
+ text-align: center;
1458
+ font-size: 11px;
1459
+ font-weight: 500;
1460
+ color: var(--ogrid-fg-muted, rgba(0, 0, 0, 0.4));
1461
+ padding: 2px 4px;
1462
+ background: var(--ogrid-column-letter-bg, var(--ogrid-header-bg, #f5f5f5));
1463
+ border-bottom: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
1464
+ user-select: none;
1465
+ font-variant-numeric: tabular-nums;
1466
+ }
1405
1467
  `]
1406
1468
  })
1407
1469
  ], DataGridTableComponent);
@@ -1632,6 +1694,8 @@ OGridComponent = __decorateClass([
1632
1694
  [hasPagination]="true"
1633
1695
  [sideBar]="service.sideBarProps()"
1634
1696
  [fullScreen]="service.fullScreen()"
1697
+ [showNameBox]="!!service.cellReferences()"
1698
+ [activeCellRef]="service.activeCellRef()"
1635
1699
  >
1636
1700
  <ng-content select="[toolbar]" toolbar></ng-content>
1637
1701
 
@@ -1682,6 +1746,10 @@ OGridComponent = __decorateClass([
1682
1746
  [aria-label]="service.ariaLabel()"
1683
1747
  [aria-labelledby]="service.ariaLabelledBy()"
1684
1748
  [emptyState]="emptyStateObj"
1749
+ [showRowNumbers]="service.dataGridProps().showRowNumbers ?? false"
1750
+ [showColumnLetters]="service.dataGridProps().showColumnLetters ?? false"
1751
+ [showNameBox]="service.dataGridProps().showNameBox ?? false"
1752
+ [onActiveCellChange]="service.dataGridProps().onActiveCellChange"
1685
1753
  ></ogrid-primeng-datagrid-table>
1686
1754
 
1687
1755
  <div pagination>
@@ -59,6 +59,9 @@ export declare class DataGridTableComponent<T = unknown> extends BaseDataGridTab
59
59
  ariaLabelInput: string | undefined;
60
60
  ariaLabelledByInput: string | undefined;
61
61
  showRowNumbers: boolean;
62
+ showColumnLettersInput: boolean;
63
+ showNameBoxInput: boolean;
64
+ onActiveCellChange: ((ref: string | null) => void) | undefined;
62
65
  currentPageInput: number;
63
66
  pageSizeInput: number;
64
67
  readonly defaultMinWidth = 80;
@@ -81,6 +84,7 @@ export declare class DataGridTableComponent<T = unknown> extends BaseDataGridTab
81
84
  private resizeColumnId;
82
85
  private resizeStartWidth;
83
86
  readonly cancelEditHandler: () => void;
87
+ readonly showColumnLetters: import("@angular/core").Signal<boolean>;
84
88
  constructor();
85
89
  ngOnChanges(changes: SimpleChanges): void;
86
90
  /** Shallow-compare two props objects by their top-level keys. */
@@ -98,4 +102,5 @@ export declare class DataGridTableComponent<T = unknown> extends BaseDataGridTab
98
102
  onRowCheckboxChangePrimeng(item: T, checked: boolean, rowIndex: number, _e: Event): void;
99
103
  onResizeStartPrimeng(e: MouseEvent, col: IColumnDef<T>): void;
100
104
  private buildProps;
105
+ getColumnLetter(colIdx: number): string;
101
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular-primeng",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
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",
@@ -37,7 +37,7 @@
37
37
  "node": ">=18"
38
38
  },
39
39
  "dependencies": {
40
- "@alaarab/ogrid-angular": "2.2.0"
40
+ "@alaarab/ogrid-angular": "2.3.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@angular/core": "^21.0.0",