@alaarab/ogrid-react 2.2.0 → 2.3.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/index.js +3828 -181
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/useClipboard.d.ts +10 -0
- package/dist/types/hooks/useDataGridEditing.d.ts +8 -0
- package/dist/types/hooks/useDataGridInteraction.d.ts +10 -0
- package/dist/types/hooks/useDataGridTableOrchestration.d.ts +2 -0
- package/dist/types/hooks/useFillHandle.d.ts +3 -0
- package/dist/types/hooks/useFormulaEngine.d.ts +52 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/types/dataGridTypes.d.ts +43 -0
- package/dist/types/utils/dataGridViewModel.d.ts +2 -1
- package/dist/types/utils/index.d.ts +2 -2
- package/package.json +2 -2
|
@@ -81,3 +81,5 @@ export { useDataGridTableOrchestration } from './useDataGridTableOrchestration';
|
|
|
81
81
|
export type { UseDataGridTableOrchestrationParams, UseDataGridTableOrchestrationResult, } from './useDataGridTableOrchestration';
|
|
82
82
|
export { useColumnMeta } from './useColumnMeta';
|
|
83
83
|
export type { UseColumnMetaParams, ColumnMetaResult } from './useColumnMeta';
|
|
84
|
+
export { useFormulaEngine } from './useFormulaEngine';
|
|
85
|
+
export type { UseFormulaEngineParams, UseFormulaEngineResult } from './useFormulaEngine';
|
|
@@ -9,6 +9,16 @@ export interface UseClipboardParams<T> {
|
|
|
9
9
|
onCellValueChanged: ((event: ICellValueChangedEvent<T>) => void) | undefined;
|
|
10
10
|
beginBatch?: () => void;
|
|
11
11
|
endBatch?: () => void;
|
|
12
|
+
/** When true, enables formula-aware copy/paste. */
|
|
13
|
+
formulas?: boolean;
|
|
14
|
+
/** Flat (unfiltered) column list used to map visible col to flat col index. */
|
|
15
|
+
flatColumns?: IColumnDef<T>[];
|
|
16
|
+
/** Returns the formula string for a flat column + row, or undefined if none. */
|
|
17
|
+
getFormula?: (col: number, row: number) => string | undefined;
|
|
18
|
+
/** Returns true if a flat column + row has a formula. */
|
|
19
|
+
hasFormula?: (col: number, row: number) => boolean;
|
|
20
|
+
/** Sets or clears a formula for a flat column + row. */
|
|
21
|
+
setFormula?: (col: number, row: number, formula: string | null) => void;
|
|
12
22
|
}
|
|
13
23
|
export interface UseClipboardResult {
|
|
14
24
|
handleCopy: () => void;
|
|
@@ -31,6 +31,14 @@ export interface UseDataGridEditingParams<T> {
|
|
|
31
31
|
endCol: number;
|
|
32
32
|
} | null) => void;
|
|
33
33
|
colOffset: number;
|
|
34
|
+
/** Formula integration: set a formula for a cell coordinate. */
|
|
35
|
+
setFormula?: (col: number, row: number, formula: string | null) => void;
|
|
36
|
+
/** Formula integration: notify a non-formula cell changed. */
|
|
37
|
+
onFormulaCellChanged?: (col: number, row: number) => void;
|
|
38
|
+
/** Whether formula support is enabled. */
|
|
39
|
+
formulas?: boolean;
|
|
40
|
+
/** All flat columns (for mapping columnId → column index). */
|
|
41
|
+
flatColumns?: IColumnDef<T>[];
|
|
34
42
|
}
|
|
35
43
|
export interface UseDataGridEditingResult<T> {
|
|
36
44
|
editing: DataGridEditingState<T>;
|
|
@@ -47,6 +47,16 @@ export interface UseDataGridInteractionParams<T> {
|
|
|
47
47
|
wrapperRef: RefObject<HTMLDivElement | null>;
|
|
48
48
|
/** Custom keydown handler — called before grid default. preventDefault() suppresses grid handling. */
|
|
49
49
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
50
|
+
/** When true, enables formula-aware clipboard and fill handle. */
|
|
51
|
+
formulas?: boolean;
|
|
52
|
+
/** Flat column list for formula coordinate mapping. */
|
|
53
|
+
flatColumns?: IColumnDef<T>[];
|
|
54
|
+
/** Returns the formula string for a flat column + row. */
|
|
55
|
+
getFormula?: (col: number, row: number) => string | undefined;
|
|
56
|
+
/** Returns true if a flat column + row has a formula. */
|
|
57
|
+
hasFormula?: (col: number, row: number) => boolean;
|
|
58
|
+
/** Sets or clears a formula for a flat column + row. */
|
|
59
|
+
setFormula?: (col: number, row: number, formula: string | null) => void;
|
|
50
60
|
}
|
|
51
61
|
export interface UseDataGridInteractionResult<T> {
|
|
52
62
|
interaction: DataGridCellInteractionState;
|
|
@@ -61,6 +61,8 @@ export interface UseDataGridTableOrchestrationResult<T> {
|
|
|
61
61
|
headerRows: HeaderRow<T>[];
|
|
62
62
|
allowOverflowX: boolean;
|
|
63
63
|
fitToContent: boolean;
|
|
64
|
+
showColumnLetters: boolean;
|
|
65
|
+
showNameBox: boolean;
|
|
64
66
|
editCallbacks: {
|
|
65
67
|
commitCellEdit: DataGridEditingState<T>['commitCellEdit'];
|
|
66
68
|
setEditingCell: DataGridEditingState<T>['setEditingCell'];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
import type { ISelectionRange, IActiveCell } from '../types';
|
|
3
3
|
import type { IColumnDef, ICellValueChangedEvent } from '../types/columnTypes';
|
|
4
|
+
import type { IFillFormulaOptions } from '../utils';
|
|
4
5
|
export interface UseFillHandleParams<T> {
|
|
5
6
|
items: T[];
|
|
6
7
|
visibleCols: IColumnDef<T>[];
|
|
@@ -13,6 +14,8 @@ export interface UseFillHandleParams<T> {
|
|
|
13
14
|
wrapperRef: RefObject<HTMLDivElement | null>;
|
|
14
15
|
beginBatch?: () => void;
|
|
15
16
|
endBatch?: () => void;
|
|
17
|
+
/** Optional formula-aware fill options. When provided, cells with formulas adjust references during fill. */
|
|
18
|
+
formulaOptions?: IFillFormulaOptions<T>;
|
|
16
19
|
}
|
|
17
20
|
export interface UseFillHandleResult {
|
|
18
21
|
fillDrag: {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFormulaEngine — React hook for integrating the formula engine with the grid.
|
|
3
|
+
*
|
|
4
|
+
* Lazily creates a FormulaEngine instance when `formulas` prop is true.
|
|
5
|
+
* Provides accessor bridge between grid data and formula coordinates.
|
|
6
|
+
* Tree-shakeable: if `formulas` is false, no formula code is loaded.
|
|
7
|
+
*/
|
|
8
|
+
import { type IGridDataAccessor, type IFormulaFunction, type IRecalcResult, type IAuditEntry, type IAuditTrail } from '@alaarab/ogrid-core';
|
|
9
|
+
import type { IColumnDef } from '@alaarab/ogrid-core';
|
|
10
|
+
export interface UseFormulaEngineParams<T> {
|
|
11
|
+
/** Enable formula support. */
|
|
12
|
+
formulas?: boolean;
|
|
13
|
+
/** Grid data items. */
|
|
14
|
+
items: T[];
|
|
15
|
+
/** Flat leaf columns (for mapping column index ↔ columnId). */
|
|
16
|
+
flatColumns: IColumnDef<T>[];
|
|
17
|
+
/** Initial formulas to load. */
|
|
18
|
+
initialFormulas?: Array<{
|
|
19
|
+
col: number;
|
|
20
|
+
row: number;
|
|
21
|
+
formula: string;
|
|
22
|
+
}>;
|
|
23
|
+
/** Called when recalculation produces cascading updates. */
|
|
24
|
+
onFormulaRecalc?: (result: IRecalcResult) => void;
|
|
25
|
+
/** Custom formula functions. */
|
|
26
|
+
formulaFunctions?: Record<string, IFormulaFunction>;
|
|
27
|
+
/** Named ranges: name → cell/range reference string. */
|
|
28
|
+
namedRanges?: Record<string, string>;
|
|
29
|
+
/** Sheet accessors for cross-sheet references. */
|
|
30
|
+
sheets?: Record<string, IGridDataAccessor>;
|
|
31
|
+
}
|
|
32
|
+
export interface UseFormulaEngineResult {
|
|
33
|
+
/** Get the formula engine's computed value for a cell coordinate. */
|
|
34
|
+
getFormulaValue: (col: number, row: number) => unknown;
|
|
35
|
+
/** Check if a cell has a formula. */
|
|
36
|
+
hasFormula: (col: number, row: number) => boolean;
|
|
37
|
+
/** Get the formula string for a cell. */
|
|
38
|
+
getFormula: (col: number, row: number) => string | undefined;
|
|
39
|
+
/** Set or clear a formula for a cell. Triggers recalculation. */
|
|
40
|
+
setFormula: (col: number, row: number, formula: string | null) => void;
|
|
41
|
+
/** Notify the engine that a non-formula cell value changed. Triggers dependent recalc. */
|
|
42
|
+
onCellChanged: (col: number, row: number) => void;
|
|
43
|
+
/** Get all cells that a cell depends on (deep, transitive). */
|
|
44
|
+
getPrecedents: (col: number, row: number) => IAuditEntry[];
|
|
45
|
+
/** Get all cells that depend on a cell (deep, transitive). */
|
|
46
|
+
getDependents: (col: number, row: number) => IAuditEntry[];
|
|
47
|
+
/** Get full audit trail for a cell. */
|
|
48
|
+
getAuditTrail: (col: number, row: number) => IAuditTrail | null;
|
|
49
|
+
/** Whether formula support is active. */
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
}
|
|
52
|
+
export declare function useFormulaEngine<T>(params: UseFormulaEngineParams<T>): UseFormulaEngineResult;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, DEFAULT_MIN_COLUMN_WIDTH, CELL_PADDING, GRID_BORDER_RADIUS, } from '@alaarab/ogrid-core';
|
|
2
2
|
export type { ColumnFilterType, IColumnFilterDef, IColumnMeta, IColumnDef, IColumnGroupDef, IColumnDefinition, ICellValueChangedEvent, ICellEditorProps, CellEditorParams, IValueParserParams, UserLike, UserLikeInput, FilterValue, IFilters, IFetchParams, IPageResult, IDataSource, IGridColumnState, IOGridApi, IOGridProps, IOGridDataGridProps, RowSelectionMode, RowId, IRowSelectionChangeEvent, StatusBarPanel, IStatusBarProps, IActiveCell, ISelectionRange, HeaderCell, HeaderRow, SideBarPanelId, ISideBarDef, IDateFilterValue, IVirtualScrollConfig, IColumnReorderConfig, } from './types';
|
|
3
3
|
export { toUserLike, isInSelectionRange, normalizeSelectionRange } from './types';
|
|
4
|
-
export { useFilterOptions, useOGrid, useActiveCell, useCellEditing, useContextMenu, useCellSelection, useClipboard, useRowSelection, useKeyboardNavigation, useUndoRedo, useDebounce, useFillHandle, useDataGridState, useColumnHeaderFilterState, useTextFilterState, useMultiSelectFilterState, usePeopleFilterState, useDateFilterState, useColumnChooserState, useInlineCellEditorState, useColumnResize, useRichSelectState, useSelectState, useSideBarState, useTableLayout, useColumnReorder, useVirtualScroll, useListVirtualizer, useLatestRef, usePaginationControls, useDataGridTableOrchestration, useColumnMeta, } from './hooks';
|
|
5
|
-
export type { UseFilterOptionsResult, UseOGridResult, UseOGridPagination, UseOGridColumnChooser, UseOGridLayout, UseOGridFilters, ColumnChooserPlacement, UseActiveCellResult, UseCellEditingResult, EditingCell, UseContextMenuResult, ContextMenuPosition, UseCellSelectionResult, UseCellSelectionParams, UseClipboardResult, UseClipboardParams, UseRowSelectionResult, UseRowSelectionParams, UseKeyboardNavigationResult, UseKeyboardNavigationParams, UseUndoRedoResult, UseUndoRedoParams, UseFillHandleResult, UseFillHandleParams, UseDataGridStateParams, UseDataGridStateResult, DataGridLayoutState, DataGridRowSelectionState, DataGridEditingState, DataGridCellInteractionState, DataGridContextMenuState, DataGridViewModelState, DataGridPinningState, UseColumnHeaderFilterStateParams, UseColumnHeaderFilterStateResult, UseTextFilterStateParams, UseTextFilterStateResult, UseMultiSelectFilterStateParams, UseMultiSelectFilterStateResult, UsePeopleFilterStateParams, UsePeopleFilterStateResult, UseDateFilterStateParams, UseDateFilterStateResult, UseColumnChooserStateParams, UseColumnChooserStateResult, UseInlineCellEditorStateParams, UseInlineCellEditorStateResult, InlineCellEditorType, UseColumnResizeParams, UseColumnResizeResult, UseRichSelectStateParams, UseRichSelectStateResult, UseSelectStateParams, UseSelectStateResult, UseSideBarStateParams, UseSideBarStateResult, UseTableLayoutParams, UseTableLayoutResult, UseColumnReorderParams, UseColumnReorderResult, UseVirtualScrollParams, UseVirtualScrollResult, UsePaginationControlsProps, UsePaginationControlsResult, UseDataGridTableOrchestrationParams, UseDataGridTableOrchestrationResult, UseColumnMetaParams, ColumnMetaResult, } from './hooks';
|
|
4
|
+
export { useFilterOptions, useOGrid, useActiveCell, useCellEditing, useContextMenu, useCellSelection, useClipboard, useRowSelection, useKeyboardNavigation, useUndoRedo, useDebounce, useFillHandle, useDataGridState, useColumnHeaderFilterState, useTextFilterState, useMultiSelectFilterState, usePeopleFilterState, useDateFilterState, useColumnChooserState, useInlineCellEditorState, useColumnResize, useRichSelectState, useSelectState, useSideBarState, useTableLayout, useColumnReorder, useVirtualScroll, useListVirtualizer, useLatestRef, usePaginationControls, useDataGridTableOrchestration, useColumnMeta, useFormulaEngine, } from './hooks';
|
|
5
|
+
export type { UseFilterOptionsResult, UseOGridResult, UseOGridPagination, UseOGridColumnChooser, UseOGridLayout, UseOGridFilters, ColumnChooserPlacement, UseActiveCellResult, UseCellEditingResult, EditingCell, UseContextMenuResult, ContextMenuPosition, UseCellSelectionResult, UseCellSelectionParams, UseClipboardResult, UseClipboardParams, UseRowSelectionResult, UseRowSelectionParams, UseKeyboardNavigationResult, UseKeyboardNavigationParams, UseUndoRedoResult, UseUndoRedoParams, UseFillHandleResult, UseFillHandleParams, UseDataGridStateParams, UseDataGridStateResult, DataGridLayoutState, DataGridRowSelectionState, DataGridEditingState, DataGridCellInteractionState, DataGridContextMenuState, DataGridViewModelState, DataGridPinningState, UseColumnHeaderFilterStateParams, UseColumnHeaderFilterStateResult, UseTextFilterStateParams, UseTextFilterStateResult, UseMultiSelectFilterStateParams, UseMultiSelectFilterStateResult, UsePeopleFilterStateParams, UsePeopleFilterStateResult, UseDateFilterStateParams, UseDateFilterStateResult, UseColumnChooserStateParams, UseColumnChooserStateResult, UseInlineCellEditorStateParams, UseInlineCellEditorStateResult, InlineCellEditorType, UseColumnResizeParams, UseColumnResizeResult, UseRichSelectStateParams, UseRichSelectStateResult, UseSelectStateParams, UseSelectStateResult, UseSideBarStateParams, UseSideBarStateResult, UseTableLayoutParams, UseTableLayoutResult, UseColumnReorderParams, UseColumnReorderResult, UseVirtualScrollParams, UseVirtualScrollResult, UsePaginationControlsProps, UsePaginationControlsResult, UseDataGridTableOrchestrationParams, UseDataGridTableOrchestrationResult, UseColumnMetaParams, ColumnMetaResult, UseFormulaEngineParams, UseFormulaEngineResult, } from './hooks';
|
|
6
6
|
export { GRID_ROOT_STYLE, CURSOR_CELL_STYLE, POPOVER_ANCHOR_STYLE, PREVENT_DEFAULT, NOOP, STOP_PROPAGATION, } from './constants/domHelpers';
|
|
7
7
|
export { OGridLayout } from './components/OGridLayout';
|
|
8
8
|
export type { OGridLayoutProps } from './components/OGridLayout';
|
|
@@ -32,7 +32,7 @@ export { BaseDropIndicator } from './components/BaseDropIndicator';
|
|
|
32
32
|
export type { BaseDropIndicatorProps } from './components/BaseDropIndicator';
|
|
33
33
|
export { DateFilterContent, getColumnHeaderFilterStateParams, getDateFilterContentProps, } from './components/ColumnHeaderFilterContent';
|
|
34
34
|
export type { IColumnHeaderFilterProps, DateFilterContentProps, DateFilterClassNames, } from './components/ColumnHeaderFilterContent';
|
|
35
|
-
export { escapeCsvValue, buildCsvHeader, buildCsvRows, exportToCsv, triggerCsvDownload, getCellValue, flattenColumns, buildHeaderRows, getFilterField, mergeFilter, deriveFilterOptionsFromData, getMultiSelectFilterFields, getStatusBarParts, getDataGridStatusBarConfig, GRID_CONTEXT_MENU_ITEMS, COLUMN_HEADER_MENU_ITEMS, getContextMenuHandlers, getColumnHeaderMenuItems, formatShortcut, getPaginationViewModel, PAGE_SIZE_OPTIONS, MAX_PAGE_BUTTONS, getHeaderFilterConfig, getCellRenderDescriptor, CellDescriptorCache, isRowInRange, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, getCellInteractionProps, parseValue, numberParser, currencyParser, dateParser, emailParser, booleanParser, computeAggregations, processClientSideData, partitionColumnsForVirtualization, areGridRowPropsEqual, findCtrlArrowTarget, computeTabNavigation, rangesEqual, clampSelectionToBounds, computeAutoScrollSpeed, formatCellValueForTsv, formatSelectionAsTsv, parseTsvClipboard, UndoRedoStack, } from './utils';
|
|
35
|
+
export { escapeCsvValue, buildCsvHeader, buildCsvRows, exportToCsv, triggerCsvDownload, getCellValue, flattenColumns, buildHeaderRows, getFilterField, mergeFilter, deriveFilterOptionsFromData, getMultiSelectFilterFields, getStatusBarParts, getDataGridStatusBarConfig, GRID_CONTEXT_MENU_ITEMS, COLUMN_HEADER_MENU_ITEMS, getContextMenuHandlers, getColumnHeaderMenuItems, formatShortcut, getPaginationViewModel, PAGE_SIZE_OPTIONS, MAX_PAGE_BUTTONS, getHeaderFilterConfig, getCellRenderDescriptor, CellDescriptorCache, isRowInRange, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, getCellInteractionProps, parseValue, numberParser, currencyParser, dateParser, emailParser, booleanParser, computeAggregations, processClientSideData, partitionColumnsForVirtualization, areGridRowPropsEqual, findCtrlArrowTarget, computeTabNavigation, rangesEqual, clampSelectionToBounds, computeAutoScrollSpeed, formatCellValueForTsv, formatSelectionAsTsv, parseTsvClipboard, UndoRedoStack, indexToColumnLetter, formatCellReference, } from './utils';
|
|
36
36
|
export type { CsvColumn, StatusBarPart, StatusBarPartsInput, GridContextMenuItem, GridContextMenuHandlerProps, PaginationViewModel, HeaderFilterConfigInput, HeaderFilterConfig, CellRenderDescriptorInput, CellRenderDescriptor, CellRenderMode, CellInteractionHandlers, ParseValueResult, AggregationResult, GridRowComparatorProps, IColumnHeaderMenuItem, ColumnHeaderMenuInput, ColumnHeaderMenuHandlers, } from './utils';
|
|
37
37
|
export { renderFilterContent } from './components/ColumnHeaderFilterRenderers';
|
|
38
38
|
export type { FilterContentRenderers, MultiSelectRendererProps, TextRendererProps, PeopleRendererProps, DateRendererProps, } from './components/ColumnHeaderFilterRenderers';
|
|
@@ -1,5 +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
4
|
export type { RowId, UserLike, UserLikeInput, FilterValue, IFilters, IFetchParams, IPageResult, IDataSource, IGridColumnState, RowSelectionMode, IRowSelectionChangeEvent, StatusBarPanel, IStatusBarProps, IActiveCell, ISelectionRange, SideBarPanelId, ISideBarDef, IVirtualScrollConfig, IColumnReorderConfig, IOGridApi, } from '@alaarab/ogrid-core';
|
|
4
5
|
export { toUserLike, isInSelectionRange, normalizeSelectionRange } from '@alaarab/ogrid-core';
|
|
5
6
|
import type { RowId, UserLike, IFilters, FilterValue, RowSelectionMode, IRowSelectionChangeEvent, IStatusBarProps, IDataSource, ISideBarDef, IVirtualScrollConfig } from '@alaarab/ogrid-core';
|
|
@@ -43,6 +44,8 @@ interface IOGridBaseProps<T> {
|
|
|
43
44
|
onSelectionChange?: (event: IRowSelectionChangeEvent<T>) => void;
|
|
44
45
|
/** Show Excel-style row numbers column at the start of the grid (1, 2, 3...). Default: false. */
|
|
45
46
|
showRowNumbers?: boolean;
|
|
47
|
+
/** Enable Excel-style cell references: column letter headers (A, B, C...), row number gutter, and a name box showing the active cell (e.g. "A1"). Implies showRowNumbers. */
|
|
48
|
+
cellReferences?: boolean;
|
|
46
49
|
statusBar?: boolean | IStatusBarProps;
|
|
47
50
|
defaultPageSize?: number;
|
|
48
51
|
defaultSortBy?: string;
|
|
@@ -94,6 +97,22 @@ interface IOGridBaseProps<T> {
|
|
|
94
97
|
onError?: (error: unknown) => void;
|
|
95
98
|
/** Called when a cell renderer or custom editor throws an error. */
|
|
96
99
|
onCellError?: (error: Error, errorInfo: React.ErrorInfo) => void;
|
|
100
|
+
/** Enable Excel-like formula support. When true, cells starting with '=' are treated as formulas. Default: false. */
|
|
101
|
+
formulas?: boolean;
|
|
102
|
+
/** Initial formulas to load when the formula engine initializes. */
|
|
103
|
+
initialFormulas?: Array<{
|
|
104
|
+
col: number;
|
|
105
|
+
row: number;
|
|
106
|
+
formula: string;
|
|
107
|
+
}>;
|
|
108
|
+
/** Called when formula recalculation produces updated cell values (e.g. cascade from an edited cell). */
|
|
109
|
+
onFormulaRecalc?: (result: IRecalcResult) => void;
|
|
110
|
+
/** Custom formula functions to register with the formula engine (e.g. { MYFUNC: { minArgs: 1, maxArgs: 1, evaluate: ... } }). */
|
|
111
|
+
formulaFunctions?: Record<string, IFormulaFunction>;
|
|
112
|
+
/** Named ranges for the formula engine: name → cell/range ref string (e.g. { Revenue: 'A1:A10' }). */
|
|
113
|
+
namedRanges?: Record<string, string>;
|
|
114
|
+
/** Sheet accessors for cross-sheet formula references (e.g. { Sheet2: accessor }). */
|
|
115
|
+
sheets?: Record<string, IGridDataAccessor>;
|
|
97
116
|
'aria-label'?: string;
|
|
98
117
|
'aria-labelledby'?: string;
|
|
99
118
|
}
|
|
@@ -152,6 +171,12 @@ export interface IOGridDataGridProps<T> {
|
|
|
152
171
|
onSelectionChange?: (event: IRowSelectionChangeEvent<T>) => void;
|
|
153
172
|
/** Show Excel-style row numbers column. */
|
|
154
173
|
showRowNumbers?: boolean;
|
|
174
|
+
/** Show Excel-style column letter headers (A, B, C...) above the header row. */
|
|
175
|
+
showColumnLetters?: boolean;
|
|
176
|
+
/** Show a name box displaying the active cell reference (e.g. "A1"). */
|
|
177
|
+
showNameBox?: boolean;
|
|
178
|
+
/** Callback when the active cell changes. Used by the name box to display the current cell reference. */
|
|
179
|
+
onActiveCellChange?: (ref: string | null) => void;
|
|
155
180
|
/** Current page number (1-based) for row number calculation. */
|
|
156
181
|
currentPage?: number;
|
|
157
182
|
/** Page size for row number calculation. */
|
|
@@ -185,4 +210,22 @@ export interface IOGridDataGridProps<T> {
|
|
|
185
210
|
'aria-labelledby'?: string;
|
|
186
211
|
/** Custom keydown handler. Called before grid's built-in handling. Call event.preventDefault() to suppress grid default. */
|
|
187
212
|
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
213
|
+
/** Enable formula support. When true, cell values starting with '=' are treated as formulas. */
|
|
214
|
+
formulas?: boolean;
|
|
215
|
+
/** Get the formula engine's computed value for a cell, or undefined if no formula. */
|
|
216
|
+
getFormulaValue?: (col: number, row: number) => unknown;
|
|
217
|
+
/** Check if a cell has a formula. */
|
|
218
|
+
hasFormula?: (col: number, row: number) => boolean;
|
|
219
|
+
/** Get the formula string for a cell. */
|
|
220
|
+
getFormula?: (col: number, row: number) => string | undefined;
|
|
221
|
+
/** Set a formula for a cell (called from edit commit when value starts with '='). */
|
|
222
|
+
setFormula?: (col: number, row: number, formula: string | null) => void;
|
|
223
|
+
/** Notify the formula engine that a non-formula cell changed. */
|
|
224
|
+
onFormulaCellChanged?: (col: number, row: number) => void;
|
|
225
|
+
/** Get all cells that a cell depends on (deep, transitive). */
|
|
226
|
+
getPrecedents?: (col: number, row: number) => IAuditEntry[];
|
|
227
|
+
/** Get all cells that depend on a cell (deep, transitive). */
|
|
228
|
+
getDependents?: (col: number, row: number) => IAuditEntry[];
|
|
229
|
+
/** Get full audit trail for a cell. */
|
|
230
|
+
getAuditTrail?: (col: number, row: number) => IAuditTrail | null;
|
|
188
231
|
}
|
|
@@ -19,7 +19,7 @@ export declare function resolveCellDisplayContent<T>(col: IColumnDef<T>, item: T
|
|
|
19
19
|
* Resolves the cellStyle from a column def.
|
|
20
20
|
* Returns React.CSSProperties for JSX compatibility.
|
|
21
21
|
*/
|
|
22
|
-
export declare function resolveCellStyle<T>(col: IColumnDef<T>, item: T): React.CSSProperties | undefined;
|
|
22
|
+
export declare function resolveCellStyle<T>(col: IColumnDef<T>, item: T, displayValue?: unknown): React.CSSProperties | undefined;
|
|
23
23
|
/**
|
|
24
24
|
* Builds props for InlineCellEditor with React-specific IColumnDef.
|
|
25
25
|
*/
|
|
@@ -63,6 +63,7 @@ export declare function getCellInteractionProps(descriptor: CellRenderDescriptor
|
|
|
63
63
|
onClick: () => void;
|
|
64
64
|
onContextMenu: (e: React.MouseEvent) => void;
|
|
65
65
|
'data-in-range'?: "true" | undefined;
|
|
66
|
+
'data-active-cell'?: "true" | undefined;
|
|
66
67
|
'data-row-index': number;
|
|
67
68
|
'data-col-index': number;
|
|
68
69
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { escapeCsvValue, buildCsvHeader, buildCsvRows, exportToCsv, triggerCsvDownload, getCellValue, flattenColumns, buildHeaderRows, 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, partitionColumnsForVirtualization, computeNextSortState, measureColumnContentWidth, AUTOSIZE_EXTRA_PX, AUTOSIZE_MAX_PX, findCtrlArrowTarget, computeTabNavigation, rangesEqual, clampSelectionToBounds, computeAutoScrollSpeed, formatCellValueForTsv, formatSelectionAsTsv, parseTsvClipboard, applyPastedValues, applyCutClear, applyFillValues, computeArrowNavigation, applyCellDeletion, applyRangeRowSelection, computeRowSelectionState, UndoRedoStack, buildCellIndex, } from '@alaarab/ogrid-core';
|
|
2
|
-
export type { CsvColumn, StatusBarPart, StatusBarPartsInput, GridContextMenuItem, GridContextMenuHandlerProps, PaginationViewModel, ParseValueResult, AggregationResult, IColumnHeaderMenuItem, ColumnHeaderMenuInput, ColumnHeaderMenuHandlers, ArrowNavigationContext, ArrowNavigationResult, } from '@alaarab/ogrid-core';
|
|
1
|
+
export { escapeCsvValue, buildCsvHeader, buildCsvRows, exportToCsv, triggerCsvDownload, getCellValue, flattenColumns, buildHeaderRows, 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, partitionColumnsForVirtualization, computeNextSortState, measureColumnContentWidth, AUTOSIZE_EXTRA_PX, AUTOSIZE_MAX_PX, findCtrlArrowTarget, computeTabNavigation, rangesEqual, clampSelectionToBounds, computeAutoScrollSpeed, formatCellValueForTsv, formatSelectionAsTsv, parseTsvClipboard, applyPastedValues, applyCutClear, applyFillValues, computeArrowNavigation, applyCellDeletion, applyRangeRowSelection, computeRowSelectionState, UndoRedoStack, buildCellIndex, indexToColumnLetter, formatCellReference, getScrollTopForRow, } from '@alaarab/ogrid-core';
|
|
2
|
+
export type { CsvColumn, StatusBarPart, StatusBarPartsInput, GridContextMenuItem, GridContextMenuHandlerProps, PaginationViewModel, ParseValueResult, AggregationResult, IColumnHeaderMenuItem, ColumnHeaderMenuInput, ColumnHeaderMenuHandlers, ArrowNavigationContext, ArrowNavigationResult, IFillFormulaOptions, } from '@alaarab/ogrid-core';
|
|
3
3
|
export { getHeaderFilterConfig, getCellRenderDescriptor, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, getCellInteractionProps, } from './dataGridViewModel';
|
|
4
4
|
export { CellDescriptorCache } from '@alaarab/ogrid-core';
|
|
5
5
|
export type { HeaderFilterConfigInput, HeaderFilterConfig, CellRenderDescriptorInput, CellRenderDescriptor, CellRenderMode, CellInteractionHandlers, } from './dataGridViewModel';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
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.3.0",
|
|
43
43
|
"@tanstack/react-virtual": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|