@alaarab/ogrid-js 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 +2 -12744
- package/dist/styles/ogrid.css +69 -0
- package/dist/types/OGridEventWiring.d.ts +1 -1
- package/dist/types/components/InlineCellEditor.d.ts +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/renderer/TableRenderer.d.ts +4 -4
- package/dist/types/state/ColumnReorderState.d.ts +2 -2
- package/dist/types/state/FillHandleState.d.ts +2 -2
- package/dist/types/state/GridState.d.ts +7 -2
- package/dist/types/types/gridTypes.d.ts +12 -4
- package/package.json +2 -2
package/dist/styles/ogrid.css
CHANGED
|
@@ -296,9 +296,18 @@
|
|
|
296
296
|
width: 8px;
|
|
297
297
|
cursor: col-resize;
|
|
298
298
|
user-select: none;
|
|
299
|
+
touch-action: none; /* Prevent browser scroll/zoom during column resize drag */
|
|
299
300
|
z-index: var(--ogrid-z-resize-handle, 1);
|
|
300
301
|
}
|
|
301
302
|
|
|
303
|
+
/* Increase touch target on touch-capable devices */
|
|
304
|
+
@media (pointer: coarse) {
|
|
305
|
+
.ogrid-resize-handle {
|
|
306
|
+
width: 16px;
|
|
307
|
+
right: -8px;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
302
311
|
.ogrid-resize-handle::after {
|
|
303
312
|
content: '';
|
|
304
313
|
position: absolute;
|
|
@@ -406,6 +415,7 @@
|
|
|
406
415
|
outline-offset: -1px;
|
|
407
416
|
z-index: var(--ogrid-z-active-cell, 2);
|
|
408
417
|
position: relative;
|
|
418
|
+
contain: none;
|
|
409
419
|
}
|
|
410
420
|
|
|
411
421
|
/* Cell range/drag highlights: qualify with .ogrid-container to reach specificity 0,3,0,
|
|
@@ -447,9 +457,21 @@
|
|
|
447
457
|
border-radius: 1px;
|
|
448
458
|
cursor: crosshair;
|
|
449
459
|
pointer-events: auto;
|
|
460
|
+
touch-action: none; /* Prevent browser scroll/zoom during fill handle drag */
|
|
450
461
|
z-index: var(--ogrid-z-fill-handle, 3);
|
|
451
462
|
}
|
|
452
463
|
|
|
464
|
+
/* Increase touch target on touch-capable devices */
|
|
465
|
+
@media (pointer: coarse) {
|
|
466
|
+
.ogrid-fill-handle {
|
|
467
|
+
width: 14px;
|
|
468
|
+
height: 14px;
|
|
469
|
+
right: -7px;
|
|
470
|
+
bottom: -7px;
|
|
471
|
+
border-radius: 2px;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
453
475
|
/* ── Pinned Columns ── */
|
|
454
476
|
|
|
455
477
|
.ogrid-table th[data-pinned='left'],
|
|
@@ -1072,3 +1094,50 @@
|
|
|
1072
1094
|
.ogrid-table td[data-type='numeric'] {
|
|
1073
1095
|
text-align: right;
|
|
1074
1096
|
}
|
|
1097
|
+
|
|
1098
|
+
/* ── Responsive Layout ── */
|
|
1099
|
+
|
|
1100
|
+
/* Compact pagination on small screens */
|
|
1101
|
+
@media (max-width: 576px) {
|
|
1102
|
+
.ogrid-pagination {
|
|
1103
|
+
flex-direction: column;
|
|
1104
|
+
align-items: stretch;
|
|
1105
|
+
gap: 8px;
|
|
1106
|
+
padding: 6px 8px;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
.ogrid-pagination-nav {
|
|
1110
|
+
order: -1;
|
|
1111
|
+
justify-content: center;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
.ogrid-pagination-info {
|
|
1115
|
+
font-size: 11px;
|
|
1116
|
+
text-align: center;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
.ogrid-pagination-size {
|
|
1120
|
+
font-size: 11px;
|
|
1121
|
+
justify-content: center;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
.ogrid-toolbar {
|
|
1125
|
+
flex-wrap: wrap;
|
|
1126
|
+
gap: 4px;
|
|
1127
|
+
padding: 4px 8px;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
/* Sidebar becomes overlay on narrow viewports */
|
|
1131
|
+
.ogrid-sidebar-container {
|
|
1132
|
+
position: absolute;
|
|
1133
|
+
top: 0;
|
|
1134
|
+
bottom: 0;
|
|
1135
|
+
right: 0;
|
|
1136
|
+
z-index: 50;
|
|
1137
|
+
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
.ogrid-body-area {
|
|
1141
|
+
position: relative;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Extracts event subscription setup from OGrid for modularity:
|
|
5
5
|
* - initializeInteraction() — creates interaction states and subscribes events
|
|
6
|
-
* - attachGlobalHandlers() — global
|
|
6
|
+
* - attachGlobalHandlers() — global pointer handlers for resize and drag
|
|
7
7
|
*
|
|
8
8
|
* Not exported publicly — instantiated and owned by OGrid.
|
|
9
9
|
*/
|
|
@@ -10,7 +10,7 @@ export declare class InlineCellEditor<T> {
|
|
|
10
10
|
private onAfterCommit;
|
|
11
11
|
private scrollCleanup;
|
|
12
12
|
constructor(container: HTMLElement);
|
|
13
|
-
startEdit(rowId: RowId, columnId: string, item: T, column: IColumnDef<T>, cell: HTMLTableCellElement, onCommit: (rowId: RowId, columnId: string, value: unknown) => void, onCancel: () => void, onAfterCommit?: () => void): void;
|
|
13
|
+
startEdit(rowId: RowId, columnId: string, item: T, column: IColumnDef<T>, cell: HTMLTableCellElement, onCommit: (rowId: RowId, columnId: string, value: unknown) => void, onCancel: () => void, onAfterCommit?: () => void, overrideValue?: unknown): void;
|
|
14
14
|
/** Returns the cell currently being edited, or null if no editor is open. */
|
|
15
15
|
getEditingCell(): {
|
|
16
16
|
rowId: RowId;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type { ColumnFilterType, IDateFilterValue, IColumnFilterDef, IColumnMeta, IValueParserParams, IColumnDef as ICoreColumnDef, ICellValueChangedEvent, ICellEditorProps, CellEditorParams, IColumnGroupDef as ICoreColumnGroupDef, HeaderCell, HeaderRow, IColumnDefinition, RowId, UserLike, UserLikeInput, FilterValue, IFilters, IFetchParams, IPageResult, IDataSource, IGridColumnState, RowSelectionMode, IRowSelectionChangeEvent, StatusBarPanel, IStatusBarProps, IActiveCell, ISelectionRange, SideBarPanelId, ISideBarDef, ISheetDef, IVirtualScrollConfig, IColumnReorderConfig, IOGridApi, CsvColumn, FormulaExportOptions, StatusBarPart, StatusBarPartsInput, PaginationViewModel, GridContextMenuItem, IColumnHeaderMenuItem, GridContextMenuHandlerProps, ColumnHeaderMenuInput, ColumnHeaderMenuHandlers, ParseValueResult, AggregationResult, GridRowComparatorProps, ColumnPinState, IDropTarget, ICalculateDropTargetParams, IVisibleRange, IVisibleColumnRange, SortFilterRequest, SortFilterResponse, HeaderFilterConfigInput, HeaderFilterConfig, CellRenderDescriptorInput, CellRenderDescriptor, CellRenderMode, OverlayRect, ISortState, ArrowNavigationContext, ArrowNavigationResult, IFillFormulaOptions, FormulaReference, IResponsiveColumnsConfig, ZIndexKey, ICellAddress, ICellRange, CellKey, FormulaErrorType, TokenType, Token, ASTNode, BinaryOp, IFormulaContext, IFormulaFunction, IEvaluator, IRecalcResult, IFormulaEngineConfig, IGridDataAccessor, INamedRange, IAuditEntry, IAuditTrail, } from '@alaarab/ogrid-core';
|
|
2
|
+
export { toUserLike, isInSelectionRange, normalizeSelectionRange, escapeCsvValue, buildCsvHeader, buildCsvRows, exportToCsv, triggerCsvDownload, getCellValue, isColumnEditable, createGridDataAccessor, flattenColumns, buildHeaderRows, isFilterConfig, 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, areGridRowPropsEqual, isRowInRange, getPinStateForColumn, reorderColumnArray, calculateDropTarget, computeVisibleRange, computeTotalHeight, getScrollTopForRow, computeVisibleColumnRange, partitionColumnsForVirtualization, createSortFilterWorker, terminateSortFilterWorker, extractValueMatrix, processClientSideDataAsync, getHeaderFilterConfig, getCellRenderDescriptor, CellDescriptorCache, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, measureRange, buildCellIndex, injectGlobalStyles, computeNextSortState, measureColumnContentWidth, AUTOSIZE_EXTRA_PX, AUTOSIZE_MAX_PX, findCtrlArrowTarget, computeTabNavigation, computeArrowNavigation, applyCellDeletion, rangesEqual, clampSelectionToBounds, computeAutoScrollSpeed, applyRangeRowSelection, computeRowSelectionState, formatCellValueForTsv, formatSelectionAsTsv, parseTsvClipboard, applyPastedValues, applyCutClear, applyFillValues, UndoRedoStack, validateColumns, validateRowIds, validateVirtualScrollConfig, indexToColumnLetter, columnLetterToIndex, formatCellReference, getResponsiveHiddenColumns, RESPONSIVE_BREAKPOINTS, resolveResponsiveConfig, applyResponsiveHiding, } from '@alaarab/ogrid-core';
|
|
3
|
+
export { CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, ROW_NUMBER_COLUMN_ID, ROW_NUMBER_COLUMN_MIN_WIDTH, DEFAULT_MIN_COLUMN_WIDTH, CELL_PADDING, GRID_BORDER_RADIUS, DEFAULT_DEBOUNCE_MS, PEOPLE_SEARCH_DEBOUNCE_MS, SIDEBAR_TRANSITION_MS, Z_INDEX, } from '@alaarab/ogrid-core';
|
|
4
|
+
export { FormulaError, FormulaEngine, FormulaEvaluator, DependencyGraph, tokenize, parse, createBuiltInFunctions, parseCellRef, parseRange, formatAddress, toCellKey, fromCellKey, adjustFormulaReferences, toNumber, formulaToString, toBoolean, flattenArgs, isFormulaError, REF_ERROR, DIV_ZERO_ERROR, VALUE_ERROR, NAME_ERROR, CIRC_ERROR, GENERAL_ERROR, NA_ERROR, extractFormulaReferences, processFormulaBarCommit, deriveFormulaBarText, handleFormulaBarKeyDown, canInsertReference, insertReferenceAtCursor, FORMULA_REF_COLORS, FORMULA_BAR_CSS, FORMULA_BAR_STYLES, } from '@alaarab/ogrid-core/formula';
|
|
2
5
|
export type { IColumnDef, IColumnGroupDef, ICellEditorContext } from './types/columnTypes';
|
|
3
6
|
export type { OGridOptions, OGridEvents, IJsOGridApi, CellEvent } from './types/gridTypes';
|
|
4
7
|
export { debounce } from './utils';
|
|
@@ -20,7 +20,7 @@ export interface TableRendererInteractionState {
|
|
|
20
20
|
onCellContextMenu?: (cellEvent: CellEvent) => void;
|
|
21
21
|
onResizeStart?: (columnId: string, clientX: number, currentWidth: number) => void;
|
|
22
22
|
onResizeDoubleClick?: (columnId: string) => void;
|
|
23
|
-
onFillHandleMouseDown?: (e:
|
|
23
|
+
onFillHandleMouseDown?: (e: PointerEvent) => void;
|
|
24
24
|
rowSelectionMode?: 'single' | 'multiple' | 'none';
|
|
25
25
|
selectedRowIds?: Set<RowId>;
|
|
26
26
|
onRowCheckboxChange?: (rowId: RowId, checked: boolean, rowIndex: number, shiftKey: boolean) => void;
|
|
@@ -33,7 +33,7 @@ export interface TableRendererInteractionState {
|
|
|
33
33
|
pinnedColumns?: Record<string, 'left' | 'right'>;
|
|
34
34
|
leftOffsets?: Record<string, number>;
|
|
35
35
|
rightOffsets?: Record<string, number>;
|
|
36
|
-
onColumnReorderStart?: (columnId: string, event:
|
|
36
|
+
onColumnReorderStart?: (columnId: string, event: PointerEvent) => void;
|
|
37
37
|
}
|
|
38
38
|
export declare class TableRenderer<T> {
|
|
39
39
|
private container;
|
|
@@ -49,11 +49,11 @@ export declare class TableRenderer<T> {
|
|
|
49
49
|
private dropIndicator;
|
|
50
50
|
private virtualScrollState;
|
|
51
51
|
private _tbodyClickHandler;
|
|
52
|
-
private
|
|
52
|
+
private _tbodyPointerdownHandler;
|
|
53
53
|
private _tbodyDblclickHandler;
|
|
54
54
|
private _tbodyContextmenuHandler;
|
|
55
55
|
private _theadClickHandler;
|
|
56
|
-
private
|
|
56
|
+
private _theadPointerdownHandler;
|
|
57
57
|
private _theadDblclickHandler;
|
|
58
58
|
private lastActiveCell;
|
|
59
59
|
private lastSelectionRange;
|
|
@@ -29,9 +29,9 @@ export declare class ColumnReorderState {
|
|
|
29
29
|
get dropIndicatorX(): number | null;
|
|
30
30
|
/**
|
|
31
31
|
* Begin a column drag operation.
|
|
32
|
-
* Called from
|
|
32
|
+
* Called from pointerdown on a header cell.
|
|
33
33
|
*/
|
|
34
|
-
startDrag(columnId: string, event:
|
|
34
|
+
startDrag(columnId: string, event: PointerEvent, columns: {
|
|
35
35
|
columnId: string;
|
|
36
36
|
}[], columnOrder: string[], pinnedColumns: Record<string, 'left' | 'right'> | undefined, tableElement: Element): void;
|
|
37
37
|
private handleMouseMove;
|
|
@@ -42,8 +42,8 @@ export declare class FillHandleState<T> {
|
|
|
42
42
|
updateParams(params: FillHandleParams<T>): void;
|
|
43
43
|
/** Fill the current selection down from the top row (keyboard Ctrl+D). No-op if no selection or editable=false. */
|
|
44
44
|
fillDown(): void;
|
|
45
|
-
/** Called when the fill handle square is
|
|
46
|
-
startFillDrag(e:
|
|
45
|
+
/** Called when the fill handle square is pointerdown'd. */
|
|
46
|
+
startFillDrag(e: PointerEvent): void;
|
|
47
47
|
private onMouseMove;
|
|
48
48
|
private onMouseUp;
|
|
49
49
|
private applyFillValuesFromCore;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IColumnDef, IColumnGroupDef } from '../types/columnTypes';
|
|
2
2
|
import type { RowId, IFilters, OGridOptions, IJsOGridApi } from '../types/gridTypes';
|
|
3
|
-
import type { FilterValue } from '@alaarab/ogrid-core';
|
|
3
|
+
import type { FilterValue, IResponsiveColumnsConfig } from '@alaarab/ogrid-core';
|
|
4
4
|
import type { FormulaEngineState } from './FormulaEngineState';
|
|
5
5
|
interface StateChangeEvent {
|
|
6
6
|
type: 'data' | 'sort' | 'filter' | 'page' | 'columns' | 'loading';
|
|
@@ -33,6 +33,8 @@ export declare class GridState<T> {
|
|
|
33
33
|
private _formulaEngine;
|
|
34
34
|
private _filterOptions;
|
|
35
35
|
private _columnOrder;
|
|
36
|
+
private _responsiveColumns;
|
|
37
|
+
private _containerWidth;
|
|
36
38
|
private _visibleColsCache;
|
|
37
39
|
private _visibleColsDirty;
|
|
38
40
|
constructor(options: OGridOptions<T>);
|
|
@@ -56,7 +58,8 @@ export declare class GridState<T> {
|
|
|
56
58
|
get columnOrder(): string[];
|
|
57
59
|
get rowHeight(): number | undefined;
|
|
58
60
|
get ariaLabel(): string | undefined;
|
|
59
|
-
|
|
61
|
+
get responsiveColumns(): IResponsiveColumnsConfig | null;
|
|
62
|
+
/** Get the visible columns in display order (respects column reorder and responsive hiding). Memoized via dirty flag. */
|
|
60
63
|
get visibleColumnDefs(): IColumnDef<T>[];
|
|
61
64
|
/** Get processed (sorted, filtered, paginated) items for current page. */
|
|
62
65
|
getProcessedItems(): {
|
|
@@ -86,6 +89,8 @@ export declare class GridState<T> {
|
|
|
86
89
|
clearFilters(): void;
|
|
87
90
|
setVisibleColumns(columns: Set<string>): void;
|
|
88
91
|
setColumnOrder(order: string[]): void;
|
|
92
|
+
/** Update the container width for responsive column hiding. Invalidates the visible-cols cache. */
|
|
93
|
+
setContainerWidth(width: number): void;
|
|
89
94
|
setLoading(loading: boolean): void;
|
|
90
95
|
refreshData(): void;
|
|
91
96
|
onStateChange(handler: (event: StateChangeEvent) => void): () => void;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { IColumnDef, IColumnGroupDef, ICellValueChangedEvent } from './columnTypes';
|
|
2
|
-
import type { RowId, IFilters, IDataSource, RowSelectionMode, IRowSelectionChangeEvent, IOGridApi, ISideBarDef, IStatusBarProps, IVirtualScrollConfig, IFormulaFunction, IRecalcResult, IGridDataAccessor } from '@alaarab/ogrid-core';
|
|
3
|
-
export type { RowId, UserLike, UserLikeInput, FilterValue, IFilters, IFetchParams, IPageResult, IDataSource, IGridColumnState, RowSelectionMode, IRowSelectionChangeEvent, StatusBarPanel, IStatusBarProps, IActiveCell, ISelectionRange, SideBarPanelId, ISideBarDef, IVirtualScrollConfig, IOGridApi, IFormulaFunction, IRecalcResult, IGridDataAccessor, IAuditEntry, IAuditTrail, } from '@alaarab/ogrid-core';
|
|
2
|
+
import type { RowId, IFilters, IDataSource, RowSelectionMode, IRowSelectionChangeEvent, IOGridApi, ISideBarDef, IStatusBarProps, IVirtualScrollConfig, IFormulaFunction, IRecalcResult, IGridDataAccessor, IResponsiveColumnsConfig } from '@alaarab/ogrid-core';
|
|
3
|
+
export type { RowId, UserLike, UserLikeInput, FilterValue, IFilters, IFetchParams, IPageResult, IDataSource, IGridColumnState, RowSelectionMode, IRowSelectionChangeEvent, StatusBarPanel, IStatusBarProps, IActiveCell, ISelectionRange, SideBarPanelId, ISideBarDef, IVirtualScrollConfig, IOGridApi, IFormulaFunction, IRecalcResult, IGridDataAccessor, IAuditEntry, IAuditTrail, IResponsiveColumnsConfig, } from '@alaarab/ogrid-core';
|
|
4
4
|
/** Standardized cell event parameter for cell interaction callbacks. */
|
|
5
5
|
export interface CellEvent {
|
|
6
6
|
/** Zero-based row index within the current page. */
|
|
7
7
|
rowIndex: number;
|
|
8
8
|
/** Zero-based column index among visible columns. */
|
|
9
9
|
colIndex: number;
|
|
10
|
-
/** The original DOM
|
|
11
|
-
event?: MouseEvent;
|
|
10
|
+
/** The original DOM event (MouseEvent for click/dblclick/contextmenu, PointerEvent for pointerdown). */
|
|
11
|
+
event?: MouseEvent | PointerEvent;
|
|
12
12
|
/** Typed row identifier (string or number). Present for double-click events. */
|
|
13
13
|
rowId?: RowId;
|
|
14
14
|
/** Column identifier string. Present for double-click events. */
|
|
@@ -104,6 +104,14 @@ export interface OGridOptions<T> {
|
|
|
104
104
|
onFirstDataRendered?: () => void;
|
|
105
105
|
/** Virtual scrolling configuration. */
|
|
106
106
|
virtualScroll?: IVirtualScrollConfig;
|
|
107
|
+
/**
|
|
108
|
+
* Enable responsive column hiding based on container width.
|
|
109
|
+
* Columns with `responsivePriority` are hidden/shown as the container resizes.
|
|
110
|
+
* - `true`: use default breakpoints
|
|
111
|
+
* - `IResponsiveColumnsConfig`: custom breakpoints
|
|
112
|
+
* - `false` or omitted: disabled
|
|
113
|
+
*/
|
|
114
|
+
responsiveColumns?: boolean | IResponsiveColumnsConfig;
|
|
107
115
|
/**
|
|
108
116
|
* Offload sorting to a Web Worker to avoid blocking the main thread.
|
|
109
117
|
* - `true`: always use worker sort
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.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.5.1"
|
|
40
40
|
},
|
|
41
41
|
"sideEffects": [
|
|
42
42
|
"**/*.css"
|