@alaarab/ogrid-angular-material 2.0.9 → 2.0.12
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/column-chooser/column-chooser.component.js +20 -42
- package/dist/esm/column-header-filter/column-header-filter.component.js +88 -228
- package/dist/esm/column-header-menu/column-header-menu.component.js +91 -58
- package/dist/esm/datagrid-table/datagrid-table.component.js +179 -68
- package/dist/esm/datagrid-table/inline-cell-editor.component.js +48 -20
- package/dist/esm/datagrid-table/popover-cell-editor.component.js +39 -20
- package/dist/esm/index.js +2 -0
- package/dist/esm/ogrid/ogrid.component.js +26 -17
- package/dist/esm/pagination-controls/pagination-controls.component.js +23 -36
- package/dist/types/column-chooser/column-chooser.component.d.ts +2 -20
- package/dist/types/column-header-filter/column-header-filter.component.d.ts +6 -68
- package/dist/types/column-header-menu/column-header-menu.component.d.ts +13 -13
- package/dist/types/datagrid-table/datagrid-table.component.d.ts +16 -3
- package/dist/types/datagrid-table/inline-cell-editor.component.d.ts +13 -10
- package/dist/types/datagrid-table/popover-cell-editor.component.d.ts +9 -9
- package/dist/types/index.d.ts +0 -2
- package/dist/types/ogrid/ogrid.component.d.ts +7 -4
- package/dist/types/pagination-controls/pagination-controls.component.d.ts +2 -10
- package/package.json +13 -4
|
@@ -4,32 +4,36 @@ 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,
|
|
7
|
+
import { Component, Input, Output, EventEmitter, signal, ViewChild } from '@angular/core';
|
|
8
8
|
import { CommonModule } from '@angular/common';
|
|
9
9
|
let InlineCellEditorComponent = class InlineCellEditorComponent {
|
|
10
10
|
constructor() {
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.column = input.required();
|
|
14
|
-
this.rowIndex = input.required();
|
|
15
|
-
this.editorType = input.required();
|
|
16
|
-
this.commit = output();
|
|
17
|
-
this.cancel = output();
|
|
18
|
-
this.inputEl = viewChild('inputEl');
|
|
11
|
+
this.commit = new EventEmitter();
|
|
12
|
+
this.cancel = new EventEmitter();
|
|
19
13
|
this.localValue = signal('');
|
|
20
14
|
this.selectOptions = signal([]);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
this._initialized = false;
|
|
16
|
+
}
|
|
17
|
+
ngOnInit() {
|
|
18
|
+
this._initialized = true;
|
|
19
|
+
this.syncFromInputs();
|
|
20
|
+
}
|
|
21
|
+
ngOnChanges() {
|
|
22
|
+
if (this._initialized) {
|
|
23
|
+
this.syncFromInputs();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
syncFromInputs() {
|
|
27
|
+
const v = this.value;
|
|
28
|
+
this.localValue.set(v != null ? String(v) : '');
|
|
29
|
+
const col = this.column;
|
|
30
|
+
if (col?.cellEditorParams?.values) {
|
|
31
|
+
this.selectOptions.set(col.cellEditorParams.values);
|
|
32
|
+
}
|
|
29
33
|
}
|
|
30
34
|
ngAfterViewInit() {
|
|
31
35
|
setTimeout(() => {
|
|
32
|
-
const el = this.inputEl
|
|
36
|
+
const el = this.inputEl?.nativeElement;
|
|
33
37
|
if (el) {
|
|
34
38
|
el.focus();
|
|
35
39
|
if (el instanceof HTMLInputElement && el.type === 'text') {
|
|
@@ -72,20 +76,44 @@ let InlineCellEditorComponent = class InlineCellEditorComponent {
|
|
|
72
76
|
}
|
|
73
77
|
getInputStyle() {
|
|
74
78
|
const baseStyle = 'width:100%;box-sizing:border-box;padding:6px 10px;border:2px solid var(--ogrid-selection, #217346);border-radius:2px;outline:none;font:inherit;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424);';
|
|
75
|
-
const col = this.column
|
|
79
|
+
const col = this.column;
|
|
76
80
|
if (col.type === 'numeric') {
|
|
77
81
|
return baseStyle + 'text-align:right;';
|
|
78
82
|
}
|
|
79
83
|
return baseStyle;
|
|
80
84
|
}
|
|
81
85
|
};
|
|
86
|
+
__decorate([
|
|
87
|
+
Input({ required: true })
|
|
88
|
+
], InlineCellEditorComponent.prototype, "value", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
Input({ required: true })
|
|
91
|
+
], InlineCellEditorComponent.prototype, "item", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
Input({ required: true })
|
|
94
|
+
], InlineCellEditorComponent.prototype, "column", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
Input({ required: true })
|
|
97
|
+
], InlineCellEditorComponent.prototype, "rowIndex", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
Input({ required: true })
|
|
100
|
+
], InlineCellEditorComponent.prototype, "editorType", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
Output()
|
|
103
|
+
], InlineCellEditorComponent.prototype, "commit", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
Output()
|
|
106
|
+
], InlineCellEditorComponent.prototype, "cancel", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
ViewChild('inputEl')
|
|
109
|
+
], InlineCellEditorComponent.prototype, "inputEl", void 0);
|
|
82
110
|
InlineCellEditorComponent = __decorate([
|
|
83
111
|
Component({
|
|
84
112
|
selector: 'ogrid-mat-inline-cell-editor',
|
|
85
113
|
standalone: true,
|
|
86
114
|
imports: [CommonModule],
|
|
87
115
|
template: `
|
|
88
|
-
@switch (editorType
|
|
116
|
+
@switch (editorType) {
|
|
89
117
|
@case ('text') {
|
|
90
118
|
<input
|
|
91
119
|
#inputEl
|
|
@@ -4,37 +4,28 @@ 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,
|
|
7
|
+
import { Component, ChangeDetectionStrategy, signal, effect, ViewChild, Injector, createComponent, EnvironmentInjector, inject, Input } from '@angular/core';
|
|
8
8
|
/**
|
|
9
9
|
* PopoverCellEditor component for Angular Material.
|
|
10
10
|
* Renders custom popover editor when anchor element is set.
|
|
11
11
|
*/
|
|
12
12
|
let PopoverCellEditorComponent = class PopoverCellEditorComponent {
|
|
13
13
|
constructor() {
|
|
14
|
-
this.item = input.required();
|
|
15
|
-
this.column = input.required();
|
|
16
|
-
this.rowIndex = input.required();
|
|
17
|
-
this.globalColIndex = input.required();
|
|
18
|
-
this.displayValue = input.required();
|
|
19
|
-
this.editorProps = input.required();
|
|
20
|
-
this.onCancel = input.required();
|
|
21
|
-
this.anchorRef = viewChild('anchorEl');
|
|
22
|
-
this.editorContainerRef = viewChild('editorContainer');
|
|
23
14
|
this.injector = inject(Injector);
|
|
24
15
|
this.envInjector = inject(EnvironmentInjector);
|
|
25
16
|
this.showEditor = signal(false);
|
|
26
17
|
// Show editor after anchor is rendered
|
|
27
18
|
effect(() => {
|
|
28
|
-
const anchor = this.anchorRef
|
|
19
|
+
const anchor = this.anchorRef;
|
|
29
20
|
if (anchor) {
|
|
30
21
|
setTimeout(() => this.showEditor.set(true), 0);
|
|
31
22
|
}
|
|
32
23
|
});
|
|
33
24
|
// Render custom editor component when container is available
|
|
34
25
|
effect(() => {
|
|
35
|
-
const container = this.editorContainerRef
|
|
36
|
-
const props = this.editorProps
|
|
37
|
-
const col = this.column
|
|
26
|
+
const container = this.editorContainerRef;
|
|
27
|
+
const props = this.editorProps;
|
|
28
|
+
const col = this.column;
|
|
38
29
|
if (!container || !this.showEditor() || typeof col.cellEditor !== 'function')
|
|
39
30
|
return;
|
|
40
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -54,9 +45,36 @@ let PopoverCellEditorComponent = class PopoverCellEditorComponent {
|
|
|
54
45
|
});
|
|
55
46
|
}
|
|
56
47
|
handleOverlayClick() {
|
|
57
|
-
this.onCancel()
|
|
48
|
+
this.onCancel();
|
|
58
49
|
}
|
|
59
50
|
};
|
|
51
|
+
__decorate([
|
|
52
|
+
Input({ required: true })
|
|
53
|
+
], PopoverCellEditorComponent.prototype, "item", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
Input({ required: true })
|
|
56
|
+
], PopoverCellEditorComponent.prototype, "column", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
Input({ required: true })
|
|
59
|
+
], PopoverCellEditorComponent.prototype, "rowIndex", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
Input({ required: true })
|
|
62
|
+
], PopoverCellEditorComponent.prototype, "globalColIndex", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
Input({ required: true })
|
|
65
|
+
], PopoverCellEditorComponent.prototype, "displayValue", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
Input({ required: true })
|
|
68
|
+
], PopoverCellEditorComponent.prototype, "editorProps", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
Input({ required: true })
|
|
71
|
+
], PopoverCellEditorComponent.prototype, "onCancel", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
ViewChild('anchorEl')
|
|
74
|
+
], PopoverCellEditorComponent.prototype, "anchorRef", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
ViewChild('editorContainer')
|
|
77
|
+
], PopoverCellEditorComponent.prototype, "editorContainerRef", void 0);
|
|
60
78
|
PopoverCellEditorComponent = __decorate([
|
|
61
79
|
Component({
|
|
62
80
|
selector: 'ogrid-mat-popover-cell-editor',
|
|
@@ -65,10 +83,10 @@ PopoverCellEditorComponent = __decorate([
|
|
|
65
83
|
template: `
|
|
66
84
|
<div #anchorEl
|
|
67
85
|
class="ogrid-popover-anchor"
|
|
68
|
-
[attr.data-row-index]="rowIndex
|
|
69
|
-
[attr.data-col-index]="globalColIndex
|
|
86
|
+
[attr.data-row-index]="rowIndex"
|
|
87
|
+
[attr.data-col-index]="globalColIndex"
|
|
70
88
|
>
|
|
71
|
-
{{ displayValue
|
|
89
|
+
{{ displayValue }}
|
|
72
90
|
</div>
|
|
73
91
|
@if (showEditor()) {
|
|
74
92
|
<div class="ogrid-popover-editor-overlay" (click)="handleOverlayClick()">
|
|
@@ -91,9 +109,10 @@ PopoverCellEditorComponent = __decorate([
|
|
|
91
109
|
display: flex; align-items: center; justify-content: center;
|
|
92
110
|
}
|
|
93
111
|
.ogrid-popover-editor-content {
|
|
94
|
-
background: #
|
|
95
|
-
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
112
|
+
background: var(--ogrid-bg, #ffffff); border-radius: 4px; padding: 16px;
|
|
113
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
96
114
|
max-width: 90vw; max-height: 90vh; overflow: auto;
|
|
115
|
+
color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
|
|
97
116
|
}
|
|
98
117
|
`],
|
|
99
118
|
})
|
package/dist/esm/index.js
CHANGED
|
@@ -4,7 +4,9 @@ export * from '@alaarab/ogrid-angular';
|
|
|
4
4
|
export { OGridComponent } from './ogrid/ogrid.component';
|
|
5
5
|
export { DataGridTableComponent } from './datagrid-table/datagrid-table.component';
|
|
6
6
|
export { ColumnHeaderFilterComponent } from './column-header-filter/column-header-filter.component';
|
|
7
|
+
// IColumnHeaderFilterProps is now exported from @alaarab/ogrid-angular (base class)
|
|
7
8
|
export { ColumnChooserComponent } from './column-chooser/column-chooser.component';
|
|
9
|
+
// IColumnChooserProps is now exported from @alaarab/ogrid-angular (base class)
|
|
8
10
|
export { PaginationControlsComponent } from './pagination-controls/pagination-controls.component';
|
|
9
11
|
export { ColumnHeaderMenuComponent } from './column-header-menu/column-header-menu.component';
|
|
10
12
|
export { InlineCellEditorComponent } from './datagrid-table/inline-cell-editor.component';
|
|
@@ -4,39 +4,47 @@ 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,
|
|
7
|
+
import { Component, ChangeDetectionStrategy, Input, signal, effect } from '@angular/core';
|
|
8
8
|
import { OGridService, OGridLayoutComponent, } from '@alaarab/ogrid-angular';
|
|
9
9
|
import { DataGridTableComponent } from '../datagrid-table/datagrid-table.component';
|
|
10
10
|
import { ColumnChooserComponent } from '../column-chooser/column-chooser.component';
|
|
11
11
|
import { PaginationControlsComponent } from '../pagination-controls/pagination-controls.component';
|
|
12
12
|
/**
|
|
13
13
|
* Top-level OGrid component for Angular Material.
|
|
14
|
-
* Equivalent to the React MaterialDataTable/OGrid component.
|
|
15
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.
|
|
16
18
|
*/
|
|
17
19
|
let OGridComponent = class OGridComponent {
|
|
20
|
+
set props(value) {
|
|
21
|
+
this.propsSignal.set(value);
|
|
22
|
+
}
|
|
18
23
|
constructor() {
|
|
19
|
-
this.
|
|
20
|
-
this.dataGridProps = computed(() => {
|
|
21
|
-
// Ensure service is configured before accessing dataGridProps
|
|
22
|
-
this.ogridService.configure(this.props());
|
|
23
|
-
return this.ogridService.dataGridProps();
|
|
24
|
-
});
|
|
25
|
-
// The OGridService is provided at the component level, so inject it here
|
|
26
|
-
// But since we can't use inject() with generics well, we use the providers array
|
|
27
|
-
// and the Angular DI system will handle it.
|
|
28
|
-
// Actually we need a slightly different approach for the generic service.
|
|
24
|
+
this.propsSignal = signal(undefined);
|
|
29
25
|
this.ogridService = new OGridService();
|
|
26
|
+
effect(() => {
|
|
27
|
+
const p = this.propsSignal();
|
|
28
|
+
if (p)
|
|
29
|
+
this.ogridService.configure(p);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
get showToolbar() {
|
|
33
|
+
return this.ogridService.columnChooserPlacement() === 'toolbar' || this.ogridService.toolbar() != null;
|
|
30
34
|
}
|
|
31
35
|
onPageSizeChange(size) {
|
|
32
36
|
this.ogridService.pagination().setPageSize(size);
|
|
33
37
|
this.ogridService.pagination().setPage(1);
|
|
34
38
|
}
|
|
35
39
|
};
|
|
40
|
+
__decorate([
|
|
41
|
+
Input({ required: true })
|
|
42
|
+
], OGridComponent.prototype, "props", null);
|
|
36
43
|
OGridComponent = __decorate([
|
|
37
44
|
Component({
|
|
38
45
|
selector: 'ogrid',
|
|
39
46
|
standalone: true,
|
|
47
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
40
48
|
imports: [
|
|
41
49
|
OGridLayoutComponent,
|
|
42
50
|
DataGridTableComponent,
|
|
@@ -44,15 +52,16 @@ OGridComponent = __decorate([
|
|
|
44
52
|
PaginationControlsComponent,
|
|
45
53
|
],
|
|
46
54
|
providers: [OGridService],
|
|
47
|
-
|
|
55
|
+
styles: [`:host { display: block; height: 100%; }`],
|
|
48
56
|
template: `
|
|
49
57
|
<ogrid-layout
|
|
50
58
|
[className]="ogridService.className()"
|
|
51
59
|
[sideBar]="ogridService.sideBarProps()"
|
|
52
|
-
[
|
|
53
|
-
[
|
|
60
|
+
[hasToolbar]="showToolbar"
|
|
61
|
+
[hasToolbarBelow]="false"
|
|
62
|
+
[hasPagination]="true"
|
|
54
63
|
>
|
|
55
|
-
<ng-container
|
|
64
|
+
<ng-container toolbarEnd>
|
|
56
65
|
@if (ogridService.columnChooserPlacement() === 'toolbar') {
|
|
57
66
|
<ogrid-column-chooser
|
|
58
67
|
[columns]="ogridService.columnChooser().columns"
|
|
@@ -62,7 +71,7 @@ OGridComponent = __decorate([
|
|
|
62
71
|
}
|
|
63
72
|
</ng-container>
|
|
64
73
|
|
|
65
|
-
<ogrid-datagrid-table [props]="dataGridProps()" />
|
|
74
|
+
<ogrid-datagrid-table [props]="ogridService.dataGridProps()" />
|
|
66
75
|
|
|
67
76
|
<ng-container pagination>
|
|
68
77
|
<ogrid-pagination-controls
|
|
@@ -4,30 +4,13 @@ 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,
|
|
8
|
-
import {
|
|
7
|
+
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
8
|
+
import { BasePaginationControlsComponent } from '@alaarab/ogrid-angular';
|
|
9
9
|
/**
|
|
10
10
|
* Pagination controls component using Angular Material styling.
|
|
11
11
|
* Standalone component with inline template — no Angular Material dependency for pagination.
|
|
12
12
|
*/
|
|
13
|
-
let PaginationControlsComponent = class PaginationControlsComponent {
|
|
14
|
-
constructor() {
|
|
15
|
-
this.currentPage = input.required();
|
|
16
|
-
this.pageSize = input.required();
|
|
17
|
-
this.totalCount = input.required();
|
|
18
|
-
this.pageSizeOptions = input(undefined);
|
|
19
|
-
this.entityLabelPlural = input('items');
|
|
20
|
-
this.pageChange = output();
|
|
21
|
-
this.pageSizeChange = output();
|
|
22
|
-
this.vm = computed(() => {
|
|
23
|
-
const opts = this.pageSizeOptions();
|
|
24
|
-
return getPaginationViewModel(this.currentPage(), this.pageSize(), this.totalCount(), opts ? { pageSizeOptions: opts } : undefined);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
onPageSizeSelect(event) {
|
|
28
|
-
const value = Number(event.target.value);
|
|
29
|
-
this.pageSizeChange.emit(value);
|
|
30
|
-
}
|
|
13
|
+
let PaginationControlsComponent = class PaginationControlsComponent extends BasePaginationControlsComponent {
|
|
31
14
|
};
|
|
32
15
|
PaginationControlsComponent = __decorate([
|
|
33
16
|
Component({
|
|
@@ -38,20 +21,20 @@ PaginationControlsComponent = __decorate([
|
|
|
38
21
|
@if (vm(); as vm) {
|
|
39
22
|
<nav class="ogrid-pagination" role="navigation" aria-label="Pagination">
|
|
40
23
|
<span class="ogrid-pagination__info">
|
|
41
|
-
Showing {{ vm.startItem }} to {{ vm.endItem }} of {{ totalCount
|
|
24
|
+
Showing {{ vm.startItem }} to {{ vm.endItem }} of {{ totalCount.toLocaleString() }} {{ entityLabelPlural }}
|
|
42
25
|
</span>
|
|
43
26
|
|
|
44
27
|
<span class="ogrid-pagination__pages">
|
|
45
28
|
<button
|
|
46
29
|
class="ogrid-pagination__btn"
|
|
47
|
-
[disabled]="currentPage
|
|
30
|
+
[disabled]="currentPage === 1"
|
|
48
31
|
(click)="pageChange.emit(1)"
|
|
49
32
|
aria-label="First page"
|
|
50
33
|
>«</button>
|
|
51
34
|
<button
|
|
52
35
|
class="ogrid-pagination__btn"
|
|
53
|
-
[disabled]="currentPage
|
|
54
|
-
(click)="pageChange.emit(currentPage
|
|
36
|
+
[disabled]="currentPage === 1"
|
|
37
|
+
(click)="pageChange.emit(currentPage - 1)"
|
|
55
38
|
aria-label="Previous page"
|
|
56
39
|
>‹</button>
|
|
57
40
|
|
|
@@ -63,10 +46,10 @@ PaginationControlsComponent = __decorate([
|
|
|
63
46
|
@for (pageNum of vm.pageNumbers; track pageNum) {
|
|
64
47
|
<button
|
|
65
48
|
class="ogrid-pagination__btn"
|
|
66
|
-
[class.ogrid-pagination__btn--active]="currentPage
|
|
49
|
+
[class.ogrid-pagination__btn--active]="currentPage === pageNum"
|
|
67
50
|
(click)="pageChange.emit(pageNum)"
|
|
68
51
|
[attr.aria-label]="'Page ' + pageNum"
|
|
69
|
-
[attr.aria-current]="currentPage
|
|
52
|
+
[attr.aria-current]="currentPage === pageNum ? 'page' : null"
|
|
70
53
|
>{{ pageNum }}</button>
|
|
71
54
|
}
|
|
72
55
|
|
|
@@ -81,13 +64,13 @@ PaginationControlsComponent = __decorate([
|
|
|
81
64
|
|
|
82
65
|
<button
|
|
83
66
|
class="ogrid-pagination__btn"
|
|
84
|
-
[disabled]="currentPage
|
|
85
|
-
(click)="pageChange.emit(currentPage
|
|
67
|
+
[disabled]="currentPage >= vm.totalPages"
|
|
68
|
+
(click)="pageChange.emit(currentPage + 1)"
|
|
86
69
|
aria-label="Next page"
|
|
87
70
|
>›</button>
|
|
88
71
|
<button
|
|
89
72
|
class="ogrid-pagination__btn"
|
|
90
|
-
[disabled]="currentPage
|
|
73
|
+
[disabled]="currentPage >= vm.totalPages"
|
|
91
74
|
(click)="pageChange.emit(vm.totalPages)"
|
|
92
75
|
aria-label="Last page"
|
|
93
76
|
>»</button>
|
|
@@ -96,12 +79,12 @@ PaginationControlsComponent = __decorate([
|
|
|
96
79
|
<span class="ogrid-pagination__size">
|
|
97
80
|
<label>Rows
|
|
98
81
|
<select
|
|
99
|
-
[value]="pageSize
|
|
82
|
+
[value]="pageSize"
|
|
100
83
|
(change)="onPageSizeSelect($event)"
|
|
101
84
|
aria-label="Rows per page"
|
|
102
85
|
>
|
|
103
86
|
@for (n of vm.pageSizeOptions; track n) {
|
|
104
|
-
<option [value]="n" [selected]="pageSize
|
|
87
|
+
<option [value]="n" [selected]="pageSize === n">{{ n }}</option>
|
|
105
88
|
}
|
|
106
89
|
</select>
|
|
107
90
|
</label>
|
|
@@ -114,25 +97,29 @@ PaginationControlsComponent = __decorate([
|
|
|
114
97
|
.ogrid-pagination {
|
|
115
98
|
display: flex; align-items: center; justify-content: space-between;
|
|
116
99
|
flex-wrap: wrap; gap: 8px; padding: 6px 12px; font-size: 14px;
|
|
100
|
+
color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
|
|
117
101
|
}
|
|
118
|
-
.ogrid-pagination__info { color: rgba(0,0,0,0.6); }
|
|
102
|
+
.ogrid-pagination__info { color: var(--ogrid-fg-secondary, rgba(0, 0, 0, 0.6)); }
|
|
119
103
|
.ogrid-pagination__pages { display: flex; align-items: center; gap: 2px; }
|
|
120
104
|
.ogrid-pagination__btn {
|
|
121
105
|
min-width: 32px; height: 32px; padding: 0 6px;
|
|
122
|
-
border: 1px solid rgba(0,0,0,0.23); border-radius: 4px;
|
|
106
|
+
border: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.23)); border-radius: 4px;
|
|
123
107
|
background: transparent; cursor: pointer; font-size: 14px;
|
|
108
|
+
color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
|
|
124
109
|
}
|
|
110
|
+
.ogrid-pagination__btn:hover:not(:disabled) { background: var(--ogrid-hover-bg, rgba(0, 0, 0, 0.04)); }
|
|
125
111
|
.ogrid-pagination__btn:disabled { opacity: 0.38; cursor: default; }
|
|
126
112
|
.ogrid-pagination__btn--active {
|
|
127
113
|
background: var(--mat-sys-primary, #1976d2); color: #fff;
|
|
128
114
|
border-color: var(--mat-sys-primary, #1976d2);
|
|
129
115
|
}
|
|
130
|
-
.ogrid-pagination__ellipsis { margin: 0 4px; color: rgba(0,0,0,0.6); }
|
|
131
|
-
.ogrid-pagination__size { display: flex; align-items: center; gap: 8px; }
|
|
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)); }
|
|
132
118
|
.ogrid-pagination__size select {
|
|
133
119
|
min-width: 60px; height: 32px; padding: 4px 8px;
|
|
134
|
-
border: 1px solid rgba(0,0,0,0.23); border-radius: 4px;
|
|
120
|
+
border: 1px solid var(--ogrid-border, rgba(0, 0, 0, 0.23)); border-radius: 4px;
|
|
135
121
|
font-size: 14px; margin-left: 8px;
|
|
122
|
+
background: var(--ogrid-bg, #ffffff); color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
|
|
136
123
|
}
|
|
137
124
|
`],
|
|
138
125
|
})
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface IColumnChooserProps {
|
|
3
|
-
columns: IColumnDefinition[];
|
|
4
|
-
visibleColumns: Set<string>;
|
|
5
|
-
onVisibilityChange: (columnKey: string, visible: boolean) => void;
|
|
6
|
-
}
|
|
1
|
+
import { BaseColumnChooserComponent } from '@alaarab/ogrid-angular';
|
|
7
2
|
/**
|
|
8
3
|
* Column visibility chooser dropdown using Angular Material styling.
|
|
9
4
|
* Standalone component with inline template.
|
|
10
5
|
*/
|
|
11
|
-
export declare class ColumnChooserComponent {
|
|
12
|
-
readonly columns: import("@angular/core").InputSignal<IColumnDefinition[]>;
|
|
13
|
-
readonly visibleColumns: import("@angular/core").InputSignal<Set<string>>;
|
|
14
|
-
readonly visibilityChange: import("@angular/core").OutputEmitterRef<{
|
|
15
|
-
columnKey: string;
|
|
16
|
-
visible: boolean;
|
|
17
|
-
}>;
|
|
18
|
-
readonly isOpen: import("@angular/core").WritableSignal<boolean>;
|
|
19
|
-
readonly visibleCount: import("@angular/core").Signal<number>;
|
|
20
|
-
readonly totalCount: import("@angular/core").Signal<number>;
|
|
21
|
-
toggle(): void;
|
|
22
|
-
onCheckboxChange(columnKey: string, event: Event): void;
|
|
23
|
-
selectAll(): void;
|
|
24
|
-
clearAll(): void;
|
|
6
|
+
export declare class ColumnChooserComponent extends BaseColumnChooserComponent {
|
|
25
7
|
onDocumentClick(event: MouseEvent): void;
|
|
26
8
|
}
|
|
@@ -1,73 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
columnKey: string;
|
|
4
|
-
columnName: string;
|
|
5
|
-
filterType: ColumnFilterType;
|
|
6
|
-
isSorted?: boolean;
|
|
7
|
-
isSortedDescending?: boolean;
|
|
8
|
-
onSort?: () => void;
|
|
9
|
-
selectedValues?: string[];
|
|
10
|
-
onFilterChange?: (values: string[]) => void;
|
|
11
|
-
options?: string[];
|
|
12
|
-
isLoadingOptions?: boolean;
|
|
13
|
-
textValue?: string;
|
|
14
|
-
onTextChange?: (value: string) => void;
|
|
15
|
-
selectedUser?: UserLike;
|
|
16
|
-
onUserChange?: (user: UserLike | undefined) => void;
|
|
17
|
-
peopleSearch?: (query: string) => Promise<UserLike[]>;
|
|
18
|
-
dateValue?: IDateFilterValue;
|
|
19
|
-
onDateChange?: (value: IDateFilterValue | undefined) => void;
|
|
20
|
-
}
|
|
1
|
+
import { ElementRef } from '@angular/core';
|
|
2
|
+
import { BaseColumnHeaderFilterComponent } from '@alaarab/ogrid-angular';
|
|
21
3
|
/**
|
|
22
4
|
* Column header filter component with sort + filter icon + popover.
|
|
23
5
|
* Standalone component with inline template.
|
|
24
6
|
*/
|
|
25
|
-
export declare class ColumnHeaderFilterComponent {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
readonly isSorted: import("@angular/core").InputSignal<boolean>;
|
|
30
|
-
readonly isSortedDescending: import("@angular/core").InputSignal<boolean>;
|
|
31
|
-
readonly onSort: import("@angular/core").InputSignal<(() => void) | undefined>;
|
|
32
|
-
readonly selectedValues: import("@angular/core").InputSignal<string[] | undefined>;
|
|
33
|
-
readonly onFilterChange: import("@angular/core").InputSignal<((values: string[]) => void) | undefined>;
|
|
34
|
-
readonly options: import("@angular/core").InputSignal<string[] | undefined>;
|
|
35
|
-
readonly isLoadingOptions: import("@angular/core").InputSignal<boolean>;
|
|
36
|
-
readonly textValue: import("@angular/core").InputSignal<string>;
|
|
37
|
-
readonly onTextChange: import("@angular/core").InputSignal<((value: string) => void) | undefined>;
|
|
38
|
-
readonly selectedUser: import("@angular/core").InputSignal<UserLike | undefined>;
|
|
39
|
-
readonly onUserChange: import("@angular/core").InputSignal<((user: UserLike | undefined) => void) | undefined>;
|
|
40
|
-
readonly peopleSearch: import("@angular/core").InputSignal<((query: string) => Promise<UserLike[]>) | undefined>;
|
|
41
|
-
readonly dateValue: import("@angular/core").InputSignal<IDateFilterValue | undefined>;
|
|
42
|
-
readonly onDateChange: import("@angular/core").InputSignal<((value: IDateFilterValue | undefined) => void) | undefined>;
|
|
43
|
-
private readonly headerEl;
|
|
44
|
-
readonly isFilterOpen: import("@angular/core").WritableSignal<boolean>;
|
|
45
|
-
readonly tempTextValue: import("@angular/core").WritableSignal<string>;
|
|
46
|
-
readonly searchText: import("@angular/core").WritableSignal<string>;
|
|
47
|
-
readonly tempSelected: import("@angular/core").WritableSignal<Set<string>>;
|
|
48
|
-
readonly peopleSearchText: import("@angular/core").WritableSignal<string>;
|
|
49
|
-
readonly peopleSuggestions: import("@angular/core").WritableSignal<UserLike[]>;
|
|
50
|
-
readonly isPeopleLoading: import("@angular/core").WritableSignal<boolean>;
|
|
51
|
-
readonly tempDateFrom: import("@angular/core").WritableSignal<string>;
|
|
52
|
-
readonly tempDateTo: import("@angular/core").WritableSignal<string>;
|
|
53
|
-
readonly popoverTop: import("@angular/core").WritableSignal<number>;
|
|
54
|
-
readonly popoverLeft: import("@angular/core").WritableSignal<number>;
|
|
55
|
-
private peopleDebounceTimer;
|
|
56
|
-
readonly hasActiveFilter: import("@angular/core").Signal<boolean>;
|
|
57
|
-
readonly filteredOptions: import("@angular/core").Signal<string[]>;
|
|
58
|
-
asInputValue(event: Event): string;
|
|
59
|
-
toggleFilter(event: MouseEvent): void;
|
|
60
|
-
onTextKeydown(event: KeyboardEvent): void;
|
|
61
|
-
handleTextApply(): void;
|
|
62
|
-
handleTextClear(): void;
|
|
63
|
-
handleCheckboxChange(option: string, event: Event): void;
|
|
64
|
-
handleSelectAllFiltered(): void;
|
|
65
|
-
handleClearSelection(): void;
|
|
66
|
-
handleApplyMultiSelect(): void;
|
|
67
|
-
onPeopleSearchInput(event: Event): void;
|
|
68
|
-
handleUserSelect(user: UserLike): void;
|
|
69
|
-
handleClearUser(): void;
|
|
70
|
-
handleDateApply(): void;
|
|
71
|
-
handleDateClear(): void;
|
|
72
|
-
onDocumentClick(event: MouseEvent): void;
|
|
7
|
+
export declare class ColumnHeaderFilterComponent extends BaseColumnHeaderFilterComponent {
|
|
8
|
+
private headerEl?;
|
|
9
|
+
protected getHeaderEl(): ElementRef<HTMLElement> | undefined;
|
|
10
|
+
onDocumentClickWrapper(event: MouseEvent): void;
|
|
73
11
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { MatMenuTrigger } from '@angular/material/menu';
|
|
2
|
+
import { type IColumnHeaderMenuItem, type ColumnHeaderMenuHandlers } from '@alaarab/ogrid-core';
|
|
2
3
|
/**
|
|
3
|
-
* Column header dropdown menu for pin/unpin actions.
|
|
4
|
+
* Column header dropdown menu for pin/unpin, sort, and autosize actions.
|
|
4
5
|
* Uses Angular Material MatMenu.
|
|
5
6
|
*/
|
|
6
7
|
export declare class ColumnHeaderMenuComponent {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
handleUnpin(): void;
|
|
8
|
+
columnId: string;
|
|
9
|
+
canPinLeft: boolean;
|
|
10
|
+
canPinRight: boolean;
|
|
11
|
+
canUnpin: boolean;
|
|
12
|
+
currentSort: 'asc' | 'desc' | null;
|
|
13
|
+
isSortable: boolean;
|
|
14
|
+
isResizable: boolean;
|
|
15
|
+
handlers: Partial<ColumnHeaderMenuHandlers>;
|
|
16
|
+
menuTrigger?: MatMenuTrigger;
|
|
17
|
+
readonly menuItems: import("@angular/core").Signal<IColumnHeaderMenuItem[]>;
|
|
18
|
+
handleMenuItemClick(itemId: string): void;
|
|
19
19
|
}
|
|
@@ -6,11 +6,24 @@ import type { IOGridDataGridProps } from '@alaarab/ogrid-angular';
|
|
|
6
6
|
* Standalone component — this is the workhorse of the grid.
|
|
7
7
|
*/
|
|
8
8
|
export declare class DataGridTableComponent<T> extends BaseDataGridTableComponent<T> {
|
|
9
|
-
readonly
|
|
10
|
-
|
|
11
|
-
private
|
|
9
|
+
private readonly propsSignal;
|
|
10
|
+
set propsInput(value: IOGridDataGridProps<T>);
|
|
11
|
+
private wrapperRef?;
|
|
12
|
+
private tableContainerRef?;
|
|
12
13
|
constructor();
|
|
13
14
|
protected getProps(): IOGridDataGridProps<T> | undefined;
|
|
14
15
|
protected getWrapperRef(): ElementRef<HTMLElement> | undefined;
|
|
15
16
|
protected getTableContainerRef(): ElementRef<HTMLElement> | undefined;
|
|
17
|
+
/** Build column header menu handlers for a given column */
|
|
18
|
+
protected getColumnMenuHandlers(columnId: string): {
|
|
19
|
+
onPinLeft: () => void;
|
|
20
|
+
onPinRight: () => void;
|
|
21
|
+
onUnpin: () => void;
|
|
22
|
+
onSortAsc: () => void;
|
|
23
|
+
onSortDesc: () => void;
|
|
24
|
+
onClearSort: () => void;
|
|
25
|
+
onAutosizeThis: () => void;
|
|
26
|
+
onAutosizeAll: () => void;
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
};
|
|
16
29
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { ElementRef, AfterViewInit } from '@angular/core';
|
|
1
|
+
import { EventEmitter, ElementRef, AfterViewInit } from '@angular/core';
|
|
2
2
|
import type { IColumnDef } from '@alaarab/ogrid-angular';
|
|
3
3
|
export declare class InlineCellEditorComponent<T = unknown> implements AfterViewInit {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
value: unknown;
|
|
5
|
+
item: T;
|
|
6
|
+
column: IColumnDef<T>;
|
|
7
|
+
rowIndex: number;
|
|
8
|
+
editorType: 'text' | 'select' | 'checkbox' | 'date' | 'richSelect';
|
|
9
|
+
commit: EventEmitter<unknown>;
|
|
10
|
+
cancel: EventEmitter<void>;
|
|
11
|
+
inputEl?: ElementRef<HTMLInputElement | HTMLSelectElement>;
|
|
12
12
|
readonly localValue: import("@angular/core").WritableSignal<unknown>;
|
|
13
13
|
readonly selectOptions: import("@angular/core").WritableSignal<unknown[]>;
|
|
14
|
-
|
|
14
|
+
private _initialized;
|
|
15
|
+
ngOnInit(): void;
|
|
16
|
+
ngOnChanges(): void;
|
|
17
|
+
private syncFromInputs;
|
|
15
18
|
ngAfterViewInit(): void;
|
|
16
19
|
commitValue(value: unknown): void;
|
|
17
20
|
onTextKeyDown(e: KeyboardEvent): void;
|