@alaarab/ogrid-angular-primeng 2.0.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.
- package/dist/esm/column-chooser/column-chooser.component.js +94 -0
- package/dist/esm/column-header-filter/column-header-filter.component.js +383 -0
- package/dist/esm/datagrid-table/datagrid-table.component.js +633 -0
- package/dist/esm/datagrid-table/inline-cell-editor.component.js +150 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/ogrid/ogrid.component.js +125 -0
- package/dist/esm/pagination-controls/pagination-controls.component.js +126 -0
- package/dist/types/column-chooser/column-chooser.component.d.ts +15 -0
- package/dist/types/column-header-filter/column-header-filter.component.d.ts +51 -0
- package/dist/types/datagrid-table/datagrid-table.component.d.ts +130 -0
- package/dist/types/datagrid-table/inline-cell-editor.component.d.ts +21 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/ogrid/ogrid.component.d.ts +23 -0
- package/dist/types/pagination-controls/pagination-controls.component.d.ts +12 -0
- package/package.json +45 -0
|
@@ -0,0 +1,150 @@
|
|
|
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, input, output, signal, effect, viewChild } from '@angular/core';
|
|
8
|
+
import { CommonModule } from '@angular/common';
|
|
9
|
+
let InlineCellEditorComponent = class InlineCellEditorComponent {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.value = input.required();
|
|
12
|
+
this.item = input.required();
|
|
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');
|
|
19
|
+
this.localValue = signal('');
|
|
20
|
+
this.selectOptions = signal([]);
|
|
21
|
+
effect(() => {
|
|
22
|
+
const v = this.value();
|
|
23
|
+
this.localValue.set(v != null ? String(v) : '');
|
|
24
|
+
const col = this.column();
|
|
25
|
+
if (col.cellEditorParams?.values) {
|
|
26
|
+
this.selectOptions.set(col.cellEditorParams.values);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
ngAfterViewInit() {
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
const el = this.inputEl()?.nativeElement;
|
|
33
|
+
if (el) {
|
|
34
|
+
el.focus();
|
|
35
|
+
if (el instanceof HTMLInputElement && el.type === 'text') {
|
|
36
|
+
el.select();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
commitValue(value) {
|
|
42
|
+
this.commit.emit(value);
|
|
43
|
+
}
|
|
44
|
+
onTextKeyDown(e) {
|
|
45
|
+
if (e.key === 'Enter') {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
this.commitValue(this.localValue());
|
|
48
|
+
}
|
|
49
|
+
else if (e.key === 'Escape') {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
this.cancel.emit();
|
|
52
|
+
}
|
|
53
|
+
else if (e.key === 'Tab') {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
this.commitValue(this.localValue());
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
onSelectKeyDown(e) {
|
|
59
|
+
if (e.key === 'Escape') {
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
this.cancel.emit();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
onCheckboxKeyDown(e) {
|
|
65
|
+
if (e.key === 'Escape') {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
this.cancel.emit();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
onTextBlur() {
|
|
71
|
+
this.commitValue(this.localValue());
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
InlineCellEditorComponent = __decorate([
|
|
75
|
+
Component({
|
|
76
|
+
selector: 'ogrid-primeng-inline-cell-editor',
|
|
77
|
+
standalone: true,
|
|
78
|
+
imports: [CommonModule],
|
|
79
|
+
template: `
|
|
80
|
+
@switch (editorType()) {
|
|
81
|
+
@case ('text') {
|
|
82
|
+
<input
|
|
83
|
+
#inputEl
|
|
84
|
+
type="text"
|
|
85
|
+
[value]="localValue()"
|
|
86
|
+
(input)="localValue.set($any($event.target).value)"
|
|
87
|
+
(keydown)="onTextKeyDown($event)"
|
|
88
|
+
(blur)="onTextBlur()"
|
|
89
|
+
style="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)"
|
|
90
|
+
/>
|
|
91
|
+
}
|
|
92
|
+
@case ('select') {
|
|
93
|
+
<div style="width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;overflow:hidden;min-width:0">
|
|
94
|
+
<select
|
|
95
|
+
#inputEl
|
|
96
|
+
[value]="localValue()"
|
|
97
|
+
(change)="commitValue($any($event.target).value)"
|
|
98
|
+
(keydown)="onSelectKeyDown($event)"
|
|
99
|
+
style="width:100%;border:none;outline:none;background:transparent;font:inherit;cursor:pointer;color:var(--ogrid-fg, #242424)"
|
|
100
|
+
>
|
|
101
|
+
@for (opt of selectOptions(); track opt) {
|
|
102
|
+
<option [value]="opt">{{ opt }}</option>
|
|
103
|
+
}
|
|
104
|
+
</select>
|
|
105
|
+
</div>
|
|
106
|
+
}
|
|
107
|
+
@case ('checkbox') {
|
|
108
|
+
<div style="display:flex;align-items:center;justify-content:center;width:100%;height:100%">
|
|
109
|
+
<input
|
|
110
|
+
type="checkbox"
|
|
111
|
+
[checked]="!!localValue()"
|
|
112
|
+
(change)="commitValue($any($event.target).checked)"
|
|
113
|
+
(keydown)="onCheckboxKeyDown($event)"
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
}
|
|
117
|
+
@case ('date') {
|
|
118
|
+
<input
|
|
119
|
+
#inputEl
|
|
120
|
+
type="date"
|
|
121
|
+
[value]="localValue()"
|
|
122
|
+
(change)="commitValue($any($event.target).value)"
|
|
123
|
+
(keydown)="onTextKeyDown($event)"
|
|
124
|
+
(blur)="onTextBlur()"
|
|
125
|
+
style="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)"
|
|
126
|
+
/>
|
|
127
|
+
}
|
|
128
|
+
@default {
|
|
129
|
+
<input
|
|
130
|
+
#inputEl
|
|
131
|
+
type="text"
|
|
132
|
+
[value]="localValue()"
|
|
133
|
+
(input)="localValue.set($any($event.target).value)"
|
|
134
|
+
(keydown)="onTextKeyDown($event)"
|
|
135
|
+
(blur)="onTextBlur()"
|
|
136
|
+
style="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)"
|
|
137
|
+
/>
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
`,
|
|
141
|
+
styles: [`
|
|
142
|
+
:host {
|
|
143
|
+
display: block;
|
|
144
|
+
width: 100%;
|
|
145
|
+
height: 100%;
|
|
146
|
+
}
|
|
147
|
+
`],
|
|
148
|
+
})
|
|
149
|
+
], InlineCellEditorComponent);
|
|
150
|
+
export { InlineCellEditorComponent };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Re-export everything from angular adapter
|
|
2
|
+
export * from '@alaarab/ogrid-angular';
|
|
3
|
+
// PrimeNG UI components
|
|
4
|
+
export { OGridComponent } from './ogrid/ogrid.component';
|
|
5
|
+
export { DataGridTableComponent } from './datagrid-table/datagrid-table.component';
|
|
6
|
+
export { InlineCellEditorComponent } from './datagrid-table/inline-cell-editor.component';
|
|
7
|
+
export { ColumnHeaderFilterComponent } from './column-header-filter/column-header-filter.component';
|
|
8
|
+
export { ColumnChooserComponent } from './column-chooser/column-chooser.component';
|
|
9
|
+
export { PaginationControlsComponent } from './pagination-controls/pagination-controls.component';
|
|
@@ -0,0 +1,125 @@
|
|
|
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, input, computed, effect, inject, ChangeDetectionStrategy } from '@angular/core';
|
|
8
|
+
import { CommonModule } from '@angular/common';
|
|
9
|
+
import { OGridService, OGridLayoutComponent, } from '@alaarab/ogrid-angular';
|
|
10
|
+
import { DataGridTableComponent } from '../datagrid-table/datagrid-table.component';
|
|
11
|
+
import { ColumnChooserComponent } from '../column-chooser/column-chooser.component';
|
|
12
|
+
import { PaginationControlsComponent } from '../pagination-controls/pagination-controls.component';
|
|
13
|
+
let OGridComponent = class OGridComponent {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.service = inject(OGridService);
|
|
16
|
+
this.props = input.required();
|
|
17
|
+
// Stable callback references (avoid re-creating every template eval)
|
|
18
|
+
this.onColumnSortFn = (columnKey) => this.service.handleSort(columnKey);
|
|
19
|
+
this.onColumnResizedFn = (columnId, width) => this.service.handleColumnResized(columnId, width);
|
|
20
|
+
this.onColumnPinnedFn = (columnId, pinned) => this.service.handleColumnPinned(columnId, pinned);
|
|
21
|
+
this.onSelectionChangeFn = (event) => this.service.handleSelectionChange(event);
|
|
22
|
+
this.onFilterChangeFn = (key, value) => this.service.handleFilterChange(key, value);
|
|
23
|
+
this.showToolbar = computed(() => this.service.columnChooserPlacement() === 'toolbar' || this.service.toolbar() != null);
|
|
24
|
+
this.emptyStateObj = computed(() => ({
|
|
25
|
+
hasActiveFilters: this.service.hasActiveFilters(),
|
|
26
|
+
onClearAll: () => this.service.setFilters({}),
|
|
27
|
+
message: this.service.emptyState()?.message,
|
|
28
|
+
render: this.service.emptyState()?.render,
|
|
29
|
+
}));
|
|
30
|
+
effect(() => {
|
|
31
|
+
this.service.configure(this.props());
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
onPageSizeChange(size) {
|
|
35
|
+
this.service.setPageSize(size);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
OGridComponent = __decorate([
|
|
39
|
+
Component({
|
|
40
|
+
selector: 'ogrid-primeng',
|
|
41
|
+
standalone: true,
|
|
42
|
+
imports: [
|
|
43
|
+
CommonModule,
|
|
44
|
+
OGridLayoutComponent,
|
|
45
|
+
DataGridTableComponent,
|
|
46
|
+
ColumnChooserComponent,
|
|
47
|
+
PaginationControlsComponent,
|
|
48
|
+
],
|
|
49
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
50
|
+
providers: [OGridService],
|
|
51
|
+
template: `
|
|
52
|
+
<ogrid-layout
|
|
53
|
+
[className]="service.className()"
|
|
54
|
+
[hasToolbar]="showToolbar()"
|
|
55
|
+
[hasToolbarBelow]="false"
|
|
56
|
+
[hasPagination]="true"
|
|
57
|
+
[sideBar]="service.sideBarProps()"
|
|
58
|
+
>
|
|
59
|
+
<ng-content select="[toolbar]" toolbar></ng-content>
|
|
60
|
+
|
|
61
|
+
<div toolbarEnd>
|
|
62
|
+
@if (service.columnChooserPlacement() === 'toolbar') {
|
|
63
|
+
<ogrid-primeng-column-chooser
|
|
64
|
+
[columns]="service.columnChooser().columns"
|
|
65
|
+
[visibleColumns]="service.columnChooser().visibleColumns"
|
|
66
|
+
(visibilityChange)="service.handleVisibilityChange($event.columnKey, $event.visible)"
|
|
67
|
+
></ogrid-primeng-column-chooser>
|
|
68
|
+
}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<ogrid-primeng-datagrid-table
|
|
72
|
+
[items]="service.displayItems()"
|
|
73
|
+
[columns]="service.columnsProp()"
|
|
74
|
+
[getRowId]="service.getRowId()"
|
|
75
|
+
[sortBy]="service.sort().field"
|
|
76
|
+
[sortDirection]="service.sort().direction"
|
|
77
|
+
[onColumnSort]="onColumnSortFn"
|
|
78
|
+
[visibleColumns]="service.visibleColumns()"
|
|
79
|
+
[columnOrder]="service.columnOrder()"
|
|
80
|
+
[onColumnOrderChange]="service.onColumnOrderChange()"
|
|
81
|
+
[onColumnResized]="onColumnResizedFn"
|
|
82
|
+
[onColumnPinned]="onColumnPinnedFn"
|
|
83
|
+
[freezeRows]="service.freezeRows()"
|
|
84
|
+
[freezeCols]="service.freezeCols()"
|
|
85
|
+
[editable]="service.editable()"
|
|
86
|
+
[cellSelection]="service.cellSelection()"
|
|
87
|
+
[onCellValueChanged]="service.onCellValueChanged()"
|
|
88
|
+
[onUndo]="service.onUndo()"
|
|
89
|
+
[onRedo]="service.onRedo()"
|
|
90
|
+
[canUndo]="service.canUndo()"
|
|
91
|
+
[canRedo]="service.canRedo()"
|
|
92
|
+
[rowSelection]="service.rowSelection()"
|
|
93
|
+
[selectedRows]="service.effectiveSelectedRows()"
|
|
94
|
+
[onSelectionChange]="onSelectionChangeFn"
|
|
95
|
+
[statusBar]="service.statusBarConfig()"
|
|
96
|
+
[isLoading]="service.isLoadingResolved()"
|
|
97
|
+
[filters]="service.filters()"
|
|
98
|
+
[onFilterChange]="onFilterChangeFn"
|
|
99
|
+
[filterOptions]="service.clientFilterOptions()"
|
|
100
|
+
[loadingFilterOptions]="service.loadingFilterOptions()"
|
|
101
|
+
[peopleSearch]="service.dataSource()?.searchPeople?.bind(service.dataSource())"
|
|
102
|
+
[getUserByEmail]="service.dataSource()?.getUserByEmail?.bind(service.dataSource())"
|
|
103
|
+
[layoutMode]="service.layoutMode()"
|
|
104
|
+
[suppressHorizontalScroll]="service.suppressHorizontalScroll()"
|
|
105
|
+
[aria-label]="service.ariaLabel()"
|
|
106
|
+
[aria-labelledby]="service.ariaLabelledBy()"
|
|
107
|
+
[emptyState]="emptyStateObj()"
|
|
108
|
+
></ogrid-primeng-datagrid-table>
|
|
109
|
+
|
|
110
|
+
<div pagination>
|
|
111
|
+
<ogrid-primeng-pagination-controls
|
|
112
|
+
[currentPage]="service.pagination().page"
|
|
113
|
+
[pageSize]="service.pagination().pageSize"
|
|
114
|
+
[totalCount]="service.pagination().displayTotalCount"
|
|
115
|
+
[pageSizeOptions]="service.pageSizeOptions()"
|
|
116
|
+
[entityLabelPlural]="service.entityLabelPlural()"
|
|
117
|
+
(pageChange)="service.setPage($event)"
|
|
118
|
+
(pageSizeChange)="onPageSizeChange($event)"
|
|
119
|
+
></ogrid-primeng-pagination-controls>
|
|
120
|
+
</div>
|
|
121
|
+
</ogrid-layout>
|
|
122
|
+
`,
|
|
123
|
+
})
|
|
124
|
+
], OGridComponent);
|
|
125
|
+
export { OGridComponent };
|
|
@@ -0,0 +1,126 @@
|
|
|
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, input, output, computed } from '@angular/core';
|
|
8
|
+
import { CommonModule } from '@angular/common';
|
|
9
|
+
import { getPaginationViewModel } from '@alaarab/ogrid-core';
|
|
10
|
+
let PaginationControlsComponent = class PaginationControlsComponent {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.currentPage = input.required();
|
|
13
|
+
this.pageSize = input.required();
|
|
14
|
+
this.totalCount = input.required();
|
|
15
|
+
this.pageSizeOptions = input(undefined);
|
|
16
|
+
this.entityLabelPlural = input('items');
|
|
17
|
+
this.pageChange = output();
|
|
18
|
+
this.pageSizeChange = output();
|
|
19
|
+
this.labelPlural = computed(() => this.entityLabelPlural() ?? 'items');
|
|
20
|
+
this.vm = computed(() => getPaginationViewModel(this.currentPage(), this.pageSize(), this.totalCount(), this.pageSizeOptions() ? { pageSizeOptions: this.pageSizeOptions() } : undefined));
|
|
21
|
+
}
|
|
22
|
+
onPageSizeChange(value) {
|
|
23
|
+
this.pageSizeChange.emit(Number(value));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
PaginationControlsComponent = __decorate([
|
|
27
|
+
Component({
|
|
28
|
+
selector: 'ogrid-primeng-pagination-controls',
|
|
29
|
+
standalone: true,
|
|
30
|
+
imports: [CommonModule],
|
|
31
|
+
template: `
|
|
32
|
+
@if (vm()) {
|
|
33
|
+
<div style="display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:13px;color:var(--ogrid-fg, #242424)">
|
|
34
|
+
<div>
|
|
35
|
+
Showing {{ vm()!.startItem }} to {{ vm()!.endItem }} of {{ totalCount().toLocaleString() }} {{ labelPlural() }}
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div style="display:flex;align-items:center;gap:4px" role="navigation" aria-label="Pagination">
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
class="p-button p-button-text p-button-sm"
|
|
42
|
+
[disabled]="currentPage() === 1"
|
|
43
|
+
(click)="pageChange.emit(1)"
|
|
44
|
+
aria-label="First page"
|
|
45
|
+
style="min-width:32px;padding:4px 8px"
|
|
46
|
+
>«</button>
|
|
47
|
+
<button
|
|
48
|
+
type="button"
|
|
49
|
+
class="p-button p-button-text p-button-sm"
|
|
50
|
+
[disabled]="currentPage() === 1"
|
|
51
|
+
(click)="pageChange.emit(currentPage() - 1)"
|
|
52
|
+
aria-label="Previous page"
|
|
53
|
+
style="min-width:32px;padding:4px 8px"
|
|
54
|
+
>‹</button>
|
|
55
|
+
|
|
56
|
+
@if (vm()!.showStartEllipsis) {
|
|
57
|
+
<button
|
|
58
|
+
type="button"
|
|
59
|
+
class="p-button p-button-text p-button-sm"
|
|
60
|
+
(click)="pageChange.emit(1)"
|
|
61
|
+
aria-label="Page 1"
|
|
62
|
+
style="min-width:32px;padding:4px 8px"
|
|
63
|
+
>1</button>
|
|
64
|
+
<span aria-hidden style="padding:0 4px">…</span>
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@for (pageNum of vm()!.pageNumbers; track pageNum) {
|
|
68
|
+
<button
|
|
69
|
+
type="button"
|
|
70
|
+
class="p-button p-button-sm"
|
|
71
|
+
[class.p-button-outlined]="currentPage() !== pageNum"
|
|
72
|
+
(click)="pageChange.emit(pageNum)"
|
|
73
|
+
[attr.aria-label]="'Page ' + pageNum"
|
|
74
|
+
[attr.aria-current]="currentPage() === pageNum ? 'page' : null"
|
|
75
|
+
style="min-width:32px;padding:4px 8px"
|
|
76
|
+
>{{ pageNum }}</button>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@if (vm()!.showEndEllipsis) {
|
|
80
|
+
<span aria-hidden style="padding:0 4px">…</span>
|
|
81
|
+
<button
|
|
82
|
+
type="button"
|
|
83
|
+
class="p-button p-button-text p-button-sm"
|
|
84
|
+
(click)="pageChange.emit(vm()!.totalPages)"
|
|
85
|
+
[attr.aria-label]="'Page ' + vm()!.totalPages"
|
|
86
|
+
style="min-width:32px;padding:4px 8px"
|
|
87
|
+
>{{ vm()!.totalPages }}</button>
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
<button
|
|
91
|
+
type="button"
|
|
92
|
+
class="p-button p-button-text p-button-sm"
|
|
93
|
+
[disabled]="currentPage() >= vm()!.totalPages"
|
|
94
|
+
(click)="pageChange.emit(currentPage() + 1)"
|
|
95
|
+
aria-label="Next page"
|
|
96
|
+
style="min-width:32px;padding:4px 8px"
|
|
97
|
+
>›</button>
|
|
98
|
+
<button
|
|
99
|
+
type="button"
|
|
100
|
+
class="p-button p-button-text p-button-sm"
|
|
101
|
+
[disabled]="currentPage() >= vm()!.totalPages"
|
|
102
|
+
(click)="pageChange.emit(vm()!.totalPages)"
|
|
103
|
+
aria-label="Last page"
|
|
104
|
+
style="min-width:32px;padding:4px 8px"
|
|
105
|
+
>»</button>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div style="display:flex;align-items:center;gap:6px">
|
|
109
|
+
<span style="font-size:12px">Rows</span>
|
|
110
|
+
<select
|
|
111
|
+
[value]="'' + pageSize()"
|
|
112
|
+
(change)="onPageSizeChange($any($event.target).value)"
|
|
113
|
+
aria-label="Rows per page"
|
|
114
|
+
style="padding:4px 6px;border:1px solid var(--ogrid-border, #e0e0e0);border-radius:4px;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424)"
|
|
115
|
+
>
|
|
116
|
+
@for (opt of vm()!.pageSizeOptions; track opt) {
|
|
117
|
+
<option [value]="opt">{{ opt }}</option>
|
|
118
|
+
}
|
|
119
|
+
</select>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
}
|
|
123
|
+
`,
|
|
124
|
+
})
|
|
125
|
+
], PaginationControlsComponent);
|
|
126
|
+
export { PaginationControlsComponent };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IColumnDefinition } from '@alaarab/ogrid-angular';
|
|
2
|
+
export declare class ColumnChooserComponent {
|
|
3
|
+
readonly columns: import("@angular/core").InputSignal<IColumnDefinition[]>;
|
|
4
|
+
readonly visibleColumns: import("@angular/core").InputSignal<Set<string>>;
|
|
5
|
+
readonly visibilityChange: import("@angular/core").OutputEmitterRef<{
|
|
6
|
+
columnKey: string;
|
|
7
|
+
visible: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
readonly open: import("@angular/core").WritableSignal<boolean>;
|
|
10
|
+
protected readonly visibleCount: import("@angular/core").Signal<number>;
|
|
11
|
+
protected readonly totalCount: import("@angular/core").Signal<number>;
|
|
12
|
+
onToggle(columnKey: string, checked: boolean): void;
|
|
13
|
+
onSelectAll(): void;
|
|
14
|
+
onClearAll(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ElementRef } from '@angular/core';
|
|
2
|
+
import type { ColumnFilterType, IDateFilterValue, UserLike } from '@alaarab/ogrid-angular';
|
|
3
|
+
export declare class ColumnHeaderFilterComponent {
|
|
4
|
+
private destroyRef;
|
|
5
|
+
readonly columnKey: import("@angular/core").InputSignal<string>;
|
|
6
|
+
readonly columnName: import("@angular/core").InputSignal<string>;
|
|
7
|
+
readonly filterType: import("@angular/core").InputSignal<ColumnFilterType>;
|
|
8
|
+
readonly isSorted: import("@angular/core").InputSignal<boolean>;
|
|
9
|
+
readonly isSortedDescending: import("@angular/core").InputSignal<boolean>;
|
|
10
|
+
readonly onSort: import("@angular/core").InputSignal<(() => void) | undefined>;
|
|
11
|
+
readonly selectedValues: import("@angular/core").InputSignal<string[] | undefined>;
|
|
12
|
+
readonly onFilterChange: import("@angular/core").InputSignal<((values: string[]) => void) | undefined>;
|
|
13
|
+
readonly options: import("@angular/core").InputSignal<string[]>;
|
|
14
|
+
readonly isLoadingOptions: import("@angular/core").InputSignal<boolean>;
|
|
15
|
+
readonly textValue: import("@angular/core").InputSignal<string>;
|
|
16
|
+
readonly onTextChange: import("@angular/core").InputSignal<((value: string) => void) | undefined>;
|
|
17
|
+
readonly selectedUser: import("@angular/core").InputSignal<UserLike | undefined>;
|
|
18
|
+
readonly onUserChange: import("@angular/core").InputSignal<((user: UserLike | undefined) => void) | undefined>;
|
|
19
|
+
readonly peopleSearch: import("@angular/core").InputSignal<((query: string) => Promise<UserLike[]>) | undefined>;
|
|
20
|
+
readonly dateValue: import("@angular/core").InputSignal<IDateFilterValue | undefined>;
|
|
21
|
+
readonly onDateChange: import("@angular/core").InputSignal<((value: IDateFilterValue | undefined) => void) | undefined>;
|
|
22
|
+
readonly isFilterOpen: import("@angular/core").WritableSignal<boolean>;
|
|
23
|
+
readonly tempTextValue: import("@angular/core").WritableSignal<string>;
|
|
24
|
+
readonly searchText: import("@angular/core").WritableSignal<string>;
|
|
25
|
+
readonly tempSelected: import("@angular/core").WritableSignal<Set<string>>;
|
|
26
|
+
readonly peopleSearchText: import("@angular/core").WritableSignal<string>;
|
|
27
|
+
readonly peopleSuggestions: import("@angular/core").WritableSignal<UserLike[]>;
|
|
28
|
+
readonly isPeopleLoading: import("@angular/core").WritableSignal<boolean>;
|
|
29
|
+
readonly tempDateFrom: import("@angular/core").WritableSignal<string>;
|
|
30
|
+
readonly tempDateTo: import("@angular/core").WritableSignal<string>;
|
|
31
|
+
readonly filterTrigger: import("@angular/core").Signal<ElementRef<HTMLButtonElement> | undefined>;
|
|
32
|
+
readonly filterPanel: import("@angular/core").Signal<ElementRef<HTMLDivElement> | undefined>;
|
|
33
|
+
private peopleDebounceTimer;
|
|
34
|
+
private clickOutsideHandler;
|
|
35
|
+
readonly hasActiveFilter: import("@angular/core").Signal<boolean>;
|
|
36
|
+
readonly filteredOptions: import("@angular/core").Signal<string[]>;
|
|
37
|
+
constructor();
|
|
38
|
+
handleSortClick(): void;
|
|
39
|
+
toggleFilter(): void;
|
|
40
|
+
handleTextApply(): void;
|
|
41
|
+
handleTextClear(): void;
|
|
42
|
+
handleCheckboxChange(opt: string, checked: boolean): void;
|
|
43
|
+
handleSelectAllOptions(): void;
|
|
44
|
+
handleClearSelection(): void;
|
|
45
|
+
handleApplyMultiSelect(): void;
|
|
46
|
+
onPeopleSearchInput(value: string): void;
|
|
47
|
+
handleUserSelect(user: UserLike): void;
|
|
48
|
+
handleClearUser(): void;
|
|
49
|
+
handleDateApply(): void;
|
|
50
|
+
handleDateClear(): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ElementRef } from '@angular/core';
|
|
2
|
+
import type { IColumnDef, IColumnGroupDef, RowId } from '@alaarab/ogrid-angular';
|
|
3
|
+
export declare class DataGridTableComponent<T = unknown> {
|
|
4
|
+
private readonly stateService;
|
|
5
|
+
readonly wrapperRef: import("@angular/core").Signal<ElementRef<HTMLDivElement> | undefined>;
|
|
6
|
+
readonly tableContainerRef: import("@angular/core").Signal<ElementRef<HTMLDivElement> | undefined>;
|
|
7
|
+
readonly items: import("@angular/core").InputSignal<T[]>;
|
|
8
|
+
readonly columns: import("@angular/core").InputSignal<(IColumnDef<T> | IColumnGroupDef<T>)[]>;
|
|
9
|
+
readonly getRowIdFn: import("@angular/core").InputSignal<(item: T) => RowId>;
|
|
10
|
+
readonly sortBy: import("@angular/core").InputSignal<string | undefined>;
|
|
11
|
+
readonly sortDirection: import("@angular/core").InputSignal<"asc" | "desc">;
|
|
12
|
+
readonly onColumnSort: import("@angular/core").InputSignal<(columnKey: string) => void>;
|
|
13
|
+
readonly visibleColumns: import("@angular/core").InputSignal<Set<string>>;
|
|
14
|
+
readonly columnOrder: import("@angular/core").InputSignal<string[] | undefined>;
|
|
15
|
+
readonly onColumnOrderChange: import("@angular/core").InputSignal<((order: string[]) => void) | undefined>;
|
|
16
|
+
readonly onColumnResized: import("@angular/core").InputSignal<((columnId: string, width: number) => void) | undefined>;
|
|
17
|
+
readonly onColumnPinned: import("@angular/core").InputSignal<((columnId: string, pinned: "left" | "right" | null) => void) | undefined>;
|
|
18
|
+
readonly pinnedColumns: import("@angular/core").InputSignal<Record<string, "left" | "right"> | undefined>;
|
|
19
|
+
readonly initialColumnWidths: import("@angular/core").InputSignal<Record<string, number> | undefined>;
|
|
20
|
+
readonly freezeRows: import("@angular/core").InputSignal<number | undefined>;
|
|
21
|
+
readonly freezeCols: import("@angular/core").InputSignal<number | undefined>;
|
|
22
|
+
readonly layoutMode: import("@angular/core").InputSignal<"fill" | "content">;
|
|
23
|
+
readonly suppressHorizontalScroll: import("@angular/core").InputSignal<boolean | undefined>;
|
|
24
|
+
readonly isLoading: import("@angular/core").InputSignal<boolean>;
|
|
25
|
+
readonly loadingMessage: import("@angular/core").InputSignal<string>;
|
|
26
|
+
readonly editable: import("@angular/core").InputSignal<boolean | undefined>;
|
|
27
|
+
readonly cellSelection: import("@angular/core").InputSignal<boolean | undefined>;
|
|
28
|
+
readonly onCellValueChanged: import("@angular/core").InputSignal<((event: {
|
|
29
|
+
item: T;
|
|
30
|
+
columnId: string;
|
|
31
|
+
oldValue: unknown;
|
|
32
|
+
newValue: unknown;
|
|
33
|
+
rowIndex: number;
|
|
34
|
+
}) => void) | undefined>;
|
|
35
|
+
readonly onUndo: import("@angular/core").InputSignal<(() => void) | undefined>;
|
|
36
|
+
readonly onRedo: import("@angular/core").InputSignal<(() => void) | undefined>;
|
|
37
|
+
readonly canUndo: import("@angular/core").InputSignal<boolean | undefined>;
|
|
38
|
+
readonly canRedo: import("@angular/core").InputSignal<boolean | undefined>;
|
|
39
|
+
readonly rowSelectionMode: import("@angular/core").InputSignal<"none" | "single" | "multiple">;
|
|
40
|
+
readonly selectedRows: import("@angular/core").InputSignal<Set<RowId> | undefined>;
|
|
41
|
+
readonly onSelectionChange: import("@angular/core").InputSignal<((event: {
|
|
42
|
+
selectedRowIds: RowId[];
|
|
43
|
+
selectedItems: T[];
|
|
44
|
+
}) => void) | undefined>;
|
|
45
|
+
readonly statusBar: import("@angular/core").InputSignal<unknown>;
|
|
46
|
+
readonly filters: import("@angular/core").InputSignal<Record<string, unknown>>;
|
|
47
|
+
readonly onFilterChange: import("@angular/core").InputSignal<(key: string, value: unknown) => void>;
|
|
48
|
+
readonly filterOptions: import("@angular/core").InputSignal<Record<string, string[]>>;
|
|
49
|
+
readonly loadingFilterOptions: import("@angular/core").InputSignal<Record<string, boolean>>;
|
|
50
|
+
readonly peopleSearch: import("@angular/core").InputSignal<((query: string) => Promise<unknown[]>) | undefined>;
|
|
51
|
+
readonly getUserByEmail: import("@angular/core").InputSignal<((email: string) => Promise<unknown>) | undefined>;
|
|
52
|
+
readonly emptyState: import("@angular/core").InputSignal<{
|
|
53
|
+
onClearAll: () => void;
|
|
54
|
+
hasActiveFilters: boolean;
|
|
55
|
+
message?: string;
|
|
56
|
+
render?: unknown;
|
|
57
|
+
} | undefined>;
|
|
58
|
+
readonly onCellError: import("@angular/core").InputSignal<((error: Error) => void) | undefined>;
|
|
59
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
60
|
+
readonly ariaLabelledBy: import("@angular/core").InputSignal<string | undefined>;
|
|
61
|
+
readonly defaultMinWidth = 80;
|
|
62
|
+
readonly statusBarClasses: {
|
|
63
|
+
statusBar: string;
|
|
64
|
+
statusBarItem: string;
|
|
65
|
+
statusBarLabel: string;
|
|
66
|
+
statusBarValue: string;
|
|
67
|
+
};
|
|
68
|
+
private readonly columnSizingOverrides;
|
|
69
|
+
private resizeStartX;
|
|
70
|
+
private resizeColumnId;
|
|
71
|
+
private resizeStartWidth;
|
|
72
|
+
private lastMouseShift;
|
|
73
|
+
constructor();
|
|
74
|
+
readonly state: import("@angular/core").Signal<import("@alaarab/ogrid-angular").DataGridStateResult<T>>;
|
|
75
|
+
readonly tableContainerEl: import("@angular/core").Signal<HTMLDivElement | null>;
|
|
76
|
+
readonly resolvedAriaLabel: import("@angular/core").Signal<string | undefined>;
|
|
77
|
+
readonly headerRows: import("@angular/core").Signal<import("@alaarab/ogrid-angular").HeaderRow<T>[]>;
|
|
78
|
+
readonly allowOverflowX: import("@angular/core").Signal<boolean>;
|
|
79
|
+
readonly tableWidthStyle: import("@angular/core").Signal<"100%" | "fit-content">;
|
|
80
|
+
readonly tableMinWidthStyle: import("@angular/core").Signal<"100%" | "max-content">;
|
|
81
|
+
readonly selectedCellCount: import("@angular/core").Signal<number | undefined>;
|
|
82
|
+
trackByRowId(_index: number, item: T): RowId;
|
|
83
|
+
getColumnWidth(col: IColumnDef<T>): number | undefined;
|
|
84
|
+
getFilterConfig(col: IColumnDef<T>): {
|
|
85
|
+
filterType: string;
|
|
86
|
+
isSorted?: boolean;
|
|
87
|
+
isSortedDescending?: boolean;
|
|
88
|
+
onSort?: () => void;
|
|
89
|
+
selectedValues?: string[];
|
|
90
|
+
onFilterChange?: (values: string[]) => void;
|
|
91
|
+
options?: string[];
|
|
92
|
+
isLoadingOptions?: boolean;
|
|
93
|
+
textValue?: string;
|
|
94
|
+
onTextChange?: (value: string) => void;
|
|
95
|
+
selectedUser?: unknown;
|
|
96
|
+
onUserChange?: (user: unknown) => void;
|
|
97
|
+
peopleSearch?: (query: string) => Promise<unknown[]>;
|
|
98
|
+
dateValue?: {
|
|
99
|
+
from?: string;
|
|
100
|
+
to?: string;
|
|
101
|
+
};
|
|
102
|
+
onDateChange?: (value: {
|
|
103
|
+
from?: string;
|
|
104
|
+
to?: string;
|
|
105
|
+
} | undefined) => void;
|
|
106
|
+
};
|
|
107
|
+
getCellValueFn(item: T, col: IColumnDef<T>): unknown;
|
|
108
|
+
resolveCellDisplay(col: IColumnDef<T>, item: T): string;
|
|
109
|
+
getCellStyleObj(col: IColumnDef<T>, item: T): Record<string, string> | null;
|
|
110
|
+
canEditCell(col: IColumnDef<T>, item: T): boolean;
|
|
111
|
+
isEditingCell(item: T, col: IColumnDef<T>): boolean;
|
|
112
|
+
getEditorType(col: IColumnDef<T>, _item: T): 'text' | 'select' | 'checkbox' | 'date' | 'richSelect';
|
|
113
|
+
isActiveCell(rowIndex: number, colIdx: number): boolean;
|
|
114
|
+
isInSelectionRange(rowIndex: number, colIdx: number): boolean;
|
|
115
|
+
isSelectionEndCell(rowIndex: number, colIdx: number): boolean;
|
|
116
|
+
getCellBackground(rowIndex: number, colIdx: number): string | null;
|
|
117
|
+
onMouseDown(e: MouseEvent): void;
|
|
118
|
+
onGridKeyDown(e: KeyboardEvent): void;
|
|
119
|
+
onCellMouseDown(e: MouseEvent, rowIndex: number, globalColIndex: number): void;
|
|
120
|
+
onCellDblClick(item: T, col: IColumnDef<T>, rowIndex: number, colIdx: number): void;
|
|
121
|
+
onCellContextMenu(e: MouseEvent): void;
|
|
122
|
+
onCellEditorCommit(item: T, col: IColumnDef<T>, rowIndex: number, colIdx: number, newValue: unknown): void;
|
|
123
|
+
onFillHandleMouseDown(e: MouseEvent): void;
|
|
124
|
+
onSelectAllChange(checked: boolean): void;
|
|
125
|
+
onRowClick(e: MouseEvent, item: T): void;
|
|
126
|
+
onRowCheckboxChange(item: T, checked: boolean, rowIndex: number, e: Event): void;
|
|
127
|
+
handlePaste(): void;
|
|
128
|
+
onResizeStart(e: MouseEvent, col: IColumnDef<T>): void;
|
|
129
|
+
private buildProps;
|
|
130
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ElementRef, AfterViewInit } from '@angular/core';
|
|
2
|
+
import type { IColumnDef } from '@alaarab/ogrid-angular';
|
|
3
|
+
export declare class InlineCellEditorComponent<T = unknown> implements AfterViewInit {
|
|
4
|
+
readonly value: import("@angular/core").InputSignal<unknown>;
|
|
5
|
+
readonly item: import("@angular/core").InputSignal<T>;
|
|
6
|
+
readonly column: import("@angular/core").InputSignal<IColumnDef<T>>;
|
|
7
|
+
readonly rowIndex: import("@angular/core").InputSignal<number>;
|
|
8
|
+
readonly editorType: import("@angular/core").InputSignal<"text" | "date" | "select" | "checkbox" | "richSelect">;
|
|
9
|
+
readonly commit: import("@angular/core").OutputEmitterRef<unknown>;
|
|
10
|
+
readonly cancel: import("@angular/core").OutputEmitterRef<void>;
|
|
11
|
+
readonly inputEl: import("@angular/core").Signal<ElementRef<HTMLInputElement | HTMLSelectElement> | undefined>;
|
|
12
|
+
readonly localValue: import("@angular/core").WritableSignal<unknown>;
|
|
13
|
+
readonly selectOptions: import("@angular/core").WritableSignal<unknown[]>;
|
|
14
|
+
constructor();
|
|
15
|
+
ngAfterViewInit(): void;
|
|
16
|
+
commitValue(value: unknown): void;
|
|
17
|
+
onTextKeyDown(e: KeyboardEvent): void;
|
|
18
|
+
onSelectKeyDown(e: KeyboardEvent): void;
|
|
19
|
+
onCheckboxKeyDown(e: KeyboardEvent): void;
|
|
20
|
+
onTextBlur(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from '@alaarab/ogrid-angular';
|
|
2
|
+
export { OGridComponent } from './ogrid/ogrid.component';
|
|
3
|
+
export { DataGridTableComponent } from './datagrid-table/datagrid-table.component';
|
|
4
|
+
export { InlineCellEditorComponent } from './datagrid-table/inline-cell-editor.component';
|
|
5
|
+
export { ColumnHeaderFilterComponent } from './column-header-filter/column-header-filter.component';
|
|
6
|
+
export { ColumnChooserComponent } from './column-chooser/column-chooser.component';
|
|
7
|
+
export { PaginationControlsComponent } from './pagination-controls/pagination-controls.component';
|