@alaarab/ogrid-angular-primeng 2.1.15 → 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);
@@ -800,8 +832,23 @@ DataGridTableComponent = __decorateClass([
800
832
  <div class="ogrid-table-wrapper">
801
833
  <div [class.loading-dimmed]="isLoading() && items().length > 0" class="ogrid-table-wrapper">
802
834
  <div #tableContainer class="ogrid-table-wrapper">
803
- <table class="ogrid-table" role="grid">
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()) {
@@ -938,7 +985,10 @@ DataGridTableComponent = __decorateClass([
938
985
  {{ rowNumberOffset() + rowIndex + 1 }}
939
986
  </td>
940
987
  }
941
- @for (col of visibleCols(); track col.columnId; let colIdx = $index) {
988
+ @if (vsColumnsEnabled() && vsLeftSpacerWidth() > 0) {
989
+ <td [style.width.px]="vsLeftSpacerWidth()" [style.minWidth.px]="vsLeftSpacerWidth()" [style.maxWidth.px]="vsLeftSpacerWidth()" [style.padding]="'0'"></td>
990
+ }
991
+ @for (col of vsVisibleCols(); track col.columnId) {
942
992
  @let pinned = isPinned(col.columnId);
943
993
  <td
944
994
  [attr.data-column-id]="col.columnId"
@@ -952,7 +1002,7 @@ DataGridTableComponent = __decorateClass([
952
1002
  [style.right.px]="pinned === 'right' ? getPinnedRightOffset(col.columnId) : null"
953
1003
  [style.text-align]="col.type === 'numeric' ? 'right' : col.type === 'boolean' ? 'center' : null"
954
1004
  >
955
- @let descriptor = getCellDescriptor(item, col, rowIndex, colIdx);
1005
+ @let descriptor = getCellDescriptor(item, col, rowIndex, getGlobalColIndex(col));
956
1006
  @if (descriptor.mode === 'editing-inline') {
957
1007
  <div class="ogrid-editing-cell">
958
1008
  <ogrid-primeng-inline-cell-editor
@@ -980,16 +1030,20 @@ DataGridTableComponent = __decorateClass([
980
1030
  <div
981
1031
  [attr.data-row-index]="rowIndex"
982
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"
983
1036
  (mousedown)="onCellMouseDown($event, rowIndex, descriptor.globalColIndex)"
1037
+ (click)="onCellClick(rowIndex, descriptor.globalColIndex)"
984
1038
  (dblclick)="descriptor.canEditAny ? onCellDblClick(descriptor.rowId, col.columnId) : null"
985
1039
  (contextmenu)="onCellContextMenu($event)"
986
1040
  class="ogrid-cell-content"
987
1041
  [style.cursor]="descriptor.canEditAny ? 'cell' : 'default'"
988
- [style.background]="descriptor.isInRange && !descriptor.isActive ? 'var(--ogrid-range-bg, rgba(33, 115, 70, 0.08))' : null"
989
- [style.outline]="descriptor.isActive ? '2px solid var(--ogrid-selection, #217346)' : null"
990
- [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"
991
1045
  >
992
- <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>
993
1047
  @if (descriptor.canEditAny && descriptor.isSelectionEndCell) {
994
1048
  <div
995
1049
  (mousedown)="onFillHandleMouseDown($event)"
@@ -1001,6 +1055,9 @@ DataGridTableComponent = __decorateClass([
1001
1055
  }
1002
1056
  </td>
1003
1057
  }
1058
+ @if (vsColumnsEnabled() && vsRightSpacerWidth() > 0) {
1059
+ <td [style.width.px]="vsRightSpacerWidth()" [style.minWidth.px]="vsRightSpacerWidth()" [style.maxWidth.px]="vsRightSpacerWidth()" [style.padding]="'0'"></td>
1060
+ }
1004
1061
  </tr>
1005
1062
  }
1006
1063
  @if (vsEnabled() && vsBottomSpacerHeight() > 0) {
@@ -1396,6 +1453,17 @@ DataGridTableComponent = __decorateClass([
1396
1453
  border-color: var(--ogrid-border, rgba(0, 0, 0, 0.12));
1397
1454
  margin: 4px 0;
1398
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
+ }
1399
1467
  `]
1400
1468
  })
1401
1469
  ], DataGridTableComponent);
@@ -1626,6 +1694,8 @@ OGridComponent = __decorateClass([
1626
1694
  [hasPagination]="true"
1627
1695
  [sideBar]="service.sideBarProps()"
1628
1696
  [fullScreen]="service.fullScreen()"
1697
+ [showNameBox]="!!service.cellReferences()"
1698
+ [activeCellRef]="service.activeCellRef()"
1629
1699
  >
1630
1700
  <ng-content select="[toolbar]" toolbar></ng-content>
1631
1701
 
@@ -1676,6 +1746,10 @@ OGridComponent = __decorateClass([
1676
1746
  [aria-label]="service.ariaLabel()"
1677
1747
  [aria-labelledby]="service.ariaLabelledBy()"
1678
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"
1679
1753
  ></ogrid-primeng-datagrid-table>
1680
1754
 
1681
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.1.15",
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.1.15"
40
+ "@alaarab/ogrid-angular": "2.3.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@angular/core": "^21.0.0",