@alaarab/ogrid-vue 2.1.12 → 2.1.14

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
@@ -2426,10 +2426,23 @@ function useColumnResize(params) {
2426
2426
  document.addEventListener("mouseup", onUp);
2427
2427
  cleanupFn = cleanup;
2428
2428
  };
2429
+ const handleResizeDoubleClick = (e, col) => {
2430
+ e.preventDefault();
2431
+ e.stopPropagation();
2432
+ const columnId = col.columnId;
2433
+ const thEl = e.currentTarget.closest("th") ?? e.currentTarget.parentElement;
2434
+ const container = thEl?.closest("table")?.parentElement ?? void 0;
2435
+ const idealWidth = measureColumnContentWidth(columnId, minWidth, container);
2436
+ setColumnSizingOverrides({
2437
+ ...columnSizingOverrides.value,
2438
+ [columnId]: { widthPx: idealWidth }
2439
+ });
2440
+ onColumnResized?.(columnId, idealWidth);
2441
+ };
2429
2442
  const getColumnWidth = (col) => {
2430
2443
  return columnSizingOverrides.value[col.columnId]?.widthPx ?? col.idealWidth ?? col.defaultWidth ?? defaultWidth;
2431
2444
  };
2432
- return { handleResizeStart, getColumnWidth };
2445
+ return { handleResizeStart, handleResizeDoubleClick, getColumnWidth };
2433
2446
  }
2434
2447
  function useDebounce(value, delayMs) {
2435
2448
  const debouncedValue = ref(value.value);
@@ -3244,7 +3257,7 @@ function createDataGridTable(ui) {
3244
3257
  columnReorder: { isDragging: isReorderDragging, dropIndicatorX, handleHeaderMouseDown: handleReorderMouseDown },
3245
3258
  virtualScroll: { containerRef: vsContainerRef, visibleRange, totalHeight: _totalHeight, scrollToRow: _scrollToRow },
3246
3259
  virtualScrollEnabled,
3247
- columnResize: { handleResizeStart, getColumnWidth }
3260
+ columnResize: { handleResizeStart, handleResizeDoubleClick, getColumnWidth }
3248
3261
  } = useDataGridTableSetup({ props: propsRef });
3249
3262
  const onWrapperMousedown = (e) => {
3250
3263
  lastMouseShift.value = e.shiftKey;
@@ -3480,7 +3493,7 @@ function createDataGridTable(ui) {
3480
3493
  style: wrapperStyle
3481
3494
  }, [
3482
3495
  h("div", { class: "ogrid-scroll-wrapper" }, [
3483
- h("div", { style: { minWidth: allowOverflowX ? `${minTableWidth}px` : void 0 } }, [
3496
+ h("div", { style: { minWidth: allowOverflowX ? `${minTableWidth}px` : void 0, overflowX: "clip" } }, [
3484
3497
  h("div", {
3485
3498
  ref: (el) => {
3486
3499
  tableContainerRef.value = el;
@@ -3610,6 +3623,7 @@ function createDataGridTable(ui) {
3610
3623
  e.stopPropagation();
3611
3624
  handleResizeStart(e, col);
3612
3625
  },
3626
+ onDblclick: (e) => handleResizeDoubleClick(e, col),
3613
3627
  class: "ogrid-resize-handle"
3614
3628
  })
3615
3629
  ]);
@@ -13,6 +13,7 @@ export interface UseColumnResizeParams {
13
13
  }
14
14
  export interface UseColumnResizeResult<T> {
15
15
  handleResizeStart: (e: MouseEvent, col: IColumnDef<T>) => void;
16
+ handleResizeDoubleClick: (e: MouseEvent, col: IColumnDef<T>) => void;
16
17
  getColumnWidth: (col: IColumnDef<T>) => number;
17
18
  }
18
19
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-vue",
3
- "version": "2.1.12",
3
+ "version": "2.1.14",
4
4
  "description": "OGrid Vue – Vue 3 composables, headless components, and utilities for OGrid data grids.",
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.1.12"
39
+ "@alaarab/ogrid-core": "2.1.14"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "vue": "^3.3.0"