@columenlabs/lumen-ui 0.1.204 → 0.1.205

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.
@@ -499,11 +499,13 @@ const colPropsOf = (units) => (f, ...more) => ({
499
499
  * theme.css), so one long name never pushes the other columns off screen; `false` lifts it.
500
500
  */
501
501
  const capOf = (f, i) => f.maxWidth === false ? undefined : (f.maxWidth ?? (i === 0 ? 'var(--lead-col-max)' : undefined));
502
- /** Holds a cell to its column's cap on one line: text past it ends in an ellipsis. */
503
- function CappedCell({ max, title, children, }) {
502
+ /** Holds a cell to its column's cap on one line: text past it ends in an ellipsis. `end` keeps a
503
+ * right-aligned column's value on its right edge (the wrapper is a flex row, which `text-right`
504
+ * alone does not move), so a capped or resized column keeps one edge. */
505
+ function CappedCell({ max, end, title, children, }) {
504
506
  if (!max)
505
507
  return children;
506
- return (_jsx("div", { className: "flex min-w-0 *:min-w-0 *:max-w-full *:truncate", style: { maxWidth: max }, title: title, children: children }));
508
+ return (_jsx("div", { className: cn('flex min-w-0 *:min-w-0 *:max-w-full *:truncate', end && 'justify-end'), style: { maxWidth: max }, title: title, children: children }));
507
509
  }
508
510
  /** The flat or grouped table: sortable headers, a Total row, group rows that collapse. */
509
511
  // Sorting, and paging of flat tables (the page is LumenView's, set right of the row count).
@@ -534,11 +536,6 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
534
536
  const resizing = resizable && !isMobile && !fit;
535
537
  const colWidths = useColumnWidths(resizing ? (widthsKey ?? '') || undefined : undefined);
536
538
  const widthOf = (f) => resizing && f ? colWidths.widths[f.key] : undefined;
537
- // A dragged width caps the column's cells in its place (the cell's own padding taken off).
538
- const capFor = (f, i) => {
539
- const w = widthOf(f);
540
- return w ? `calc(${w}px - 2 * var(--cell-x))` : capOf(f, i);
541
- };
542
539
  const [sorting, setSorting] = useState(() => sortingOf(sort, columns, serverSorts));
543
540
  // A saved sort patched while the table is open (the assistant's card move) applies at once.
544
541
  const savedSort = JSON.stringify(sort ?? null);
@@ -554,11 +551,18 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
554
551
  pageIndex: paging ? page.index : 0,
555
552
  pageSize: paging ? page.size : Math.max(rows.length, 1),
556
553
  };
557
- // Groups whose state differs from where they start: open, or past OPEN_ALL rows only the first.
558
554
  // Columns a UnitValue has drawn in (`UnitColumns`): their cells share the numbers' edge.
559
555
  const [units, setUnits] = useState(() => new Set());
560
556
  const markUnits = useCallback((key) => setUnits((s) => (s.has(key) ? s : new Set(s).add(key))), []);
561
557
  const colProps = colPropsOf(units);
558
+ // A dragged width caps the column's cells in its place (the cell's own padding taken off).
559
+ const capFor = (f, i) => {
560
+ const w = widthOf(f);
561
+ // A units column's right padding also holds the unit slot (theme.css `[data-units]`).
562
+ const pad = units.has(f.key) ? '2 * var(--cell-x) - var(--unit-slot)' : '2 * var(--cell-x)';
563
+ return w ? `calc(${w}px - ${pad})` : capOf(f, i);
564
+ };
565
+ // Groups whose state differs from where they start: open, or past OPEN_ALL rows only the first.
562
566
  const [flipped, setFlipped] = useState(new Set());
563
567
  const [more, setMore] = useState(new Map());
564
568
  // Under a sub-group's `flat` grouping each row names itself by its sub-group key instead of
@@ -683,7 +687,7 @@ function LumenTableRows({ domain, columns = domain.fields, rows, groupBy = null,
683
687
  const field = now[i] ?? f;
684
688
  const chip = chips.some((c) => c.key === field.key);
685
689
  const v = computed.value(field, row.original);
686
- return (_jsx(CappedCell, { max: capFor(field, i), title: !field.render && typeof v === 'string' ? v : undefined, children: i === 0 && inline.length ? (_jsx(FirstCell, { value: cellOf(field, row.original, chip), chips: inline.flatMap((x) => {
690
+ return (_jsx(CappedCell, { max: capFor(field, i), end: (field.format ?? 'text') !== 'text', title: !field.render && typeof v === 'string' ? v : undefined, children: i === 0 && inline.length ? (_jsx(FirstCell, { value: cellOf(field, row.original, chip), chips: inline.flatMap((x) => {
687
691
  const v = computed.value(x, row.original);
688
692
  if (!x.edit && (v === null || v === ''))
689
693
  return [];
package/dist/theme.css CHANGED
@@ -433,6 +433,9 @@
433
433
  }
434
434
  [data-units] [data-slot="unit-value"] {
435
435
  position: relative;
436
+ /* A resized column wraps its cells in a truncating box; the unit hangs outside the value's box,
437
+ so it must not be clipped with it. */
438
+ overflow: visible;
436
439
  }
437
440
  [data-units] [data-slot="unit-value-unit"] {
438
441
  position: absolute;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@columenlabs/lumen-ui",
3
- "version": "0.1.204",
3
+ "version": "0.1.205",
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.204",
52
+ "@columenlabs/lumen-ui-types": "0.1.205",
53
53
  "@dnd-kit/core": "6.3.1",
54
54
  "@dnd-kit/sortable": "10.0.0",
55
55
  "@dnd-kit/utilities": "3.2.2",