@alaarab/ogrid-angular-primeng 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, 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';
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, FormulaRefOverlayComponent, OGridService, OGridLayoutComponent, BaseColumnHeaderFilterComponent, BaseColumnHeaderMenuComponent, 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';
@@ -256,47 +256,16 @@ ColumnHeaderFilterComponent = __decorateClass([
256
256
  `]
257
257
  })
258
258
  ], ColumnHeaderFilterComponent);
259
- var ColumnHeaderMenuComponent = class {
259
+ var ColumnHeaderMenuComponent = class extends BaseColumnHeaderMenuComponent {
260
260
  constructor() {
261
- this.canPinLeft = true;
262
- this.canPinRight = true;
263
- this.canUnpin = false;
264
- this.currentSort = null;
265
- this.isSortable = true;
266
- this.isResizable = true;
267
- this.handlers = {};
261
+ super(...arguments);
268
262
  this.menuModel = computed(() => {
269
- const items = getColumnHeaderMenuItems({
270
- canPinLeft: this.canPinLeft,
271
- canPinRight: this.canPinRight,
272
- canUnpin: this.canUnpin,
273
- currentSort: this.currentSort,
274
- isSortable: this.isSortable,
275
- isResizable: this.isResizable
276
- });
277
- const h = this.handlers;
278
- const actionMap = {
279
- pinLeft: h.onPinLeft,
280
- pinRight: h.onPinRight,
281
- unpin: h.onUnpin,
282
- sortAsc: h.onSortAsc,
283
- sortDesc: h.onSortDesc,
284
- clearSort: h.onClearSort,
285
- autosizeThis: h.onAutosizeThis,
286
- autosizeAll: h.onAutosizeAll
287
- };
288
263
  const result = [];
289
- for (const item of items) {
264
+ for (const item of this.menuItems()) {
290
265
  result.push({
291
266
  label: item.label,
292
267
  disabled: item.disabled,
293
- command: () => {
294
- const action = actionMap[item.id];
295
- if (action) {
296
- action();
297
- h.onClose?.();
298
- }
299
- }
268
+ command: () => this.handleMenuItemClick(item.id)
300
269
  });
301
270
  if (item.divider) {
302
271
  result.push({ separator: true });
@@ -306,30 +275,6 @@ var ColumnHeaderMenuComponent = class {
306
275
  });
307
276
  }
308
277
  };
309
- __decorateClass([
310
- Input({ required: true })
311
- ], ColumnHeaderMenuComponent.prototype, "columnId", 2);
312
- __decorateClass([
313
- Input()
314
- ], ColumnHeaderMenuComponent.prototype, "canPinLeft", 2);
315
- __decorateClass([
316
- Input()
317
- ], ColumnHeaderMenuComponent.prototype, "canPinRight", 2);
318
- __decorateClass([
319
- Input()
320
- ], ColumnHeaderMenuComponent.prototype, "canUnpin", 2);
321
- __decorateClass([
322
- Input()
323
- ], ColumnHeaderMenuComponent.prototype, "currentSort", 2);
324
- __decorateClass([
325
- Input()
326
- ], ColumnHeaderMenuComponent.prototype, "isSortable", 2);
327
- __decorateClass([
328
- Input()
329
- ], ColumnHeaderMenuComponent.prototype, "isResizable", 2);
330
- __decorateClass([
331
- Input()
332
- ], ColumnHeaderMenuComponent.prototype, "handlers", 2);
333
278
  __decorateClass([
334
279
  ViewChild("menu")
335
280
  ], ColumnHeaderMenuComponent.prototype, "menuRef", 2);
@@ -446,6 +391,7 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
446
391
  this.showColumnLettersInput = false;
447
392
  this.showNameBoxInput = false;
448
393
  this.onActiveCellChange = void 0;
394
+ this.formulaReferencesInput = void 0;
449
395
  this.currentPageInput = 1;
450
396
  this.pageSizeInput = 25;
451
397
  this.defaultMinWidth = DEFAULT_MIN_COLUMN_WIDTH;
@@ -471,6 +417,7 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
471
417
  // Bound method reference for template
472
418
  this.cancelEditHandler = () => this.cancelEdit();
473
419
  this.showColumnLetters = computed(() => !!this.getProps()?.showColumnLetters);
420
+ this.formulaReferences = computed(() => this.getProps()?.formulaReferences);
474
421
  // --- PrimeNG-specific computed signals ---
475
422
  this.resolvedAriaLabel = computed(
476
423
  () => this.ariaLabelInput ?? (this.ariaLabelledByInput ? void 0 : "Data grid")
@@ -640,7 +587,8 @@ var DataGridTableComponent = class extends BaseDataGridTableComponent {
640
587
  onCellError: this.onCellError,
641
588
  stickyHeader: this.stickyHeaderInput,
642
589
  "aria-label": this.ariaLabelInput,
643
- "aria-labelledby": this.ariaLabelledByInput
590
+ "aria-labelledby": this.ariaLabelledByInput,
591
+ formulaReferences: this.formulaReferencesInput
644
592
  };
645
593
  }
646
594
  getColumnLetter(colIdx) {
@@ -785,6 +733,9 @@ __decorateClass([
785
733
  __decorateClass([
786
734
  Input()
787
735
  ], DataGridTableComponent.prototype, "onActiveCellChange", 2);
736
+ __decorateClass([
737
+ Input({ alias: "formulaReferences" })
738
+ ], DataGridTableComponent.prototype, "formulaReferencesInput", 2);
788
739
  __decorateClass([
789
740
  Input({ alias: "currentPage" })
790
741
  ], DataGridTableComponent.prototype, "currentPageInput", 2);
@@ -800,6 +751,7 @@ DataGridTableComponent = __decorateClass([
800
751
  GridContextMenuComponent,
801
752
  MarchingAntsOverlayComponent,
802
753
  EmptyStateComponent,
754
+ FormulaRefOverlayComponent,
803
755
  ColumnHeaderFilterComponent,
804
756
  ColumnHeaderMenuComponent,
805
757
  InlineCellEditorComponent,
@@ -1079,6 +1031,14 @@ DataGridTableComponent = __decorateClass([
1079
1031
  [columnOrder]="propsColumnOrder()"
1080
1032
  ></ogrid-marching-ants-overlay>
1081
1033
 
1034
+ @if (formulaReferences() && formulaReferences()!.length > 0) {
1035
+ <ogrid-formula-ref-overlay
1036
+ [containerEl]="tableContainerEl()"
1037
+ [references]="formulaReferences()!"
1038
+ [colOffset]="colOffset()"
1039
+ />
1040
+ }
1041
+
1082
1042
  @if (showEmptyInGrid() && emptyState()) {
1083
1043
  <div class="ogrid-empty-container">
1084
1044
  <div>
@@ -1694,8 +1654,13 @@ OGridComponent = __decorateClass([
1694
1654
  [hasPagination]="true"
1695
1655
  [sideBar]="service.sideBarProps()"
1696
1656
  [fullScreen]="service.fullScreen()"
1697
- [showNameBox]="!!service.cellReferences()"
1657
+ [showNameBox]="!!(service.cellReferences() && !service.formulasEnabled())"
1698
1658
  [activeCellRef]="service.activeCellRef()"
1659
+ [formulaBar]="service.formulasEnabled() ? service.formulaBarState() : null"
1660
+ [sheetDefs]="service.sheetDefs()"
1661
+ [activeSheet]="service.activeSheet()"
1662
+ [onSheetChange]="service.onSheetChange()"
1663
+ [onSheetAdd]="service.onSheetAdd()"
1699
1664
  >
1700
1665
  <ng-content select="[toolbar]" toolbar></ng-content>
1701
1666
 
@@ -1750,6 +1715,7 @@ OGridComponent = __decorateClass([
1750
1715
  [showColumnLetters]="service.dataGridProps().showColumnLetters ?? false"
1751
1716
  [showNameBox]="service.dataGridProps().showNameBox ?? false"
1752
1717
  [onActiveCellChange]="service.dataGridProps().onActiveCellChange"
1718
+ [formulaReferences]="service.dataGridProps().formulaReferences"
1753
1719
  ></ogrid-primeng-datagrid-table>
1754
1720
 
1755
1721
  <div pagination>
@@ -1,19 +1,7 @@
1
1
  import type { Menu } from 'primeng/menu';
2
2
  import type { MenuItem } from 'primeng/api';
3
- import { type ColumnHeaderMenuHandlers } from '@alaarab/ogrid-angular';
4
- /**
5
- * Column header dropdown menu for pin/unpin, sort, and autosize actions.
6
- * Uses PrimeNG Menu component.
7
- */
8
- export declare class ColumnHeaderMenuComponent {
9
- columnId: string;
10
- canPinLeft: boolean;
11
- canPinRight: boolean;
12
- canUnpin: boolean;
13
- currentSort: 'asc' | 'desc' | null;
14
- isSortable: boolean;
15
- isResizable: boolean;
16
- handlers: Partial<ColumnHeaderMenuHandlers>;
3
+ import { BaseColumnHeaderMenuComponent } from '@alaarab/ogrid-angular';
4
+ export declare class ColumnHeaderMenuComponent extends BaseColumnHeaderMenuComponent {
17
5
  menuRef?: Menu;
18
6
  readonly menuModel: import("@angular/core").Signal<MenuItem[]>;
19
7
  }
@@ -62,6 +62,7 @@ export declare class DataGridTableComponent<T = unknown> extends BaseDataGridTab
62
62
  showColumnLettersInput: boolean;
63
63
  showNameBoxInput: boolean;
64
64
  onActiveCellChange: ((ref: string | null) => void) | undefined;
65
+ formulaReferencesInput: import('@alaarab/ogrid-core').FormulaReference[] | undefined;
65
66
  currentPageInput: number;
66
67
  pageSizeInput: number;
67
68
  readonly defaultMinWidth = 80;
@@ -85,6 +86,7 @@ export declare class DataGridTableComponent<T = unknown> extends BaseDataGridTab
85
86
  private resizeStartWidth;
86
87
  readonly cancelEditHandler: () => void;
87
88
  readonly showColumnLetters: import("@angular/core").Signal<boolean>;
89
+ readonly formulaReferences: import("@angular/core").Signal<import("@alaarab/ogrid-core").FormulaReference[] | undefined>;
88
90
  constructor();
89
91
  ngOnChanges(changes: SimpleChanges): void;
90
92
  /** Shallow-compare two props objects by their top-level keys. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular-primeng",
3
- "version": "2.3.0",
3
+ "version": "2.4.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.3.0"
40
+ "@alaarab/ogrid-angular": "2.4.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@angular/core": "^21.0.0",