@design.estate/dees-catalog 21.46.0 → 21.46.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-catalog",
3
- "version": "21.46.0",
3
+ "version": "21.46.1",
4
4
  "private": false,
5
5
  "description": "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.",
6
6
  "main": "dist_ts_web/index.js",
package/readme.md CHANGED
@@ -3495,7 +3495,7 @@ html`<dees-table
3495
3495
  - `rowClick` opens a row with a single click, as a list opens its entry for list→detail navigation: a plain primary click on the row's data runs the row's first relevant `rowClick` action, and so do Space on the focused row and Enter on a row without a relevant `doubleClick` action. Enter runs one action: a row with both kinds runs its `doubleClick` action. Clicks on a control inside the row (a link, a button, anything focusable), on an editable cell, which the click focuses for editing, and on the selection and actions columns stay theirs, as do clicks with Shift, Ctrl, Cmd or Alt (selection gestures), the second click of a double click and a click that ends a drag (a text selection). Rows with such an action show a pointer. A double click activates with its first click and then runs its `doubleClick` action, which is unchanged. `activateRow(row)` runs the action as an activation does and answers whether it ran one (a row whose `rowClick` action is disabled answers `false`); a rejected action reports `source: 'table-rowclick'`.
3496
3496
  - `keyCombination` runs an action on the keys its `keyCombination` names, written as the app bar's shortcuts: `{ name: 'Delete', type: ['inRow', 'keyCombination'], keyCombination: 'Delete', … }`, `'Mod+E'`, `'Shift+Alt+D'`, where `Mod` (also `Cmd` or `Ctrl`) is the platform's modifier — Command on Apple platforms, Control elsewhere. The keys count while the focus is on a row or on the table itself: a row action runs for the focused row, else for `selectedDataRow`, when its `actionRelevancyCheckFunc` accepts that row, and an action that is also a `header`, `footer` or `empty` action acts on the table with `selectedDataRow`, as its button does. The first declared action whose keys match and that applies runs, once per press, ahead of the table's own keys (Enter, Space, the arrows, Ctrl/Cmd+C); a link, a field or another control in the table, and a cell's editor, keep their keys. A rejected action reports `source: 'table-keycombination'`.
3497
3497
  - `revealRow(id, { pulse? })` points the reader to a row: the row whose `rowKey` is `id` is brought into view, centred in what the reader sees, in whichever scroller holds the table (its own under `fill` or `fixedHeight`, an ancestor, the page). A virtualized table renders the row first, however far away it is, and corrects its estimate of where the row stands once the row is measured. The scroll is smooth unless the reader asked for less motion (`prefers-reduced-motion: reduce`) or the row had to be rendered first. With `pulse`, the row lights up in a wash of the accent and fades back over 1.6 s; under reduced motion it holds the wash as long without the fade. The focus and the selection stay as they were. It answers whether the row is shown: `false` for an id no row has, a row the search or a filter leaves out, or a table that shows no rows (a failed load) — a host that wants such a row shown clears what hides it first.
3498
- - `fixedHeight` uses internal scrolling with sticky headers and `--table-max-height`; the default uses a floating header while the page scrolls. The footer — row counts, selection and footer actions — sticks only where the table scrolls its own rows, by default: under `fill` while the rows overflow it, and `fixedHeight` keeps it under its own box. A table as tall as its rows lets its footer scroll with the page. `stickyFooter` (`sticky-footer`, unset by default) decides it: `.stickyFooter=${true}` (the attribute) keeps the footer of a table as tall as its rows at the bottom of the page's scroller while the table runs past it, the counterpart of the floating header, flush with the bottom edge the reader sees, over any padding the scroller has; it comes into view with the column header, so a table scrolling in from below shows its footer right below the column header, ahead of the rows. `.stickyFooter=${false}` (`sticky-footer="false"`) never sticks it. A table that fits is unchanged either way. `fill` makes the table take the height its host gives it — a grid or flex track of definite size, as an app-like page gives a section that scrolls on its own: the header and footer keep their height, the rows scroll between them under a sticky column header, nothing outside the table scrolls, and a table without rows centres its empty state in that space. `fill` takes precedence over `fixedHeight` (no `--table-max-height` cap), and while its rows scroll inside it no floating header shows. Under `fill` and `fixedHeight` an edge of the rows' scroller casts a [scroll-edge shadow](#scroll-edges) while rows lie past it: under the column header once the reader scrolled down, above the footer while rows lie below. A host without a definite height leaves nothing to fill: the table grows to its rows, the page scrolls, and the floating header keeps the column headers in view as without `fill`. `virtualized` limits rendered rows and retains spacer geometry. Rows may differ in height: each rendered row is measured and keeps its height, rows not rendered yet are estimated at the mean of the measured ones, and the row under the reader stays in place when a measurement corrects an estimate. A row above it that changes height after it rendered (a late image, a cell that wraps) moves it, and the table moves it back on the next frame unless the reader scrolled in between. Rows that share an id — a `rowKey` naming a missing or repeated field, one object listed twice — are told apart by position, and a row that stays in the window keeps its element. A column widens when the window changes, `data` is replaced or a cell edit is committed and the rows on screen hold a wider value than the column was sized for; a row changed in place without either widens it when the window next changes. The table turns browser scroll anchoring off for its rows (`overflow-anchor: none`) and anchors them itself.
3498
+ - `fixedHeight` uses internal scrolling with sticky headers and `--table-max-height`; the default uses a floating header while the page scrolls. The footer — row counts, selection and footer actions — sticks only where the table scrolls its own rows, by default: under `fill` while the rows overflow it, and `fixedHeight` keeps it under its own box. A table as tall as its rows lets its footer scroll with the page. `stickyFooter` (`sticky-footer`, unset by default) decides it: `.stickyFooter=${true}` (the attribute) keeps the footer of a table as tall as its rows at the bottom of the page's scroller while the table runs past it, the counterpart of the floating header, flush with the bottom edge the reader sees, over any padding the scroller has; it comes into view with the column header, so a table scrolling in from below shows its footer right below the column header, ahead of the rows. `.stickyFooter=${false}` (`sticky-footer="false"`) never sticks it. A table that fits is unchanged either way. `fill` makes the table take the height its host gives it — a grid or flex track of definite size, as an app-like page gives a section that scrolls on its own: the header and footer keep their height, the rows scroll between them under a sticky column header, nothing outside the table scrolls, and a table without rows centres its empty state in that space. `fill` takes precedence over `fixedHeight` (no `--table-max-height` cap), and while its rows scroll inside it no floating header shows. Under `fill` and `fixedHeight` an edge of the rows' scroller casts a [scroll-edge shadow](#scroll-edges) while rows lie past it: under the column header once the reader scrolled down, above the footer while rows lie below. A host without a definite height leaves nothing to fill: the table grows to its rows, the page scrolls, and the floating header keeps the column headers in view as without `fill`. `virtualized` limits rendered rows and retains spacer geometry. Rows may differ in height: each rendered row is measured and keeps its height, rows not rendered yet are estimated at the mean of the measured ones, and the row under the reader stays in place when a measurement corrects an estimate. A row above it that changes height after it rendered (a late image, a cell that wraps) moves it, and the table moves it back on the next frame unless the reader scrolled in between. Rows that share an id — a `rowKey` naming a missing or repeated field, one object listed twice — are told apart by position, and a row that stays in the window keeps its element. A column widens when the window changes, `data` is replaced, a search, a filter or a sort shows other rows or a cell edit is committed and the rows on screen hold a wider value than the column was sized for; a row changed in place without any of these widens it when the window next changes. A widening column takes the room the columns were stretched by to fill the container first, so the table grows wider than its container, and scrolls sideways, only once the values shown so far need more than it holds. The table turns browser scroll anchoring off for its rows (`overflow-anchor: none`) and anchors them itself.
3499
3499
  - Set a column's `editor` to `text`, `number`, `checkbox`, `dropdown`, `date`, or `tags`; `editable: true` defaults to text. Use `editorOptions`, `format`, `parse`, and `validate` for value handling. Double-click edits a cell; Enter commits and opens the cell below, Tab and Shift+Tab commit and open the next or previous editable cell, leaving the editor commits it, and Escape closes it without committing. A value `validate` refuses keeps its editor open, Enter and Tab included. `cellEdit` reports `{ row, key, oldValue, newValue }`; `cellEditError` reports validation failures. `commitCellEdit(row, column, value)` applies a value through `parse` and `validate` and returns whether it was accepted; it closes the editor only when that is the cell being edited.
3500
3500
  - [`frameless`](#frameless-components) drops the table's outer frame and surface when the host — a modal, a panel, a dashboard cell — already owns it: the host's surface shows through the header, rows and footer, and a sticky header or footer paints its backdrop only while rows pass beneath it. Inline cell editors are frameless in every mode. A frameless table also takes the [region inset](#region-inset) of the body it sits in at its edges: header band, first and last cells, footer, skeleton rows and notice; the selection checkbox starts at it and the row actions end at it.
3501
3501
  - Loading, failure and emptiness are said through [`dees-state`](#deesstate), like every other place of an app. `loading` without rows says "Loading {dataName}…" in place of the empty state; with rows — a refresh — the rows stay, the body is `aria-busy` and a thin bar runs along the top edge. `error` — the reader's sentence for why, such as "The registry did not answer." — hides the rows and says "Could not load {dataName}." with it, `errorDetail` folded under "Technical details" and, with `onRetry`, a Retry button that stays pending while the awaited retry runs; clear `error` to show the rows again. An empty table (no rows, no search) offers the data actions of type `'empty'` — `type: ['header', 'empty']` puts "New service" in the header and in the empty state — and the controls in its `empty` slot. A search or filter that matches nothing still offers Clear filters.
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '21.46.0',
6
+ version: '21.46.1',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -343,9 +343,13 @@ export class DeesTable<T> extends DeesElement {
343
343
  * the reader scrolled in between. Rows that share an id (a `rowKey` naming
344
344
  * a missing or repeated field, one object listed twice) are told apart by
345
345
  * position. A column widens when the
346
- * window changes, `data` is replaced or a cell edit is committed and the
347
- * rows on screen hold a wider value than it was sized for; a row changed in
348
- * place without either widens it when the window next changes. Browser
346
+ * window changes, `data` is replaced, a search, a filter or a sort shows
347
+ * other rows or a cell edit is committed and the rows on screen hold a
348
+ * wider value than it was sized for; a row changed in place without any of
349
+ * these widens it when the window next changes. A widening column takes the
350
+ * room the columns were stretched by to fill the container first: the table
351
+ * grows wider than its container only once the values on screen so far need
352
+ * more than it holds. Browser
349
353
  * scroll anchoring is off for the table's rows. Recommended for tables with
350
354
  * > a few hundred rows.
351
355
  */
@@ -667,8 +671,17 @@ export class DeesTable<T> extends DeesElement {
667
671
  * virtualized.
668
672
  */
669
673
  private __settledAnchor?: IVirtualAnchor & { scrollPosition: number };
670
- /** The window whose values the column widths were last checked against. */
671
- private __virtualColumnsCheckedFor?: { start: number; end: number };
674
+ /**
675
+ * The window, and the view it showed, whose values the column widths were
676
+ * last checked against: a search, a filter or a sort shows other rows in the
677
+ * same window.
678
+ */
679
+ private __virtualColumnsCheckedFor?: { start: number; end: number; view: T[] | undefined };
680
+ /**
681
+ * What each data column's values have needed, laid out at their natural
682
+ * width, in the windows shown since the widths were frozen.
683
+ */
684
+ private __columnContentWidths?: number[];
672
685
  private __virtualSettleFrame?: number;
673
686
  /** Currently rendered range [start, end). Triggers re-render when changed. */
674
687
  @state()
@@ -1730,9 +1743,13 @@ export class DeesTable<T> extends DeesElement {
1730
1743
  /**
1731
1744
  * The column widths are frozen from the first window. Under virtualization
1732
1745
  * later windows bring other values, so a column widens to the widest value
1733
- * rendered so far: the window is laid out at its natural widths once and
1734
- * every column keeps the larger of that and its frozen width. Returns
1735
- * whether a column widened.
1746
+ * rendered so far: the window is laid out at its natural widths once, and
1747
+ * each column needs the widest it has been in any window since the freeze.
1748
+ * A column that needs more than it has takes the room the columns were
1749
+ * stretched by to fill the table's container, shared out in proportion to
1750
+ * what each needs as the browser shares it; the table grows wider than its
1751
+ * container only once the columns need more than it holds. Returns whether
1752
+ * a column's width changed.
1736
1753
  */
1737
1754
  private __growColumnWidths(): boolean {
1738
1755
  const table = this.__realTableEl;
@@ -1746,15 +1763,25 @@ export class DeesTable<T> extends DeesElement {
1746
1763
  table.style.minWidth = '0';
1747
1764
  cells.forEach((cell) => { cell.style.width = ''; });
1748
1765
  const natural = cells.map((cell) => parseFloat(getComputedStyle(cell).width) || 0);
1749
- let grew = false;
1750
- cells.forEach((cell, index) => {
1751
- const width = Math.max(frozen[index], natural[index]);
1752
- if (width > frozen[index] + 0.5) grew = true;
1753
- cell.style.width = `${width}px`;
1754
- });
1766
+ const naturalTotal = natural.reduce((sum, width) => sum + width, 0);
1767
+ const naturalTableWidth = parseFloat(getComputedStyle(table).width) || 0;
1755
1768
  table.style.minWidth = '';
1769
+ // The data columns' room: the width the container stretches the table to,
1770
+ // less what the other columns and the table's edges take.
1771
+ const room = (parseFloat(getComputedStyle(table).width) || 0) - (naturalTableWidth - naturalTotal);
1772
+ const before = this.__columnContentWidths?.length === cells.length ? this.__columnContentWidths : [];
1773
+ const needed = natural.map((width, index) => Math.max(before[index] ?? 0, width));
1774
+ this.__columnContentWidths = needed;
1775
+ const neededTotal = needed.reduce((sum, width) => sum + width, 0);
1776
+ const widths = !needed.some((width, index) => width > frozen[index] + 0.5)
1777
+ ? frozen
1778
+ : neededTotal >= room
1779
+ ? needed
1780
+ // whole pixels of the room left, so the shares never add up past it
1781
+ : needed.map((width) => width + Math.floor((room - neededTotal) * width / neededTotal));
1782
+ cells.forEach((cell, index) => { cell.style.width = `${widths[index]}px`; });
1756
1783
  table.style.tableLayout = 'fixed';
1757
- return grew;
1784
+ return widths.some((width, index) => Math.abs(width - frozen[index]) > 0.5);
1758
1785
  }
1759
1786
 
1760
1787
  /** Settles the window on the next frame: at most one range change per frame. */
@@ -1770,15 +1797,16 @@ export class DeesTable<T> extends DeesElement {
1770
1797
  this.__restoreVirtualAnchor(settled);
1771
1798
  }
1772
1799
  const range = this.__virtualRange;
1800
+ const view = this.__rowKeysFor?.view;
1773
1801
  const checked = this.__virtualColumnsCheckedFor;
1774
- if (!checked || checked.start !== range.start || checked.end !== range.end) {
1802
+ if (!checked || checked.start !== range.start || checked.end !== range.end || checked.view !== view) {
1775
1803
  const anchor = this.__captureVirtualAnchor();
1776
1804
  if (this.__growColumnWidths()) {
1777
1805
  this.__measureRenderedRows();
1778
1806
  if (anchor) this.__restoreVirtualAnchor(anchor);
1779
1807
  }
1780
1808
  // Only a window the frozen widths have seen counts as checked.
1781
- if (this.__realTableEl?.style.tableLayout === 'fixed') this.__virtualColumnsCheckedFor = { ...range };
1809
+ if (this.__realTableEl?.style.tableLayout === 'fixed') this.__virtualColumnsCheckedFor = { ...range, view };
1782
1810
  }
1783
1811
  this.__measureRenderedRows();
1784
1812
  this.__computeVirtualRange();
@@ -2549,12 +2577,21 @@ export class DeesTable<T> extends DeesElement {
2549
2577
  // their content lays them out now, not as they were.
2550
2578
  table.style.tableLayout = '';
2551
2579
  dataCells.forEach((cell) => { cell.style.width = ''; });
2580
+ this.__columnContentWidths = undefined;
2552
2581
 
2553
2582
  // An empty table has no widths worth keeping: its header and empty state
2554
2583
  // stretch across the container. It stays in automatic layout until a data
2555
2584
  // row is shown, which `updated()` measures then.
2556
2585
  if (!table.querySelector('tbody tr[data-row-idx]')) return;
2557
2586
 
2587
+ // A virtualized table shows other rows later: what the first window's
2588
+ // values need is where `__growColumnWidths()` starts.
2589
+ if (this.virtualized) {
2590
+ table.style.minWidth = '0';
2591
+ this.__columnContentWidths = dataCells.map((cell) => parseFloat(getComputedStyle(cell).width) || 0);
2592
+ table.style.minWidth = '';
2593
+ }
2594
+
2558
2595
  // Freeze data widths in one read/write batch. They include the table's
2559
2596
  // stretch to its container: in fixed layout a column without a width
2560
2597
  // takes what the others leave, so natural widths alone would hand the