@alaarab/ogrid-react 2.4.2 → 2.5.1
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/index.js +1 -13923
- package/dist/types/components/FormulaBar.d.ts +3 -1
- package/dist/types/components/FormulaRefOverlay.d.ts +1 -1
- package/dist/types/hooks/useDataGridInteraction.d.ts +2 -0
- package/dist/types/hooks/useDataGridLayout.d.ts +2 -0
- package/dist/types/hooks/useFormulaBar.d.ts +9 -1
- package/dist/types/types/dataGridTypes.d.ts +16 -1
- package/dist/types/utils/dataGridViewModel.d.ts +1 -1
- package/package.json +2 -2
|
@@ -21,5 +21,7 @@ export interface FormulaBarProps {
|
|
|
21
21
|
onCancel: () => void;
|
|
22
22
|
/** Start editing the formula bar. */
|
|
23
23
|
startEditing: () => void;
|
|
24
|
+
/** External ref for the input element (for cursor position tracking). */
|
|
25
|
+
inputRef?: React.RefObject<HTMLInputElement | null>;
|
|
24
26
|
}
|
|
25
|
-
export declare function FormulaBar({ cellRef, formulaText, isEditing, onInputChange, onCommit, onCancel, startEditing, }: FormulaBarProps): React.ReactElement;
|
|
27
|
+
export declare function FormulaBar({ cellRef, formulaText, isEditing, onInputChange, onCommit, onCancel, startEditing, inputRef: externalInputRef, }: FormulaBarProps): React.ReactElement;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Uses the same container measurement pattern as MarchingAntsOverlay.
|
|
6
6
|
*/
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import { type FormulaReference } from '@alaarab/ogrid-core';
|
|
8
|
+
import { type FormulaReference } from '@alaarab/ogrid-core/formula';
|
|
9
9
|
export interface FormulaRefOverlayProps {
|
|
10
10
|
/** Ref to the positioned container that wraps the table. */
|
|
11
11
|
containerRef: React.RefObject<HTMLElement | null>;
|
|
@@ -57,6 +57,8 @@ export interface UseDataGridInteractionParams<T> {
|
|
|
57
57
|
hasFormula?: (col: number, row: number) => boolean;
|
|
58
58
|
/** Sets or clears a formula for a flat column + row. */
|
|
59
59
|
setFormula?: (col: number, row: number, formula: string | null) => void;
|
|
60
|
+
/** Called when a cell is clicked during formula editing to insert a cell reference. */
|
|
61
|
+
onFormulaInsertReference?: (reference: string) => boolean;
|
|
60
62
|
}
|
|
61
63
|
export interface UseDataGridInteractionResult<T> {
|
|
62
64
|
interaction: DataGridCellInteractionState;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
import type { RowId, IColumnDef } from '../types';
|
|
3
|
+
import type { IResponsiveColumnsConfig } from '@alaarab/ogrid-core';
|
|
3
4
|
import type { DataGridLayoutState, DataGridPinningState } from './useDataGridState';
|
|
4
5
|
export interface UseDataGridLayoutParams<T> {
|
|
5
6
|
columns: unknown[];
|
|
@@ -17,6 +18,7 @@ export interface UseDataGridLayoutParams<T> {
|
|
|
17
18
|
sortBy?: string;
|
|
18
19
|
sortDirection?: 'asc' | 'desc';
|
|
19
20
|
onColumnSort?: (columnKey: string, direction?: 'asc' | 'desc' | null) => void;
|
|
21
|
+
responsiveColumns?: boolean | IResponsiveColumnsConfig;
|
|
20
22
|
wrapperRef: RefObject<HTMLDivElement | null>;
|
|
21
23
|
}
|
|
22
24
|
export interface UseDataGridLayoutResult<T> {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Manages the formula bar text, editing mode, and reference extraction.
|
|
5
5
|
*/
|
|
6
|
-
import { type FormulaReference } from '@alaarab/ogrid-core';
|
|
6
|
+
import { type FormulaReference } from '@alaarab/ogrid-core/formula';
|
|
7
7
|
export interface UseFormulaBarParams {
|
|
8
8
|
/** Active cell column index (0-based). */
|
|
9
9
|
activeCol: number | null;
|
|
@@ -39,5 +39,13 @@ export interface UseFormulaBarResult {
|
|
|
39
39
|
referencedCells: FormulaReference[];
|
|
40
40
|
/** Whether the formula bar is actively being edited (for click-to-insert-ref guards). */
|
|
41
41
|
isFormulaBarEditing: React.MutableRefObject<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Insert a cell reference into the formula text at the current cursor position.
|
|
44
|
+
* Called by cell click handlers when the formula bar is in formula-edit mode.
|
|
45
|
+
* Returns true if the reference was inserted, false if not in formula-edit mode.
|
|
46
|
+
*/
|
|
47
|
+
insertReference: (reference: string) => boolean;
|
|
48
|
+
/** Ref to the formula bar input element — set by the FormulaBar component for cursor tracking. */
|
|
49
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
42
50
|
}
|
|
43
51
|
export declare function useFormulaBar(params: UseFormulaBarParams): UseFormulaBarResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { IColumnDef, IColumnGroupDef, ICellValueChangedEvent } from './columnTypes';
|
|
3
|
-
import type { IFormulaFunction, IRecalcResult, IGridDataAccessor, IAuditEntry, IAuditTrail } from '@alaarab/ogrid-core';
|
|
3
|
+
import type { IFormulaFunction, IRecalcResult, IGridDataAccessor, IAuditEntry, IAuditTrail, IResponsiveColumnsConfig } from '@alaarab/ogrid-core';
|
|
4
4
|
export type { RowId, UserLike, UserLikeInput, FilterValue, IFilters, IFetchParams, IPageResult, IDataSource, IGridColumnState, RowSelectionMode, IRowSelectionChangeEvent, StatusBarPanel, IStatusBarProps, IActiveCell, ISelectionRange, SideBarPanelId, ISideBarDef, ISheetDef, IVirtualScrollConfig, IColumnReorderConfig, IOGridApi, } from '@alaarab/ogrid-core';
|
|
5
5
|
export { toUserLike, isInSelectionRange, normalizeSelectionRange } from '@alaarab/ogrid-core';
|
|
6
6
|
import type { RowId, UserLike, IFilters, FilterValue, RowSelectionMode, IRowSelectionChangeEvent, IStatusBarProps, IDataSource, ISideBarDef, ISheetDef, IVirtualScrollConfig } from '@alaarab/ogrid-core';
|
|
@@ -77,6 +77,14 @@ interface IOGridBaseProps<T> {
|
|
|
77
77
|
pageSizeOptions?: number[];
|
|
78
78
|
/** Enable column reordering via drag-and-drop on header cells. Default: false. */
|
|
79
79
|
columnReorder?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Enable responsive column hiding. Columns with `responsivePriority` are
|
|
82
|
+
* auto-hidden when the container narrows below breakpoint thresholds.
|
|
83
|
+
* - `true`: use default breakpoints (576/768/992/1200px)
|
|
84
|
+
* - `IResponsiveColumnsConfig`: custom breakpoints
|
|
85
|
+
* - `false` / omitted: disabled
|
|
86
|
+
*/
|
|
87
|
+
responsiveColumns?: boolean | IResponsiveColumnsConfig;
|
|
80
88
|
/** Virtual scrolling configuration. When provided, only visible rows are rendered for large datasets. */
|
|
81
89
|
virtualScroll?: IVirtualScrollConfig;
|
|
82
90
|
/** Fixed row height in pixels. Overrides default row height (36px). */
|
|
@@ -206,6 +214,8 @@ export interface IOGridDataGridProps<T> {
|
|
|
206
214
|
};
|
|
207
215
|
/** Enable column reordering via drag-and-drop on header cells. Default: false. */
|
|
208
216
|
columnReorder?: boolean;
|
|
217
|
+
/** Responsive column hiding config (passed from IOGridBaseProps). */
|
|
218
|
+
responsiveColumns?: boolean | IResponsiveColumnsConfig;
|
|
209
219
|
/** Virtual scrolling configuration. When provided, only visible rows are rendered for large datasets. */
|
|
210
220
|
virtualScroll?: IVirtualScrollConfig;
|
|
211
221
|
/** Fixed row height in pixels. Overrides default row height (36px). */
|
|
@@ -240,4 +250,9 @@ export interface IOGridDataGridProps<T> {
|
|
|
240
250
|
formulaVersion?: number;
|
|
241
251
|
/** Cell references to highlight (from active formula in formula bar). */
|
|
242
252
|
formulaReferences?: import('@alaarab/ogrid-core').FormulaReference[];
|
|
253
|
+
/**
|
|
254
|
+
* Called when a cell is clicked during formula editing to insert a cell reference.
|
|
255
|
+
* Accepts a cell reference string (e.g. "A1") and returns true if the reference was inserted.
|
|
256
|
+
*/
|
|
257
|
+
onFormulaInsertReference?: (reference: string) => boolean;
|
|
243
258
|
}
|
|
@@ -59,7 +59,7 @@ export declare function getCellInteractionProps(descriptor: CellRenderDescriptor
|
|
|
59
59
|
role?: "button" | undefined;
|
|
60
60
|
onDoubleClick?: (() => void) | undefined;
|
|
61
61
|
tabIndex: number;
|
|
62
|
-
|
|
62
|
+
onPointerDown: (e: React.PointerEvent) => void;
|
|
63
63
|
onClick: () => void;
|
|
64
64
|
onContextMenu: (e: React.MouseEvent) => void;
|
|
65
65
|
'data-in-range'?: "true" | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "OGrid React – React hooks, headless components, and utilities for OGrid data grids.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": ">=18"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@alaarab/ogrid-core": "2.
|
|
42
|
+
"@alaarab/ogrid-core": "2.5.1",
|
|
43
43
|
"@tanstack/react-virtual": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|