@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.
@@ -8396,8 +8396,17 @@ var _DeesTable = class _DeesTable extends (_a17 = DeesElement, _heading1_dec = [
8396
8396
  * virtualized.
8397
8397
  */
8398
8398
  __publicField(this, "__settledAnchor");
8399
- /** The window whose values the column widths were last checked against. */
8399
+ /**
8400
+ * The window, and the view it showed, whose values the column widths were
8401
+ * last checked against: a search, a filter or a sort shows other rows in the
8402
+ * same window.
8403
+ */
8400
8404
  __publicField(this, "__virtualColumnsCheckedFor");
8405
+ /**
8406
+ * What each data column's values have needed, laid out at their natural
8407
+ * width, in the windows shown since the widths were frozen.
8408
+ */
8409
+ __publicField(this, "__columnContentWidths");
8401
8410
  __publicField(this, "__virtualSettleFrame");
8402
8411
  __privateAdd(this, ___virtualRange, __runInitializers(_init19, 212, this, { start: 0, end: 0 })), __runInitializers(_init19, 215, this);
8403
8412
  /** The row that holds the rows' tab stop in a table whose rows activate. */
@@ -9420,9 +9429,13 @@ var _DeesTable = class _DeesTable extends (_a17 = DeesElement, _heading1_dec = [
9420
9429
  /**
9421
9430
  * The column widths are frozen from the first window. Under virtualization
9422
9431
  * later windows bring other values, so a column widens to the widest value
9423
- * rendered so far: the window is laid out at its natural widths once and
9424
- * every column keeps the larger of that and its frozen width. Returns
9425
- * whether a column widened.
9432
+ * rendered so far: the window is laid out at its natural widths once, and
9433
+ * each column needs the widest it has been in any window since the freeze.
9434
+ * A column that needs more than it has takes the room the columns were
9435
+ * stretched by to fill the table's container, shared out in proportion to
9436
+ * what each needs as the browser shares it; the table grows wider than its
9437
+ * container only once the columns need more than it holds. Returns whether
9438
+ * a column's width changed.
9426
9439
  */
9427
9440
  __growColumnWidths() {
9428
9441
  const table = this.__realTableEl;
@@ -9438,15 +9451,20 @@ var _DeesTable = class _DeesTable extends (_a17 = DeesElement, _heading1_dec = [
9438
9451
  cell.style.width = "";
9439
9452
  });
9440
9453
  const natural = cells.map((cell) => parseFloat(getComputedStyle(cell).width) || 0);
9441
- let grew = false;
9454
+ const naturalTotal = natural.reduce((sum, width) => sum + width, 0);
9455
+ const naturalTableWidth = parseFloat(getComputedStyle(table).width) || 0;
9456
+ table.style.minWidth = "";
9457
+ const room = (parseFloat(getComputedStyle(table).width) || 0) - (naturalTableWidth - naturalTotal);
9458
+ const before = this.__columnContentWidths?.length === cells.length ? this.__columnContentWidths : [];
9459
+ const needed = natural.map((width, index) => Math.max(before[index] ?? 0, width));
9460
+ this.__columnContentWidths = needed;
9461
+ const neededTotal = needed.reduce((sum, width) => sum + width, 0);
9462
+ const widths = !needed.some((width, index) => width > frozen[index] + 0.5) ? frozen : neededTotal >= room ? needed : needed.map((width) => width + Math.floor((room - neededTotal) * width / neededTotal));
9442
9463
  cells.forEach((cell, index) => {
9443
- const width = Math.max(frozen[index], natural[index]);
9444
- if (width > frozen[index] + 0.5) grew = true;
9445
- cell.style.width = `${width}px`;
9464
+ cell.style.width = `${widths[index]}px`;
9446
9465
  });
9447
- table.style.minWidth = "";
9448
9466
  table.style.tableLayout = "fixed";
9449
- return grew;
9467
+ return widths.some((width, index) => Math.abs(width - frozen[index]) > 0.5);
9450
9468
  }
9451
9469
  /** Settles the window on the next frame: at most one range change per frame. */
9452
9470
  __scheduleVirtualSettle() {
@@ -9459,14 +9477,15 @@ var _DeesTable = class _DeesTable extends (_a17 = DeesElement, _heading1_dec = [
9459
9477
  this.__restoreVirtualAnchor(settled);
9460
9478
  }
9461
9479
  const range = this.__virtualRange;
9480
+ const view = this.__rowKeysFor?.view;
9462
9481
  const checked = this.__virtualColumnsCheckedFor;
9463
- if (!checked || checked.start !== range.start || checked.end !== range.end) {
9482
+ if (!checked || checked.start !== range.start || checked.end !== range.end || checked.view !== view) {
9464
9483
  const anchor = this.__captureVirtualAnchor();
9465
9484
  if (this.__growColumnWidths()) {
9466
9485
  this.__measureRenderedRows();
9467
9486
  if (anchor) this.__restoreVirtualAnchor(anchor);
9468
9487
  }
9469
- if (this.__realTableEl?.style.tableLayout === "fixed") this.__virtualColumnsCheckedFor = { ...range };
9488
+ if (this.__realTableEl?.style.tableLayout === "fixed") this.__virtualColumnsCheckedFor = { ...range, view };
9470
9489
  }
9471
9490
  this.__measureRenderedRows();
9472
9491
  this.__computeVirtualRange();
@@ -10056,7 +10075,13 @@ var _DeesTable = class _DeesTable extends (_a17 = DeesElement, _heading1_dec = [
10056
10075
  dataCells.forEach((cell) => {
10057
10076
  cell.style.width = "";
10058
10077
  });
10078
+ this.__columnContentWidths = void 0;
10059
10079
  if (!table.querySelector("tbody tr[data-row-idx]")) return;
10080
+ if (this.virtualized) {
10081
+ table.style.minWidth = "0";
10082
+ this.__columnContentWidths = dataCells.map((cell) => parseFloat(getComputedStyle(cell).width) || 0);
10083
+ table.style.minWidth = "";
10084
+ }
10060
10085
  const widths = dataCells.map((cell) => getComputedStyle(cell).width);
10061
10086
  dataCells.forEach((cell, index) => {
10062
10087
  cell.style.width = widths[index];
@@ -124734,7 +124759,7 @@ var bright = {
124734
124759
  // ts_web/00_commitinfo_data.ts
124735
124760
  var commitinfo = {
124736
124761
  name: "@design.estate/dees-catalog",
124737
- version: "21.46.0",
124762
+ version: "21.46.1",
124738
124763
  description: "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript."
124739
124764
  };
124740
124765
  export {