@columenlabs/lumen-ui 0.1.167 → 0.1.169

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.
Files changed (2) hide show
  1. package/dist/lumen-view.js +18 -2
  2. package/package.json +2 -2
@@ -725,7 +725,8 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
725
725
  n = down ? n.nextElementSibling : n.previousElementSibling;
726
726
  if (!(n instanceof HTMLElement))
727
727
  return;
728
- n.focus();
728
+ n.focus({ preventScroll: true });
729
+ revealRow(n);
729
730
  const next = openKey === null ? undefined : sorted.find((x) => keyOf(x.original) === n.dataset.row);
730
731
  if (next && onDetails)
731
732
  onDetails(next.original);
@@ -737,7 +738,8 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
737
738
  if (openKey === null)
738
739
  return;
739
740
  const el = box.current?.querySelector(`tr[data-row="${CSS.escape(openKey)}"]`);
740
- el?.scrollIntoView({ block: 'nearest' });
741
+ if (el)
742
+ revealRow(el);
741
743
  }, [openKey, pageKeys, page?.index]);
742
744
  // The whole row opens the details drawer.
743
745
  const dataRow = (r) => (_jsxs(Fragment, { children: [_jsxs(TableRow, { "data-row": domain.rowKey(r.original), "data-state": tapped?.(r.original) ? 'selected' : undefined, "aria-selected": openKey === null ? undefined : openKey === keyOf(r.original), className: cn('group/row', onDetails && 'cursor-pointer'), tabIndex: onDetails ? 0 : undefined, onClick: onDetails ? () => onDetails(r.original) : undefined, onKeyDown: onDetails
@@ -883,3 +885,17 @@ function GroupMark({ field, value }) {
883
885
  return _jsx(ColorDot, { color: color });
884
886
  return _jsx(field.icon, {});
885
887
  }
888
+ /** Scrolls a row into view up and down only: a table wider than its box keeps its sideways scroll,
889
+ * so the name column never slides out of view when a row opens or the keys step. */
890
+ function revealRow(row) {
891
+ const kept = [];
892
+ for (let e = row.parentElement; e; e = e.parentElement)
893
+ if (e.scrollLeft)
894
+ kept.push([e, e.scrollLeft]);
895
+ row.scrollIntoView({ block: 'nearest', inline: 'nearest' });
896
+ for (let e = row.parentElement; e; e = e.parentElement) {
897
+ const was = kept.find(([k]) => k === e)?.[1] ?? 0;
898
+ if (e.scrollLeft !== was)
899
+ e.scrollLeft = was;
900
+ }
901
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ui",
3
- "version": "0.1.167",
3
+ "version": "0.1.169",
4
4
  "description": "Lumen: shared React components (frame, views, widgets, charts, drawers).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -49,7 +49,7 @@
49
49
  "@codemirror/lang-javascript": "6.2.5",
50
50
  "@codemirror/lang-json": "6.0.2",
51
51
  "@codemirror/lang-sql": "6.10.0",
52
- "@columenlabs/lumen-ui-types": "0.1.167",
52
+ "@columenlabs/lumen-ui-types": "0.1.169",
53
53
  "@dnd-kit/core": "6.3.1",
54
54
  "@dnd-kit/sortable": "10.0.0",
55
55
  "@dnd-kit/utilities": "3.2.2",