@alaarab/ogrid-angular-material 2.1.0 → 2.1.2

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.
@@ -4,32 +4,42 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { Component, ChangeDetectionStrategy, ViewChild, computed, Input } from '@angular/core';
7
+ import { Component, ChangeDetectionStrategy, ViewChild, computed, Input, signal } from '@angular/core';
8
8
  import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
9
9
  import { MatDividerModule } from '@angular/material/divider';
10
10
  import { getColumnHeaderMenuItems } from '@alaarab/ogrid-angular';
11
11
  /**
12
12
  * Column header dropdown menu for pin/unpin, sort, and autosize actions.
13
13
  * Uses Angular Material MatMenu.
14
+ *
15
+ * Uses signal-backed @Input setters so that computed() tracks changes
16
+ * (plain @Input properties are not reactive in Angular signals).
14
17
  */
15
18
  let ColumnHeaderMenuComponent = class ColumnHeaderMenuComponent {
16
19
  constructor() {
17
- this.canPinLeft = true;
18
- this.canPinRight = true;
19
- this.canUnpin = false;
20
- this.currentSort = null;
21
- this.isSortable = true;
22
- this.isResizable = true;
20
+ // Signal-backed inputs so computed() tracks changes reactively
21
+ this._canPinLeft = signal(true);
22
+ this._canPinRight = signal(true);
23
+ this._canUnpin = signal(false);
24
+ this._currentSort = signal(null);
25
+ this._isSortable = signal(true);
26
+ this._isResizable = signal(true);
23
27
  this.handlers = {};
24
28
  this.menuItems = computed(() => getColumnHeaderMenuItems({
25
- canPinLeft: this.canPinLeft,
26
- canPinRight: this.canPinRight,
27
- canUnpin: this.canUnpin,
28
- currentSort: this.currentSort,
29
- isSortable: this.isSortable,
30
- isResizable: this.isResizable,
29
+ canPinLeft: this._canPinLeft(),
30
+ canPinRight: this._canPinRight(),
31
+ canUnpin: this._canUnpin(),
32
+ currentSort: this._currentSort(),
33
+ isSortable: this._isSortable(),
34
+ isResizable: this._isResizable(),
31
35
  }));
32
36
  }
37
+ set canPinLeft(v) { this._canPinLeft.set(v); }
38
+ set canPinRight(v) { this._canPinRight.set(v); }
39
+ set canUnpin(v) { this._canUnpin.set(v); }
40
+ set currentSort(v) { this._currentSort.set(v); }
41
+ set isSortable(v) { this._isSortable.set(v); }
42
+ set isResizable(v) { this._isResizable.set(v); }
33
43
  handleMenuItemClick(itemId) {
34
44
  const h = this.handlers;
35
45
  const actionMap = {
@@ -54,22 +64,22 @@ __decorate([
54
64
  ], ColumnHeaderMenuComponent.prototype, "columnId", void 0);
55
65
  __decorate([
56
66
  Input()
57
- ], ColumnHeaderMenuComponent.prototype, "canPinLeft", void 0);
67
+ ], ColumnHeaderMenuComponent.prototype, "canPinLeft", null);
58
68
  __decorate([
59
69
  Input()
60
- ], ColumnHeaderMenuComponent.prototype, "canPinRight", void 0);
70
+ ], ColumnHeaderMenuComponent.prototype, "canPinRight", null);
61
71
  __decorate([
62
72
  Input()
63
- ], ColumnHeaderMenuComponent.prototype, "canUnpin", void 0);
73
+ ], ColumnHeaderMenuComponent.prototype, "canUnpin", null);
64
74
  __decorate([
65
75
  Input()
66
- ], ColumnHeaderMenuComponent.prototype, "currentSort", void 0);
76
+ ], ColumnHeaderMenuComponent.prototype, "currentSort", null);
67
77
  __decorate([
68
78
  Input()
69
- ], ColumnHeaderMenuComponent.prototype, "isSortable", void 0);
79
+ ], ColumnHeaderMenuComponent.prototype, "isSortable", null);
70
80
  __decorate([
71
81
  Input()
72
- ], ColumnHeaderMenuComponent.prototype, "isResizable", void 0);
82
+ ], ColumnHeaderMenuComponent.prototype, "isResizable", null);
73
83
  __decorate([
74
84
  Input()
75
85
  ], ColumnHeaderMenuComponent.prototype, "handlers", void 0);
@@ -40,7 +40,7 @@ __decorate([
40
40
  ViewChild('wrapperEl')
41
41
  ], DataGridTableComponent.prototype, "wrapperRef", void 0);
42
42
  __decorate([
43
- ViewChild('tableContainerEl')
43
+ ViewChild('tableContainerElRef')
44
44
  ], DataGridTableComponent.prototype, "tableContainerRef", void 0);
45
45
  DataGridTableComponent = __decorate([
46
46
  Component({
@@ -71,10 +71,10 @@ DataGridTableComponent = __decorate([
71
71
  >
72
72
  <div class="ogrid-datagrid-scroll-wrapper">
73
73
  <div [style.minWidth.px]="allowOverflowX() ? minTableWidth() : undefined">
74
- <div [class.ogrid-datagrid-table-wrapper--loading]="isLoading() && items().length > 0" #tableContainerEl>
74
+ <div [class.ogrid-datagrid-table-wrapper--loading]="isLoading() && items().length > 0" #tableContainerElRef>
75
75
  <table class="ogrid-datagrid-table" [style.minWidth.px]="minTableWidth()"
76
76
  >
77
- <thead class="ogrid-datagrid-thead">
77
+ <thead [class]="stickyHeader() ? 'ogrid-datagrid-thead ogrid-sticky-header' : 'ogrid-datagrid-thead'">
78
78
  @for (row of headerRows(); track $index; let rowIdx = $index) {
79
79
  <tr class="ogrid-datagrid-header-row">
80
80
  @if (rowIdx === headerRows().length - 1 && hasCheckboxCol()) {
@@ -391,21 +391,24 @@ DataGridTableComponent = __decorate([
391
391
  .ogrid-datagrid-thead th { background: var(--ogrid-header-bg, rgba(0, 0, 0, 0.04)); }
392
392
  .ogrid-datagrid-header-row { background: var(--ogrid-header-bg, rgba(0, 0, 0, 0.04)); }
393
393
  .ogrid-datagrid-th {
394
- font-weight: 600; position: sticky; top: 0; padding: 6px 10px; text-align: left;
394
+ font-weight: 600; padding: 6px 10px; text-align: left;
395
395
  font-size: 14px; border-bottom: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
396
396
  background: var(--ogrid-header-bg, rgba(0, 0, 0, 0.04)); z-index: 8;
397
397
  color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
398
398
  }
399
+ .ogrid-sticky-header .ogrid-datagrid-th { position: sticky; top: 0; }
399
400
  .ogrid-datagrid-th:focus-visible {
400
401
  outline: 2px solid var(--mat-sys-primary, #1976d2); outline-offset: -2px; z-index: 11;
401
402
  }
402
403
  .ogrid-datagrid-th--pinned-left {
403
404
  position: sticky; top: 0; left: 0; z-index: 10; background: var(--ogrid-header-bg, rgba(0, 0, 0, 0.04)); will-change: transform;
404
- border-right: 2px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
405
+ border-right: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
406
+ box-shadow: 2px 0 4px -1px rgba(0, 0, 0, 0.1);
405
407
  }
406
408
  .ogrid-datagrid-th--pinned-right {
407
409
  position: sticky; top: 0; right: 0; z-index: 10; background: var(--ogrid-header-bg, rgba(0, 0, 0, 0.04)); will-change: transform;
408
- border-left: 2px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
410
+ border-left: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
411
+ box-shadow: -2px 0 4px -1px rgba(0, 0, 0, 0.1);
409
412
  }
410
413
  .ogrid-datagrid-group-header {
411
414
  text-align: center; font-weight: 600; border-bottom: 2px solid var(--ogrid-border, rgba(0, 0, 0, 0.12)); padding: 6px;
@@ -432,11 +435,13 @@ DataGridTableComponent = __decorate([
432
435
  .ogrid-datagrid-td { position: relative; padding: 0; height: 1px; border-bottom: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.06)); }
433
436
  .ogrid-datagrid-td--pinned-left {
434
437
  position: sticky; left: 0; z-index: 6; background: var(--ogrid-bg, #ffffff); will-change: transform;
435
- border-right: 2px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
438
+ border-right: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
439
+ box-shadow: 2px 0 4px -1px rgba(0, 0, 0, 0.1);
436
440
  }
437
441
  .ogrid-datagrid-td--pinned-right {
438
442
  position: sticky; right: 0; z-index: 6; background: var(--ogrid-bg, #ffffff); will-change: transform;
439
- border-left: 2px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
443
+ border-left: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));
444
+ box-shadow: -2px 0 4px -1px rgba(0, 0, 0, 0.1);
440
445
  }
441
446
  .ogrid-datagrid-cell {
442
447
  width: 100%; height: 100%; display: flex; align-items: center; min-width: 0;
@@ -38,6 +38,7 @@ OGridComponent = __decorate([
38
38
  [hasToolbar]="showToolbar"
39
39
  [hasToolbarBelow]="false"
40
40
  [hasPagination]="true"
41
+ [fullScreen]="ogridService.fullScreen()"
41
42
  >
42
43
  <ng-container toolbarEnd>
43
44
  @if (ogridService.columnChooserPlacement() === 'toolbar') {
@@ -3,15 +3,24 @@ import { type IColumnHeaderMenuItem, type ColumnHeaderMenuHandlers } from '@alaa
3
3
  /**
4
4
  * Column header dropdown menu for pin/unpin, sort, and autosize actions.
5
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).
6
9
  */
7
10
  export declare class ColumnHeaderMenuComponent {
8
11
  columnId: string;
9
- canPinLeft: boolean;
10
- canPinRight: boolean;
11
- canUnpin: boolean;
12
- currentSort: 'asc' | 'desc' | null;
13
- isSortable: boolean;
14
- isResizable: boolean;
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);
15
24
  handlers: Partial<ColumnHeaderMenuHandlers>;
16
25
  menuTrigger?: MatMenuTrigger;
17
26
  readonly menuItems: import("@angular/core").Signal<IColumnHeaderMenuItem[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular-material",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
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.1.0"
40
+ "@alaarab/ogrid-angular": "2.1.2"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@angular/cdk": "^21.0.0",