@design.estate/dees-catalog 24.0.2 → 24.1.0

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.
@@ -210,6 +210,13 @@ export const tableStyles = [
210
210
  .floatingHeader table { margin: 0; }
211
211
  .floatingHeader th { pointer-events: auto; }
212
212
  table { width: max-content; min-width: 100%; caption-side: bottom; font-size: inherit; border-collapse: separate; border-spacing: 0; }
213
+ /* With a wrapping column the table fits its container: automatic layout gives every column its
214
+ minimum, which for a cell that stays on one line is that line, and hands what is left to the
215
+ columns that can use it, the wrapping ones. Scoped to the data rows: the empty state wraps. */
216
+ table.wrapsCells { width: 100%; }
217
+ table.wrapsCells th, table.wrapsCells tr[data-row-idx] > td { white-space: nowrap; }
218
+ table.wrapsCells tr[data-row-idx] > td.wrapCell { white-space: normal; overflow-wrap: break-word; }
219
+ table.wrapsCells tr[data-row-idx] > td.wrapCell .innerCellContainer { min-width: 20ch; }
213
220
  th, td { box-sizing: border-box; padding: 6px 16px; text-align: start; vertical-align: middle; }
214
221
  th { height: var(--table-header-height); background: var(--table-head-surface); color: var(--dees-color-text-secondary); font-size: 12px; font-weight: 500; border-bottom: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle); }
215
222
  td { height: 40px; position: relative; color: var(--dees-color-text-primary); border-bottom: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle); font-size: 13px; }
@@ -437,4 +444,4 @@ export const tableStyles = [
437
444
  }
438
445
  `,
439
446
  ];
440
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3R5bGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vdHNfd2ViL2VsZW1lbnRzLzAwZ3JvdXAtZGF0YXZpZXcvZGVlcy10YWJsZS9zdHlsZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxH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ult;
102
102
  /** Explicit display alignment. Values and formatted strings are never inferred. */
103
103
  align?: 'start' | 'center' | 'end';
104
+ /**
105
+ * Whether the column's cells wrap, for a long text or a row of chips. A table with a wrapping
106
+ * column fits its container instead of asking for every column's one-line width: the other
107
+ * columns keep their one line, the wrapping ones take the room that leaves and wrap within it,
108
+ * and rows grow with them. Each stays at least 20ch wide; only when that does not fit does the
109
+ * table scroll sideways, as any table does. Without it (the default) a cell stays on one line.
110
+ */
111
+ wrap?: boolean;
104
112
  value?: (row: T) => any;
105
113
  renderer?: (value: any, row: T, ctx: {
106
114
  rowIndex: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-catalog",
3
- "version": "24.0.2",
3
+ "version": "24.1.0",
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
@@ -3757,6 +3757,7 @@ html`<dees-table
3757
3757
  - The search field is readable and writable from outside in every mode: `searchQuery` reports what it shows, `setSearchQuery(text, { emit })` writes it, and `clearSearch({ emit })` empties it. A written query runs the search exactly as a typed one does once its debounce elapses — `searchRequest` in server mode, `filterChange` otherwise — and drops a keystroke still waiting out that debounce. Pass `{ emit: false }` to write the field alone, for a host that answers the query itself — a `server` mode table restoring a query it has already run. In `table` and `data` mode the table filters the rows from `filterText`, so a withheld query shows in the field while the rows still answer the previous one until something else runs the search, a mode change included. Column filters are a separate control and stay untouched. `focusSearch()` awaits the table's own render, puts the caret in the field and answers whether there is one. `inputSearchQuery(text, { composing })` takes a query as a field delivers it while the reader types: it writes the field and runs the search once 200 ms pass without another keystroke, and waits for an IME composition to end. After the table's first render, the bubbling `searchChange` event (`ITableSearchChangeDetail`: `{ query, mode }`) follows every change of the query or of `searchMode`, from typing, code or the filter bubble alike. [`dees-table-search`](#deestablesearch) puts the same field outside the table.
3758
3758
  - Native header buttons sort and expose `aria-sort`. Shift-click builds a multi-column sort; the header context menu controls sort priority. `sortBy` and `sortChange` expose the descriptors.
3759
3759
  - A value shown beneath another column's cell sorts from that column's header. Give it a hidden column whose `sortUnder` names the column it shows under — `{ key: 'source', header: 'Source', hidden: true, sortUnder: 'period' }`, with the source rendered beneath each period — and the named column's header menu offers "Sort by Source", ascending or descending, and "Remove from sort" once it sorts. Both columns must be sortable. It sorts alone, like the menu's other single sorts: a cascade of more than one column is replaced only after the reader confirms. While it sorts, the header shows its name after its own, then its arrow and, in a cascade, its place; `aria-sort` follows it while it leads. The name takes the room the header has and gives way to an ellipsis, so it never widens the column. A click on the header still sorts by the column's own value, and `sortBy` and `sortChange` name the hidden column by its key, as any other.
3760
+ - A long text or a row of chips wraps with `wrap` on its column — `{ key: 'summary', header: 'Summary', wrap: true }`. The table then fits its container instead of asking for every column's one-line width: the other columns keep their line, the wrapping column takes the room they leave and wraps within it, and the rows grow. When the container changes its width, the rows wrap anew. A wrapping column stays at least 20ch wide; only when that does not fit does the table scroll sideways. It holds under `virtualized` as well: a wider value in a later window takes its room from the wrapping column.
3760
3761
  - `selectionMode` accepts `none`, `single`, or `multi`. Use a stable `rowKey` to retain selection and editing through fresh data arrays. `showSelectionCheckbox` includes select-all for visible rows.
3761
3762
  - Header, footer and empty-state actions are bar actions: one renderer draws them and [`dees-tile`'s actions](#deestile), so a table's actions and a tile's look and behave alike, and actions that do not fit beside the heading or the count wrap onto further lines at the end. [Where actions go](#where-actions-go) says which to use.
3762
3763
  - `info` puts a standing explanation of the list behind an info button (ⓘ, "About this list") at the end of the footer, after the footer actions, opened in the speech bubble; see [the tile's footer info](#deestile), which works the same way.
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '24.0.2',
6
+ version: '24.1.0',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -54,6 +54,19 @@ const demoMovements: IDemoMovement[] = [
54
54
  { id: 'm7', booked: '2026-08-12', payee: 'Telekom', account: 'sparkasse', month: '2026-08', amount: -39.95, private: false },
55
55
  ];
56
56
  const accountNames: Record<string, string> = { sparkasse: 'Sparkasse', n26: 'N26' };
57
+
58
+ /** A support ticket, for the wrapping example: the summary wraps, the columns beside it keep their line. */
59
+ interface IDemoTicket { id: string; opened: string; summary: string; owner: string; }
60
+ const demoTickets: IDemoTicket[] = [
61
+ { id: 't1', opened: '2026-09-29', summary: 'Invoices from the Hamburg office arrive twice since the mail gateway moved, and the second copy is booked as a new document', owner: 'Finance' },
62
+ { id: 't2', opened: '2026-09-24', summary: 'Scanner in the hallway stops after forty pages', owner: 'Facilities' },
63
+ { id: 't3', opened: '2026-09-18', summary: 'Single sign-on asks new colleagues to choose an organization they do not belong to, and a wrong choice cannot be undone without an administrator', owner: 'Platform' },
64
+ ];
65
+ const ticketColumns: Column<IDemoTicket>[] = [
66
+ { key: 'opened', header: 'Opened' },
67
+ { key: 'summary', header: 'Summary', wrap: true },
68
+ { key: 'owner', header: 'Owner' },
69
+ ];
57
70
  const euro = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'EUR' });
58
71
  const movementColumns: Column<IDemoMovement>[] = [
59
72
  { key: 'booked', header: 'Booked' },
@@ -389,6 +402,13 @@ export class DeesDemoTableWorkspace extends DeesElement {
389
402
  .displayFunction=${(person: { name: string; email: string; team: string }) => ({ name: person.name, Email: person.email, Team: person.team })}
390
403
  .data=${[{ name: 'Alex Morgan', email: 'alex@example.com', team: 'Design' }, { name: 'Sam Rivera', email: 'sam@example.com', team: 'Engineering' }, { name: 'Jamie Chen', email: 'jamie@example.com', team: 'Product' }]}></dees-table>
391
404
  </section>
405
+ <section class="example">
406
+ <p class="caption">A wrapping column fits the table to its container: the columns beside it keep their one line,
407
+ it takes the room they leave and wraps within it, and the rows grow. Narrow the window to watch it. Only when a
408
+ wrapping column would fall below 20ch does the table scroll sideways.</p>
409
+ <dees-table heading1="Support tickets" heading2="A wrapping column" dataName="tickets"
410
+ .columns=${ticketColumns} .data=${demoTickets} .rowKey=${'id'}></dees-table>
411
+ </section>
392
412
  <section class="example">
393
413
  <p class="caption">Rows can offer different actions: an e-invoice can be validated and shows its XML source from the
394
414
  "…" menu, a PDF cannot. Each action keeps its place in the actions column, and a row leaves the place of an action
@@ -688,6 +688,8 @@ export class DeesTable<T> extends DeesElement {
688
688
  * width, in the windows shown since the widths were frozen.
689
689
  */
690
690
  private __columnContentWidths?: number[];
691
+ /** The container's width the column widths were measured at, for a table that fits it. */
692
+ private __columnsFittedTo?: number;
691
693
  private __virtualSettleFrame?: number;
692
694
  /** Currently rendered range [start, end). Triggers re-render when changed. */
693
695
  @state()
@@ -1032,7 +1034,8 @@ export class DeesTable<T> extends DeesElement {
1032
1034
  ${this.loading && viewData.length && showRows ? html`<div class="refreshBar" aria-hidden="true"></div>` : ''}
1033
1035
  <div class="tableScrollFrame">
1034
1036
  <div class="tableScroll">
1035
- <table aria-label=${this.label || this.heading1 || this.__dataNames?.other || this.t('table.data')}>
1037
+ <table class=${effectiveColumns.some((col) => col.wrap && !col.hidden) ? 'wrapsCells' : ''}
1038
+ aria-label=${this.label || this.heading1 || this.__dataNames?.other || this.t('table.data')}>
1036
1039
  <thead>
1037
1040
  ${this.renderHeaderRows(effectiveColumns)}
1038
1041
  </thead>
@@ -1097,6 +1100,7 @@ export class DeesTable<T> extends DeesElement {
1097
1100
  const isFlashing = flashToken !== undefined;
1098
1101
  const useFlashBorder = isFlashing && !!col.flashBorder;
1099
1102
  const cellClasses = [
1103
+ col.wrap ? 'wrapCell' : '',
1100
1104
  isEditable ? 'editable' : '',
1101
1105
  isFocused && !isEditing ? 'focused' : '',
1102
1106
  isEditing ? 'editingCell' : '',
@@ -1213,6 +1217,7 @@ export class DeesTable<T> extends DeesElement {
1213
1217
  const ariaSort = this.getAriaSort(col, underColumns);
1214
1218
  return html`
1215
1219
  <th
1220
+ class=${col.wrap ? 'wrapCell' : ''}
1216
1221
  role="columnheader"
1217
1222
  scope="col"
1218
1223
  aria-sort=${ariaSort}
@@ -1447,6 +1452,7 @@ export class DeesTable<T> extends DeesElement {
1447
1452
 
1448
1453
  // Track resize of the real table so we can mirror its width and column widths.
1449
1454
  this.__floatingResizeObserver = new ResizeObserver(() => {
1455
+ this.__refitWrappingColumns();
1450
1456
  this.__syncViewportWidth();
1451
1457
  this.__syncScrollport();
1452
1458
  this.__syncPinnedActions();
@@ -1754,8 +1760,10 @@ export class DeesTable<T> extends DeesElement {
1754
1760
  * A column that needs more than it has takes the room the columns were
1755
1761
  * stretched by to fill the table's container, shared out in proportion to
1756
1762
  * what each needs as the browser shares it; the table grows wider than its
1757
- * container only once the columns need more than it holds. Returns whether
1758
- * a column's width changed.
1763
+ * container only once the columns need more than it holds. A wrapping column
1764
+ * needs no more than it has: it gives the columns beside it the room they
1765
+ * need, down to what it can narrow to. Returns whether a column's width
1766
+ * changed.
1759
1767
  */
1760
1768
  private __growColumnWidths(): boolean {
1761
1769
  const table = this.__realTableEl;
@@ -1764,6 +1772,7 @@ export class DeesTable<T> extends DeesElement {
1764
1772
  const cells = Array.from(headerRow.cells).filter(
1765
1773
  (cell) => !cell.classList.contains('actionsCol') && !cell.classList.contains('selectionCol')
1766
1774
  );
1775
+ const wrapping = cells.map((cell) => cell.classList.contains('wrapCell'));
1767
1776
  const frozen = cells.map((cell) => parseFloat(cell.style.width) || 0);
1768
1777
  table.style.tableLayout = 'auto';
1769
1778
  table.style.minWidth = '0';
@@ -1771,25 +1780,56 @@ export class DeesTable<T> extends DeesElement {
1771
1780
  const natural = cells.map((cell) => parseFloat(getComputedStyle(cell).width) || 0);
1772
1781
  const naturalTotal = natural.reduce((sum, width) => sum + width, 0);
1773
1782
  const naturalTableWidth = parseFloat(getComputedStyle(table).width) || 0;
1783
+ let narrowest: number[] = [];
1784
+ if (wrapping.includes(true)) {
1785
+ table.style.width = 'min-content';
1786
+ narrowest = cells.map((cell) => parseFloat(getComputedStyle(cell).width) || 0);
1787
+ table.style.width = '';
1788
+ }
1774
1789
  table.style.minWidth = '';
1775
1790
  // The data columns' room: the width the container stretches the table to,
1776
1791
  // less what the other columns and the table's edges take.
1777
1792
  const room = (parseFloat(getComputedStyle(table).width) || 0) - (naturalTableWidth - naturalTotal);
1778
1793
  const before = this.__columnContentWidths?.length === cells.length ? this.__columnContentWidths : [];
1779
- const needed = natural.map((width, index) => Math.max(before[index] ?? 0, width));
1794
+ const needed = natural.map((width, index) => (wrapping[index] ? width : Math.max(before[index] ?? 0, width)));
1780
1795
  this.__columnContentWidths = needed;
1781
1796
  const neededTotal = needed.reduce((sum, width) => sum + width, 0);
1782
- const widths = !needed.some((width, index) => width > frozen[index] + 0.5)
1797
+ // What the columns on one line leave the wrapping ones, shared as they share the room now.
1798
+ const leftToWrap = room - needed.reduce((sum, width, index) => sum + (wrapping[index] ? 0 : width), 0);
1799
+ const wrappingTotal = frozen.reduce((sum, width, index) => sum + (wrapping[index] ? width : 0), 0);
1800
+ const widths = !needed.some((width, index) => !wrapping[index] && width > frozen[index] + 0.5)
1783
1801
  ? frozen
1784
- : neededTotal >= room
1785
- ? needed
1786
- // whole pixels of the room left, so the shares never add up past it
1787
- : needed.map((width) => width + Math.floor((room - neededTotal) * width / neededTotal));
1802
+ : wrapping.includes(true)
1803
+ ? needed.map((width, index) => (wrapping[index]
1804
+ ? Math.max(narrowest[index], Math.floor(leftToWrap * frozen[index] / wrappingTotal))
1805
+ : width))
1806
+ : neededTotal >= room
1807
+ ? needed
1808
+ // whole pixels of the room left, so the shares never add up past it
1809
+ : needed.map((width) => width + Math.floor((room - neededTotal) * width / neededTotal));
1788
1810
  cells.forEach((cell, index) => { cell.style.width = `${widths[index]}px`; });
1789
1811
  table.style.tableLayout = 'fixed';
1790
1812
  return widths.some((width, index) => Math.abs(width - frozen[index]) > 0.5);
1791
1813
  }
1792
1814
 
1815
+ /**
1816
+ * A table with a wrapping column fits its container, so widths frozen at one
1817
+ * width hold for that width only: when the container's width changes, the
1818
+ * columns are measured again and the rows wrap anew.
1819
+ */
1820
+ private __refitWrappingColumns(): void {
1821
+ const table = this.__realTableEl;
1822
+ if (!table?.classList.contains('wrapsCells')) return;
1823
+ if (table.parentElement?.clientWidth === this.__columnsFittedTo) return;
1824
+ void this.determineColumnWidths().then(() => {
1825
+ if (!this.fixedHeight) this.__syncFloatingHeader();
1826
+ if (!this.virtualized) return;
1827
+ this.__rowHeights.clear();
1828
+ this.__virtualColumnsCheckedFor = undefined;
1829
+ this.__scheduleVirtualSettle();
1830
+ });
1831
+ }
1832
+
1793
1833
  /** Settles the window on the next frame: at most one range change per frame. */
1794
1834
  private __scheduleVirtualSettle(): void {
1795
1835
  if (this.__virtualSettleFrame !== undefined) return;
@@ -2584,6 +2624,7 @@ export class DeesTable<T> extends DeesElement {
2584
2624
  table.style.tableLayout = '';
2585
2625
  dataCells.forEach((cell) => { cell.style.width = ''; });
2586
2626
  this.__columnContentWidths = undefined;
2627
+ this.__columnsFittedTo = table.parentElement?.clientWidth;
2587
2628
 
2588
2629
  // An empty table has no widths worth keeping: its header and empty state
2589
2630
  // stretch across the container. It stays in automatic layout until a data
@@ -214,6 +214,13 @@ export const tableStyles: CSSResult[] = [
214
214
  .floatingHeader table { margin: 0; }
215
215
  .floatingHeader th { pointer-events: auto; }
216
216
  table { width: max-content; min-width: 100%; caption-side: bottom; font-size: inherit; border-collapse: separate; border-spacing: 0; }
217
+ /* With a wrapping column the table fits its container: automatic layout gives every column its
218
+ minimum, which for a cell that stays on one line is that line, and hands what is left to the
219
+ columns that can use it, the wrapping ones. Scoped to the data rows: the empty state wraps. */
220
+ table.wrapsCells { width: 100%; }
221
+ table.wrapsCells th, table.wrapsCells tr[data-row-idx] > td { white-space: nowrap; }
222
+ table.wrapsCells tr[data-row-idx] > td.wrapCell { white-space: normal; overflow-wrap: break-word; }
223
+ table.wrapsCells tr[data-row-idx] > td.wrapCell .innerCellContainer { min-width: 20ch; }
217
224
  th, td { box-sizing: border-box; padding: 6px 16px; text-align: start; vertical-align: middle; }
218
225
  th { height: var(--table-header-height); background: var(--table-head-surface); color: var(--dees-color-text-secondary); font-size: 12px; font-weight: 500; border-bottom: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle); }
219
226
  td { height: 40px; position: relative; color: var(--dees-color-text-primary); border-bottom: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle); font-size: 13px; }
@@ -114,6 +114,14 @@ export interface Column<T = any> {
114
114
  header?: string | TemplateResult;
115
115
  /** Explicit display alignment. Values and formatted strings are never inferred. */
116
116
  align?: 'start' | 'center' | 'end';
117
+ /**
118
+ * Whether the column's cells wrap, for a long text or a row of chips. A table with a wrapping
119
+ * column fits its container instead of asking for every column's one-line width: the other
120
+ * columns keep their one line, the wrapping ones take the room that leaves and wrap within it,
121
+ * and rows grow with them. Each stays at least 20ch wide; only when that does not fit does the
122
+ * table scroll sideways, as any table does. Without it (the default) a cell stays on one line.
123
+ */
124
+ wrap?: boolean;
117
125
  value?: (row: T) => any;
118
126
  renderer?: (value: any, row: T, ctx: { rowIndex: number; colIndex: number; column: Column<T> }) => TemplateResult | string;
119
127
  /** Whether this column can be sorted by clicking its header. Defaults to `true`; set to `false` to disable. */