@alaarab/ogrid-angular 2.6.1 → 2.7.0
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/components/base-datagrid-table.component.js +9 -0
- package/dist/esm/components/base-popover-cell-editor.component.js +12 -15
- package/dist/esm/services/datagrid-state.service.js +7 -20
- package/dist/types/components/base-datagrid-table.component.d.ts +6 -0
- package/dist/types/components/base-popover-cell-editor.component.d.ts +5 -3
- package/dist/types/types/dataGridTypes.d.ts +1 -0
- package/package.json +2 -2
|
@@ -222,6 +222,7 @@ export class BaseDataGridTableComponent {
|
|
|
222
222
|
pinnedRight,
|
|
223
223
|
minWidth: effectiveMinWidth,
|
|
224
224
|
width: w,
|
|
225
|
+
cssWidth: col.width,
|
|
225
226
|
};
|
|
226
227
|
});
|
|
227
228
|
}, ...(ngDevMode ? [{ debugName: "columnLayouts" }] : []));
|
|
@@ -578,6 +579,14 @@ export class BaseDataGridTableComponent {
|
|
|
578
579
|
this.state().editing.setEditingCell(null);
|
|
579
580
|
this.state().interaction.handleCellMouseDown(event, rowIndex, globalColIndex);
|
|
580
581
|
}
|
|
582
|
+
onNonDataSurfacePointerDown(event) {
|
|
583
|
+
if (typeof event.button === 'number' && event.button !== 0)
|
|
584
|
+
return;
|
|
585
|
+
event.preventDefault();
|
|
586
|
+
}
|
|
587
|
+
onNonDataSurfaceSelectStart(event) {
|
|
588
|
+
event.preventDefault();
|
|
589
|
+
}
|
|
581
590
|
onCellClick(rowIndex, globalColIndex) {
|
|
582
591
|
this.state().interaction.setActiveCell?.({ rowIndex, columnIndex: globalColIndex });
|
|
583
592
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Directive, Input, ViewChild, Injector, EnvironmentInjector, inject, signal, effect, createComponent } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
const _c0 = ["
|
|
4
|
-
const _c1 = ["editorContainer"];
|
|
3
|
+
const _c0 = ["editorContainer"];
|
|
5
4
|
/**
|
|
6
5
|
* Shared popover cell editor template used by all Angular UI packages.
|
|
7
6
|
*/
|
|
@@ -45,21 +44,23 @@ export const POPOVER_CELL_EDITOR_OVERLAY_STYLES = `
|
|
|
45
44
|
* framework-specific .ogrid-popover-anchor CSS styles.
|
|
46
45
|
*/
|
|
47
46
|
export class BasePopoverCellEditorComponent {
|
|
47
|
+
set editorContainerRef(ref) {
|
|
48
|
+
this.editorContainerRefSig.set(ref);
|
|
49
|
+
}
|
|
50
|
+
ngAfterViewInit() {
|
|
51
|
+
// Defer until after the anchor has painted; the editor container is gated by
|
|
52
|
+
// `showEditor()`, so the container ViewChild signal will fire on the next render.
|
|
53
|
+
setTimeout(() => this.showEditor.set(true), 0);
|
|
54
|
+
}
|
|
48
55
|
constructor() {
|
|
49
56
|
this.injector = inject(Injector);
|
|
50
57
|
this.envInjector = inject(EnvironmentInjector);
|
|
58
|
+
this.editorContainerRefSig = signal(undefined, ...(ngDevMode ? [{ debugName: "editorContainerRefSig" }] : []));
|
|
51
59
|
this.showEditor = signal(false, ...(ngDevMode ? [{ debugName: "showEditor" }] : []));
|
|
52
|
-
// Show editor after anchor is rendered
|
|
53
|
-
effect(() => {
|
|
54
|
-
const anchor = this.anchorRef;
|
|
55
|
-
if (anchor) {
|
|
56
|
-
setTimeout(() => this.showEditor.set(true), 0);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
60
|
// Render custom editor component when container is available.
|
|
60
61
|
// Angular's effect() ignores return values - use onCleanup() for cleanup.
|
|
61
62
|
effect((onCleanup) => {
|
|
62
|
-
const container = this.
|
|
63
|
+
const container = this.editorContainerRefSig();
|
|
63
64
|
const props = this.editorProps;
|
|
64
65
|
const col = this.column;
|
|
65
66
|
if (!container || !this.showEditor() || typeof col.cellEditor !== 'function')
|
|
@@ -83,10 +84,9 @@ export class BasePopoverCellEditorComponent {
|
|
|
83
84
|
}
|
|
84
85
|
static { this.ɵfac = function BasePopoverCellEditorComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BasePopoverCellEditorComponent)(); }; }
|
|
85
86
|
static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: BasePopoverCellEditorComponent, viewQuery: function BasePopoverCellEditorComponent_Query(rf, ctx) { if (rf & 1) {
|
|
86
|
-
i0.ɵɵviewQuery(_c0, 5)
|
|
87
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
87
88
|
} if (rf & 2) {
|
|
88
89
|
let _t;
|
|
89
|
-
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.anchorRef = _t.first);
|
|
90
90
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.editorContainerRef = _t.first);
|
|
91
91
|
} }, inputs: { item: "item", column: "column", rowIndex: "rowIndex", globalColIndex: "globalColIndex", displayValue: "displayValue", editorProps: "editorProps", onCancel: "onCancel" } }); }
|
|
92
92
|
}
|
|
@@ -113,9 +113,6 @@ export class BasePopoverCellEditorComponent {
|
|
|
113
113
|
}], onCancel: [{
|
|
114
114
|
type: Input,
|
|
115
115
|
args: [{ required: true }]
|
|
116
|
-
}], anchorRef: [{
|
|
117
|
-
type: ViewChild,
|
|
118
|
-
args: ['anchorEl']
|
|
119
116
|
}], editorContainerRef: [{
|
|
120
117
|
type: ViewChild,
|
|
121
118
|
args: ['editorContainer']
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injectable, signal, computed, effect, DestroyRef, inject, NgZone } from '@angular/core';
|
|
2
|
-
import { getDataGridStatusBarConfig,
|
|
2
|
+
import { getDataGridStatusBarConfig, applyFillValues, computeAggregations, normalizeSelectionRange, } from '@alaarab/ogrid-core';
|
|
3
3
|
import { DataGridLayoutHelper } from './datagrid-layout.service';
|
|
4
4
|
import { DataGridEditingHelper } from './datagrid-editing.service';
|
|
5
5
|
import { DataGridInteractionHelper } from './datagrid-interaction.service';
|
|
@@ -596,27 +596,14 @@ export class DataGridStateService {
|
|
|
596
596
|
const startColDef = visibleCols[norm.startCol];
|
|
597
597
|
const onCellValueChanged = this.wrappedOnCellValueChanged();
|
|
598
598
|
if (startItem && startColDef && onCellValueChanged) {
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
for (
|
|
603
|
-
|
|
604
|
-
continue;
|
|
605
|
-
if (row >= items.length || col >= visibleCols.length)
|
|
606
|
-
continue;
|
|
607
|
-
const item = items[row];
|
|
608
|
-
const colDef = visibleCols[col];
|
|
609
|
-
const colEditable = colDef.editable === true || (typeof colDef.editable === 'function' && colDef.editable(item));
|
|
610
|
-
if (!colEditable)
|
|
611
|
-
continue;
|
|
612
|
-
const oldValue = getCellValue(item, colDef);
|
|
613
|
-
const result = parseValue(startValue, oldValue, item, colDef);
|
|
614
|
-
if (!result.valid)
|
|
615
|
-
continue;
|
|
616
|
-
onCellValueChanged({ item, columnId: colDef.columnId, oldValue, newValue: result.value, rowIndex: row });
|
|
599
|
+
const fillEvents = applyFillValues(norm, fillStart.startRow, fillStart.startCol, items, visibleCols);
|
|
600
|
+
if (fillEvents.length > 0) {
|
|
601
|
+
this.beginBatch();
|
|
602
|
+
for (const event of fillEvents) {
|
|
603
|
+
onCellValueChanged(event);
|
|
617
604
|
}
|
|
605
|
+
this.endBatch();
|
|
618
606
|
}
|
|
619
|
-
this.endBatch();
|
|
620
607
|
}
|
|
621
608
|
this.interactionHelper.fillDragStart = null;
|
|
622
609
|
};
|
|
@@ -156,6 +156,7 @@ export declare abstract class BaseDataGridTableComponent<T = unknown> {
|
|
|
156
156
|
pinnedRight: boolean;
|
|
157
157
|
minWidth: number;
|
|
158
158
|
width: number;
|
|
159
|
+
cssWidth: string | undefined;
|
|
159
160
|
}[]>;
|
|
160
161
|
/** Visible columns filtered by column virtualization range (or all if column virt is off). */
|
|
161
162
|
readonly vsVisibleCols: import("@angular/core").Signal<IColumnDef<T>[]>;
|
|
@@ -178,6 +179,7 @@ export declare abstract class BaseDataGridTableComponent<T = unknown> {
|
|
|
178
179
|
pinnedRight: boolean;
|
|
179
180
|
minWidth: number;
|
|
180
181
|
width: number;
|
|
182
|
+
cssWidth: string | undefined;
|
|
181
183
|
}[]>;
|
|
182
184
|
/** Returns the effective row number column width (from overrides or default). */
|
|
183
185
|
getRowNumberWidth(): number;
|
|
@@ -276,6 +278,10 @@ export declare abstract class BaseDataGridTableComponent<T = unknown> {
|
|
|
276
278
|
onWrapperMouseDown(event: PointerEvent): void;
|
|
277
279
|
onGridKeyDown(event: KeyboardEvent): void;
|
|
278
280
|
onCellMouseDown(event: PointerEvent, rowIndex: number, globalColIndex: number): void;
|
|
281
|
+
onNonDataSurfacePointerDown(event: Event & {
|
|
282
|
+
button?: number;
|
|
283
|
+
}): void;
|
|
284
|
+
onNonDataSurfaceSelectStart(event: Event): void;
|
|
279
285
|
onCellClick(rowIndex: number, globalColIndex: number): void;
|
|
280
286
|
onCellContextMenu(event: MouseEvent): void;
|
|
281
287
|
onCellDblClick(rowId: RowId, columnId: string): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AfterViewInit } from '@angular/core';
|
|
1
2
|
import type { IColumnDef, ICellEditorProps } from '../types';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
4
|
/**
|
|
@@ -16,7 +17,7 @@ export declare const POPOVER_CELL_EDITOR_OVERLAY_STYLES = "\n :host { display
|
|
|
16
17
|
* Subclasses only need a @Component decorator with selector, template, and
|
|
17
18
|
* framework-specific .ogrid-popover-anchor CSS styles.
|
|
18
19
|
*/
|
|
19
|
-
export declare abstract class BasePopoverCellEditorComponent<T = unknown> {
|
|
20
|
+
export declare abstract class BasePopoverCellEditorComponent<T = unknown> implements AfterViewInit {
|
|
20
21
|
item: T;
|
|
21
22
|
column: IColumnDef<T>;
|
|
22
23
|
rowIndex: number;
|
|
@@ -24,11 +25,12 @@ export declare abstract class BasePopoverCellEditorComponent<T = unknown> {
|
|
|
24
25
|
displayValue: unknown;
|
|
25
26
|
editorProps: ICellEditorProps<T>;
|
|
26
27
|
onCancel: () => void;
|
|
27
|
-
private
|
|
28
|
-
private editorContainerRef?;
|
|
28
|
+
private set editorContainerRef(value);
|
|
29
29
|
private readonly injector;
|
|
30
30
|
private readonly envInjector;
|
|
31
|
+
private readonly editorContainerRefSig;
|
|
31
32
|
protected readonly showEditor: import("@angular/core").WritableSignal<boolean>;
|
|
33
|
+
ngAfterViewInit(): void;
|
|
32
34
|
constructor();
|
|
33
35
|
protected handleOverlayClick(): void;
|
|
34
36
|
static ɵfac: i0.ɵɵFactoryDeclaration<BasePopoverCellEditorComponent<any>, never>;
|
|
@@ -31,6 +31,7 @@ interface IOGridBaseProps<T> {
|
|
|
31
31
|
/** Called when user requests autosize for a single column (with measured width). */
|
|
32
32
|
onAutosizeColumn?: (columnId: string, width: number) => void;
|
|
33
33
|
onColumnPinned?: (columnId: string, pinned: 'left' | 'right' | null) => void;
|
|
34
|
+
pinnedColumns?: Record<string, 'left' | 'right'>;
|
|
34
35
|
editable?: boolean;
|
|
35
36
|
cellSelection?: boolean;
|
|
36
37
|
density?: 'compact' | 'normal' | 'comfortable';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-angular",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "OGrid Angular – Angular services, signals, and headless components for OGrid data grids.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"node": ">=18"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@alaarab/ogrid-core": "2.
|
|
38
|
+
"@alaarab/ogrid-core": "2.7.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@angular/core": "^21.0.0",
|