@alaarab/ogrid-angular-material 2.0.6 → 2.0.7

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,7 +4,7 @@ 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, Input, Output, EventEmitter, ViewChild } from '@angular/core';
7
+ import { Component, input, viewChild, ChangeDetectionStrategy } from '@angular/core';
8
8
  import { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';
9
9
  import { MatButtonModule } from '@angular/material/button';
10
10
  import { MatIconModule } from '@angular/material/icon';
@@ -15,65 +15,44 @@ import { COLUMN_HEADER_MENU_ITEMS } from '@alaarab/ogrid-core';
15
15
  */
16
16
  let ColumnHeaderMenuComponent = class ColumnHeaderMenuComponent {
17
17
  constructor() {
18
- this.canPinLeft = true;
19
- this.canPinRight = true;
20
- this.canUnpin = false;
21
- this.pinLeft = new EventEmitter();
22
- this.pinRight = new EventEmitter();
23
- this.unpin = new EventEmitter();
18
+ this.columnId = input.required();
19
+ this.canPinLeft = input(true);
20
+ this.canPinRight = input(true);
21
+ this.canUnpin = input(false);
22
+ this.onPinLeft = input(undefined);
23
+ this.onPinRight = input(undefined);
24
+ this.onUnpin = input(undefined);
25
+ this.menuTrigger = viewChild(MatMenuTrigger);
24
26
  this.menuItems = COLUMN_HEADER_MENU_ITEMS;
25
27
  }
26
28
  handlePinLeft() {
27
- if (this.canPinLeft) {
28
- this.pinLeft.emit();
29
+ if (this.canPinLeft()) {
30
+ this.onPinLeft()?.();
29
31
  }
30
32
  }
31
33
  handlePinRight() {
32
- if (this.canPinRight) {
33
- this.pinRight.emit();
34
+ if (this.canPinRight()) {
35
+ this.onPinRight()?.();
34
36
  }
35
37
  }
36
38
  handleUnpin() {
37
- if (this.canUnpin) {
38
- this.unpin.emit();
39
+ if (this.canUnpin()) {
40
+ this.onUnpin()?.();
39
41
  }
40
42
  }
41
43
  };
42
- __decorate([
43
- Input()
44
- ], ColumnHeaderMenuComponent.prototype, "columnId", void 0);
45
- __decorate([
46
- Input()
47
- ], ColumnHeaderMenuComponent.prototype, "canPinLeft", void 0);
48
- __decorate([
49
- Input()
50
- ], ColumnHeaderMenuComponent.prototype, "canPinRight", void 0);
51
- __decorate([
52
- Input()
53
- ], ColumnHeaderMenuComponent.prototype, "canUnpin", void 0);
54
- __decorate([
55
- Output()
56
- ], ColumnHeaderMenuComponent.prototype, "pinLeft", void 0);
57
- __decorate([
58
- Output()
59
- ], ColumnHeaderMenuComponent.prototype, "pinRight", void 0);
60
- __decorate([
61
- Output()
62
- ], ColumnHeaderMenuComponent.prototype, "unpin", void 0);
63
- __decorate([
64
- ViewChild(MatMenuTrigger)
65
- ], ColumnHeaderMenuComponent.prototype, "menuTrigger", void 0);
66
44
  ColumnHeaderMenuComponent = __decorate([
67
45
  Component({
68
46
  selector: 'column-header-menu',
69
47
  standalone: true,
70
48
  imports: [MatMenuModule, MatButtonModule, MatIconModule],
49
+ changeDetection: ChangeDetectionStrategy.OnPush,
71
50
  template: `
72
51
  <button
73
52
  mat-icon-button
74
53
  [matMenuTriggerFor]="menu"
75
54
  class="column-header-menu-trigger"
76
- [attr.aria-label]="'Column options for ' + columnId"
55
+ [attr.aria-label]="'Column options for ' + columnId()"
77
56
  >
78
57
  <mat-icon>more_vert</mat-icon>
79
58
  </button>
@@ -81,21 +60,21 @@ ColumnHeaderMenuComponent = __decorate([
81
60
  <mat-menu #menu="matMenu">
82
61
  <button
83
62
  mat-menu-item
84
- [disabled]="!canPinLeft"
63
+ [disabled]="!canPinLeft()"
85
64
  (click)="handlePinLeft()"
86
65
  >
87
66
  {{ menuItems[0].label }}
88
67
  </button>
89
68
  <button
90
69
  mat-menu-item
91
- [disabled]="!canPinRight"
70
+ [disabled]="!canPinRight()"
92
71
  (click)="handlePinRight()"
93
72
  >
94
73
  {{ menuItems[1].label }}
95
74
  </button>
96
75
  <button
97
76
  mat-menu-item
98
- [disabled]="!canUnpin"
77
+ [disabled]="!canUnpin()"
99
78
  (click)="handleUnpin()"
100
79
  >
101
80
  {{ menuItems[2].label }}
@@ -1,18 +1,17 @@
1
- import { EventEmitter } from '@angular/core';
2
1
  import { MatMenuTrigger } from '@angular/material/menu';
3
2
  /**
4
3
  * Column header dropdown menu for pin/unpin actions.
5
4
  * Uses Angular Material MatMenu.
6
5
  */
7
6
  export declare class ColumnHeaderMenuComponent {
8
- columnId: string;
9
- canPinLeft: boolean;
10
- canPinRight: boolean;
11
- canUnpin: boolean;
12
- pinLeft: EventEmitter<void>;
13
- pinRight: EventEmitter<void>;
14
- unpin: EventEmitter<void>;
15
- menuTrigger?: MatMenuTrigger;
7
+ readonly columnId: import("@angular/core").InputSignal<string>;
8
+ readonly canPinLeft: import("@angular/core").InputSignal<boolean>;
9
+ readonly canPinRight: import("@angular/core").InputSignal<boolean>;
10
+ readonly canUnpin: import("@angular/core").InputSignal<boolean>;
11
+ readonly onPinLeft: import("@angular/core").InputSignal<(() => void) | undefined>;
12
+ readonly onPinRight: import("@angular/core").InputSignal<(() => void) | undefined>;
13
+ readonly onUnpin: import("@angular/core").InputSignal<(() => void) | undefined>;
14
+ readonly menuTrigger: import("@angular/core").Signal<MatMenuTrigger | undefined>;
16
15
  readonly menuItems: import("@alaarab/ogrid-core").IColumnHeaderMenuItem[];
17
16
  handlePinLeft(): void;
18
17
  handlePinRight(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular-material",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
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",
@@ -22,7 +22,7 @@
22
22
  "files": ["dist", "README.md", "LICENSE"],
23
23
  "engines": { "node": ">=18" },
24
24
  "dependencies": {
25
- "@alaarab/ogrid-angular": "2.0.6"
25
+ "@alaarab/ogrid-angular": "2.0.7"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@angular/core": "^21.0.0",