@alaarab/ogrid-angular-material 2.3.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,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, CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, DataGridStateService, ColumnReorderService, VirtualScrollService, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, OGridService, OGridLayoutComponent, BaseColumnHeaderFilterComponent, getColumnHeaderMenuItems, BaseInlineCellEditorComponent, BasePopoverCellEditorComponent, BaseDataGridTableComponent, formatCellReference, indexToColumnLetter, 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
3
  import { ViewChild, Component, ChangeDetectionStrategy, Input, ViewEncapsulation, signal, computed, effect } from '@angular/core';
4
4
  import { MatMenuTrigger, MatMenuModule } from '@angular/material/menu';
@@ -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);
@@ -507,6 +427,7 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
507
427
  super();
508
428
  this.propsSignal = signal(void 0);
509
429
  this.showColumnLetters = computed(() => !!this.getProps()?.showColumnLetters);
430
+ this.formulaReferences = computed(() => this.getProps()?.formulaReferences);
510
431
  this.initBase();
511
432
  effect(() => {
512
433
  const props = this.getProps();
@@ -553,7 +474,7 @@ DataGridTableComponent = __decorateClass([
553
474
  standalone: true,
554
475
  changeDetection: ChangeDetectionStrategy.OnPush,
555
476
  encapsulation: ViewEncapsulation.None,
556
- imports: [ColumnHeaderFilterComponent, ColumnHeaderMenuComponent, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, InlineCellEditorComponent, PopoverCellEditorComponent],
477
+ imports: [ColumnHeaderFilterComponent, ColumnHeaderMenuComponent, StatusBarComponent, GridContextMenuComponent, MarchingAntsOverlayComponent, EmptyStateComponent, FormulaRefOverlayComponent, InlineCellEditorComponent, PopoverCellEditorComponent],
557
478
  providers: [DataGridStateService, ColumnReorderService, VirtualScrollService],
558
479
  template: `
559
480
  <div class="ogrid-datagrid-root">
@@ -828,6 +749,14 @@ DataGridTableComponent = __decorateClass([
828
749
  [columnOrder]="propsColumnOrder()"
829
750
  ></ogrid-marching-ants-overlay>
830
751
 
752
+ @if (formulaReferences() && formulaReferences()!.length > 0) {
753
+ <ogrid-formula-ref-overlay
754
+ [containerEl]="tableContainerEl()"
755
+ [references]="formulaReferences()!"
756
+ [colOffset]="colOffset()"
757
+ />
758
+ }
759
+
831
760
  @if (showEmptyInGrid() && emptyState()) {
832
761
  <div class="ogrid-datagrid-empty">
833
762
  <div class="ogrid-datagrid-empty__title">No results found</div>
@@ -1337,8 +1266,13 @@ OGridComponent = __decorateClass([
1337
1266
  [hasToolbarBelow]="false"
1338
1267
  [hasPagination]="true"
1339
1268
  [fullScreen]="ogridService.fullScreen()"
1340
- [showNameBox]="!!ogridService.cellReferences()"
1269
+ [showNameBox]="!!(ogridService.cellReferences() && !ogridService.formulasEnabled())"
1341
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()"
1342
1276
  >
1343
1277
  <ng-container toolbarEnd>
1344
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
  }
@@ -11,6 +11,7 @@ export declare class DataGridTableComponent<T> extends BaseDataGridTableComponen
11
11
  private wrapperRef?;
12
12
  private tableContainerRef?;
13
13
  readonly showColumnLetters: import("@angular/core").Signal<boolean>;
14
+ readonly formulaReferences: import("@angular/core").Signal<import("@alaarab/ogrid-core").FormulaReference[] | undefined>;
14
15
  constructor();
15
16
  protected getProps(): IOGridDataGridProps<T> | undefined;
16
17
  protected getWrapperRef(): ElementRef<HTMLElement> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular-material",
3
- "version": "2.3.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.3.0"
40
+ "@alaarab/ogrid-angular": "2.4.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@angular/cdk": "^21.0.0",