@ni/nimble-components 18.3.2 → 18.3.4

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,27 +26903,15 @@
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
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
  `)}
26918
26917
  <div class="header-scrollbar-spacer" style="width: ${x => x.virtualizer.headerContainerMarginRight}px;"></div>
@@ -26936,7 +26935,6 @@
26936
26935
  </div>
26937
26936
  </div>
26938
26937
  </div>
26939
- <slot ${slotted({ property: 'columns', filter: isTableColumn() })}></slot>
26940
26938
  </template>
26941
26939
  `;
26942
26940
 
@@ -27669,7 +27667,14 @@
27669
27667
  * @internal
27670
27668
  */
27671
27669
  this.tableData = [];
27670
+ /**
27671
+ * @internal
27672
+ */
27672
27673
  this.columns = [];
27674
+ /**
27675
+ * @internal
27676
+ */
27677
+ this.childItems = [];
27673
27678
  /**
27674
27679
  * @internal
27675
27680
  */
@@ -27722,6 +27727,16 @@
27722
27727
  checkValidity() {
27723
27728
  return this.tableValidator.isValid();
27724
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
+ }
27725
27740
  setTableData(newData) {
27726
27741
  const data = newData.map(record => {
27727
27742
  return { ...record };
@@ -27780,6 +27795,9 @@
27780
27795
  __decorate$1([
27781
27796
  observable
27782
27797
  ], Table.prototype, "columns", void 0);
27798
+ __decorate$1([
27799
+ observable
27800
+ ], Table.prototype, "childItems", void 0);
27783
27801
  __decorate$1([
27784
27802
  observable
27785
27803
  ], Table.prototype, "canRenderRows", void 0);
@@ -27792,7 +27810,7 @@
27792
27810
 
27793
27811
  const styles$9 = css `
27794
27812
  :host {
27795
- display: none;
27813
+ display: contents;
27796
27814
  }
27797
27815
  `;
27798
27816