@alaarab/ogrid-react 2.4.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/esm/index.js CHANGED
@@ -1200,7 +1200,8 @@ function computeCellDescriptor(item, col, rowIndex, colIdx, input) {
1200
1200
  globalColIndex,
1201
1201
  rowId,
1202
1202
  rowIndex,
1203
- displayValue: formulaDisplay !== void 0 ? formulaDisplay : cellValue
1203
+ displayValue: formulaDisplay !== void 0 ? formulaDisplay : cellValue,
1204
+ columnType: col.type
1204
1205
  };
1205
1206
  }
1206
1207
  function resolveCellDisplayContent(col, item, displayValue) {
@@ -1314,6 +1315,8 @@ var CHECKBOX_COLUMN_WIDTH = 48;
1314
1315
  var ROW_NUMBER_COLUMN_WIDTH = 50;
1315
1316
  var DEFAULT_MIN_COLUMN_WIDTH = 80;
1316
1317
  var CELL_PADDING = 16;
1318
+ var ROW_NUMBER_COLUMN_MIN_WIDTH = 30;
1319
+ var ROW_NUMBER_COLUMN_ID = "__row_number__";
1317
1320
  var GRID_BORDER_RADIUS = 6;
1318
1321
  var AUTOSIZE_EXTRA_PX = 16;
1319
1322
  var AUTOSIZE_MAX_PX = 520;
@@ -8803,6 +8806,7 @@ function useKeyboardNavigation(params) {
8803
8806
  case "ArrowUp":
8804
8807
  case "ArrowRight":
8805
8808
  case "ArrowLeft": {
8809
+ if (editingCell != null) break;
8806
8810
  e.preventDefault();
8807
8811
  const { newRowIndex, newColumnIndex, newRange } = computeArrowNavigation({
8808
8812
  direction: e.key,
@@ -10792,9 +10796,10 @@ function useColumnResize({
10792
10796
  [columnId]: { widthPx: latestWidth }
10793
10797
  }));
10794
10798
  };
10799
+ const effectiveMinWidth = columnId === ROW_NUMBER_COLUMN_ID ? ROW_NUMBER_COLUMN_MIN_WIDTH : minWidth;
10795
10800
  const onMove = (moveEvent) => {
10796
10801
  const deltaX = moveEvent.clientX - startX;
10797
- latestWidth = Math.max(minWidth, startWidth + deltaX);
10802
+ latestWidth = Math.max(effectiveMinWidth, startWidth + deltaX);
10798
10803
  if (!rafRef.current) {
10799
10804
  rafRef.current = requestAnimationFrame(() => {
10800
10805
  rafRef.current = 0;
@@ -10855,9 +10860,14 @@ function getSelectDisplayText(value, formatValue) {
10855
10860
  return value != null ? String(value) : "";
10856
10861
  }
10857
10862
  function useRichSelectState(params) {
10858
- const { values, formatValue, onCommit, onCancel } = params;
10863
+ const { values, formatValue, initialValue, onCommit, onCancel } = params;
10859
10864
  const [searchText, setSearchText] = useState("");
10860
- const [highlightedIndex, setHighlightedIndex] = useState(0);
10865
+ const initialIndex = values.findIndex((v) => String(v) === String(initialValue));
10866
+ const [highlightedIndex, setHighlightedIndex] = useState(Math.max(initialIndex, 0));
10867
+ useEffect(() => {
10868
+ const idx = values.findIndex((v) => String(v) === String(initialValue));
10869
+ setHighlightedIndex(Math.max(idx, 0));
10870
+ }, [initialValue, values]);
10861
10871
  const getDisplayText = useCallback(
10862
10872
  (value) => getSelectDisplayText(value, formatValue),
10863
10873
  [formatValue]
@@ -10919,6 +10929,10 @@ function useSelectState(params) {
10919
10929
  );
10920
10930
  const initialIndex = values.findIndex((v) => String(v) === String(initialValue));
10921
10931
  const [highlightedIndex, setHighlightedIndex] = useState(Math.max(initialIndex, 0));
10932
+ useEffect(() => {
10933
+ const idx = values.findIndex((v) => String(v) === String(initialValue));
10934
+ setHighlightedIndex(Math.max(idx, 0));
10935
+ }, [initialValue, values]);
10922
10936
  useEffect(() => {
10923
10937
  const dropdown = dropdownRef.current;
10924
10938
  if (!dropdown) return;
@@ -12996,6 +13010,7 @@ function BaseInlineCellEditor(props) {
12996
13010
  const richSelect = useRichSelectState({
12997
13011
  values: editorValues,
12998
13012
  formatValue: editorFormatValue,
13013
+ initialValue: value,
12999
13014
  onCommit,
13000
13015
  onCancel
13001
13016
  });
@@ -13893,4 +13908,4 @@ function createBaseFilterRenderers(components, dateClassNames) {
13893
13908
  };
13894
13909
  }
13895
13910
 
13896
- export { BaseColumnHeaderMenu, BaseDropIndicator, BaseEmptyState, BaseInlineCellEditor, BaseLoadingOverlay, CELL_PADDING, CHECKBOX_COLUMN_WIDTH, COLUMN_HEADER_MENU_ITEMS, CURSOR_CELL_STYLE, CellDescriptorCache, CellErrorBoundary, ColumnChooserContent, DEFAULT_MIN_COLUMN_WIDTH, DateFilterContent, EmptyState, FormulaBar, FormulaRefOverlay, GRID_BORDER_RADIUS, GRID_CONTEXT_MENU_ITEMS, GRID_ROOT_STYLE, GridContextMenu, MAX_PAGE_BUTTONS, MarchingAntsOverlay, NOOP3 as NOOP, OGridLayout, PAGE_SIZE_OPTIONS, POPOVER_ANCHOR_STYLE, PREVENT_DEFAULT, PaginationControlsBase, ROW_NUMBER_COLUMN_WIDTH, STOP_PROPAGATION, SheetTabs, SideBar, StatusBar, UndoRedoStack, areGridRowPropsEqual, booleanParser, buildCsvHeader, buildCsvRows, buildHeaderRows, buildInlineEditorProps2 as buildInlineEditorProps, buildPopoverEditorProps2 as buildPopoverEditorProps, clampSelectionToBounds, computeAggregations, computeAutoScrollSpeed, computeTabNavigation, createBaseFilterRenderers, createOGrid, currencyParser, dateParser, deriveFilterOptionsFromData, editorInputStyle, editorWrapperStyle, emailParser, escapeCsvValue, exportToCsv, findCtrlArrowTarget, flattenColumns, formatCellReference, formatCellValueForTsv, formatSelectionAsTsv, formatShortcut, getCellInteractionProps, getCellRenderDescriptor, getCellValue, getColumnHeaderFilterStateParams, getColumnHeaderMenuItems, getColumnHeaderMenuProps, getContextMenuHandlers, getDataGridStatusBarConfig, getDateFilterContentProps, getFilterField, getHeaderFilterConfig, getMultiSelectFilterFields, getPaginationViewModel, getStatusBarParts, indexToColumnLetter, isInSelectionRange, isRowInRange, mergeFilter, normalizeSelectionRange, numberParser, parseTsvClipboard, parseValue, partitionColumnsForVirtualization, processClientSideData, rangesEqual, renderFilterContent, resolveCellDisplayContent2 as resolveCellDisplayContent, resolveCellStyle2 as resolveCellStyle, richSelectDropdownStyle, richSelectNoMatchesStyle, richSelectOptionHighlightedStyle, richSelectOptionStyle, richSelectWrapperStyle, selectChevronStyle, selectDisplayStyle, selectEditorStyle, toUserLike, triggerCsvDownload, useActiveCell, useCellEditing, useCellSelection, useClipboard, useColumnChooserState, useColumnHeaderFilterState, useColumnMeta, useColumnReorder, useColumnResize, useContextMenu, useDataGridState, useDataGridTableOrchestration, useDateFilterState, useDebounce, useFillHandle, useFilterOptions, useFormulaBar, useFormulaEngine, useInlineCellEditorState, useKeyboardNavigation, useLatestRef, useListVirtualizer, useMultiSelectFilterState, useOGrid, usePaginationControls, usePeopleFilterState, useRichSelectState, useRowSelection, useSelectState, useSideBarState, useTableLayout, useTextFilterState, useUndoRedo, useVirtualScroll };
13911
+ export { BaseColumnHeaderMenu, BaseDropIndicator, BaseEmptyState, BaseInlineCellEditor, BaseLoadingOverlay, CELL_PADDING, CHECKBOX_COLUMN_WIDTH, COLUMN_HEADER_MENU_ITEMS, CURSOR_CELL_STYLE, CellDescriptorCache, CellErrorBoundary, ColumnChooserContent, DEFAULT_MIN_COLUMN_WIDTH, DateFilterContent, EmptyState, FormulaBar, FormulaRefOverlay, GRID_BORDER_RADIUS, GRID_CONTEXT_MENU_ITEMS, GRID_ROOT_STYLE, GridContextMenu, MAX_PAGE_BUTTONS, MarchingAntsOverlay, NOOP3 as NOOP, OGridLayout, PAGE_SIZE_OPTIONS, POPOVER_ANCHOR_STYLE, PREVENT_DEFAULT, PaginationControlsBase, ROW_NUMBER_COLUMN_ID, ROW_NUMBER_COLUMN_MIN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, STOP_PROPAGATION, SheetTabs, SideBar, StatusBar, UndoRedoStack, areGridRowPropsEqual, booleanParser, buildCsvHeader, buildCsvRows, buildHeaderRows, buildInlineEditorProps2 as buildInlineEditorProps, buildPopoverEditorProps2 as buildPopoverEditorProps, clampSelectionToBounds, computeAggregations, computeAutoScrollSpeed, computeTabNavigation, createBaseFilterRenderers, createOGrid, currencyParser, dateParser, deriveFilterOptionsFromData, editorInputStyle, editorWrapperStyle, emailParser, escapeCsvValue, exportToCsv, findCtrlArrowTarget, flattenColumns, formatCellReference, formatCellValueForTsv, formatSelectionAsTsv, formatShortcut, getCellInteractionProps, getCellRenderDescriptor, getCellValue, getColumnHeaderFilterStateParams, getColumnHeaderMenuItems, getColumnHeaderMenuProps, getContextMenuHandlers, getDataGridStatusBarConfig, getDateFilterContentProps, getFilterField, getHeaderFilterConfig, getMultiSelectFilterFields, getPaginationViewModel, getStatusBarParts, indexToColumnLetter, isInSelectionRange, isRowInRange, mergeFilter, normalizeSelectionRange, numberParser, parseTsvClipboard, parseValue, partitionColumnsForVirtualization, processClientSideData, rangesEqual, renderFilterContent, resolveCellDisplayContent2 as resolveCellDisplayContent, resolveCellStyle2 as resolveCellStyle, richSelectDropdownStyle, richSelectNoMatchesStyle, richSelectOptionHighlightedStyle, richSelectOptionStyle, richSelectWrapperStyle, selectChevronStyle, selectDisplayStyle, selectEditorStyle, toUserLike, triggerCsvDownload, useActiveCell, useCellEditing, useCellSelection, useClipboard, useColumnChooserState, useColumnHeaderFilterState, useColumnMeta, useColumnReorder, useColumnResize, useContextMenu, useDataGridState, useDataGridTableOrchestration, useDateFilterState, useDebounce, useFillHandle, useFilterOptions, useFormulaBar, useFormulaEngine, useInlineCellEditorState, useKeyboardNavigation, useLatestRef, useListVirtualizer, useMultiSelectFilterState, useOGrid, usePaginationControls, usePeopleFilterState, useRichSelectState, useRowSelection, useSelectState, useSideBarState, useTableLayout, useTextFilterState, useUndoRedo, useVirtualScroll };
@@ -1,4 +1,4 @@
1
- export { CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, DEFAULT_MIN_COLUMN_WIDTH, CELL_PADDING, GRID_BORDER_RADIUS, } from '@alaarab/ogrid-core';
1
+ export { CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, ROW_NUMBER_COLUMN_MIN_WIDTH, ROW_NUMBER_COLUMN_ID, 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, ISheetDef, } from './types';
3
3
  export { toUserLike, isInSelectionRange, normalizeSelectionRange } from './types';
4
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, useFormulaBar, getColumnHeaderMenuProps, } from './hooks';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-react",
3
- "version": "2.4.0",
3
+ "version": "2.4.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.4.0",
42
+ "@alaarab/ogrid-core": "2.4.1",
43
43
  "@tanstack/react-virtual": "^3.0.0"
44
44
  },
45
45
  "peerDependencies": {