@alaarab/ogrid-angular-primeng 2.0.9 → 2.0.11
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 +8 -28
- package/dist/esm/column-header-filter/column-header-filter.component.js +44 -162
- package/dist/esm/column-header-menu/column-header-menu.component.js +77 -44
- package/dist/esm/datagrid-table/datagrid-table.component.js +286 -115
- package/dist/esm/datagrid-table/inline-cell-editor.component.js +32 -14
- package/dist/esm/datagrid-table/popover-cell-editor.component.js +36 -18
- package/dist/esm/index.js +2 -0
- package/dist/esm/ogrid/ogrid.component.js +22 -10
- package/dist/esm/pagination-controls/pagination-controls.component.js +13 -27
- package/dist/types/column-chooser/column-chooser.component.d.ts +3 -19
- package/dist/types/column-header-filter/column-header-filter.component.d.ts +5 -62
- package/dist/types/column-header-menu/column-header-menu.component.d.ts +11 -12
- package/dist/types/datagrid-table/datagrid-table.component.d.ts +64 -50
- package/dist/types/datagrid-table/inline-cell-editor.component.d.ts +9 -9
- 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 +6 -5
- package/dist/types/pagination-controls/pagination-controls.component.d.ts +2 -11
- package/package.json +2 -2
|
@@ -4,33 +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
|
|
7
|
+
import { Component } from '@angular/core';
|
|
8
8
|
import { CommonModule } from '@angular/common';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this.
|
|
14
|
-
this.open = signal(false);
|
|
15
|
-
this.visibleCount = computed(() => this.visibleColumns().size);
|
|
16
|
-
this.totalCount = computed(() => this.columns().length);
|
|
17
|
-
}
|
|
18
|
-
onToggle(columnKey, checked) {
|
|
19
|
-
this.visibilityChange.emit({ columnKey, visible: checked });
|
|
20
|
-
}
|
|
21
|
-
onSelectAll() {
|
|
22
|
-
for (const col of this.columns()) {
|
|
23
|
-
if (!this.visibleColumns().has(col.columnId)) {
|
|
24
|
-
this.visibilityChange.emit({ columnKey: col.columnId, visible: true });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
onClearAll() {
|
|
29
|
-
for (const col of this.columns()) {
|
|
30
|
-
if (col.required !== true && this.visibleColumns().has(col.columnId)) {
|
|
31
|
-
this.visibilityChange.emit({ columnKey: col.columnId, visible: false });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
9
|
+
import { BaseColumnChooserComponent } from '@alaarab/ogrid-angular';
|
|
10
|
+
let ColumnChooserComponent = class ColumnChooserComponent extends BaseColumnChooserComponent {
|
|
11
|
+
// PrimeNG uses 'open' instead of 'isOpen'
|
|
12
|
+
get open() {
|
|
13
|
+
return this.isOpen;
|
|
34
14
|
}
|
|
35
15
|
};
|
|
36
16
|
ColumnChooserComponent = __decorate([
|
|
@@ -60,11 +40,11 @@ ColumnChooserComponent = __decorate([
|
|
|
60
40
|
<div style="padding:4px 12px;font-weight:600;font-size:12px;color:var(--ogrid-muted, #666)">
|
|
61
41
|
Select Columns ({{ visibleCount() }} of {{ totalCount() }})
|
|
62
42
|
</div>
|
|
63
|
-
@for (col of columns
|
|
43
|
+
@for (col of columns; track col.columnId) {
|
|
64
44
|
<label style="display:flex;align-items:center;gap:8px;padding:4px 12px;cursor:pointer;font-size:13px">
|
|
65
45
|
<input
|
|
66
46
|
type="checkbox"
|
|
67
|
-
[checked]="visibleColumns
|
|
47
|
+
[checked]="visibleColumns.has(col.columnId)"
|
|
68
48
|
(change)="onToggle(col.columnId, $any($event.target).checked)"
|
|
69
49
|
[disabled]="col.required === true"
|
|
70
50
|
/>
|
|
@@ -4,81 +4,31 @@ 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, ViewChild, DestroyRef, inject, effect } from '@angular/core';
|
|
8
8
|
import { CommonModule } from '@angular/common';
|
|
9
|
-
|
|
9
|
+
import { BaseColumnHeaderFilterComponent } from '@alaarab/ogrid-angular';
|
|
10
|
+
let ColumnHeaderFilterComponent = class ColumnHeaderFilterComponent extends BaseColumnHeaderFilterComponent {
|
|
11
|
+
getHeaderEl() {
|
|
12
|
+
return this.filterTrigger;
|
|
13
|
+
}
|
|
10
14
|
constructor() {
|
|
15
|
+
super();
|
|
11
16
|
this.destroyRef = inject(DestroyRef);
|
|
12
|
-
this.columnKey = input.required();
|
|
13
|
-
this.columnName = input.required();
|
|
14
|
-
this.filterType = input('none');
|
|
15
|
-
this.isSorted = input(false);
|
|
16
|
-
this.isSortedDescending = input(false);
|
|
17
|
-
this.onSort = input(undefined);
|
|
18
|
-
// Multi-select filter
|
|
19
|
-
this.selectedValues = input(undefined);
|
|
20
|
-
this.onFilterChange = input(undefined);
|
|
21
|
-
this.options = input([]);
|
|
22
|
-
this.isLoadingOptions = input(false);
|
|
23
|
-
// Text filter
|
|
24
|
-
this.textValue = input('');
|
|
25
|
-
this.onTextChange = input(undefined);
|
|
26
|
-
// People filter
|
|
27
|
-
this.selectedUser = input(undefined);
|
|
28
|
-
this.onUserChange = input(undefined);
|
|
29
|
-
this.peopleSearch = input(undefined);
|
|
30
|
-
// Date filter
|
|
31
|
-
this.dateValue = input(undefined);
|
|
32
|
-
this.onDateChange = input(undefined);
|
|
33
|
-
// Internal state
|
|
34
|
-
this.isFilterOpen = signal(false);
|
|
35
|
-
this.tempTextValue = signal('');
|
|
36
|
-
this.searchText = signal('');
|
|
37
|
-
this.tempSelected = signal(new Set());
|
|
38
|
-
this.peopleSearchText = signal('');
|
|
39
|
-
this.peopleSuggestions = signal([]);
|
|
40
|
-
this.isPeopleLoading = signal(false);
|
|
41
|
-
this.tempDateFrom = signal('');
|
|
42
|
-
this.tempDateTo = signal('');
|
|
43
|
-
this.filterTrigger = viewChild('filterTrigger');
|
|
44
|
-
this.filterPanel = viewChild('filterPanel');
|
|
45
|
-
this.peopleDebounceTimer = null;
|
|
46
17
|
this.clickOutsideHandler = (e) => {
|
|
47
|
-
const trigger = this.filterTrigger
|
|
48
|
-
const panel = this.filterPanel
|
|
18
|
+
const trigger = this.filterTrigger?.nativeElement;
|
|
19
|
+
const panel = this.filterPanel?.nativeElement;
|
|
49
20
|
if (trigger && !trigger.contains(e.target) && (!panel || !panel.contains(e.target))) {
|
|
50
21
|
this.isFilterOpen.set(false);
|
|
51
22
|
}
|
|
52
23
|
};
|
|
53
|
-
this.hasActiveFilter = computed(() => {
|
|
54
|
-
const ft = this.filterType();
|
|
55
|
-
if (ft === 'text')
|
|
56
|
-
return !!this.textValue();
|
|
57
|
-
if (ft === 'multiSelect') {
|
|
58
|
-
const sv = this.selectedValues();
|
|
59
|
-
return sv != null && sv.length > 0;
|
|
60
|
-
}
|
|
61
|
-
if (ft === 'people')
|
|
62
|
-
return this.selectedUser() != null;
|
|
63
|
-
if (ft === 'date') {
|
|
64
|
-
const dv = this.dateValue();
|
|
65
|
-
return dv != null && (dv.from != null || dv.to != null);
|
|
66
|
-
}
|
|
67
|
-
return false;
|
|
68
|
-
});
|
|
69
|
-
this.filteredOptions = computed(() => {
|
|
70
|
-
const search = this.searchText().toLowerCase();
|
|
71
|
-
const opts = this.options() ?? [];
|
|
72
|
-
return search ? opts.filter((o) => o.toLowerCase().includes(search)) : opts;
|
|
73
|
-
});
|
|
74
24
|
// Sync temp values when filter opens
|
|
75
25
|
effect(() => {
|
|
76
26
|
if (this.isFilterOpen()) {
|
|
77
|
-
this.tempTextValue.set(this.textValue
|
|
27
|
+
this.tempTextValue.set(this.textValue ?? '');
|
|
78
28
|
this.searchText.set('');
|
|
79
|
-
const sv = this.selectedValues
|
|
29
|
+
const sv = this.selectedValues;
|
|
80
30
|
this.tempSelected.set(new Set(sv ?? []));
|
|
81
|
-
const dv = this.dateValue
|
|
31
|
+
const dv = this.dateValue;
|
|
82
32
|
this.tempDateFrom.set(dv?.from ?? '');
|
|
83
33
|
this.tempDateTo.set(dv?.to ?? '');
|
|
84
34
|
document.addEventListener('mousedown', this.clickOutsideHandler, true);
|
|
@@ -89,93 +39,25 @@ let ColumnHeaderFilterComponent = class ColumnHeaderFilterComponent {
|
|
|
89
39
|
});
|
|
90
40
|
this.destroyRef.onDestroy(() => {
|
|
91
41
|
document.removeEventListener('mousedown', this.clickOutsideHandler, true);
|
|
92
|
-
if (this.peopleDebounceTimer)
|
|
93
|
-
clearTimeout(this.peopleDebounceTimer);
|
|
94
42
|
});
|
|
95
43
|
}
|
|
96
44
|
handleSortClick() {
|
|
97
|
-
this.onSort
|
|
45
|
+
this.onSort?.();
|
|
98
46
|
}
|
|
99
47
|
toggleFilter() {
|
|
100
48
|
this.isFilterOpen.update((v) => !v);
|
|
101
49
|
}
|
|
102
|
-
//
|
|
103
|
-
handleTextApply() {
|
|
104
|
-
const value = this.tempTextValue().trim();
|
|
105
|
-
this.onTextChange()?.(value);
|
|
106
|
-
this.isFilterOpen.set(false);
|
|
107
|
-
}
|
|
108
|
-
handleTextClear() {
|
|
109
|
-
this.tempTextValue.set('');
|
|
110
|
-
this.onTextChange()?.('');
|
|
111
|
-
this.isFilterOpen.set(false);
|
|
112
|
-
}
|
|
113
|
-
// Multi-select filter
|
|
114
|
-
handleCheckboxChange(opt, checked) {
|
|
115
|
-
this.tempSelected.update((prev) => {
|
|
116
|
-
const next = new Set(prev);
|
|
117
|
-
if (checked)
|
|
118
|
-
next.add(opt);
|
|
119
|
-
else
|
|
120
|
-
next.delete(opt);
|
|
121
|
-
return next;
|
|
122
|
-
});
|
|
123
|
-
}
|
|
50
|
+
// Adapter methods for template compatibility
|
|
124
51
|
handleSelectAllOptions() {
|
|
125
|
-
this.
|
|
126
|
-
}
|
|
127
|
-
handleClearSelection() {
|
|
128
|
-
this.tempSelected.set(new Set());
|
|
129
|
-
}
|
|
130
|
-
handleApplyMultiSelect() {
|
|
131
|
-
this.onFilterChange()?.(Array.from(this.tempSelected()));
|
|
132
|
-
this.isFilterOpen.set(false);
|
|
133
|
-
}
|
|
134
|
-
// People filter
|
|
135
|
-
onPeopleSearchInput(value) {
|
|
136
|
-
this.peopleSearchText.set(value);
|
|
137
|
-
if (this.peopleDebounceTimer)
|
|
138
|
-
clearTimeout(this.peopleDebounceTimer);
|
|
139
|
-
const searcher = this.peopleSearch();
|
|
140
|
-
if (!searcher || !value.trim()) {
|
|
141
|
-
this.peopleSuggestions.set([]);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
this.isPeopleLoading.set(true);
|
|
145
|
-
this.peopleDebounceTimer = setTimeout(() => {
|
|
146
|
-
searcher(value.trim())
|
|
147
|
-
.then((results) => {
|
|
148
|
-
this.peopleSuggestions.set(results);
|
|
149
|
-
this.isPeopleLoading.set(false);
|
|
150
|
-
})
|
|
151
|
-
.catch(() => {
|
|
152
|
-
this.peopleSuggestions.set([]);
|
|
153
|
-
this.isPeopleLoading.set(false);
|
|
154
|
-
});
|
|
155
|
-
}, 300);
|
|
156
|
-
}
|
|
157
|
-
handleUserSelect(user) {
|
|
158
|
-
this.onUserChange()?.(user);
|
|
159
|
-
this.isFilterOpen.set(false);
|
|
160
|
-
}
|
|
161
|
-
handleClearUser() {
|
|
162
|
-
this.onUserChange()?.(undefined);
|
|
163
|
-
this.isFilterOpen.set(false);
|
|
164
|
-
}
|
|
165
|
-
// Date filter
|
|
166
|
-
handleDateApply() {
|
|
167
|
-
const from = this.tempDateFrom() || undefined;
|
|
168
|
-
const to = this.tempDateTo() || undefined;
|
|
169
|
-
this.onDateChange()?.(from || to ? { from, to } : undefined);
|
|
170
|
-
this.isFilterOpen.set(false);
|
|
171
|
-
}
|
|
172
|
-
handleDateClear() {
|
|
173
|
-
this.tempDateFrom.set('');
|
|
174
|
-
this.tempDateTo.set('');
|
|
175
|
-
this.onDateChange()?.(undefined);
|
|
176
|
-
this.isFilterOpen.set(false);
|
|
52
|
+
this.handleSelectAllFiltered();
|
|
177
53
|
}
|
|
178
54
|
};
|
|
55
|
+
__decorate([
|
|
56
|
+
ViewChild('filterTrigger')
|
|
57
|
+
], ColumnHeaderFilterComponent.prototype, "filterTrigger", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
ViewChild('filterPanel')
|
|
60
|
+
], ColumnHeaderFilterComponent.prototype, "filterPanel", void 0);
|
|
179
61
|
ColumnHeaderFilterComponent = __decorate([
|
|
180
62
|
Component({
|
|
181
63
|
selector: 'ogrid-primeng-column-header-filter',
|
|
@@ -184,31 +66,31 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
184
66
|
template: `
|
|
185
67
|
<div style="display:flex;align-items:center;flex:1;min-width:0;gap:4px">
|
|
186
68
|
<div style="flex:1;min-width:0;overflow:hidden">
|
|
187
|
-
<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block" [title]="columnName
|
|
188
|
-
{{ columnName
|
|
69
|
+
<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block" [title]="columnName" data-header-label>
|
|
70
|
+
{{ columnName }}
|
|
189
71
|
</span>
|
|
190
72
|
</div>
|
|
191
73
|
<div style="display:flex;align-items:center;gap:2px;flex-shrink:0">
|
|
192
|
-
@if (onSort
|
|
74
|
+
@if (onSort) {
|
|
193
75
|
<button
|
|
194
76
|
type="button"
|
|
195
77
|
(click)="handleSortClick()"
|
|
196
|
-
[attr.aria-label]="'Sort by ' + columnName
|
|
197
|
-
[title]="isSorted
|
|
78
|
+
[attr.aria-label]="'Sort by ' + columnName"
|
|
79
|
+
[title]="isSorted ? (isSortedDescending ? 'Sorted descending' : 'Sorted ascending') : 'Sort'"
|
|
198
80
|
style="border:none;background:transparent;cursor:pointer;padding:2px 4px;font-size:12px;color:var(--ogrid-fg, #242424)"
|
|
199
|
-
[style.font-weight]="isSorted
|
|
81
|
+
[style.font-weight]="isSorted ? 'bold' : 'normal'"
|
|
200
82
|
>
|
|
201
|
-
{{ isSorted
|
|
83
|
+
{{ isSorted ? (isSortedDescending ? '\u2193' : '\u2191') : '\u21C5' }}
|
|
202
84
|
</button>
|
|
203
85
|
}
|
|
204
86
|
|
|
205
|
-
@if (filterType
|
|
87
|
+
@if (filterType !== 'none') {
|
|
206
88
|
<button
|
|
207
89
|
type="button"
|
|
208
90
|
#filterTrigger
|
|
209
91
|
(click)="toggleFilter()"
|
|
210
|
-
[attr.aria-label]="'Filter ' + columnName
|
|
211
|
-
[title]="'Filter ' + columnName
|
|
92
|
+
[attr.aria-label]="'Filter ' + columnName"
|
|
93
|
+
[title]="'Filter ' + columnName"
|
|
212
94
|
style="border:none;background:transparent;cursor:pointer;padding:2px 4px;font-size:12px;position:relative;color:var(--ogrid-fg, #242424)"
|
|
213
95
|
[style.font-weight]="hasActiveFilter() ? 'bold' : 'normal'"
|
|
214
96
|
>
|
|
@@ -224,10 +106,10 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
224
106
|
style="position:absolute;top:100%;left:0;z-index:200;min-width:200px;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, #e0e0e0);border-radius:6px;box-shadow:0 2px 8px rgba(0,0,0,0.12);font-weight:normal"
|
|
225
107
|
>
|
|
226
108
|
<div style="padding:8px 12px;font-weight:600;font-size:12px;border-bottom:1px solid var(--ogrid-border, #e0e0e0)">
|
|
227
|
-
Filter: {{ columnName
|
|
109
|
+
Filter: {{ columnName }}
|
|
228
110
|
</div>
|
|
229
111
|
|
|
230
|
-
@if (filterType
|
|
112
|
+
@if (filterType === 'text') {
|
|
231
113
|
<div style="padding:8px 12px">
|
|
232
114
|
<input
|
|
233
115
|
type="text"
|
|
@@ -235,7 +117,7 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
235
117
|
(input)="tempTextValue.set($any($event.target).value)"
|
|
236
118
|
placeholder="Filter text..."
|
|
237
119
|
style="width:100%;box-sizing:border-box;padding:6px 8px;border:1px solid var(--ogrid-border, #e0e0e0);border-radius:4px;font-size:13px;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424)"
|
|
238
|
-
[attr.aria-label]="'Filter ' + columnName
|
|
120
|
+
[attr.aria-label]="'Filter ' + columnName"
|
|
239
121
|
/>
|
|
240
122
|
</div>
|
|
241
123
|
<div style="display:flex;justify-content:flex-end;gap:6px;padding:6px 12px;border-top:1px solid var(--ogrid-border, #e0e0e0)">
|
|
@@ -243,7 +125,7 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
243
125
|
type="button"
|
|
244
126
|
class="p-button p-button-text p-button-sm"
|
|
245
127
|
(click)="handleTextClear()"
|
|
246
|
-
[disabled]="!textValue
|
|
128
|
+
[disabled]="!textValue"
|
|
247
129
|
style="font-size:12px"
|
|
248
130
|
>Clear</button>
|
|
249
131
|
<button
|
|
@@ -255,7 +137,7 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
255
137
|
</div>
|
|
256
138
|
}
|
|
257
139
|
|
|
258
|
-
@if (filterType
|
|
140
|
+
@if (filterType === 'multiSelect') {
|
|
259
141
|
<div style="padding:8px 12px">
|
|
260
142
|
<input
|
|
261
143
|
type="text"
|
|
@@ -263,16 +145,16 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
263
145
|
(input)="searchText.set($any($event.target).value)"
|
|
264
146
|
placeholder="Search options..."
|
|
265
147
|
style="width:100%;box-sizing:border-box;padding:6px 8px;border:1px solid var(--ogrid-border, #e0e0e0);border-radius:4px;font-size:13px;margin-bottom:6px;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424)"
|
|
266
|
-
[attr.aria-label]="'Search ' + columnName
|
|
148
|
+
[attr.aria-label]="'Search ' + columnName + ' options'"
|
|
267
149
|
/>
|
|
268
|
-
@if (isLoadingOptions
|
|
150
|
+
@if (isLoadingOptions) {
|
|
269
151
|
<div style="padding:8px 0;color:var(--ogrid-muted, #999);font-size:12px">Loading...</div>
|
|
270
152
|
} @else {
|
|
271
153
|
<div style="display:flex;gap:4px;margin-bottom:6px">
|
|
272
154
|
<button type="button" class="p-button p-button-text p-button-sm" (click)="handleSelectAllOptions()" style="font-size:11px">All</button>
|
|
273
155
|
<button type="button" class="p-button p-button-text p-button-sm" (click)="handleClearSelection()" style="font-size:11px">None</button>
|
|
274
156
|
</div>
|
|
275
|
-
<div style="max-height:160px;overflow-y:auto" role="group" [attr.aria-label]="columnName
|
|
157
|
+
<div style="max-height:160px;overflow-y:auto" role="group" [attr.aria-label]="columnName + ' filter options'">
|
|
276
158
|
@for (opt of filteredOptions(); track opt) {
|
|
277
159
|
<label style="display:flex;align-items:center;gap:6px;padding:2px 0;cursor:pointer;font-size:13px">
|
|
278
160
|
<input
|
|
@@ -296,11 +178,11 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
296
178
|
</div>
|
|
297
179
|
}
|
|
298
180
|
|
|
299
|
-
@if (filterType
|
|
181
|
+
@if (filterType === 'people') {
|
|
300
182
|
<div style="padding:8px 12px">
|
|
301
|
-
@if (selectedUser
|
|
183
|
+
@if (selectedUser) {
|
|
302
184
|
<div style="display:flex;align-items:center;justify-content:space-between;padding:4px 0;margin-bottom:4px">
|
|
303
|
-
<span style="font-size:13px">{{ selectedUser
|
|
185
|
+
<span style="font-size:13px">{{ selectedUser!.displayName ?? selectedUser!.email }}</span>
|
|
304
186
|
<button type="button" class="p-button p-button-text p-button-sm" (click)="handleClearUser()" style="font-size:11px">Clear</button>
|
|
305
187
|
</div>
|
|
306
188
|
}
|
|
@@ -310,7 +192,7 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
310
192
|
(input)="onPeopleSearchInput($any($event.target).value)"
|
|
311
193
|
placeholder="Search people..."
|
|
312
194
|
style="width:100%;box-sizing:border-box;padding:6px 8px;border:1px solid var(--ogrid-border, #e0e0e0);border-radius:4px;font-size:13px;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424)"
|
|
313
|
-
[attr.aria-label]="'Search people for ' + columnName
|
|
195
|
+
[attr.aria-label]="'Search people for ' + columnName"
|
|
314
196
|
/>
|
|
315
197
|
@if (isPeopleLoading()) {
|
|
316
198
|
<div style="padding:8px 0;color:var(--ogrid-muted, #999);font-size:12px">Loading...</div>
|
|
@@ -327,7 +209,7 @@ ColumnHeaderFilterComponent = __decorate([
|
|
|
327
209
|
</div>
|
|
328
210
|
}
|
|
329
211
|
|
|
330
|
-
@if (filterType
|
|
212
|
+
@if (filterType === 'date') {
|
|
331
213
|
<div style="padding:8px 12px;display:flex;flex-direction:column;gap:6px">
|
|
332
214
|
<label style="display:flex;align-items:center;gap:6px;font-size:12px">
|
|
333
215
|
From:
|
|
@@ -4,58 +4,91 @@ 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, computed, ViewChild, ChangeDetectionStrategy, Input } from '@angular/core';
|
|
8
8
|
import { ButtonModule } from 'primeng/button';
|
|
9
9
|
import { MenuModule } from 'primeng/menu';
|
|
10
|
-
import {
|
|
10
|
+
import { getColumnHeaderMenuItems } from '@alaarab/ogrid-core';
|
|
11
11
|
/**
|
|
12
|
-
* Column header dropdown menu for pin/unpin actions.
|
|
12
|
+
* Column header dropdown menu for pin/unpin, sort, and autosize actions.
|
|
13
13
|
* Uses PrimeNG Menu component.
|
|
14
14
|
*/
|
|
15
15
|
let ColumnHeaderMenuComponent = class ColumnHeaderMenuComponent {
|
|
16
16
|
constructor() {
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
17
|
+
this.canPinLeft = true;
|
|
18
|
+
this.canPinRight = true;
|
|
19
|
+
this.canUnpin = false;
|
|
20
|
+
this.currentSort = null;
|
|
21
|
+
this.isSortable = true;
|
|
22
|
+
this.isResizable = true;
|
|
23
|
+
this.handlers = {};
|
|
24
|
+
this.menuModel = computed(() => {
|
|
25
|
+
const items = getColumnHeaderMenuItems({
|
|
26
|
+
canPinLeft: this.canPinLeft,
|
|
27
|
+
canPinRight: this.canPinRight,
|
|
28
|
+
canUnpin: this.canUnpin,
|
|
29
|
+
currentSort: this.currentSort,
|
|
30
|
+
isSortable: this.isSortable,
|
|
31
|
+
isResizable: this.isResizable,
|
|
32
|
+
});
|
|
33
|
+
const h = this.handlers;
|
|
34
|
+
const actionMap = {
|
|
35
|
+
pinLeft: h.onPinLeft,
|
|
36
|
+
pinRight: h.onPinRight,
|
|
37
|
+
unpin: h.onUnpin,
|
|
38
|
+
sortAsc: h.onSortAsc,
|
|
39
|
+
sortDesc: h.onSortDesc,
|
|
40
|
+
clearSort: h.onClearSort,
|
|
41
|
+
autosizeThis: h.onAutosizeThis,
|
|
42
|
+
autosizeAll: h.onAutosizeAll,
|
|
43
|
+
};
|
|
44
|
+
const result = [];
|
|
45
|
+
for (const item of items) {
|
|
46
|
+
result.push({
|
|
47
|
+
label: item.label,
|
|
48
|
+
disabled: item.disabled,
|
|
49
|
+
command: () => {
|
|
50
|
+
const action = actionMap[item.id];
|
|
51
|
+
if (action) {
|
|
52
|
+
action();
|
|
53
|
+
h.onClose?.();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
if (item.divider) {
|
|
58
|
+
result.push({ separator: true });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
});
|
|
57
63
|
}
|
|
58
64
|
};
|
|
65
|
+
__decorate([
|
|
66
|
+
Input({ required: true })
|
|
67
|
+
], ColumnHeaderMenuComponent.prototype, "columnId", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
Input()
|
|
70
|
+
], ColumnHeaderMenuComponent.prototype, "canPinLeft", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
Input()
|
|
73
|
+
], ColumnHeaderMenuComponent.prototype, "canPinRight", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
Input()
|
|
76
|
+
], ColumnHeaderMenuComponent.prototype, "canUnpin", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
Input()
|
|
79
|
+
], ColumnHeaderMenuComponent.prototype, "currentSort", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
Input()
|
|
82
|
+
], ColumnHeaderMenuComponent.prototype, "isSortable", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
Input()
|
|
85
|
+
], ColumnHeaderMenuComponent.prototype, "isResizable", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
Input()
|
|
88
|
+
], ColumnHeaderMenuComponent.prototype, "handlers", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
ViewChild('menu')
|
|
91
|
+
], ColumnHeaderMenuComponent.prototype, "menuRef", void 0);
|
|
59
92
|
ColumnHeaderMenuComponent = __decorate([
|
|
60
93
|
Component({
|
|
61
94
|
selector: 'column-header-menu',
|
|
@@ -69,7 +102,7 @@ ColumnHeaderMenuComponent = __decorate([
|
|
|
69
102
|
icon="pi pi-ellipsis-v"
|
|
70
103
|
class="p-button-text p-button-sm column-header-menu-trigger"
|
|
71
104
|
(click)="menu.toggle($event)"
|
|
72
|
-
[attr.aria-label]="'Column options for ' + columnId
|
|
105
|
+
[attr.aria-label]="'Column options for ' + columnId"
|
|
73
106
|
></button>
|
|
74
107
|
|
|
75
108
|
<p-menu
|