@ni/nimble-components 18.3.1 → 18.3.3

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.
@@ -26568,6 +26568,16 @@
26568
26568
  });
26569
26569
  }
26570
26570
 
26571
+ /**
26572
+ * The base class for table columns
26573
+ */
26574
+ class TableColumn extends FoundationElement {
26575
+ connectedCallback() {
26576
+ super.connectedCallback();
26577
+ this.setAttribute('slot', uniqueId('table-column-slot'));
26578
+ }
26579
+ }
26580
+
26571
26581
  /**
26572
26582
  * Helper class for the nimble-table to validate that the table's configuration
26573
26583
  * is valid and report which aspects of the configuration are valid or invalid.
@@ -26712,6 +26722,7 @@
26712
26722
  padding: 0px calc(${standardPadding} / 2);
26713
26723
  font: ${tableHeaderFont};
26714
26724
  color: ${tableHeaderFontColor};
26725
+ ${iconColor.cssCustomProperty}: ${tableHeaderFontColor};
26715
26726
  text-transform: uppercase;
26716
26727
  }
26717
26728
  `;
@@ -26892,29 +26903,18 @@
26892
26903
  });
26893
26904
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableRow());
26894
26905
 
26895
- /**
26896
- * The base class for table columns
26897
- */
26898
- class TableColumn extends FoundationElement {
26899
- }
26900
-
26901
- const isTableColumn = () => {
26902
- const filter = (value, _, __) => {
26903
- return value instanceof TableColumn;
26904
- };
26905
- return filter;
26906
- };
26907
26906
  // prettier-ignore
26908
26907
  const template$4 = html `
26909
- <template role="table">
26908
+ <template role="table" ${children$1({ property: 'childItems', filter: elements() })}>
26910
26909
  <div class="table-container">
26911
- <div role="rowgroup" class="header-container" style="margin-right: ${x => x.virtualizer.headerContainerMarginRight}px;">
26910
+ <div role="rowgroup" class="header-container">
26912
26911
  <div class="header-row" role="row">
26913
26912
  ${repeat(x => x.columns, html `
26914
26913
  <${DesignSystem.tagFor(TableHeader)} class="header">
26915
- ${x => x.textContent}
26914
+ <slot name="${x => x.slot}"></slot>
26916
26915
  </${DesignSystem.tagFor(TableHeader)}>
26917
26916
  `)}
26917
+ <div class="header-scrollbar-spacer" style="width: ${x => x.virtualizer.headerContainerMarginRight}px;"></div>
26918
26918
  </div>
26919
26919
  </div>
26920
26920
  <div class="table-viewport" ${ref('viewport')}>
@@ -26935,7 +26935,6 @@
26935
26935
  </div>
26936
26936
  </div>
26937
26937
  </div>
26938
- <slot ${slotted({ property: 'columns', filter: isTableColumn() })}></slot>
26939
26938
  </template>
26940
26939
  `;
26941
26940
 
@@ -27668,7 +27667,14 @@
27668
27667
  * @internal
27669
27668
  */
27670
27669
  this.tableData = [];
27670
+ /**
27671
+ * @internal
27672
+ */
27671
27673
  this.columns = [];
27674
+ /**
27675
+ * @internal
27676
+ */
27677
+ this.childItems = [];
27672
27678
  /**
27673
27679
  * @internal
27674
27680
  */
@@ -27721,6 +27727,16 @@
27721
27727
  checkValidity() {
27722
27728
  return this.tableValidator.isValid();
27723
27729
  }
27730
+ childItemsChanged() {
27731
+ void this.updateColumnsFromChildItems();
27732
+ }
27733
+ async updateColumnsFromChildItems() {
27734
+ const definedElements = this.childItems.map(async (item) => (item.matches(':not(:defined)')
27735
+ ? customElements.whenDefined(item.localName)
27736
+ : Promise.resolve()));
27737
+ await Promise.all(definedElements);
27738
+ this.columns = this.childItems.filter((x) => x instanceof TableColumn);
27739
+ }
27724
27740
  setTableData(newData) {
27725
27741
  const data = newData.map(record => {
27726
27742
  return { ...record };
@@ -27779,6 +27795,9 @@
27779
27795
  __decorate$1([
27780
27796
  observable
27781
27797
  ], Table.prototype, "columns", void 0);
27798
+ __decorate$1([
27799
+ observable
27800
+ ], Table.prototype, "childItems", void 0);
27782
27801
  __decorate$1([
27783
27802
  observable
27784
27803
  ], Table.prototype, "canRenderRows", void 0);
@@ -27791,7 +27810,7 @@
27791
27810
 
27792
27811
  const styles$9 = css `
27793
27812
  :host {
27794
- display: none;
27813
+ display: contents;
27795
27814
  }
27796
27815
  `;
27797
27816