@alaarab/ogrid-angular-material 2.1.3 → 2.1.4

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.
@@ -1,70 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Component, ChangeDetectionStrategy } from '@angular/core';
8
- import { OGridService, OGridLayoutComponent, BaseOGridComponent, } from '@alaarab/ogrid-angular';
9
- import { DataGridTableComponent } from '../datagrid-table/datagrid-table.component';
10
- import { ColumnChooserComponent } from '../column-chooser/column-chooser.component';
11
- import { PaginationControlsComponent } from '../pagination-controls/pagination-controls.component';
12
- /**
13
- * Top-level OGrid component for Angular Material.
14
- * Standalone component — provides OGridService and renders OGridLayout with all sub-components.
15
- *
16
- * Uses @Input with signal setter for JIT compatibility (project builds with tsc, not ngc).
17
- * The effect() reactively configures the service when the input signal changes.
18
- */
19
- let OGridComponent = class OGridComponent extends BaseOGridComponent {
20
- };
21
- OGridComponent = __decorate([
22
- Component({
23
- selector: 'ogrid',
24
- standalone: true,
25
- changeDetection: ChangeDetectionStrategy.OnPush,
26
- imports: [
27
- OGridLayoutComponent,
28
- DataGridTableComponent,
29
- ColumnChooserComponent,
30
- PaginationControlsComponent,
31
- ],
32
- providers: [OGridService],
33
- styles: [`:host { display: block; height: 100%; }`],
34
- template: `
35
- <ogrid-layout
36
- [className]="ogridService.className()"
37
- [sideBar]="ogridService.sideBarProps()"
38
- [hasToolbar]="showToolbar"
39
- [hasToolbarBelow]="false"
40
- [hasPagination]="true"
41
- [fullScreen]="ogridService.fullScreen()"
42
- >
43
- <ng-container toolbarEnd>
44
- @if (ogridService.columnChooserPlacement() === 'toolbar') {
45
- <ogrid-column-chooser
46
- [columns]="ogridService.columnChooser().columns"
47
- [visibleColumns]="ogridService.columnChooser().visibleColumns"
48
- (visibilityChange)="ogridService.columnChooser().onVisibilityChange($event.columnKey, $event.visible)"
49
- />
50
- }
51
- </ng-container>
52
-
53
- <ogrid-datagrid-table [props]="ogridService.dataGridProps()" />
54
-
55
- <ng-container pagination>
56
- <ogrid-pagination-controls
57
- [currentPage]="ogridService.pagination().page"
58
- [pageSize]="ogridService.pagination().pageSize"
59
- [totalCount]="ogridService.pagination().displayTotalCount"
60
- [pageSizeOptions]="ogridService.pagination().pageSizeOptions"
61
- [entityLabelPlural]="ogridService.pagination().entityLabelPlural"
62
- (pageChange)="ogridService.pagination().setPage($event)"
63
- (pageSizeChange)="onPageSizeChange($event)"
64
- />
65
- </ng-container>
66
- </ogrid-layout>
67
- `,
68
- })
69
- ], OGridComponent);
70
- export { OGridComponent };
@@ -1,127 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Component, ChangeDetectionStrategy } from '@angular/core';
8
- import { BasePaginationControlsComponent } from '@alaarab/ogrid-angular';
9
- /**
10
- * Pagination controls component using Angular Material styling.
11
- * Standalone component with inline template — no Angular Material dependency for pagination.
12
- */
13
- let PaginationControlsComponent = class PaginationControlsComponent extends BasePaginationControlsComponent {
14
- };
15
- PaginationControlsComponent = __decorate([
16
- Component({
17
- selector: 'ogrid-pagination-controls',
18
- standalone: true,
19
- changeDetection: ChangeDetectionStrategy.OnPush,
20
- template: `
21
- @if (vm(); as vm) {
22
- <nav class="ogrid-pagination" role="navigation" aria-label="Pagination">
23
- <span class="ogrid-pagination__info">
24
- Showing {{ vm.startItem }} to {{ vm.endItem }} of {{ totalCount.toLocaleString() }} {{ entityLabelPlural }}
25
- </span>
26
-
27
- <span class="ogrid-pagination__pages">
28
- <button
29
- class="ogrid-pagination__btn"
30
- [disabled]="currentPage === 1"
31
- (click)="pageChange.emit(1)"
32
- aria-label="First page"
33
- >&laquo;</button>
34
- <button
35
- class="ogrid-pagination__btn"
36
- [disabled]="currentPage === 1"
37
- (click)="pageChange.emit(currentPage - 1)"
38
- aria-label="Previous page"
39
- >&lsaquo;</button>
40
-
41
- @if (vm.showStartEllipsis) {
42
- <button class="ogrid-pagination__btn" (click)="pageChange.emit(1)" aria-label="Page 1">1</button>
43
- <span class="ogrid-pagination__ellipsis" aria-hidden="true">&hellip;</span>
44
- }
45
-
46
- @for (pageNum of vm.pageNumbers; track pageNum) {
47
- <button
48
- class="ogrid-pagination__btn"
49
- [class.ogrid-pagination__btn--active]="currentPage === pageNum"
50
- (click)="pageChange.emit(pageNum)"
51
- [attr.aria-label]="'Page ' + pageNum"
52
- [attr.aria-current]="currentPage === pageNum ? 'page' : null"
53
- >{{ pageNum }}</button>
54
- }
55
-
56
- @if (vm.showEndEllipsis) {
57
- <span class="ogrid-pagination__ellipsis" aria-hidden="true">&hellip;</span>
58
- <button
59
- class="ogrid-pagination__btn"
60
- (click)="pageChange.emit(vm.totalPages)"
61
- [attr.aria-label]="'Page ' + vm.totalPages"
62
- >{{ vm.totalPages }}</button>
63
- }
64
-
65
- <button
66
- class="ogrid-pagination__btn"
67
- [disabled]="currentPage >= vm.totalPages"
68
- (click)="pageChange.emit(currentPage + 1)"
69
- aria-label="Next page"
70
- >&rsaquo;</button>
71
- <button
72
- class="ogrid-pagination__btn"
73
- [disabled]="currentPage >= vm.totalPages"
74
- (click)="pageChange.emit(vm.totalPages)"
75
- aria-label="Last page"
76
- >&raquo;</button>
77
- </span>
78
-
79
- <span class="ogrid-pagination__size">
80
- <label>Rows
81
- <select
82
- [value]="pageSize"
83
- (change)="onPageSizeSelect($event)"
84
- aria-label="Rows per page"
85
- >
86
- @for (n of vm.pageSizeOptions; track n) {
87
- <option [value]="n" [selected]="pageSize === n">{{ n }}</option>
88
- }
89
- </select>
90
- </label>
91
- </span>
92
- </nav>
93
- }
94
- `,
95
- styles: [`
96
- :host { display: block; }
97
- .ogrid-pagination {
98
- display: flex; align-items: center; justify-content: space-between;
99
- flex-wrap: wrap; gap: 8px; padding: 6px 12px; font-size: 14px;
100
- color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
101
- }
102
- .ogrid-pagination__info { color: var(--ogrid-fg-secondary, rgba(0, 0, 0, 0.6)); }
103
- .ogrid-pagination__pages { display: flex; align-items: center; gap: 2px; }
104
- .ogrid-pagination__btn {
105
- min-width: 32px; height: 32px; padding: 0 6px;
106
- border: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.23)); border-radius: 4px;
107
- background: transparent; cursor: pointer; font-size: 14px;
108
- color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
109
- }
110
- .ogrid-pagination__btn:hover:not(:disabled) { background: var(--ogrid-hover-bg, rgba(0, 0, 0, 0.04)); }
111
- .ogrid-pagination__btn:disabled { opacity: 0.38; cursor: default; }
112
- .ogrid-pagination__btn--active {
113
- background: var(--mat-sys-primary, #1976d2); color: #fff;
114
- border-color: var(--mat-sys-primary, #1976d2);
115
- }
116
- .ogrid-pagination__ellipsis { margin: 0 4px; color: var(--ogrid-fg-secondary, rgba(0, 0, 0, 0.6)); }
117
- .ogrid-pagination__size { display: flex; align-items: center; gap: 8px; color: var(--ogrid-fg, rgba(0, 0, 0, 0.87)); }
118
- .ogrid-pagination__size select {
119
- min-width: 60px; height: 32px; padding: 4px 8px;
120
- border: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.23)); border-radius: 4px;
121
- font-size: 14px; margin-left: 8px;
122
- background: var(--ogrid-bg, #ffffff); color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
123
- }
124
- `],
125
- })
126
- ], PaginationControlsComponent);
127
- export { PaginationControlsComponent };