tosijs-ui 1.5.19 → 1.5.22

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.
@@ -75,7 +75,7 @@ export declare class TosiTable extends WebComponent {
75
75
  zIndex: string;
76
76
  background: string;
77
77
  };
78
- ':host .tr[aria-selected="true"] .td': {
78
+ ':host .tr[aria-selected] .td': {
79
79
  background: string;
80
80
  };
81
81
  ':host .td:focus, :host .th:focus': {
@@ -120,7 +120,8 @@ test('row selection: data model + aria-selected on row (incl. custom dataCell)',
120
120
  expect(table.selectedRows.length).toBe(2)
121
121
 
122
122
  // DOM: aria-selected lives on the row element. CSS targets
123
- // .tr[aria-selected="true"] .td to highlight cells.
123
+ // .tr[aria-selected] .td to highlight cells. The attribute is set via
124
+ // toggleAttribute, so its value is "" (presence-only) — match accordingly.
124
125
  const cells0 = table.getCells(items[0])
125
126
  const cells1 = table.getCells(items[1])
126
127
  expect(cells0.length).toBe(table.visibleColumns.length)
@@ -615,7 +616,7 @@ export class TosiTable extends WebComponent {
615
616
  zIndex: '3',
616
617
  background: varDefault.tosiTableHeaderBg(varDefault.tosiTableBg('var(--tosi-bg, #fff)')),
617
618
  },
618
- ':host .tr[aria-selected="true"] .td': {
619
+ ':host .tr[aria-selected] .td': {
619
620
  background: varDefault.tosiTableSelectedBg('var(--tosi-accent, #007AFF22)'),
620
621
  },
621
622
  ':host .td:focus, :host .th:focus': {
@@ -1090,8 +1091,13 @@ export class TosiTable extends WebComponent {
1090
1091
  // its own non-virtualised listBinding so each pinned row goes through the
1091
1092
  // same dataCell / rowRendered / `^.prop` pipeline as the virtual rows. The
1092
1093
  // 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) {
1094
+ // .scroll-area and share its single sticky context. Returns null when the
1095
+ // region is empty so render() can drop it from the DOM.
1096
+ buildPinnedBody(rowsProxy, cols, stickyInfo, region) {
1097
+ const data = tosiValue(rowsProxy);
1098
+ if (!data || data.length === 0)
1099
+ return null;
1100
+ const part = region === 'pinned-top' ? 'pinnedTopRows' : 'pinnedBottomRows';
1095
1101
  const rowClass = this.rowClasses(region);
1096
1102
  const binding = rowsProxy.listBinding((_elements, item) => this.buildRow(item, cols, stickyInfo, rowClass), {});
1097
1103
  return div({
@@ -1641,25 +1647,18 @@ export class TosiTable extends WebComponent {
1641
1647
  // so their stamped rows participate in .scroll-area's layout directly,
1642
1648
  // sharing one sticky context with the visible rows and the header.
1643
1649
  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;
1650
+ this._tbodyTop = this.buildPinnedBody(this.rowData.pinnedTopData, cols, stickyInfo, 'pinned-top');
1651
+ this._tbodyBottom = this.buildPinnedBody(this.rowData.pinnedBottomData, cols, stickyInfo, 'pinned-bottom');
1652
1652
  // The visible-rows listBinding is bound directly to .scroll-area so
1653
1653
  // virtualisation observes the same scroll container that sticky cells
1654
1654
  // stick against.
1655
1655
  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);
1656
+ this._scrollArea = div({ class: 'scroll-area', part: 'visibleRows' }, ...[
1657
+ this._head,
1658
+ this._tbodyTop,
1659
+ ...visibleBinding,
1660
+ this._tbodyBottom,
1661
+ ].filter(Boolean));
1663
1662
  this._scrollArea.addEventListener('scrollend', this.onScrollEnd);
1664
1663
  this.append(this._scrollArea);
1665
1664
  this.observePinnedRowMutations();