@alaarab/ogrid-angular-material 2.2.0 → 2.4.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,6 +1,6 @@
1
- import { INLINE_CELL_EDITOR_STYLES, INLINE_CELL_EDITOR_TEMPLATE, POPOVER_CELL_EDITOR_OVERLAY_STYLES, POPOVER_CELL_EDITOR_TEMPLATE, OGRID_THEME_VARS_CSS, CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, DataGridStateService, ColumnReorderService, VirtualScrollService, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, OGridService, OGridLayoutComponent, BaseColumnHeaderFilterComponent, getColumnHeaderMenuItems, BaseInlineCellEditorComponent, BasePopoverCellEditorComponent, BaseDataGridTableComponent, BaseColumnChooserComponent, BasePaginationControlsComponent, BaseOGridComponent } 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, CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, DataGridStateService, ColumnReorderService, VirtualScrollService, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, FormulaRefOverlayComponent, OGridService, OGridLayoutComponent, BaseColumnHeaderFilterComponent, BaseColumnHeaderMenuComponent, BaseInlineCellEditorComponent, BasePopoverCellEditorComponent, BaseDataGridTableComponent, formatCellReference, indexToColumnLetter, BaseColumnChooserComponent, BasePaginationControlsComponent, BaseOGridComponent } 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
- import { ViewChild, Component, ChangeDetectionStrategy, Input, ViewEncapsulation, signal, computed } from '@angular/core';
3
+ import { ViewChild, Component, ChangeDetectionStrategy, Input, ViewEncapsulation, signal, computed, effect } from '@angular/core';
4
4
  import { MatMenuTrigger, MatMenuModule } from '@angular/material/menu';
5
5
  import { MatDividerModule } from '@angular/material/divider';
6
6
 
@@ -329,88 +329,8 @@ ColumnHeaderFilterComponent = __decorateClass([
329
329
  }
330
330
  })
331
331
  ], ColumnHeaderFilterComponent);
332
- var ColumnHeaderMenuComponent = class {
333
- constructor() {
334
- // Signal-backed inputs so computed() tracks changes reactively
335
- this._canPinLeft = signal(true);
336
- this._canPinRight = signal(true);
337
- this._canUnpin = signal(false);
338
- this._currentSort = signal(null);
339
- this._isSortable = signal(true);
340
- this._isResizable = signal(true);
341
- this.handlers = {};
342
- this.menuItems = computed(
343
- () => getColumnHeaderMenuItems({
344
- canPinLeft: this._canPinLeft(),
345
- canPinRight: this._canPinRight(),
346
- canUnpin: this._canUnpin(),
347
- currentSort: this._currentSort(),
348
- isSortable: this._isSortable(),
349
- isResizable: this._isResizable()
350
- })
351
- );
352
- }
353
- set canPinLeft(v) {
354
- this._canPinLeft.set(v);
355
- }
356
- set canPinRight(v) {
357
- this._canPinRight.set(v);
358
- }
359
- set canUnpin(v) {
360
- this._canUnpin.set(v);
361
- }
362
- set currentSort(v) {
363
- this._currentSort.set(v);
364
- }
365
- set isSortable(v) {
366
- this._isSortable.set(v);
367
- }
368
- set isResizable(v) {
369
- this._isResizable.set(v);
370
- }
371
- handleMenuItemClick(itemId) {
372
- const h = this.handlers;
373
- const actionMap = {
374
- pinLeft: h.onPinLeft,
375
- pinRight: h.onPinRight,
376
- unpin: h.onUnpin,
377
- sortAsc: h.onSortAsc,
378
- sortDesc: h.onSortDesc,
379
- clearSort: h.onClearSort,
380
- autosizeThis: h.onAutosizeThis,
381
- autosizeAll: h.onAutosizeAll
382
- };
383
- const action = actionMap[itemId];
384
- if (action) {
385
- action();
386
- h.onClose?.();
387
- }
388
- }
332
+ var ColumnHeaderMenuComponent = class extends BaseColumnHeaderMenuComponent {
389
333
  };
390
- __decorateClass([
391
- Input({ required: true })
392
- ], ColumnHeaderMenuComponent.prototype, "columnId", 2);
393
- __decorateClass([
394
- Input()
395
- ], ColumnHeaderMenuComponent.prototype, "canPinLeft", 1);
396
- __decorateClass([
397
- Input()
398
- ], ColumnHeaderMenuComponent.prototype, "canPinRight", 1);
399
- __decorateClass([
400
- Input()
401
- ], ColumnHeaderMenuComponent.prototype, "canUnpin", 1);
402
- __decorateClass([
403
- Input()
404
- ], ColumnHeaderMenuComponent.prototype, "currentSort", 1);
405
- __decorateClass([
406
- Input()
407
- ], ColumnHeaderMenuComponent.prototype, "isSortable", 1);
408
- __decorateClass([
409
- Input()
410
- ], ColumnHeaderMenuComponent.prototype, "isResizable", 1);
411
- __decorateClass([
412
- Input()
413
- ], ColumnHeaderMenuComponent.prototype, "handlers", 2);
414
334
  __decorateClass([
415
335
  ViewChild(MatMenuTrigger)
416
336
  ], ColumnHeaderMenuComponent.prototype, "menuTrigger", 2);
@@ -506,7 +426,22 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
506
426
  constructor() {
507
427
  super();
508
428
  this.propsSignal = signal(void 0);
429
+ this.showColumnLetters = computed(() => !!this.getProps()?.showColumnLetters);
430
+ this.formulaReferences = computed(() => this.getProps()?.formulaReferences);
509
431
  this.initBase();
432
+ effect(() => {
433
+ const props = this.getProps();
434
+ const onActiveCellChange = props?.onActiveCellChange;
435
+ if (!onActiveCellChange) return;
436
+ const ac = this.activeCell();
437
+ if (ac) {
438
+ const colIndex = ac.columnIndex - this.colOffset();
439
+ const rowNumber = ac.rowIndex + 1;
440
+ onActiveCellChange(formatCellReference(colIndex, rowNumber));
441
+ } else {
442
+ onActiveCellChange(null);
443
+ }
444
+ });
510
445
  }
511
446
  set propsInput(value) {
512
447
  this.propsSignal.set(value);
@@ -520,6 +455,9 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
520
455
  getTableContainerRef() {
521
456
  return this.tableContainerRef;
522
457
  }
458
+ getColumnLetter(colIdx) {
459
+ return indexToColumnLetter(colIdx);
460
+ }
523
461
  };
524
462
  __decorateClass([
525
463
  Input({ required: true, alias: "props" })
@@ -536,7 +474,7 @@ DataGridTableComponent = __decorateClass([
536
474
  standalone: true,
537
475
  changeDetection: ChangeDetectionStrategy.OnPush,
538
476
  encapsulation: ViewEncapsulation.None,
539
- imports: [ColumnHeaderFilterComponent, ColumnHeaderMenuComponent, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, InlineCellEditorComponent, PopoverCellEditorComponent],
477
+ imports: [ColumnHeaderFilterComponent, ColumnHeaderMenuComponent, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, FormulaRefOverlayComponent, InlineCellEditorComponent, PopoverCellEditorComponent],
540
478
  providers: [DataGridStateService, ColumnReorderService, VirtualScrollService],
541
479
  template: `
542
480
  <div class="ogrid-datagrid-root">
@@ -564,6 +502,21 @@ DataGridTableComponent = __decorateClass([
564
502
  [attr.data-virtual-scroll]="vsEnabled() ? '' : null"
565
503
  >
566
504
  <thead [class]="stickyHeader() ? 'ogrid-datagrid-thead ogrid-sticky-header' : 'ogrid-datagrid-thead'">
505
+ @if (showColumnLetters()) {
506
+ <tr class="ogrid-column-letter-row">
507
+ @if (hasCheckboxCol()) {
508
+ <th class="ogrid-column-letter-cell"></th>
509
+ }
510
+ @if (hasRowNumbersCol()) {
511
+ <th class="ogrid-column-letter-cell"></th>
512
+ }
513
+ @for (col of visibleCols(); track col.columnId; let colIdx = $index) {
514
+ <th class="ogrid-column-letter-cell">
515
+ {{ getColumnLetter(colIdx) }}
516
+ </th>
517
+ }
518
+ </tr>
519
+ }
567
520
  @for (row of headerRows(); track $index; let rowIdx = $index) {
568
521
  <tr class="ogrid-datagrid-header-row">
569
522
  @if (rowIdx === headerRows().length - 1 && hasCheckboxCol()) {
@@ -739,10 +692,11 @@ DataGridTableComponent = __decorateClass([
739
692
  ></ogrid-mat-popover-cell-editor>
740
693
  } @else {
741
694
  @let content = resolveCellContent(colLayout.col, item, descriptor.displayValue);
742
- @let cellStyle = resolveCellStyleFn(colLayout.col, item);
695
+ @let cellStyle = resolveCellStyleFn(colLayout.col, item, descriptor.displayValue);
743
696
  <div
744
697
  class="ogrid-datagrid-cell"
745
698
  [class.ogrid-datagrid-cell--active]="descriptor.isActive"
699
+ [class.ogrid-datagrid-cell--active-in-range]="descriptor.isActive && descriptor.isInRange"
746
700
  [class.ogrid-datagrid-cell--in-range]="descriptor.isInRange && !descriptor.isActive"
747
701
  [class.ogrid-datagrid-cell--in-cut-range]="descriptor.isInCutRange"
748
702
  [class.ogrid-datagrid-cell--editable]="descriptor.canEditAny"
@@ -795,6 +749,14 @@ DataGridTableComponent = __decorateClass([
795
749
  [columnOrder]="propsColumnOrder()"
796
750
  ></ogrid-marching-ants-overlay>
797
751
 
752
+ @if (formulaReferences() && formulaReferences()!.length > 0) {
753
+ <ogrid-formula-ref-overlay
754
+ [containerEl]="tableContainerEl()"
755
+ [references]="formulaReferences()!"
756
+ [colOffset]="colOffset()"
757
+ />
758
+ }
759
+
798
760
  @if (showEmptyInGrid() && emptyState()) {
799
761
  <div class="ogrid-datagrid-empty">
800
762
  <div class="ogrid-datagrid-empty__title">No results found</div>
@@ -955,6 +917,7 @@ DataGridTableComponent = __decorateClass([
955
917
  outline: 2px solid var(--ogrid-selection-color, #217346); outline-offset: -1px;
956
918
  z-index: 2; position: relative; overflow: visible;
957
919
  }
920
+ .ogrid-datagrid-cell--active-in-range { outline: none; background: var(--ogrid-bg, #fff); }
958
921
  .ogrid-datagrid-cell--in-range { background: var(--ogrid-range-bg, rgba(33, 115, 70, 0.12)); }
959
922
  .ogrid-datagrid-cell--in-cut-range { background: var(--ogrid-hover-bg, rgba(0, 0, 0, 0.04)); opacity: 0.7; }
960
923
  .ogrid-datagrid-cell--editing { padding: 0; }
@@ -1026,6 +989,17 @@ DataGridTableComponent = __decorateClass([
1026
989
  .ogrid-datagrid-context-menu-overlay {
1027
990
  position: fixed; inset: 0; z-index: 1000;
1028
991
  }
992
+ .ogrid-column-letter-cell {
993
+ text-align: center;
994
+ font-size: 11px;
995
+ font-weight: 500;
996
+ color: var(--ogrid-fg-muted, rgba(0, 0, 0, 0.4));
997
+ padding: 2px 4px;
998
+ background: var(--ogrid-column-letter-bg, var(--ogrid-header-bg, rgba(0, 0, 0, 0.04)));
999
+ border-bottom: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
1000
+ user-select: none;
1001
+ font-variant-numeric: tabular-nums;
1002
+ }
1029
1003
 
1030
1004
  /* Angular Material Menu popup dark mode overrides.
1031
1005
  Double-class selector (0,2,0) beats MUI's single-class (0,1,0) defaults. */
@@ -1292,6 +1266,13 @@ OGridComponent = __decorateClass([
1292
1266
  [hasToolbarBelow]="false"
1293
1267
  [hasPagination]="true"
1294
1268
  [fullScreen]="ogridService.fullScreen()"
1269
+ [showNameBox]="!!(ogridService.cellReferences() && !ogridService.formulasEnabled())"
1270
+ [activeCellRef]="ogridService.activeCellRef()"
1271
+ [formulaBar]="ogridService.formulasEnabled() ? ogridService.formulaBarState() : null"
1272
+ [sheetDefs]="ogridService.sheetDefs()"
1273
+ [activeSheet]="ogridService.activeSheet()"
1274
+ [onSheetChange]="ogridService.onSheetChange()"
1275
+ [onSheetAdd]="ogridService.onSheetAdd()"
1295
1276
  >
1296
1277
  <ng-container toolbarEnd>
1297
1278
  @if (ogridService.columnChooserPlacement() === 'toolbar') {
@@ -1,28 +1,5 @@
1
1
  import { MatMenuTrigger } from '@angular/material/menu';
2
- import { type IColumnHeaderMenuItem, type ColumnHeaderMenuHandlers } from '@alaarab/ogrid-angular';
3
- /**
4
- * Column header dropdown menu for pin/unpin, sort, and autosize actions.
5
- * Uses Angular Material MatMenu.
6
- *
7
- * Uses signal-backed @Input setters so that computed() tracks changes
8
- * (plain @Input properties are not reactive in Angular signals).
9
- */
10
- export declare class ColumnHeaderMenuComponent {
11
- columnId: string;
12
- private readonly _canPinLeft;
13
- private readonly _canPinRight;
14
- private readonly _canUnpin;
15
- private readonly _currentSort;
16
- private readonly _isSortable;
17
- private readonly _isResizable;
18
- set canPinLeft(v: boolean);
19
- set canPinRight(v: boolean);
20
- set canUnpin(v: boolean);
21
- set currentSort(v: 'asc' | 'desc' | null);
22
- set isSortable(v: boolean);
23
- set isResizable(v: boolean);
24
- handlers: Partial<ColumnHeaderMenuHandlers>;
2
+ import { BaseColumnHeaderMenuComponent } from '@alaarab/ogrid-angular';
3
+ export declare class ColumnHeaderMenuComponent extends BaseColumnHeaderMenuComponent {
25
4
  menuTrigger?: MatMenuTrigger;
26
- readonly menuItems: import("@angular/core").Signal<IColumnHeaderMenuItem[]>;
27
- handleMenuItemClick(itemId: string): void;
28
5
  }
@@ -10,8 +10,11 @@ export declare class DataGridTableComponent<T> extends BaseDataGridTableComponen
10
10
  set propsInput(value: IOGridDataGridProps<T>);
11
11
  private wrapperRef?;
12
12
  private tableContainerRef?;
13
+ readonly showColumnLetters: import("@angular/core").Signal<boolean>;
14
+ readonly formulaReferences: import("@angular/core").Signal<import("@alaarab/ogrid-core").FormulaReference[] | undefined>;
13
15
  constructor();
14
16
  protected getProps(): IOGridDataGridProps<T> | undefined;
15
17
  protected getWrapperRef(): ElementRef<HTMLElement> | undefined;
16
18
  protected getTableContainerRef(): ElementRef<HTMLElement> | undefined;
19
+ getColumnLetter(colIdx: number): string;
17
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular-material",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "OGrid Angular Material – MatTable-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.4.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@angular/cdk": "^21.0.0",