@alaarab/ogrid-angular-primeng 2.1.3 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,7 @@
1
- export * from '@alaarab/ogrid-angular';
1
+ export type { ColumnFilterType, IDateFilterValue, IColumnFilterDef, IColumnMeta, IValueParserParams, ICellValueChangedEvent, ICellEditorProps, CellEditorParams, HeaderCell, HeaderRow, RowId, UserLike, UserLikeInput, FilterValue, IFilters, IFetchParams, IPageResult, IDataSource, IGridColumnState, RowSelectionMode, IRowSelectionChangeEvent, StatusBarPanel, IStatusBarProps, IActiveCell, ISelectionRange, SideBarPanelId, ISideBarDef, IVirtualScrollConfig, IColumnReorderConfig, IOGridApi, CsvColumn, StatusBarPart, StatusBarPartsInput, PaginationViewModel, GridContextMenuItem, IColumnHeaderMenuItem, GridContextMenuHandlerProps, ColumnHeaderMenuInput, ColumnHeaderMenuHandlers, ParseValueResult, AggregationResult, GridRowComparatorProps, ColumnPinState, IDropTarget, ICalculateDropTargetParams, IVisibleRange, HeaderFilterConfigInput, HeaderFilterConfig, CellRenderDescriptorInput, CellRenderDescriptor, CellRenderMode, OverlayRect, ISortState, ArrowNavigationContext, ArrowNavigationResult, ZIndexKey, } from '@alaarab/ogrid-angular';
2
+ export { toUserLike, isInSelectionRange, normalizeSelectionRange, escapeCsvValue, buildCsvHeader, buildCsvRows, exportToCsv, triggerCsvDownload, getCellValue, flattenColumns, buildHeaderRows, isFilterConfig, getFilterField, mergeFilter, deriveFilterOptionsFromData, getMultiSelectFilterFields, getStatusBarParts, getDataGridStatusBarConfig, getPaginationViewModel, PAGE_SIZE_OPTIONS, MAX_PAGE_BUTTONS, GRID_CONTEXT_MENU_ITEMS, COLUMN_HEADER_MENU_ITEMS, getContextMenuHandlers, getColumnHeaderMenuItems, formatShortcut, parseValue, numberParser, currencyParser, dateParser, emailParser, booleanParser, computeAggregations, processClientSideData, areGridRowPropsEqual, isRowInRange, getPinStateForColumn, reorderColumnArray, calculateDropTarget, computeVisibleRange, computeTotalHeight, getScrollTopForRow, getHeaderFilterConfig, getCellRenderDescriptor, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, debounce, measureRange, injectGlobalStyles, computeNextSortState, measureColumnContentWidth, AUTOSIZE_EXTRA_PX, AUTOSIZE_MAX_PX, findCtrlArrowTarget, computeTabNavigation, computeArrowNavigation, applyCellDeletion, rangesEqual, clampSelectionToBounds, computeAutoScrollSpeed, applyRangeRowSelection, computeRowSelectionState, formatCellValueForTsv, formatSelectionAsTsv, parseTsvClipboard, applyPastedValues, applyCutClear, applyFillValues, UndoRedoStack, validateColumns, validateRowIds, CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, DEFAULT_MIN_COLUMN_WIDTH, CELL_PADDING, GRID_BORDER_RADIUS, DEFAULT_DEBOUNCE_MS, PEOPLE_SEARCH_DEBOUNCE_MS, SIDEBAR_TRANSITION_MS, Z_INDEX, } from '@alaarab/ogrid-angular';
3
+ export type { IColumnDef, IColumnGroupDef, IColumnDefinition, IOGridProps, IOGridClientProps, IOGridServerProps, IOGridDataGridProps, ColumnChooserPlacement, OGridPagination, OGridColumnChooser, OGridFilters, OGridSideBarState, DataGridLayoutState, DataGridRowSelectionState, DataGridEditingState, DataGridCellInteractionState, DataGridContextMenuState, DataGridViewModelState, DataGridPinningState, DataGridStateResult, SideBarProps, SideBarFilterColumn, IColumnHeaderFilterProps, IColumnChooserProps, } from '@alaarab/ogrid-angular';
4
+ export { OGridService, DataGridStateService, DataGridLayoutHelper, DataGridEditingHelper, DataGridInteractionHelper, ColumnReorderService, VirtualScrollService, OGridLayoutComponent, StatusBarComponent, GridContextMenuComponent, SideBarComponent, MarchingAntsOverlayComponent, EmptyStateComponent, BaseOGridComponent, BaseDataGridTableComponent, BaseColumnHeaderFilterComponent, BaseColumnChooserComponent, BasePaginationControlsComponent, BaseInlineCellEditorComponent, INLINE_CELL_EDITOR_TEMPLATE, INLINE_CELL_EDITOR_STYLES, BasePopoverCellEditorComponent, POPOVER_CELL_EDITOR_TEMPLATE, POPOVER_CELL_EDITOR_OVERLAY_STYLES, OGRID_THEME_VARS_CSS, createDebouncedSignal, createDebouncedCallback, createLatestCallback, } from '@alaarab/ogrid-angular';
2
5
  export { OGridComponent } from './ogrid/ogrid.component';
3
6
  export { DataGridTableComponent } from './datagrid-table/datagrid-table.component';
4
7
  export { InlineCellEditorComponent } from './datagrid-table/inline-cell-editor.component';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular-primeng",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "OGrid PrimeNG – PrimeNG Table-based data grid with sorting, filtering, pagination, column chooser, and CSV export.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -9,11 +9,11 @@
9
9
  ".": {
10
10
  "types": "./dist/types/index.d.ts",
11
11
  "import": "./dist/esm/index.js",
12
- "require": "./dist/esm/index.js"
12
+ "default": "./dist/esm/index.js"
13
13
  }
14
14
  },
15
15
  "scripts": {
16
- "build": "rimraf dist && tsc -p tsconfig.build.json",
16
+ "build": "rimraf dist && tsup && tsc -p tsconfig.build.json",
17
17
  "test": "jest --passWithNoTests",
18
18
  "storybook": "ng run angular-primeng:storybook",
19
19
  "build-storybook": "ng run angular-primeng:build-storybook"
@@ -37,7 +37,7 @@
37
37
  "node": ">=18"
38
38
  },
39
39
  "dependencies": {
40
- "@alaarab/ogrid-angular": "2.1.3"
40
+ "@alaarab/ogrid-angular": "2.1.5"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@angular/core": "^21.0.0",
@@ -1,73 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Component, ChangeDetectionStrategy } from '@angular/core';
8
- import { BaseColumnChooserComponent } from '@alaarab/ogrid-angular';
9
- let ColumnChooserComponent = class ColumnChooserComponent extends BaseColumnChooserComponent {
10
- // PrimeNG uses 'open' instead of 'isOpen'
11
- get open() {
12
- return this.isOpen;
13
- }
14
- };
15
- ColumnChooserComponent = __decorate([
16
- Component({
17
- selector: 'ogrid-primeng-column-chooser',
18
- standalone: true,
19
- changeDetection: ChangeDetectionStrategy.OnPush,
20
- template: `
21
- <div style="position:relative;display:inline-block">
22
- <button
23
- type="button"
24
- class="p-button p-button-text p-button-sm"
25
- (click)="open.set(!open())"
26
- [attr.aria-expanded]="open()"
27
- aria-haspopup="listbox"
28
- style="display:flex;align-items:center;gap:6px;font-size:13px"
29
- >
30
- <span aria-hidden>&#9881;</span>
31
- <span>Column Visibility ({{ visibleCount() }} of {{ totalCount() }})</span>
32
- <span aria-hidden>{{ open() ? '\u25B2' : '\u25BC' }}</span>
33
- </button>
34
-
35
- @if (open()) {
36
- <div
37
- style="position:absolute;right:0;top:100%;z-index:1000;min-width:220px;max-height:320px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));border-radius:6px;box-shadow:0 2px 8px rgba(0,0,0,0.12);padding:8px 0"
38
- >
39
- <div style="padding:4px 12px;font-weight:600;font-size:12px;color:var(--ogrid-fg-secondary, rgba(0, 0, 0, 0.6))">
40
- Select Columns ({{ visibleCount() }} of {{ totalCount() }})
41
- </div>
42
- @for (col of columns; track col.columnId) {
43
- <label style="display:flex;align-items:center;gap:8px;padding:4px 12px;cursor:pointer;font-size:13px">
44
- <input
45
- type="checkbox"
46
- [checked]="visibleColumns.has(col.columnId)"
47
- (change)="onToggle(col.columnId, $any($event.target).checked)"
48
- [disabled]="col.required === true"
49
- />
50
- {{ col.name }}
51
- </label>
52
- }
53
- <div style="display:flex;gap:4px;padding:8px 12px;border-top:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));margin-top:4px">
54
- <button
55
- type="button"
56
- class="p-button p-button-text p-button-sm"
57
- (click)="onClearAll()"
58
- style="flex:1;font-size:12px"
59
- >Clear All</button>
60
- <button
61
- type="button"
62
- class="p-button p-button-text p-button-sm"
63
- (click)="onSelectAll()"
64
- style="flex:1;font-size:12px"
65
- >Select All</button>
66
- </div>
67
- </div>
68
- }
69
- </div>
70
- `,
71
- })
72
- ], ColumnChooserComponent);
73
- export { ColumnChooserComponent };
@@ -1,251 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Component, ViewChild, DestroyRef, inject, effect, ChangeDetectionStrategy } from '@angular/core';
8
- import { BaseColumnHeaderFilterComponent } from '@alaarab/ogrid-angular';
9
- let ColumnHeaderFilterComponent = class ColumnHeaderFilterComponent extends BaseColumnHeaderFilterComponent {
10
- getHeaderEl() {
11
- return this.filterTrigger;
12
- }
13
- constructor() {
14
- super();
15
- this.destroyRef = inject(DestroyRef);
16
- this.clickOutsideHandler = (e) => {
17
- const trigger = this.filterTrigger?.nativeElement;
18
- const panel = this.filterPanel?.nativeElement;
19
- if (trigger && !trigger.contains(e.target) && (!panel || !panel.contains(e.target))) {
20
- this.isFilterOpen.set(false);
21
- }
22
- };
23
- // Sync temp values when filter opens
24
- effect(() => {
25
- if (this.isFilterOpen()) {
26
- this.tempTextValue.set(this.textValue ?? '');
27
- this.searchText.set('');
28
- const sv = this.selectedValues;
29
- this.tempSelected.set(new Set(sv ?? []));
30
- const dv = this.dateValue;
31
- this.tempDateFrom.set(dv?.from ?? '');
32
- this.tempDateTo.set(dv?.to ?? '');
33
- document.addEventListener('mousedown', this.clickOutsideHandler, true);
34
- }
35
- else {
36
- document.removeEventListener('mousedown', this.clickOutsideHandler, true);
37
- }
38
- });
39
- this.destroyRef.onDestroy(() => {
40
- document.removeEventListener('mousedown', this.clickOutsideHandler, true);
41
- });
42
- }
43
- handleSortClick() {
44
- this.onSort?.();
45
- }
46
- toggleFilter() {
47
- this.isFilterOpen.update((v) => !v);
48
- }
49
- // Adapter methods for template compatibility
50
- handleSelectAllOptions() {
51
- this.handleSelectAllFiltered();
52
- }
53
- };
54
- __decorate([
55
- ViewChild('filterTrigger')
56
- ], ColumnHeaderFilterComponent.prototype, "filterTrigger", void 0);
57
- __decorate([
58
- ViewChild('filterPanel')
59
- ], ColumnHeaderFilterComponent.prototype, "filterPanel", void 0);
60
- ColumnHeaderFilterComponent = __decorate([
61
- Component({
62
- selector: 'ogrid-primeng-column-header-filter',
63
- standalone: true,
64
- changeDetection: ChangeDetectionStrategy.OnPush,
65
- template: `
66
- <div style="display:flex;align-items:center;flex:1;min-width:0;gap:4px">
67
- <div style="flex:1;min-width:0;overflow:hidden">
68
- <span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block" [title]="columnName" data-header-label>
69
- {{ columnName }}
70
- </span>
71
- </div>
72
- <div style="display:flex;align-items:center;gap:2px;flex-shrink:0">
73
- @if (filterType !== 'none') {
74
- <button
75
- type="button"
76
- #filterTrigger
77
- (click)="toggleFilter()"
78
- [attr.aria-label]="'Filter ' + columnName"
79
- [title]="'Filter ' + columnName"
80
- style="border:none;background:transparent;cursor:pointer;padding:2px 4px;font-size:12px;position:relative;color:var(--ogrid-fg, #242424)"
81
- [style.font-weight]="hasActiveFilter() ? 'bold' : 'normal'"
82
- >
83
- &#9662;
84
- @if (hasActiveFilter()) {
85
- <span style="position:absolute;top:0;right:0;width:6px;height:6px;border-radius:50%;background:var(--ogrid-selection, #217346)"></span>
86
- }
87
- </button>
88
-
89
- @if (isFilterOpen()) {
90
- <div
91
- #filterPanel
92
- style="position:absolute;top:100%;left:0;z-index:1000;min-width:200px;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));border-radius:6px;box-shadow:0 2px 8px rgba(0,0,0,0.12);font-weight:normal"
93
- >
94
- <div style="padding:8px 12px;font-weight:600;font-size:12px;border-bottom:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12))">
95
- Filter: {{ columnName }}
96
- </div>
97
-
98
- @if (filterType === 'text') {
99
- <div style="padding:8px 12px">
100
- <input
101
- type="text"
102
- [value]="tempTextValue()"
103
- (input)="tempTextValue.set($any($event.target).value)"
104
- placeholder="Filter text..."
105
- style="width:100%;box-sizing:border-box;padding:6px 8px;border:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));border-radius:4px;font-size:13px;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424)"
106
- [attr.aria-label]="'Filter ' + columnName"
107
- />
108
- </div>
109
- <div style="display:flex;justify-content:flex-end;gap:6px;padding:6px 12px;border-top:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12))">
110
- <button
111
- type="button"
112
- class="p-button p-button-text p-button-sm"
113
- (click)="handleTextClear()"
114
- [disabled]="!textValue"
115
- style="font-size:12px"
116
- >Clear</button>
117
- <button
118
- type="button"
119
- class="p-button p-button-sm"
120
- (click)="handleTextApply()"
121
- style="font-size:12px"
122
- >Apply</button>
123
- </div>
124
- }
125
-
126
- @if (filterType === 'multiSelect') {
127
- <div style="padding:8px 12px">
128
- <input
129
- type="text"
130
- [value]="searchText()"
131
- (input)="searchText.set($any($event.target).value)"
132
- placeholder="Search options..."
133
- style="width:100%;box-sizing:border-box;padding:6px 8px;border:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));border-radius:4px;font-size:13px;margin-bottom:6px;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424)"
134
- [attr.aria-label]="'Search ' + columnName + ' options'"
135
- />
136
- @if (isLoadingOptions) {
137
- <div style="padding:8px 0;color:var(--ogrid-fg-muted, rgba(0, 0, 0, 0.5));font-size:12px">Loading...</div>
138
- } @else {
139
- <div style="display:flex;gap:4px;margin-bottom:6px">
140
- <button type="button" class="p-button p-button-text p-button-sm" (click)="handleSelectAllOptions()" style="font-size:11px">All</button>
141
- <button type="button" class="p-button p-button-text p-button-sm" (click)="handleClearSelection()" style="font-size:11px">None</button>
142
- </div>
143
- <div style="max-height:160px;overflow-y:auto" role="group" [attr.aria-label]="columnName + ' filter options'">
144
- @for (opt of filteredOptions(); track opt) {
145
- <label style="display:flex;align-items:center;gap:6px;padding:2px 0;cursor:pointer;font-size:13px">
146
- <input
147
- type="checkbox"
148
- [checked]="tempSelected().has(opt)"
149
- (change)="handleCheckboxChange(opt, $event)"
150
- />
151
- {{ opt }}
152
- </label>
153
- }
154
- </div>
155
- }
156
- </div>
157
- <div style="display:flex;justify-content:flex-end;gap:6px;padding:6px 12px;border-top:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12))">
158
- <button
159
- type="button"
160
- class="p-button p-button-sm"
161
- (click)="handleApplyMultiSelect()"
162
- style="font-size:12px"
163
- >Apply</button>
164
- </div>
165
- }
166
-
167
- @if (filterType === 'people') {
168
- <div style="padding:8px 12px">
169
- @if (selectedUser) {
170
- <div style="display:flex;align-items:center;justify-content:space-between;padding:4px 0;margin-bottom:4px">
171
- <span style="font-size:13px">{{ selectedUser!.displayName ?? selectedUser!.email }}</span>
172
- <button type="button" class="p-button p-button-text p-button-sm" (click)="handleClearUser()" style="font-size:11px">Clear</button>
173
- </div>
174
- }
175
- <input
176
- type="text"
177
- [value]="peopleSearchText()"
178
- (input)="onPeopleSearchInput($event)"
179
- placeholder="Search people..."
180
- style="width:100%;box-sizing:border-box;padding:6px 8px;border:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));border-radius:4px;font-size:13px;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424)"
181
- [attr.aria-label]="'Search people for ' + columnName"
182
- />
183
- @if (isPeopleLoading()) {
184
- <div style="padding:8px 0;color:var(--ogrid-fg-muted, rgba(0, 0, 0, 0.5));font-size:12px">Loading...</div>
185
- }
186
- @for (user of peopleSuggestions(); track user.email) {
187
- <button
188
- type="button"
189
- (click)="handleUserSelect(user)"
190
- style="display:block;width:100%;text-align:left;padding:6px 0;border:none;background:transparent;cursor:pointer;font-size:13px;color:var(--ogrid-fg, #242424)"
191
- >
192
- {{ user.displayName ?? user.email }}
193
- </button>
194
- }
195
- </div>
196
- }
197
-
198
- @if (filterType === 'date') {
199
- <div style="padding:8px 12px;display:flex;flex-direction:column;gap:6px">
200
- <label style="display:flex;align-items:center;gap:6px;font-size:12px">
201
- From:
202
- <input
203
- type="date"
204
- [value]="tempDateFrom()"
205
- (change)="tempDateFrom.set($any($event.target).value)"
206
- style="flex:1;padding:4px 6px;border:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));border-radius:4px;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424)"
207
- />
208
- </label>
209
- <label style="display:flex;align-items:center;gap:6px;font-size:12px">
210
- To:
211
- <input
212
- type="date"
213
- [value]="tempDateTo()"
214
- (change)="tempDateTo.set($any($event.target).value)"
215
- style="flex:1;padding:4px 6px;border:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12));border-radius:4px;background:var(--ogrid-bg, #fff);color:var(--ogrid-fg, #242424)"
216
- />
217
- </label>
218
- </div>
219
- <div style="display:flex;justify-content:flex-end;gap:6px;padding:6px 12px;border-top:1px solid var(--ogrid-border, rgba(0, 0, 0, 0.12))">
220
- <button
221
- type="button"
222
- class="p-button p-button-text p-button-sm"
223
- (click)="handleDateClear()"
224
- [disabled]="!tempDateFrom() && !tempDateTo()"
225
- style="font-size:12px"
226
- >Clear</button>
227
- <button
228
- type="button"
229
- class="p-button p-button-sm"
230
- (click)="handleDateApply()"
231
- style="font-size:12px"
232
- >Apply</button>
233
- </div>
234
- }
235
- </div>
236
- }
237
- }
238
- </div>
239
- </div>
240
- `,
241
- styles: [`
242
- :host {
243
- display: flex;
244
- position: relative;
245
- flex: 1;
246
- min-width: 0;
247
- }
248
- `],
249
- })
250
- ], ColumnHeaderFilterComponent);
251
- export { ColumnHeaderFilterComponent };
@@ -1,134 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Component, computed, ViewChild, ChangeDetectionStrategy, Input } from '@angular/core';
8
- import { ButtonModule } from 'primeng/button';
9
- import { MenuModule } from 'primeng/menu';
10
- import { getColumnHeaderMenuItems } from '@alaarab/ogrid-angular';
11
- /**
12
- * Column header dropdown menu for pin/unpin, sort, and autosize actions.
13
- * Uses PrimeNG Menu component.
14
- */
15
- let ColumnHeaderMenuComponent = class ColumnHeaderMenuComponent {
16
- constructor() {
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
- });
63
- }
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);
92
- ColumnHeaderMenuComponent = __decorate([
93
- Component({
94
- selector: 'column-header-menu',
95
- standalone: true,
96
- imports: [ButtonModule, MenuModule],
97
- changeDetection: ChangeDetectionStrategy.OnPush,
98
- template: `
99
- <button
100
- pButton
101
- type="button"
102
- icon="pi pi-ellipsis-v"
103
- class="p-button-text p-button-sm column-header-menu-trigger"
104
- (click)="menu.toggle($event)"
105
- [attr.aria-label]="'Column options for ' + columnId"
106
- ></button>
107
-
108
- <p-menu
109
- #menu
110
- [model]="menuModel()"
111
- [popup]="true"
112
- appendTo="body"
113
- ></p-menu>
114
- `,
115
- styles: [`
116
- .column-header-menu-trigger {
117
- padding: 0.25rem;
118
- min-width: 24px;
119
- height: 24px;
120
- display: inline-flex;
121
- align-items: center;
122
- justify-content: center;
123
- color: var(--ogrid-fg-secondary, rgba(0, 0, 0, 0.6));
124
- border-radius: 4px;
125
- transition: background-color 0.15s;
126
- }
127
- .column-header-menu-trigger:hover {
128
- background: var(--ogrid-hover-bg, rgba(0, 0, 0, 0.04));
129
- color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
130
- }
131
- `],
132
- })
133
- ], ColumnHeaderMenuComponent);
134
- export { ColumnHeaderMenuComponent };