tosijs-ui 1.5.18 → 1.5.21

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.
@@ -1090,8 +1090,13 @@ export class TosiTable extends WebComponent {
1090
1090
  // its own non-virtualised listBinding so each pinned row goes through the
1091
1091
  // same dataCell / rowRendered / `^.prop` pipeline as the virtual rows. The
1092
1092
  // wrapper has no box of its own, so its stamped rows are layout children of
1093
- // .scroll-area and share its single sticky context.
1094
- buildPinnedBody(rowsProxy, cols, stickyInfo, region, part) {
1093
+ // .scroll-area and share its single sticky context. Returns null when the
1094
+ // region is empty so render() can drop it from the DOM.
1095
+ buildPinnedBody(rowsProxy, cols, stickyInfo, region) {
1096
+ const data = tosiValue(rowsProxy);
1097
+ if (!data || data.length === 0)
1098
+ return null;
1099
+ const part = region === 'pinned-top' ? 'pinnedTopRows' : 'pinnedBottomRows';
1095
1100
  const rowClass = this.rowClasses(region);
1096
1101
  const binding = rowsProxy.listBinding((_elements, item) => this.buildRow(item, cols, stickyInfo, rowClass), {});
1097
1102
  return div({
@@ -1641,25 +1646,18 @@ export class TosiTable extends WebComponent {
1641
1646
  // so their stamped rows participate in .scroll-area's layout directly,
1642
1647
  // sharing one sticky context with the visible rows and the header.
1643
1648
  this._head = this.buildHeader(cols, stickyInfo);
1644
- this._tbodyTop =
1645
- pinnedTopData.length > 0
1646
- ? this.buildPinnedBody(this.rowData.pinnedTopData, cols, stickyInfo, 'pinned-top', 'pinnedTopRows')
1647
- : null;
1648
- this._tbodyBottom =
1649
- pinnedBottomData.length > 0
1650
- ? this.buildPinnedBody(this.rowData.pinnedBottomData, cols, stickyInfo, 'pinned-bottom', 'pinnedBottomRows')
1651
- : null;
1649
+ this._tbodyTop = this.buildPinnedBody(this.rowData.pinnedTopData, cols, stickyInfo, 'pinned-top');
1650
+ this._tbodyBottom = this.buildPinnedBody(this.rowData.pinnedBottomData, cols, stickyInfo, 'pinned-bottom');
1652
1651
  // The visible-rows listBinding is bound directly to .scroll-area so
1653
1652
  // virtualisation observes the same scroll container that sticky cells
1654
1653
  // stick against.
1655
1654
  const visibleBinding = this.rowData.visible.listBinding((_elements, item) => this.buildRow(item, cols, stickyInfo), this.rowHeight > 0 ? { virtual: { height: this.rowHeight } } : {});
1656
- const scrollAreaChildren = [this._head];
1657
- if (this._tbodyTop)
1658
- scrollAreaChildren.push(this._tbodyTop);
1659
- scrollAreaChildren.push(...visibleBinding);
1660
- if (this._tbodyBottom)
1661
- scrollAreaChildren.push(this._tbodyBottom);
1662
- this._scrollArea = div({ class: 'scroll-area', part: 'visibleRows' }, ...scrollAreaChildren);
1655
+ this._scrollArea = div({ class: 'scroll-area', part: 'visibleRows' }, ...[
1656
+ this._head,
1657
+ this._tbodyTop,
1658
+ ...visibleBinding,
1659
+ this._tbodyBottom,
1660
+ ].filter(Boolean));
1663
1661
  this._scrollArea.addEventListener('scrollend', this.onScrollEnd);
1664
1662
  this.append(this._scrollArea);
1665
1663
  this.observePinnedRowMutations();