@dmsi/wedgekit-react 0.0.172 → 0.0.174

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.
@@ -241,6 +241,8 @@ export function DataCellHeader<T>({
241
241
  predeterminedPinned.current = [...left, ...right].includes(
242
242
  header.column.id,
243
243
  );
244
+ // header is stable for the lifetime of the header cell
245
+ // eslint-disable-next-line react-hooks/exhaustive-deps
244
246
  }, []);
245
247
 
246
248
  useEffect(() => {
@@ -251,12 +253,14 @@ export function DataCellHeader<T>({
251
253
  return () => {
252
254
  clearTimeout(handler);
253
255
  };
256
+ // We only want to react to filter changes; header.column methods are stable
257
+ // eslint-disable-next-line react-hooks/exhaustive-deps
254
258
  }, [filter]);
255
259
 
256
260
  const style: CSSProperties = {
257
261
  position: "relative",
258
262
  whiteSpace: "nowrap",
259
- width: header.column.getSize(),
263
+ width: header.column.columnDef.meta?.headerWidth ?? header.column.getSize(),
260
264
  "--color-text-primary-normal": "var(--color-text-brand-primary-normal)",
261
265
  "--color-icon-on-action-primary-normal":
262
266
  "var(--color-text-brand-primary-normal)",
@@ -466,7 +470,7 @@ export function DraggableCellHeader<T extends Record<string, any>>({
466
470
  transition: "width transform 0.2s ease-in-out",
467
471
  whiteSpace: "nowrap",
468
472
  zIndex: isDragging ? 1 : 0,
469
- width: header.column.getSize(),
473
+ width: header.column.columnDef.meta?.headerWidth ?? header.column.getSize(),
470
474
  "--color-text-primary-normal": "var(--color-action-000)",
471
475
  "--color-icon-on-action-primary-normal": "var(--color-action-000)",
472
476
  userSelect: "none",
@@ -506,12 +510,20 @@ export function DragAlongCell<T extends RowData, TValue>({
506
510
  position: "relative",
507
511
  transform: CSS.Translate.toString(transform),
508
512
  transition: "width transform 0.2s ease-in-out",
509
- width: cell.column.getSize(),
513
+ width: cell.column.columnDef.meta?.headerWidth ?? cell.column.getSize(),
510
514
  zIndex: isDragging ? 1 : 0,
511
515
  };
512
516
 
513
517
  return (
514
- <DataGridCell style={style} ref={setNodeRef} {...props}>
518
+ <DataGridCell
519
+ style={style}
520
+ ref={setNodeRef}
521
+ width={
522
+ (cell.column.columnDef.meta?.headerWidth as string | undefined) ??
523
+ `${cell.column.getSize()}px`
524
+ }
525
+ {...props}
526
+ >
515
527
  {children}
516
528
  </DataGridCell>
517
529
  );