@alaarab/ogrid-react 2.1.13 → 2.1.15

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
@@ -507,23 +507,39 @@ function processClientSideData(data, columns, filters, sortBy, sortDirection) {
507
507
  const trimmed = val.value.trim();
508
508
  if (trimmed) {
509
509
  const lower = trimmed.toLowerCase();
510
- predicates.push((r) => String(getCellValue(r, col) ?? "").toLowerCase().includes(lower));
510
+ const textCache = /* @__PURE__ */ new Map();
511
+ for (let j = 0; j < data.length; j++) {
512
+ textCache.set(data[j], String(getCellValue(data[j], col) ?? "").toLowerCase());
513
+ }
514
+ predicates.push((r) => (textCache.get(r) ?? "").includes(lower));
511
515
  }
512
516
  break;
513
517
  }
514
518
  case "people": {
515
519
  const email = val.value.email.toLowerCase();
516
- predicates.push((r) => String(getCellValue(r, col) ?? "").toLowerCase() === email);
520
+ const peopleCache = /* @__PURE__ */ new Map();
521
+ for (let j = 0; j < data.length; j++) {
522
+ peopleCache.set(data[j], String(getCellValue(data[j], col) ?? "").toLowerCase());
523
+ }
524
+ predicates.push((r) => (peopleCache.get(r) ?? "") === email);
517
525
  break;
518
526
  }
519
527
  case "date": {
520
528
  const dv = val.value;
521
529
  const fromTs = dv.from ? (/* @__PURE__ */ new Date(dv.from + "T00:00:00")).getTime() : NaN;
522
530
  const toTs = dv.to ? (/* @__PURE__ */ new Date(dv.to + "T23:59:59.999")).getTime() : NaN;
531
+ const dateCache = /* @__PURE__ */ new Map();
532
+ for (let j = 0; j < data.length; j++) {
533
+ const cellVal = getCellValue(data[j], col);
534
+ if (cellVal == null) {
535
+ dateCache.set(data[j], NaN);
536
+ } else {
537
+ const t = new Date(String(cellVal)).getTime();
538
+ dateCache.set(data[j], Number.isNaN(t) ? NaN : t);
539
+ }
540
+ }
523
541
  predicates.push((r) => {
524
- const cellVal = getCellValue(r, col);
525
- if (cellVal == null) return false;
526
- const cellTs = new Date(String(cellVal)).getTime();
542
+ const cellTs = dateCache.get(r) ?? NaN;
527
543
  if (Number.isNaN(cellTs)) return false;
528
544
  if (!Number.isNaN(fromTs) && cellTs < fromTs) return false;
529
545
  if (!Number.isNaN(toTs) && cellTs > toTs) return false;
@@ -971,23 +987,94 @@ var ROW_NUMBER_COLUMN_WIDTH = 50;
971
987
  var DEFAULT_MIN_COLUMN_WIDTH = 80;
972
988
  var CELL_PADDING = 16;
973
989
  var GRID_BORDER_RADIUS = 6;
974
- var AUTOSIZE_EXTRA_PX = 28;
990
+ var AUTOSIZE_EXTRA_PX = 16;
975
991
  var AUTOSIZE_MAX_PX = 520;
992
+ function measureHeaderWidth(th) {
993
+ const cs = getComputedStyle(th);
994
+ const thPadding = (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);
995
+ let resizeHandleWidth = 0;
996
+ for (let i = 0; i < th.children.length; i++) {
997
+ const child = th.children[i];
998
+ const cls = child.className || "";
999
+ if (cls.includes("resizeHandle") || cls.includes("resize-handle") || cls.includes("ogrid-resize-handle")) {
1000
+ resizeHandleWidth = child.offsetWidth;
1001
+ break;
1002
+ }
1003
+ }
1004
+ const contentContainer = th.firstElementChild;
1005
+ if (!contentContainer) return th.offsetWidth;
1006
+ const modified = [];
1007
+ const expandDescendants = (parent) => {
1008
+ for (let i = 0; i < parent.children.length; i++) {
1009
+ const child = parent.children[i];
1010
+ const style = getComputedStyle(child);
1011
+ if (style.overflow === "hidden" || style.flexShrink !== "0") {
1012
+ modified.push({
1013
+ el: child,
1014
+ overflow: child.style.overflow,
1015
+ flexShrink: child.style.flexShrink,
1016
+ width: child.style.width,
1017
+ minWidth: child.style.minWidth
1018
+ });
1019
+ child.style.overflow = "visible";
1020
+ child.style.flexShrink = "0";
1021
+ child.style.width = "max-content";
1022
+ child.style.minWidth = "max-content";
1023
+ }
1024
+ expandDescendants(child);
1025
+ }
1026
+ };
1027
+ const origPos = contentContainer.style.position;
1028
+ const origWidth = contentContainer.style.width;
1029
+ contentContainer.style.position = "absolute";
1030
+ contentContainer.style.width = "max-content";
1031
+ expandDescendants(contentContainer);
1032
+ const expandedWidth = contentContainer.offsetWidth;
1033
+ contentContainer.style.position = origPos;
1034
+ contentContainer.style.width = origWidth;
1035
+ for (const m of modified) {
1036
+ m.el.style.overflow = m.overflow;
1037
+ m.el.style.flexShrink = m.flexShrink;
1038
+ m.el.style.width = m.width;
1039
+ m.el.style.minWidth = m.minWidth;
1040
+ }
1041
+ return expandedWidth + resizeHandleWidth + thPadding;
1042
+ }
976
1043
  function measureColumnContentWidth(columnId, minWidth, container) {
977
1044
  const minW = minWidth ?? DEFAULT_MIN_COLUMN_WIDTH;
978
- const root = document;
1045
+ const root = container ?? document;
979
1046
  const cells = root.querySelectorAll(`[data-column-id="${columnId}"]`);
980
1047
  if (cells.length === 0) return minW;
981
1048
  let maxWidth = minW;
1049
+ const contentEls = [];
1050
+ const origPositions = [];
1051
+ const origWidths = [];
982
1052
  cells.forEach((cell) => {
983
1053
  const el = cell;
984
- const label = el.querySelector?.("[data-header-label]");
985
- if (label) {
986
- maxWidth = Math.max(maxWidth, label.scrollWidth + AUTOSIZE_EXTRA_PX);
1054
+ const isHeader = !!el.querySelector?.("[data-header-label]");
1055
+ if (isHeader) {
1056
+ maxWidth = Math.max(maxWidth, measureHeaderWidth(el));
987
1057
  } else {
988
- maxWidth = Math.max(maxWidth, el.scrollWidth);
1058
+ const content = el.firstElementChild ?? el;
1059
+ contentEls.push(content);
989
1060
  }
990
1061
  });
1062
+ if (contentEls.length > 0) {
1063
+ for (let i = 0; i < contentEls.length; i++) {
1064
+ const el = contentEls[i];
1065
+ origPositions.push(el.style.position);
1066
+ origWidths.push(el.style.width);
1067
+ el.style.position = "absolute";
1068
+ el.style.width = "max-content";
1069
+ }
1070
+ for (let i = 0; i < contentEls.length; i++) {
1071
+ maxWidth = Math.max(maxWidth, contentEls[i].offsetWidth + AUTOSIZE_EXTRA_PX);
1072
+ }
1073
+ for (let i = 0; i < contentEls.length; i++) {
1074
+ contentEls[i].style.position = origPositions[i];
1075
+ contentEls[i].style.width = origWidths[i];
1076
+ }
1077
+ }
991
1078
  return Math.min(AUTOSIZE_MAX_PX, Math.max(minW, Math.ceil(maxWidth)));
992
1079
  }
993
1080
  function findCtrlArrowTarget(pos, edge, step, isEmpty) {
@@ -1149,7 +1236,7 @@ function computeRowSelectionState(selectedIds, items, getRowId) {
1149
1236
  if (selectedIds.size === 0 || items.length === 0) {
1150
1237
  return { allSelected: false, someSelected: false };
1151
1238
  }
1152
- const allSelected = items.every((item) => selectedIds.has(getRowId(item)));
1239
+ const allSelected = selectedIds.size >= items.length && items.every((item) => selectedIds.has(getRowId(item)));
1153
1240
  const someSelected = !allSelected && selectedIds.size > 0;
1154
1241
  return { allSelected, someSelected };
1155
1242
  }
@@ -1470,7 +1557,7 @@ function useFilterOptions(dataSource, fields) {
1470
1557
  );
1471
1558
  setFilterOptions(results);
1472
1559
  setLoadingOptions(EMPTY_LOADING);
1473
- }, [stableFields]);
1560
+ }, [stableFields, dataSourceRef]);
1474
1561
  useEffect(() => {
1475
1562
  load().catch(() => {
1476
1563
  });
@@ -1681,7 +1768,7 @@ function useOGridDataFetching(params) {
1681
1768
  }).finally(() => {
1682
1769
  if (id === fetchIdRef.current) setServerLoading(false);
1683
1770
  });
1684
- }, [isServerSide, page, pageSize, sort.field, sort.direction, stableFilters, refreshCounter]);
1771
+ }, [isServerSide, page, pageSize, sort.field, sort.direction, stableFilters, refreshCounter, dataSourceRef, onErrorRef]);
1685
1772
  const displayItems = isClientSide && clientItemsAndTotal ? clientItemsAndTotal.items : serverItems;
1686
1773
  const displayTotalCount = isClientSide && clientItemsAndTotal ? clientItemsAndTotal.totalCount : serverTotalCount;
1687
1774
  const onFirstDataRenderedRef = useLatestRef(onFirstDataRendered);
@@ -1691,7 +1778,7 @@ function useOGridDataFetching(params) {
1691
1778
  firstDataRenderedRef.current = true;
1692
1779
  onFirstDataRenderedRef.current?.();
1693
1780
  }
1694
- }, [displayItems.length]);
1781
+ }, [displayItems.length, onFirstDataRenderedRef]);
1695
1782
  return {
1696
1783
  displayItems,
1697
1784
  displayTotalCount,
@@ -1796,28 +1883,28 @@ function useOGrid(props, ref) {
1796
1883
  const getRowIdStableRef = useLatestRef(getRowIdProp);
1797
1884
  const getRowId = useCallback((item) => getRowIdStableRef.current(item), [getRowIdStableRef]);
1798
1885
  const onColumnOrderChangeRef = useLatestRef(onColumnOrderChangeProp);
1886
+ const hasColumnOrderChange = onColumnOrderChangeProp != null;
1799
1887
  const onColumnOrderChange = useMemo(
1800
- () => onColumnOrderChangeProp ? (order) => onColumnOrderChangeRef.current?.(order) : void 0,
1801
- // eslint-disable-next-line react-hooks/exhaustive-deps
1802
- [!!onColumnOrderChangeProp]
1888
+ () => hasColumnOrderChange ? (order) => onColumnOrderChangeRef.current?.(order) : void 0,
1889
+ [hasColumnOrderChange, onColumnOrderChangeRef]
1803
1890
  );
1804
1891
  const onCellValueChangedRef = useLatestRef(onCellValueChangedProp);
1892
+ const hasCellValueChanged = onCellValueChangedProp != null;
1805
1893
  const onCellValueChanged = useMemo(
1806
- () => onCellValueChangedProp ? (event) => onCellValueChangedRef.current?.(event) : void 0,
1807
- // eslint-disable-next-line react-hooks/exhaustive-deps
1808
- [!!onCellValueChangedProp]
1894
+ () => hasCellValueChanged ? (event) => onCellValueChangedRef.current?.(event) : void 0,
1895
+ [hasCellValueChanged, onCellValueChangedRef]
1809
1896
  );
1810
1897
  const onUndoRef = useLatestRef(onUndoProp);
1898
+ const hasUndo = onUndoProp != null;
1811
1899
  const onUndo = useMemo(
1812
- () => onUndoProp ? () => onUndoRef.current?.() : void 0,
1813
- // eslint-disable-next-line react-hooks/exhaustive-deps
1814
- [!!onUndoProp]
1900
+ () => hasUndo ? () => onUndoRef.current?.() : void 0,
1901
+ [hasUndo, onUndoRef]
1815
1902
  );
1816
1903
  const onRedoRef = useLatestRef(onRedoProp);
1904
+ const hasRedo = onRedoProp != null;
1817
1905
  const onRedo = useMemo(
1818
- () => onRedoProp ? () => onRedoRef.current?.() : void 0,
1819
- // eslint-disable-next-line react-hooks/exhaustive-deps
1820
- [!!onRedoProp]
1906
+ () => hasRedo ? () => onRedoRef.current?.() : void 0,
1907
+ [hasRedo, onRedoRef]
1821
1908
  );
1822
1909
  const columnChooserPlacement = columnChooserProp === false ? "none" : columnChooserProp === "sidebar" ? "sidebar" : "toolbar";
1823
1910
  const columns = useMemo(() => flattenColumns(columnsProp), [columnsProp]);
@@ -1825,7 +1912,7 @@ function useOGrid(props, ref) {
1825
1912
  const rowIdsValidatedRef = useRef(false);
1826
1913
  useEffect(() => {
1827
1914
  validateColumns(columns);
1828
- }, []);
1915
+ }, [columns]);
1829
1916
  const defaultSortField = defaultSortBy ?? columns[0]?.columnId ?? "";
1830
1917
  const [internalData, setInternalData] = useState([]);
1831
1918
  const [internalLoading, setInternalLoading] = useState(false);
@@ -2447,15 +2534,17 @@ function useCellSelection(params) {
2447
2534
  }
2448
2535
  }
2449
2536
  if (!cellIndex) cellIndex = buildCellIndex(wrapperRef.current);
2537
+ let rebuilt = false;
2450
2538
  for (let r = minR; r <= maxR; r++) {
2451
2539
  for (let c = minC; c <= maxC; c++) {
2452
2540
  const key = `${r},${c + colOff}`;
2453
2541
  let el = cellIndex?.get(key);
2454
- if (el && !el.isConnected) {
2542
+ if (el && !el.isConnected && !rebuilt) {
2543
+ rebuilt = true;
2455
2544
  cellIndex = buildCellIndex(wrapperRef.current);
2456
2545
  el = cellIndex?.get(key);
2457
2546
  }
2458
- if (el) {
2547
+ if (el && el.isConnected) {
2459
2548
  styleCellInRange(el, r, c, minR, maxR, minC, maxC, anchor);
2460
2549
  }
2461
2550
  }
@@ -2590,10 +2679,13 @@ function useCellSelection(params) {
2590
2679
  const finalRange = liveDragRangeRef.current;
2591
2680
  if (finalRange) {
2592
2681
  setSelectionRange(finalRange);
2593
- setActiveCell({
2594
- rowIndex: finalRange.endRow,
2595
- columnIndex: finalRange.endCol + colOffsetRef.current
2596
- });
2682
+ const anchor = dragStartRef.current;
2683
+ if (anchor) {
2684
+ setActiveCell({
2685
+ rowIndex: anchor.row,
2686
+ columnIndex: anchor.col + colOffsetRef.current
2687
+ });
2688
+ }
2597
2689
  }
2598
2690
  }
2599
2691
  clearDragAttrs();
@@ -3058,8 +3150,7 @@ function useUndoRedo(params) {
3058
3150
  }
3059
3151
  onCellValueChangedRef.current(event);
3060
3152
  },
3061
- // eslint-disable-next-line react-hooks/exhaustive-deps
3062
- [getStack]
3153
+ [getStack, onCellValueChangedRef]
3063
3154
  );
3064
3155
  const beginBatch = useCallback(() => {
3065
3156
  getStack().beginBatch();
@@ -3085,7 +3176,7 @@ function useUndoRedo(params) {
3085
3176
  newValue: ev.oldValue
3086
3177
  });
3087
3178
  }
3088
- }, [getStack]);
3179
+ }, [getStack, onCellValueChangedRef]);
3089
3180
  const redo = useCallback(() => {
3090
3181
  if (!onCellValueChangedRef.current) return;
3091
3182
  const stack = getStack();
@@ -3096,7 +3187,7 @@ function useUndoRedo(params) {
3096
3187
  for (const ev of nextBatch) {
3097
3188
  onCellValueChangedRef.current(ev);
3098
3189
  }
3099
- }, [getStack]);
3190
+ }, [getStack, onCellValueChangedRef]);
3100
3191
  return {
3101
3192
  onCellValueChanged: onCellValueChanged ? wrapped : void 0,
3102
3193
  undo,
@@ -3236,7 +3327,7 @@ function useFillHandle(params) {
3236
3327
  endCol: end.endCol
3237
3328
  });
3238
3329
  setSelectionRange(norm);
3239
- setActiveCell({ rowIndex: end.endRow, columnIndex: end.endCol + colOffsetRef.current });
3330
+ setActiveCell({ rowIndex: fillDrag.startRow, columnIndex: fillDrag.startCol + colOffsetRef.current });
3240
3331
  const fillEvents = applyFillValues(norm, fillDrag.startRow, fillDrag.startCol, items, visibleCols);
3241
3332
  if (fillEvents.length > 0) {
3242
3333
  beginBatch?.();
@@ -3263,7 +3354,8 @@ function useFillHandle(params) {
3263
3354
  beginBatch,
3264
3355
  endBatch,
3265
3356
  colOffsetRef,
3266
- wrapperRef
3357
+ wrapperRef,
3358
+ onCellValueChangedRef
3267
3359
  ]);
3268
3360
  const selectionRangeRef = useRef(selectionRange);
3269
3361
  selectionRangeRef.current = selectionRange;
@@ -3298,7 +3390,7 @@ function useFillHandle(params) {
3298
3390
  for (const evt of fillEvents) onCellValueChangedRef.current(evt);
3299
3391
  endBatch?.();
3300
3392
  }
3301
- }, [editable, beginBatch, endBatch]);
3393
+ }, [editable, beginBatch, endBatch, onCellValueChangedRef, itemsRef, visibleColsRef]);
3302
3394
  return { fillDrag, setFillDrag, handleFillHandleMouseDown, fillDown };
3303
3395
  }
3304
3396
  function useTableLayout(params) {
@@ -3318,7 +3410,8 @@ function useTableLayout(params) {
3318
3410
  const rect = el.getBoundingClientRect();
3319
3411
  const cs = window.getComputedStyle(el);
3320
3412
  const borderX = (parseFloat(cs.borderLeftWidth || "0") || 0) + (parseFloat(cs.borderRightWidth || "0") || 0);
3321
- setContainerWidth(Math.max(0, rect.width - borderX));
3413
+ const next = Math.round(Math.max(0, rect.width - borderX));
3414
+ setContainerWidth((prev) => prev === next ? prev : next);
3322
3415
  };
3323
3416
  const ro = new ResizeObserver(measure);
3324
3417
  ro.observe(el);
@@ -3623,6 +3716,11 @@ function useDataGridLayout(params) {
3623
3716
  pinnedColumns,
3624
3717
  onColumnPinned
3625
3718
  });
3719
+ const overridesKey = useMemo(() => {
3720
+ const entries = Object.entries(columnSizingOverrides);
3721
+ if (entries.length === 0) return "";
3722
+ return entries.map(([id, v]) => `${id}:${Math.round(v.widthPx)}`).join(",");
3723
+ }, [columnSizingOverrides]);
3626
3724
  const [measuredColumnWidths, setMeasuredColumnWidths] = useState({});
3627
3725
  useLayoutEffect(() => {
3628
3726
  const wrapper = wrapperRef.current;
@@ -3641,7 +3739,7 @@ function useDataGridLayout(params) {
3641
3739
  if (Object.keys(prev).length !== Object.keys(measured).length) return measured;
3642
3740
  return prev;
3643
3741
  });
3644
- }, [visibleCols, columnSizingOverrides, wrapperRef]);
3742
+ }, [visibleCols, overridesKey, wrapperRef]);
3645
3743
  const columnWidthMap = useMemo(() => {
3646
3744
  const map = {};
3647
3745
  for (const col of visibleCols) {
@@ -3792,8 +3890,7 @@ function useDataGridEditing(params) {
3792
3890
  setSelectionRange({ startRow: newRow, startCol: localCol, endRow: newRow, endCol: localCol });
3793
3891
  }
3794
3892
  },
3795
- // eslint-disable-next-line react-hooks/exhaustive-deps
3796
- [setEditingCell, setPendingEditorValue, setActiveCell, setSelectionRange, colOffset, visibleColsRef, itemsLengthRef]
3893
+ [setEditingCell, setPendingEditorValue, setActiveCell, setSelectionRange, colOffset, visibleColsRef, itemsLengthRef, onCellValueChangedRef]
3797
3894
  );
3798
3895
  const cancelPopoverEdit = useCallback(() => {
3799
3896
  setEditingCell(null);
@@ -4736,10 +4833,25 @@ function useColumnResize({
4736
4833
  document.addEventListener("mouseup", onUp);
4737
4834
  cleanupRef.current = cleanup;
4738
4835
  }, [defaultWidth, minWidth, setColumnSizingOverrides, columnSizingOverridesRef]);
4836
+ const handleResizeDoubleClick = useCallback((e, col) => {
4837
+ e.preventDefault();
4838
+ e.stopPropagation();
4839
+ const columnId = col.columnId;
4840
+ const thEl = e.currentTarget.closest("th");
4841
+ const container = thEl?.closest("table")?.parentElement ?? void 0;
4842
+ const idealWidth = measureColumnContentWidth(columnId, minWidth, container);
4843
+ setColumnSizingOverrides((prev) => ({
4844
+ ...prev,
4845
+ [columnId]: { widthPx: idealWidth }
4846
+ }));
4847
+ if (onColumnResizedRef.current) {
4848
+ onColumnResizedRef.current(columnId, idealWidth);
4849
+ }
4850
+ }, [minWidth, setColumnSizingOverrides]);
4739
4851
  const getColumnWidth = useCallback((col) => {
4740
4852
  return columnSizingOverrides[col.columnId]?.widthPx ?? col.idealWidth ?? col.defaultWidth ?? defaultWidth;
4741
4853
  }, [columnSizingOverrides, defaultWidth]);
4742
- return { handleResizeStart, getColumnWidth };
4854
+ return { handleResizeStart, handleResizeDoubleClick, getColumnWidth };
4743
4855
  }
4744
4856
  function getSelectDisplayText(value, formatValue) {
4745
4857
  if (formatValue) return formatValue(value);
@@ -5915,7 +6027,7 @@ function useVirtualScroll(params) {
5915
6027
  } = params;
5916
6028
  useEffect(() => {
5917
6029
  validateVirtualScrollConfig({ enabled, rowHeight });
5918
- }, []);
6030
+ }, [enabled, rowHeight]);
5919
6031
  const isActive = enabled && totalRows >= threshold;
5920
6032
  const getScrollElement = useCallback(
5921
6033
  () => containerRef.current,
@@ -6071,7 +6183,7 @@ function useDataGridTableOrchestration(params) {
6071
6183
  const headerRows = useMemo(() => buildHeaderRows(columns, visibleColumns), [columns, visibleColumns]);
6072
6184
  const allowOverflowX = !suppressHorizontalScroll && containerWidth > 0 && (minTableWidth > containerWidth || desiredTableWidth > containerWidth);
6073
6185
  const fitToContent = layoutMode === "content";
6074
- const { handleResizeStart, getColumnWidth } = useColumnResize({
6186
+ const { handleResizeStart, handleResizeDoubleClick, getColumnWidth } = useColumnResize({
6075
6187
  columnSizingOverrides,
6076
6188
  setColumnSizingOverrides
6077
6189
  });
@@ -6109,8 +6221,10 @@ function useDataGridTableOrchestration(params) {
6109
6221
  const currentVersion = CellDescriptorCache.computeVersion(cellDescriptorInput);
6110
6222
  cellDescriptorCacheRef.current.updateVersion(currentVersion);
6111
6223
  const prevItemsRef = useRef(items);
6112
- if (prevItemsRef.current !== items) {
6224
+ const prevVisibleColsRef = useRef(visibleCols);
6225
+ if (prevItemsRef.current !== items || prevVisibleColsRef.current !== visibleCols) {
6113
6226
  prevItemsRef.current = items;
6227
+ prevVisibleColsRef.current = visibleCols;
6114
6228
  cellDescriptorCacheRef.current.clear();
6115
6229
  }
6116
6230
  const handleSingleRowClick = useCallback((e) => {
@@ -6135,6 +6249,7 @@ function useDataGridTableOrchestration(params) {
6135
6249
  pinning,
6136
6250
  // Column resize
6137
6251
  handleResizeStart,
6252
+ handleResizeDoubleClick,
6138
6253
  getColumnWidth,
6139
6254
  // Column reorder
6140
6255
  isReorderDragging,
@@ -7044,7 +7159,7 @@ function MarchingAntsOverlay({
7044
7159
  const selR = selRect ? roundRect(selRect) : null;
7045
7160
  const clipR = clipRect ? roundRect(clipRect) : null;
7046
7161
  return /* @__PURE__ */ jsxs(Fragment, { children: [
7047
- selR && !isDragging && !clipRangeMatchesSel && /* @__PURE__ */ jsx(
7162
+ selR && !isDragging && !clipRangeMatchesSel && !(selectionRange && selectionRange.startRow === selectionRange.endRow && selectionRange.startCol === selectionRange.endCol) && /* @__PURE__ */ jsx(
7048
7163
  "svg",
7049
7164
  {
7050
7165
  style: {
@@ -13,6 +13,7 @@ export interface UseColumnResizeParams {
13
13
  }
14
14
  export interface UseColumnResizeResult<T> {
15
15
  handleResizeStart: (e: React.MouseEvent, col: IColumnDef<T>) => void;
16
+ handleResizeDoubleClick: (e: React.MouseEvent, col: IColumnDef<T>) => void;
16
17
  getColumnWidth: (col: IColumnDef<T>) => number;
17
18
  }
18
19
  /**
@@ -24,6 +24,7 @@ export interface UseDataGridTableOrchestrationResult<T> {
24
24
  viewModels: DataGridViewModelState<T>;
25
25
  pinning: DataGridPinningState;
26
26
  handleResizeStart: UseColumnResizeResult<T>['handleResizeStart'];
27
+ handleResizeDoubleClick: UseColumnResizeResult<T>['handleResizeDoubleClick'];
27
28
  getColumnWidth: UseColumnResizeResult<T>['getColumnWidth'];
28
29
  isReorderDragging: UseColumnReorderResult['isDragging'];
29
30
  dropIndicatorX: UseColumnReorderResult['dropIndicatorX'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-react",
3
- "version": "2.1.13",
3
+ "version": "2.1.15",
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.1.13",
42
+ "@alaarab/ogrid-core": "2.1.15",
43
43
  "@tanstack/react-virtual": "^3.0.0"
44
44
  },
45
45
  "peerDependencies": {