@alaarab/ogrid-js 2.3.0 → 2.4.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/types/OGrid.d.ts
CHANGED
|
@@ -120,6 +120,13 @@ export declare class OGrid<T> {
|
|
|
120
120
|
private cellEditor;
|
|
121
121
|
private contextMenu;
|
|
122
122
|
private layoutState;
|
|
123
|
+
private formulaEngine;
|
|
124
|
+
private formulaBar;
|
|
125
|
+
private formulaBarContainer;
|
|
126
|
+
/** Tracks the text currently displayed/edited in the formula bar. */
|
|
127
|
+
private formulaBarText;
|
|
128
|
+
/** Whether the formula bar input is currently in editing mode. */
|
|
129
|
+
private formulaBarEditing;
|
|
123
130
|
private events;
|
|
124
131
|
private unsubscribes;
|
|
125
132
|
private containerEl;
|
|
@@ -145,6 +152,11 @@ export declare class OGrid<T> {
|
|
|
145
152
|
private startCellEdit;
|
|
146
153
|
private buildFilterConfigs;
|
|
147
154
|
private handleFilterIconClick;
|
|
155
|
+
/** Build a grid data accessor for the formula engine from current state. */
|
|
156
|
+
private buildFormulaAccessor;
|
|
157
|
+
private handleFormulaBarCommit;
|
|
158
|
+
private handleFormulaBarCancel;
|
|
159
|
+
private handleFormulaBarStartEditing;
|
|
148
160
|
/** Subscribe to grid events. */
|
|
149
161
|
on<K extends keyof OGridEvents<T>>(event: K, handler: (data: OGridEvents<T>[K]) => void): void;
|
|
150
162
|
/** Unsubscribe from grid events. */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FormulaBar — DOM-based Excel-style formula bar for the vanilla JS grid.
|
|
3
|
+
*
|
|
4
|
+
* Layout: [Name Box] [fx] [Formula Input]
|
|
5
|
+
*
|
|
6
|
+
* Uses --ogrid-* CSS variables for theming. Matches the React FormulaBar
|
|
7
|
+
* component behavior exactly.
|
|
8
|
+
*/
|
|
9
|
+
export interface FormulaBarCallbacks {
|
|
10
|
+
/** Called when the user presses Enter to commit the formula/value. */
|
|
11
|
+
onCommit: () => void;
|
|
12
|
+
/** Called when the user presses Escape to cancel editing. */
|
|
13
|
+
onCancel: () => void;
|
|
14
|
+
/** Called when the input text changes. */
|
|
15
|
+
onInputChange: (text: string) => void;
|
|
16
|
+
/** Called when the user clicks the input to start editing. */
|
|
17
|
+
onStartEditing: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare class FormulaBar {
|
|
20
|
+
private el;
|
|
21
|
+
private nameBoxEl;
|
|
22
|
+
private inputEl;
|
|
23
|
+
private isEditing;
|
|
24
|
+
private callbacks;
|
|
25
|
+
constructor(callbacks: FormulaBarCallbacks);
|
|
26
|
+
/** Create the formula bar DOM and append it to the given container. */
|
|
27
|
+
mount(container: HTMLElement): void;
|
|
28
|
+
/** Update the formula bar display with the current active cell ref and formula text. */
|
|
29
|
+
update(cellRef: string | null, formulaText: string): void;
|
|
30
|
+
/** Set editing state. When true, the input becomes editable and receives focus. */
|
|
31
|
+
setEditing(editing: boolean): void;
|
|
32
|
+
/** Remove the formula bar from the DOM and clean up event listeners. */
|
|
33
|
+
destroy(): void;
|
|
34
|
+
private handleKeyDown;
|
|
35
|
+
private handleInput;
|
|
36
|
+
private handleClick;
|
|
37
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -34,3 +34,5 @@ export { FormulaEngineState } from './state/FormulaEngineState';
|
|
|
34
34
|
export type { FormulaEngineStateOptions } from './state/FormulaEngineState';
|
|
35
35
|
export { SideBar } from './components/SideBar';
|
|
36
36
|
export { HeaderFilter } from './components/HeaderFilter';
|
|
37
|
+
export { FormulaBar } from './components/FormulaBar';
|
|
38
|
+
export type { FormulaBarCallbacks } from './components/FormulaBar';
|
|
@@ -3,6 +3,7 @@ import type { IActiveCell, ISelectionRange } from '@alaarab/ogrid-core';
|
|
|
3
3
|
import type { GridState } from '../state/GridState';
|
|
4
4
|
import type { HeaderFilterState, HeaderFilterConfig } from '../state/HeaderFilterState';
|
|
5
5
|
import type { VirtualScrollState } from '../state/VirtualScrollState';
|
|
6
|
+
import type { FormulaEngineState } from '../state/FormulaEngineState';
|
|
6
7
|
export interface TableRendererInteractionState {
|
|
7
8
|
activeCell: IActiveCell | null;
|
|
8
9
|
selectionRange: ISelectionRange | null;
|
|
@@ -68,7 +69,9 @@ export declare class TableRenderer<T> {
|
|
|
68
69
|
private lastPinnedColumns;
|
|
69
70
|
private lastAllSelected;
|
|
70
71
|
private lastSomeSelected;
|
|
72
|
+
private formulaEngine;
|
|
71
73
|
constructor(container: HTMLElement, state: GridState<T>);
|
|
74
|
+
setFormulaEngine(engine: FormulaEngineState): void;
|
|
72
75
|
setVirtualScrollState(vs: VirtualScrollState): void;
|
|
73
76
|
setHeaderFilterState(state: HeaderFilterState, configs: Map<string, HeaderFilterConfig>): void;
|
|
74
77
|
setOnFilterIconClick(handler: (columnId: string, headerEl: HTMLElement) => void): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "OGrid vanilla JS – framework-free data grid with sorting, filtering, pagination, and spreadsheet-style editing.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"node": ">=18"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@alaarab/ogrid-core": "2.
|
|
39
|
+
"@alaarab/ogrid-core": "2.4.1"
|
|
40
40
|
},
|
|
41
41
|
"sideEffects": [
|
|
42
42
|
"**/*.css"
|