@alaarab/ogrid-angular-primeng 2.0.14 → 2.0.16
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-header-menu/column-header-menu.component.js +1 -1
- package/dist/esm/datagrid-table/datagrid-table.component.js +13 -2
- package/dist/esm/datagrid-table/inline-cell-editor.component.js +48 -102
- package/dist/types/column-header-menu/column-header-menu.component.d.ts +1 -1
- package/dist/types/datagrid-table/inline-cell-editor.component.d.ts +2 -21
- package/dist/types/datagrid-table/popover-cell-editor.component.d.ts +1 -1
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
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 { getColumnHeaderMenuItems } from '@alaarab/ogrid-
|
|
10
|
+
import { getColumnHeaderMenuItems } from '@alaarab/ogrid-angular';
|
|
11
11
|
/**
|
|
12
12
|
* Column header dropdown menu for pin/unpin, sort, and autosize actions.
|
|
13
13
|
* Uses PrimeNG Menu component.
|
|
@@ -243,6 +243,10 @@ let DataGridTableComponent = class DataGridTableComponent extends BaseDataGridTa
|
|
|
243
243
|
}
|
|
244
244
|
onResizeStartPrimeng(e, col) {
|
|
245
245
|
e.preventDefault();
|
|
246
|
+
// Clear cell selection before resize so selection outlines don't persist during drag
|
|
247
|
+
this.state().interaction.setActiveCell(null);
|
|
248
|
+
this.state().interaction.setSelectionRange(null);
|
|
249
|
+
this.getWrapperRef()?.nativeElement.focus({ preventScroll: true });
|
|
246
250
|
this.resizeStartX = e.clientX;
|
|
247
251
|
this.resizeColumnId = col.columnId;
|
|
248
252
|
this.resizeStartWidth = this.getColumnWidth(col);
|
|
@@ -546,7 +550,7 @@ DataGridTableComponent = __decorate([
|
|
|
546
550
|
[attr.rowSpan]="headerRows().length > 1 && rowIdx < headerRows().length - 1 ? headerRows().length - rowIdx : null"
|
|
547
551
|
[class.ogrid-th-pinned-left]="pinned === 'left'"
|
|
548
552
|
[class.ogrid-th-pinned-right]="pinned === 'right'"
|
|
549
|
-
[style.min-width.px]="col
|
|
553
|
+
[style.min-width.px]="getEffectiveMinWidth(col)"
|
|
550
554
|
[style.width.px]="getColumnWidth(col)"
|
|
551
555
|
[style.max-width.px]="getColumnWidth(col)"
|
|
552
556
|
[style.left.px]="pinned === 'left' ? getPinnedLeftOffset(col.columnId) : null"
|
|
@@ -641,7 +645,7 @@ DataGridTableComponent = __decorate([
|
|
|
641
645
|
[class.ogrid-td-pinned-left]="pinned === 'left'"
|
|
642
646
|
[class.ogrid-td-pinned-right]="pinned === 'right'"
|
|
643
647
|
class="ogrid-data-cell"
|
|
644
|
-
[style.min-width.px]="col
|
|
648
|
+
[style.min-width.px]="getEffectiveMinWidth(col)"
|
|
645
649
|
[style.width.px]="getColumnWidth(col)"
|
|
646
650
|
[style.max-width.px]="getColumnWidth(col)"
|
|
647
651
|
[style.left.px]="pinned === 'left' ? getPinnedLeftOffset(col.columnId) : null"
|
|
@@ -649,6 +653,7 @@ DataGridTableComponent = __decorate([
|
|
|
649
653
|
[style.text-align]="col.type === 'numeric' ? 'right' : col.type === 'boolean' ? 'center' : null"
|
|
650
654
|
>
|
|
651
655
|
@if (isEditingCellInline(item, col)) {
|
|
656
|
+
<div class="ogrid-editing-cell">
|
|
652
657
|
<ogrid-primeng-inline-cell-editor
|
|
653
658
|
[value]="getCellValueFn(item, col)"
|
|
654
659
|
[item]="item"
|
|
@@ -658,6 +663,7 @@ DataGridTableComponent = __decorate([
|
|
|
658
663
|
(commit)="onCellEditorCommit(item, col, rowIndex, colIdx, $event)"
|
|
659
664
|
(cancel)="cancelEdit()"
|
|
660
665
|
></ogrid-primeng-inline-cell-editor>
|
|
666
|
+
</div>
|
|
661
667
|
} @else if (isEditingCellPopover(item, col)) {
|
|
662
668
|
@let editorProps = buildPopoverEditorPropsForPrimeng(item, col, rowIndex, colIdx);
|
|
663
669
|
<ogrid-primeng-popover-cell-editor
|
|
@@ -951,6 +957,11 @@ DataGridTableComponent = __decorate([
|
|
|
951
957
|
text-overflow: ellipsis;
|
|
952
958
|
white-space: nowrap;
|
|
953
959
|
}
|
|
960
|
+
.ogrid-editing-cell {
|
|
961
|
+
width: 100%; height: 100%; display: flex; align-items: center; box-sizing: border-box;
|
|
962
|
+
outline: 2px solid var(--ogrid-selection-color, #217346); outline-offset: -1px;
|
|
963
|
+
z-index: 2; position: relative; background: var(--ogrid-bg, #fff); overflow: visible; padding: 0;
|
|
964
|
+
}
|
|
954
965
|
.ogrid-scroll-wrapper [data-drag-range] { background: var(--ogrid-range-bg, rgba(33, 115, 70, 0.12)) !important; }
|
|
955
966
|
.ogrid-fill-handle {
|
|
956
967
|
position: absolute;
|
|
@@ -4,99 +4,11 @@ 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
|
-
this.commit = new EventEmitter();
|
|
12
|
-
this.cancel = new EventEmitter();
|
|
13
|
-
this.localValue = signal('');
|
|
14
|
-
this.selectOptions = signal([]);
|
|
15
|
-
effect(() => {
|
|
16
|
-
const v = this.value;
|
|
17
|
-
this.localValue.set(v != null ? String(v) : '');
|
|
18
|
-
const col = this.column;
|
|
19
|
-
if (col.cellEditorParams?.values) {
|
|
20
|
-
this.selectOptions.set(col.cellEditorParams.values);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
ngAfterViewInit() {
|
|
25
|
-
setTimeout(() => {
|
|
26
|
-
const el = this.inputEl?.nativeElement;
|
|
27
|
-
if (el) {
|
|
28
|
-
el.focus();
|
|
29
|
-
if (el instanceof HTMLInputElement && el.type === 'text') {
|
|
30
|
-
el.select();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
commitValue(value) {
|
|
36
|
-
this.commit.emit(value);
|
|
37
|
-
}
|
|
38
|
-
onTextKeyDown(e) {
|
|
39
|
-
if (e.key === 'Enter') {
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
this.commitValue(this.localValue());
|
|
42
|
-
}
|
|
43
|
-
else if (e.key === 'Escape') {
|
|
44
|
-
e.preventDefault();
|
|
45
|
-
this.cancel.emit();
|
|
46
|
-
}
|
|
47
|
-
else if (e.key === 'Tab') {
|
|
48
|
-
e.preventDefault();
|
|
49
|
-
this.commitValue(this.localValue());
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
onSelectKeyDown(e) {
|
|
53
|
-
if (e.key === 'Escape') {
|
|
54
|
-
e.preventDefault();
|
|
55
|
-
this.cancel.emit();
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
onCheckboxKeyDown(e) {
|
|
59
|
-
if (e.key === 'Escape') {
|
|
60
|
-
e.preventDefault();
|
|
61
|
-
this.cancel.emit();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
onTextBlur() {
|
|
65
|
-
this.commitValue(this.localValue());
|
|
66
|
-
}
|
|
67
|
-
getInputStyle() {
|
|
68
|
-
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);';
|
|
69
|
-
const col = this.column;
|
|
70
|
-
if (col.type === 'numeric') {
|
|
71
|
-
return baseStyle + 'text-align:right;';
|
|
72
|
-
}
|
|
73
|
-
return baseStyle;
|
|
74
|
-
}
|
|
9
|
+
import { BaseInlineCellEditorComponent } from '@alaarab/ogrid-angular';
|
|
10
|
+
let InlineCellEditorComponent = class InlineCellEditorComponent extends BaseInlineCellEditorComponent {
|
|
75
11
|
};
|
|
76
|
-
__decorate([
|
|
77
|
-
Input({ required: true })
|
|
78
|
-
], InlineCellEditorComponent.prototype, "value", void 0);
|
|
79
|
-
__decorate([
|
|
80
|
-
Input({ required: true })
|
|
81
|
-
], InlineCellEditorComponent.prototype, "item", void 0);
|
|
82
|
-
__decorate([
|
|
83
|
-
Input({ required: true })
|
|
84
|
-
], InlineCellEditorComponent.prototype, "column", void 0);
|
|
85
|
-
__decorate([
|
|
86
|
-
Input({ required: true })
|
|
87
|
-
], InlineCellEditorComponent.prototype, "rowIndex", void 0);
|
|
88
|
-
__decorate([
|
|
89
|
-
Input({ required: true })
|
|
90
|
-
], InlineCellEditorComponent.prototype, "editorType", void 0);
|
|
91
|
-
__decorate([
|
|
92
|
-
Output()
|
|
93
|
-
], InlineCellEditorComponent.prototype, "commit", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
Output()
|
|
96
|
-
], InlineCellEditorComponent.prototype, "cancel", void 0);
|
|
97
|
-
__decorate([
|
|
98
|
-
ViewChild('inputEl')
|
|
99
|
-
], InlineCellEditorComponent.prototype, "inputEl", void 0);
|
|
100
12
|
InlineCellEditorComponent = __decorate([
|
|
101
13
|
Component({
|
|
102
14
|
selector: 'ogrid-primeng-inline-cell-editor',
|
|
@@ -115,19 +27,53 @@ InlineCellEditorComponent = __decorate([
|
|
|
115
27
|
[style]="getInputStyle()"
|
|
116
28
|
/>
|
|
117
29
|
}
|
|
30
|
+
@case ('richSelect') {
|
|
31
|
+
<div #richSelectWrapper
|
|
32
|
+
style="width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;min-width:0;position:relative">
|
|
33
|
+
<input
|
|
34
|
+
#richSelectInput
|
|
35
|
+
type="text"
|
|
36
|
+
[value]="searchText()"
|
|
37
|
+
(input)="onRichSelectSearch($any($event.target).value)"
|
|
38
|
+
(keydown)="onRichSelectKeyDown($event)"
|
|
39
|
+
placeholder="Search..."
|
|
40
|
+
style="width:100%;padding:0;border:none;background:transparent;color:inherit;font:inherit;font-size:13px;outline:none;min-width:0"
|
|
41
|
+
/>
|
|
42
|
+
<div #richSelectDropdown role="listbox"
|
|
43
|
+
style="position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2)">
|
|
44
|
+
@for (opt of filteredOptions(); track opt; let i = $index) {
|
|
45
|
+
<div role="option"
|
|
46
|
+
[attr.aria-selected]="i === highlightedIndex()"
|
|
47
|
+
(click)="commitValue(opt)"
|
|
48
|
+
[style]="i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424)'">
|
|
49
|
+
{{ getDisplayText(opt) }}
|
|
50
|
+
</div>
|
|
51
|
+
}
|
|
52
|
+
@if (filteredOptions().length === 0) {
|
|
53
|
+
<div style="padding:6px 8px;color:var(--ogrid-muted, #999)">No matches</div>
|
|
54
|
+
}
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
}
|
|
118
58
|
@case ('select') {
|
|
119
|
-
<div
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
59
|
+
<div #selectWrapper tabindex="0"
|
|
60
|
+
style="width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;min-width:0;position:relative"
|
|
61
|
+
(keydown)="onCustomSelectKeyDown($event)">
|
|
62
|
+
<div style="display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer;font-size:13px;color:inherit">
|
|
63
|
+
<span>{{ getDisplayText(value) }}</span>
|
|
64
|
+
<span style="margin-left:4px;font-size:10px;opacity:0.5">▾</span>
|
|
65
|
+
</div>
|
|
66
|
+
<div #selectDropdown role="listbox"
|
|
67
|
+
style="position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2)">
|
|
68
|
+
@for (opt of selectOptions(); track opt; let i = $index) {
|
|
69
|
+
<div role="option"
|
|
70
|
+
[attr.aria-selected]="i === highlightedIndex()"
|
|
71
|
+
(click)="commitValue(opt)"
|
|
72
|
+
[style]="i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424)'">
|
|
73
|
+
{{ getDisplayText(opt) }}
|
|
74
|
+
</div>
|
|
129
75
|
}
|
|
130
|
-
</
|
|
76
|
+
</div>
|
|
131
77
|
</div>
|
|
132
78
|
}
|
|
133
79
|
@case ('checkbox') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Menu } from 'primeng/menu';
|
|
2
2
|
import type { MenuItem } from 'primeng/api';
|
|
3
|
-
import { type ColumnHeaderMenuHandlers } from '@alaarab/ogrid-
|
|
3
|
+
import { type ColumnHeaderMenuHandlers } from '@alaarab/ogrid-angular';
|
|
4
4
|
/**
|
|
5
5
|
* Column header dropdown menu for pin/unpin, sort, and autosize actions.
|
|
6
6
|
* Uses PrimeNG Menu component.
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare class InlineCellEditorComponent<T = unknown> implements AfterViewInit {
|
|
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
|
-
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
|
-
getInputStyle(): string;
|
|
1
|
+
import { BaseInlineCellEditorComponent } from '@alaarab/ogrid-angular';
|
|
2
|
+
export declare class InlineCellEditorComponent<T = unknown> extends BaseInlineCellEditorComponent<T> {
|
|
22
3
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-angular-primeng",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.16",
|
|
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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"node": ">=18"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@alaarab/ogrid-angular": "2.0.
|
|
40
|
+
"@alaarab/ogrid-angular": "2.0.15"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@angular/core": "^21.0.0",
|