@ni/nimble-components 18.6.3 → 18.7.0

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.
Files changed (44) hide show
  1. package/dist/all-components-bundle.js +250 -141
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +989 -985
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/banner/template.js +11 -12
  6. package/dist/esm/banner/template.js.map +1 -1
  7. package/dist/esm/combobox/index.js +9 -9
  8. package/dist/esm/combobox/index.js.map +1 -1
  9. package/dist/esm/menu-button/template.js +6 -7
  10. package/dist/esm/menu-button/template.js.map +1 -1
  11. package/dist/esm/number-field/index.js +14 -14
  12. package/dist/esm/number-field/index.js.map +1 -1
  13. package/dist/esm/select/index.js +3 -3
  14. package/dist/esm/select/index.js.map +1 -1
  15. package/dist/esm/table/components/cell/index.d.ts +1 -0
  16. package/dist/esm/table/components/cell/index.js +1 -0
  17. package/dist/esm/table/components/cell/index.js.map +1 -1
  18. package/dist/esm/table/components/cell/template.js +5 -6
  19. package/dist/esm/table/components/cell/template.js.map +1 -1
  20. package/dist/esm/table/components/header/index.d.ts +1 -0
  21. package/dist/esm/table/components/header/index.js +1 -0
  22. package/dist/esm/table/components/header/index.js.map +1 -1
  23. package/dist/esm/table/components/header/template.js +4 -5
  24. package/dist/esm/table/components/header/template.js.map +1 -1
  25. package/dist/esm/table/components/row/index.d.ts +1 -0
  26. package/dist/esm/table/components/row/index.js +1 -0
  27. package/dist/esm/table/components/row/index.js.map +1 -1
  28. package/dist/esm/table/components/row/template.js +3 -4
  29. package/dist/esm/table/components/row/template.js.map +1 -1
  30. package/dist/esm/table/index.d.ts +15 -7
  31. package/dist/esm/table/index.js +82 -74
  32. package/dist/esm/table/index.js.map +1 -1
  33. package/dist/esm/table/models/update-tracker.d.ts +26 -0
  34. package/dist/esm/table/models/update-tracker.js +106 -0
  35. package/dist/esm/table/models/update-tracker.js.map +1 -0
  36. package/dist/esm/table/template.js +6 -7
  37. package/dist/esm/table/template.js.map +1 -1
  38. package/dist/esm/text-field/index.js +3 -3
  39. package/dist/esm/text-field/index.js.map +1 -1
  40. package/dist/esm/tooltip/template.js +9 -10
  41. package/dist/esm/tooltip/template.js.map +1 -1
  42. package/dist/esm/tree-item/styles.js +0 -6
  43. package/dist/esm/tree-item/styles.js.map +1 -1
  44. package/package.json +1 -1
@@ -18088,7 +18088,7 @@
18088
18088
  DesignSystem.getOrCreate()
18089
18089
  .withPrefix('nimble')
18090
18090
  .register(nimbleAnchoredRegion());
18091
- DesignSystem.tagFor(AnchoredRegion);
18091
+ const anchoredRegionTag = DesignSystem.tagFor(AnchoredRegion);
18092
18092
 
18093
18093
  /**
18094
18094
  * Subscription for {@link ThemeStyleSheetBehavior}
@@ -18374,7 +18374,7 @@
18374
18374
  }
18375
18375
  });
18376
18376
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleButton());
18377
- DesignSystem.tagFor(Button);
18377
+ const buttonTag = DesignSystem.tagFor(Button);
18378
18378
 
18379
18379
  /* 🤖 this file was generated by svg-to-ts */
18380
18380
  const add16X16 = {
@@ -19066,7 +19066,7 @@
19066
19066
  }
19067
19067
  }
19068
19068
  registerIcon('icon-exclamation-mark', IconExclamationMark);
19069
- DesignSystem.tagFor(IconExclamationMark);
19069
+ const iconExclamationMarkTag = DesignSystem.tagFor(IconExclamationMark);
19070
19070
 
19071
19071
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
19072
19072
  /**
@@ -19078,7 +19078,7 @@
19078
19078
  }
19079
19079
  }
19080
19080
  registerIcon('icon-info', IconInfo);
19081
- DesignSystem.tagFor(IconInfo);
19081
+ const iconInfoTag = DesignSystem.tagFor(IconInfo);
19082
19082
 
19083
19083
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
19084
19084
  /**
@@ -19090,7 +19090,7 @@
19090
19090
  }
19091
19091
  }
19092
19092
  registerIcon('icon-triangle-filled', IconTriangleFilled);
19093
- DesignSystem.tagFor(IconTriangleFilled);
19093
+ const iconTriangleFilledTag = DesignSystem.tagFor(IconTriangleFilled);
19094
19094
 
19095
19095
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
19096
19096
  /**
@@ -19102,7 +19102,7 @@
19102
19102
  }
19103
19103
  }
19104
19104
  registerIcon('icon-xmark', IconXmark);
19105
- DesignSystem.tagFor(IconXmark);
19105
+ const iconXmarkTag = DesignSystem.tagFor(IconXmark);
19106
19106
 
19107
19107
  /**
19108
19108
  * Severities of banners.
@@ -19142,13 +19142,13 @@
19142
19142
  >
19143
19143
  <div class="icon">
19144
19144
  ${when(x => x.severity === BannerSeverity.error, html `
19145
- <${DesignSystem.tagFor(IconExclamationMark)}></${DesignSystem.tagFor(IconExclamationMark)}>
19145
+ <${iconExclamationMarkTag}></${iconExclamationMarkTag}>
19146
19146
  `)}
19147
19147
  ${when(x => x.severity === BannerSeverity.warning, html `
19148
- <${DesignSystem.tagFor(IconTriangleFilled)}></${DesignSystem.tagFor(IconTriangleFilled)}>
19148
+ <${iconTriangleFilledTag}></${iconTriangleFilledTag}>
19149
19149
  `)}
19150
19150
  ${when(x => x.severity === BannerSeverity.information, html `
19151
- <${DesignSystem.tagFor(IconInfo)}></${DesignSystem.tagFor(IconInfo)}>
19151
+ <${iconInfoTag}></${iconInfoTag}>
19152
19152
  `)}
19153
19153
  </div>
19154
19154
  <div class="text">
@@ -19159,10 +19159,10 @@
19159
19159
  <slot name="action"></slot>
19160
19160
  <div class="dismiss">
19161
19161
  ${when(x => !x.preventDismiss, html `
19162
- <${DesignSystem.tagFor(Button)} appearance="ghost" content-hidden @click="${x => x.dismissBanner()}">
19163
- <${DesignSystem.tagFor(IconXmark)} slot="start"></${DesignSystem.tagFor(IconXmark)}>
19162
+ <${buttonTag} appearance="ghost" content-hidden @click="${x => x.dismissBanner()}">
19163
+ <${iconXmarkTag} slot="start"></${iconXmarkTag}>
19164
19164
  ${x => x.dismissButtonLabel ?? 'Close'}
19165
- </${DesignSystem.tagFor(Button)}>
19165
+ </${buttonTag}>
19166
19166
  `)}
19167
19167
  </div>
19168
19168
  </div>
@@ -19772,7 +19772,7 @@
19772
19772
  }
19773
19773
  });
19774
19774
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleToggleButton());
19775
- DesignSystem.tagFor(ToggleButton);
19775
+ const toggleButtonTag = DesignSystem.tagFor(ToggleButton);
19776
19776
 
19777
19777
  const errorTextTemplate = html `
19778
19778
  <div class="error-text" title="${x => x.errorText}" aria-live="polite">
@@ -19790,7 +19790,7 @@
19790
19790
  }
19791
19791
  }
19792
19792
  registerIcon('icon-arrow-expander-down', IconArrowExpanderDown);
19793
- DesignSystem.tagFor(IconArrowExpanderDown);
19793
+ const iconArrowExpanderDownTag = DesignSystem.tagFor(IconArrowExpanderDown);
19794
19794
 
19795
19795
  const DropdownAppearance = {
19796
19796
  underline: 'underline',
@@ -20316,12 +20316,12 @@
20316
20316
  },
20317
20317
  end: html `
20318
20318
  <div class="end-slot-container">
20319
- <${DesignSystem.tagFor(IconExclamationMark)}
20319
+ <${iconExclamationMarkTag}
20320
20320
  severity="error"
20321
20321
  class="error-icon"
20322
- ></${DesignSystem.tagFor(IconExclamationMark)}>
20322
+ ></${iconExclamationMarkTag}>
20323
20323
  <div class="separator"></div>
20324
- <${DesignSystem.tagFor(ToggleButton)}
20324
+ <${toggleButtonTag}
20325
20325
  ${ref('dropdownButton')}
20326
20326
  appearance="ghost"
20327
20327
  ?checked="${x => x.open}"
@@ -20336,12 +20336,12 @@
20336
20336
  aria-expanded="${x => x.open}"
20337
20337
  tabindex="-1"
20338
20338
  >
20339
- <${DesignSystem.tagFor(IconArrowExpanderDown)}
20339
+ <${iconArrowExpanderDownTag}
20340
20340
  slot="start"
20341
20341
  class="dropdown-icon"
20342
20342
  >
20343
- </${DesignSystem.tagFor(IconArrowExpanderDown)}>
20344
- </${DesignSystem.tagFor(ToggleButton)}>
20343
+ </${iconArrowExpanderDownTag}>
20344
+ </${toggleButtonTag}>
20345
20345
  </div>
20346
20346
  ${errorTextTemplate}
20347
20347
  `
@@ -20887,7 +20887,7 @@
20887
20887
  }
20888
20888
  }
20889
20889
  registerIcon('icon-add', IconAdd);
20890
- DesignSystem.tagFor(IconAdd);
20890
+ const iconAddTag = DesignSystem.tagFor(IconAdd);
20891
20891
 
20892
20892
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
20893
20893
  /**
@@ -20899,7 +20899,7 @@
20899
20899
  }
20900
20900
  }
20901
20901
  registerIcon('icon-arrow-down', IconArrowDown);
20902
- DesignSystem.tagFor(IconArrowDown);
20902
+ const iconArrowDownTag = DesignSystem.tagFor(IconArrowDown);
20903
20903
 
20904
20904
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
20905
20905
  /**
@@ -21019,7 +21019,7 @@
21019
21019
  }
21020
21020
  }
21021
21021
  registerIcon('icon-arrow-up', IconArrowUp);
21022
- DesignSystem.tagFor(IconArrowUp);
21022
+ const iconArrowUpTag = DesignSystem.tagFor(IconArrowUp);
21023
21023
 
21024
21024
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
21025
21025
  /**
@@ -22123,7 +22123,7 @@
22123
22123
  }
22124
22124
  }
22125
22125
  registerIcon('icon-minus-wide', IconMinusWide);
22126
- DesignSystem.tagFor(IconMinusWide);
22126
+ const iconMinusWideTag = DesignSystem.tagFor(IconMinusWide);
22127
22127
 
22128
22128
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22129
22129
  /**
@@ -22423,7 +22423,7 @@
22423
22423
  }
22424
22424
  }
22425
22425
  registerIcon('icon-three-dots-line', IconThreeDotsLine);
22426
- DesignSystem.tagFor(IconThreeDotsLine);
22426
+ const iconThreeDotsLineTag = DesignSystem.tagFor(IconThreeDotsLine);
22427
22427
 
22428
22428
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22429
22429
  /**
@@ -22834,7 +22834,7 @@
22834
22834
  ?open="${x => x.open}"
22835
22835
  @focusout="${(x, c) => x.focusoutHandler(c.event)}"
22836
22836
  >
22837
- <${DesignSystem.tagFor(ToggleButton)}
22837
+ <${toggleButtonTag}
22838
22838
  part="button"
22839
22839
  appearance="${x => x.appearance}"
22840
22840
  ?content-hidden="${x => x.contentHidden}"
@@ -22851,9 +22851,9 @@
22851
22851
  <slot slot="start" name="start"></slot>
22852
22852
  <slot></slot>
22853
22853
  <slot slot="end" name="end"></slot>
22854
- </${DesignSystem.tagFor(ToggleButton)}>
22854
+ </${toggleButtonTag}>
22855
22855
  ${when(x => x.open, html `
22856
- <${DesignSystem.tagFor(AnchoredRegion)}
22856
+ <${anchoredRegionTag}
22857
22857
  fixed-placement="true"
22858
22858
  auto-update-mode="auto"
22859
22859
  horizontal-inset="true"
@@ -22867,7 +22867,7 @@
22867
22867
  <span part="menu">
22868
22868
  <slot name="menu" ${slotted({ property: 'slottedMenus' })}></slot>
22869
22869
  </span>
22870
- </${DesignSystem.tagFor(AnchoredRegion)}>
22870
+ </${anchoredRegionTag}>
22871
22871
  `)}
22872
22872
  </template>
22873
22873
  `;
@@ -23091,7 +23091,7 @@
23091
23091
  }
23092
23092
  });
23093
23093
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleMenuButton());
23094
- DesignSystem.tagFor(MenuButton);
23094
+ const menuButtonTag = DesignSystem.tagFor(MenuButton);
23095
23095
 
23096
23096
  const styles$l = css `
23097
23097
  ${display('grid')}
@@ -23427,37 +23427,37 @@
23427
23427
  delegatesFocus: true
23428
23428
  },
23429
23429
  stepDownGlyph: html `
23430
- <${DesignSystem.tagFor(Button)}
23430
+ <${buttonTag}
23431
23431
  class="step-up-down-button"
23432
23432
  appearance="ghost"
23433
23433
  content-hidden
23434
23434
  tabindex="-1"
23435
23435
  >
23436
23436
  "Decrement"
23437
- <${DesignSystem.tagFor(IconMinusWide)}
23437
+ <${iconMinusWideTag}
23438
23438
  slot="start"
23439
23439
  >
23440
- </${DesignSystem.tagFor(IconMinusWide)}>
23441
- </${DesignSystem.tagFor(Button)}>
23440
+ </${iconMinusWideTag}>
23441
+ </${buttonTag}>
23442
23442
  `,
23443
23443
  stepUpGlyph: html `
23444
- <${DesignSystem.tagFor(Button)}
23444
+ <${buttonTag}
23445
23445
  class="step-up-down-button"
23446
23446
  appearance="ghost"
23447
23447
  content-hidden
23448
23448
  tabindex="-1"
23449
23449
  >
23450
23450
  "Increment"
23451
- <${DesignSystem.tagFor(IconAdd)}
23451
+ <${iconAddTag}
23452
23452
  slot="start">
23453
- </${DesignSystem.tagFor(IconAdd)}>
23454
- </${DesignSystem.tagFor(Button)}>
23453
+ </${iconAddTag}>
23454
+ </${buttonTag}>
23455
23455
  `,
23456
23456
  end: html `
23457
- <${DesignSystem.tagFor(IconExclamationMark)}
23457
+ <${iconExclamationMarkTag}
23458
23458
  severity="error"
23459
23459
  class="error-icon"
23460
- ></${DesignSystem.tagFor(IconExclamationMark)}>
23460
+ ></${iconExclamationMarkTag}>
23461
23461
  ${errorTextTemplate}
23462
23462
  `
23463
23463
  });
@@ -23694,10 +23694,10 @@
23694
23694
  styles: styles$h,
23695
23695
  indicator: arrowExpanderDown16X16.data,
23696
23696
  end: html `
23697
- <${DesignSystem.tagFor(IconExclamationMark)}
23697
+ <${iconExclamationMarkTag}
23698
23698
  severity="error"
23699
23699
  class="error-icon"
23700
- ></${DesignSystem.tagFor(IconExclamationMark)}>
23700
+ ></${iconExclamationMarkTag}>
23701
23701
  ${errorTextTemplate}
23702
23702
  `
23703
23703
  });
@@ -27487,10 +27487,10 @@
27487
27487
 
27488
27488
  <span class="sort-indicator" aria-hidden="true">
27489
27489
  ${when(x => x.sortDirection === TableColumnSortDirection.ascending, html `
27490
- <${DesignSystem.tagFor(IconArrowUp)}></${DesignSystem.tagFor(IconArrowUp)}>
27490
+ <${iconArrowUpTag}></${iconArrowUpTag}>
27491
27491
  `)}
27492
27492
  ${when(x => x.sortDirection === TableColumnSortDirection.descending, html `
27493
- <${DesignSystem.tagFor(IconArrowDown)}></${DesignSystem.tagFor(IconArrowDown)}>
27493
+ <${iconArrowDownTag}></${iconArrowDownTag}>
27494
27494
  `)}
27495
27495
  </span>
27496
27496
  </template>
@@ -27537,6 +27537,7 @@
27537
27537
  styles: styles$c
27538
27538
  });
27539
27539
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableHeader());
27540
+ const tableHeaderTag = DesignSystem.tagFor(TableHeader);
27540
27541
 
27541
27542
  const styles$b = css `
27542
27543
  ${display('grid')}
@@ -27593,17 +27594,17 @@
27593
27594
  <div ${ref('cellContentContainer')} class="cell-content-container"></div>
27594
27595
 
27595
27596
  ${when(x => x.hasActionMenu, html `
27596
- <${DesignSystem.tagFor(MenuButton)}
27597
+ <${menuButtonTag}
27597
27598
  content-hidden
27598
27599
  appearance="${ButtonAppearance.ghost}"
27599
27600
  @beforetoggle="${(x, c) => x.onActionMenuBeforeToggle(c.event)}"
27600
27601
  @toggle="${(x, c) => x.onActionMenuToggle(c.event)}"
27601
27602
  class="action-menu"
27602
27603
  >
27603
- <${DesignSystem.tagFor(IconThreeDotsLine)} slot="start"></${DesignSystem.tagFor(IconThreeDotsLine)}>
27604
+ <${iconThreeDotsLineTag} slot="start"></${iconThreeDotsLineTag}>
27604
27605
  ${x => x.actionMenuLabel}
27605
27606
  <slot name="cellActionMenu" slot="menu"></slot>
27606
- </${DesignSystem.tagFor(MenuButton)}>
27607
+ </${menuButtonTag}>
27607
27608
  `)}
27608
27609
  </template>
27609
27610
  `;
@@ -27678,13 +27679,14 @@
27678
27679
  styles: styles$a
27679
27680
  });
27680
27681
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableCell());
27682
+ const tableCellTag = DesignSystem.tagFor(TableCell);
27681
27683
 
27682
27684
  // prettier-ignore
27683
27685
  const template$5 = html `
27684
27686
  <template role="row">
27685
27687
  ${repeat(x => x.columnStates, html `
27686
27688
  ${when(x => !x.column.columnHidden, html `
27687
- <${DesignSystem.tagFor(TableCell)}
27689
+ <${tableCellTag}
27688
27690
  class="cell"
27689
27691
  :cellTemplate="${x => x.column.cellTemplate}"
27690
27692
  :cellStyles="${x => x.column.cellStyles}"
@@ -27701,7 +27703,7 @@
27701
27703
  slot="cellActionMenu"
27702
27704
  ></slot>
27703
27705
  `)}
27704
- </${DesignSystem.tagFor(TableCell)}>
27706
+ </${tableCellTag}>
27705
27707
  `)}
27706
27708
  `)}
27707
27709
  </template>
@@ -27784,6 +27786,7 @@
27784
27786
  styles: styles$b
27785
27787
  });
27786
27788
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableRow());
27789
+ const tableRowTag = DesignSystem.tagFor(TableRow);
27787
27790
 
27788
27791
  // prettier-ignore
27789
27792
  const template$4 = html `
@@ -27799,13 +27802,13 @@
27799
27802
  <div class="header-row" role="row">
27800
27803
  ${repeat(x => x.columns, html `
27801
27804
  ${when(x => !x.columnHidden, html `
27802
- <${DesignSystem.tagFor(TableHeader)}
27805
+ <${tableHeaderTag}
27803
27806
  class="header"
27804
27807
  sort-direction="${x => (typeof x.sortIndex === 'number' ? x.sortDirection : TableColumnSortDirection.none)}"
27805
27808
  ?first-sorted-column="${(x, c) => x === c.parent.firstSortedColumn}"
27806
27809
  >
27807
27810
  <slot name="${x => x.slot}"></slot>
27808
- </${DesignSystem.tagFor(TableHeader)}>
27811
+ </${tableHeaderTag}>
27809
27812
  `)}
27810
27813
  `)}
27811
27814
  <div class="header-scrollbar-spacer"></div>
@@ -27817,7 +27820,7 @@
27817
27820
  role="rowgroup">
27818
27821
  ${when(x => x.columns.length > 0 && x.canRenderRows, html `
27819
27822
  ${repeat(x => x.virtualizer.visibleItems, html `
27820
- <${DesignSystem.tagFor(TableRow)}
27823
+ <${tableRowTag}
27821
27824
  class="row"
27822
27825
  record-id="${(x, c) => c.parent.tableData[x.index]?.id}"
27823
27826
  :dataRecord="${(x, c) => c.parent.tableData[x.index]?.record}"
@@ -27833,7 +27836,7 @@
27833
27836
  </slot>
27834
27837
  `)}
27835
27838
  `)}
27836
- </${DesignSystem.tagFor(TableRow)}>
27839
+ </${tableRowTag}>
27837
27840
  `)}
27838
27841
  `)}
27839
27842
  </div>
@@ -28593,6 +28596,111 @@
28593
28596
  return 1;
28594
28597
  }
28595
28598
 
28599
+ const isColumnProperty = (changedProperty, ...args) => {
28600
+ for (const arg of args) {
28601
+ if (changedProperty === arg) {
28602
+ return true;
28603
+ }
28604
+ }
28605
+ return false;
28606
+ };
28607
+ /**
28608
+ * Helper class to track what updates are needed to the table based on configuration
28609
+ * changes.
28610
+ */
28611
+ class UpdateTracker {
28612
+ constructor(table) {
28613
+ this.requiredUpdates = {
28614
+ rowIds: false,
28615
+ columnIds: false,
28616
+ columnSort: false,
28617
+ columnWidths: false,
28618
+ columnDefinition: false,
28619
+ actionMenuSlots: false
28620
+ };
28621
+ this.updateQueued = false;
28622
+ this.table = table;
28623
+ }
28624
+ get updateRowIds() {
28625
+ return this.requiredUpdates.rowIds;
28626
+ }
28627
+ get updateColumnIds() {
28628
+ return this.requiredUpdates.columnIds;
28629
+ }
28630
+ get updateColumnSort() {
28631
+ return this.requiredUpdates.columnSort;
28632
+ }
28633
+ get updateColumnWidths() {
28634
+ return this.requiredUpdates.columnWidths;
28635
+ }
28636
+ get updateColumnDefinition() {
28637
+ return this.requiredUpdates.columnDefinition;
28638
+ }
28639
+ get updateActionMenuSlots() {
28640
+ return this.requiredUpdates.actionMenuSlots;
28641
+ }
28642
+ get requiresTanStackUpdate() {
28643
+ return (this.requiredUpdates.rowIds
28644
+ || this.requiredUpdates.columnSort
28645
+ || this.requiredUpdates.columnDefinition);
28646
+ }
28647
+ get requiresTanStackDataReset() {
28648
+ return (this.requiredUpdates.rowIds || this.requiredUpdates.columnDefinition);
28649
+ }
28650
+ trackAllStateChanged() {
28651
+ this.setAllKeys(true);
28652
+ this.queueUpdate();
28653
+ }
28654
+ trackColumnPropertyChanged(changedColumnProperty) {
28655
+ if (isColumnProperty(changedColumnProperty, 'columnId')) {
28656
+ this.requiredUpdates.columnIds = true;
28657
+ }
28658
+ else if (isColumnProperty(changedColumnProperty, 'operandDataRecordFieldName', 'sortOperation')) {
28659
+ this.requiredUpdates.columnDefinition = true;
28660
+ }
28661
+ else if (isColumnProperty(changedColumnProperty, 'sortIndex', 'sortDirection')) {
28662
+ this.requiredUpdates.columnSort = true;
28663
+ }
28664
+ else if (isColumnProperty(changedColumnProperty, 'currentFractionalWidth', 'currentPixelWidth', 'internalMinPixelWidth', 'columnHidden')) {
28665
+ this.requiredUpdates.columnWidths = true;
28666
+ }
28667
+ else if (isColumnProperty(changedColumnProperty, 'actionMenuSlot')) {
28668
+ this.requiredUpdates.actionMenuSlots = true;
28669
+ }
28670
+ this.queueUpdate();
28671
+ }
28672
+ trackColumnInstancesChanged() {
28673
+ this.requiredUpdates.columnIds = true;
28674
+ this.requiredUpdates.columnDefinition = true;
28675
+ this.requiredUpdates.columnSort = true;
28676
+ this.requiredUpdates.columnWidths = true;
28677
+ this.requiredUpdates.actionMenuSlots = true;
28678
+ this.queueUpdate();
28679
+ }
28680
+ trackIdFieldNameChanged() {
28681
+ this.requiredUpdates.rowIds = true;
28682
+ this.queueUpdate();
28683
+ }
28684
+ setAllKeys(value) {
28685
+ Object.keys(this.requiredUpdates).forEach(key => {
28686
+ this.requiredUpdates[key] = value;
28687
+ });
28688
+ }
28689
+ queueUpdate() {
28690
+ if (!this.table.$fastController.isConnected) {
28691
+ return;
28692
+ }
28693
+ if (!this.updateQueued) {
28694
+ this.updateQueued = true;
28695
+ DOM.queueUpdate(() => {
28696
+ this.table.update();
28697
+ this.setAllKeys(false);
28698
+ this.updateQueued = false;
28699
+ });
28700
+ }
28701
+ }
28702
+ }
28703
+
28596
28704
  /**
28597
28705
  * This class provides helper methods for managing the layout of cells within
28598
28706
  * a Table.
@@ -28648,6 +28756,7 @@
28648
28756
  */
28649
28757
  this.scrollX = 0;
28650
28758
  this.tableValidator = new TableValidator();
28759
+ this.updateTracker = new UpdateTracker(this);
28651
28760
  this.columnNotifiers = [];
28652
28761
  this.onViewPortScroll = (event) => {
28653
28762
  this.scrollX = event.target.scrollLeft;
@@ -28675,7 +28784,8 @@
28675
28784
  connectedCallback() {
28676
28785
  super.connectedCallback();
28677
28786
  this.virtualizer.connectedCallback();
28678
- this.validateAndObserveColumns();
28787
+ this.updateTracker.trackAllStateChanged();
28788
+ this.observeColumns();
28679
28789
  this.viewport.addEventListener('scroll', this.onViewPortScroll, {
28680
28790
  passive: true
28681
28791
  });
@@ -28697,24 +28807,8 @@
28697
28807
  * is the string name of the property that changed on that column.
28698
28808
  */
28699
28809
  handleChange(source, args) {
28700
- if (source instanceof TableColumn) {
28701
- if (args === 'columnId') {
28702
- this.validateColumnIds();
28703
- }
28704
- else if (args === 'operandDataRecordFieldName'
28705
- || args === 'sortOperation') {
28706
- this.generateTanStackColumns();
28707
- }
28708
- else if (args === 'sortIndex' || args === 'sortDirection') {
28709
- this.validateColumnSortIndices();
28710
- this.setSortState();
28711
- }
28712
- else if (args === 'currentFractionalWidth'
28713
- || args === 'currentPixelWidth'
28714
- || args === 'internalMinPixelWidth'
28715
- || args === 'columnHidden') {
28716
- this.updateRowGridColumns();
28717
- }
28810
+ if (source instanceof TableColumn && typeof args === 'string') {
28811
+ this.updateTracker.trackColumnPropertyChanged(args);
28718
28812
  }
28719
28813
  }
28720
28814
  onRowActionMenuBeforeToggle(event) {
@@ -28724,29 +28818,33 @@
28724
28818
  onRowActionMenuToggle(event) {
28725
28819
  this.$emit('action-menu-toggle', event.detail);
28726
28820
  }
28727
- childItemsChanged() {
28728
- void this.updateColumnsFromChildItems();
28821
+ /**
28822
+ * @internal
28823
+ */
28824
+ update() {
28825
+ this.validate();
28826
+ if (this.updateTracker.requiresTanStackUpdate) {
28827
+ this.updateTanStack();
28828
+ }
28829
+ if (this.updateTracker.updateActionMenuSlots) {
28830
+ this.updateActionMenuSlots();
28831
+ }
28832
+ if (this.updateTracker.updateColumnWidths) {
28833
+ this.updateRowGridColumns();
28834
+ }
28729
28835
  }
28730
28836
  idFieldNameChanged(_prev, _next) {
28731
- // Force TanStack to detect a data update because a row's ID is only
28732
- // generated when creating a new row model.
28733
- this.setTableData(this.table.options.data);
28837
+ if (!this.$fastController.isConnected) {
28838
+ return;
28839
+ }
28840
+ this.updateTracker.trackIdFieldNameChanged();
28734
28841
  }
28735
28842
  columnsChanged(_prev, _next) {
28736
28843
  if (!this.$fastController.isConnected) {
28737
28844
  return;
28738
28845
  }
28739
- this.validateAndObserveColumns();
28740
- this.generateTanStackColumns();
28741
- this.setSortState();
28742
- const slots = new Set();
28743
- for (const column of this.columns) {
28744
- if (column.actionMenuSlot) {
28745
- slots.add(column.actionMenuSlot);
28746
- }
28747
- }
28748
- this.actionMenuSlots = Array.from(slots);
28749
- this.updateRowGridColumns();
28846
+ this.observeColumns();
28847
+ this.updateTracker.trackColumnInstancesChanged();
28750
28848
  }
28751
28849
  removeColumnObservers() {
28752
28850
  this.columnNotifiers.forEach(notifier => {
@@ -28754,30 +28852,20 @@
28754
28852
  });
28755
28853
  this.columnNotifiers = [];
28756
28854
  }
28757
- validateAndObserveColumns() {
28855
+ observeColumns() {
28758
28856
  this.removeColumnObservers();
28759
28857
  for (const column of this.columns) {
28760
28858
  const notifier = Observable.getNotifier(column);
28761
28859
  notifier.subscribe(this);
28762
28860
  this.columnNotifiers.push(notifier);
28763
28861
  }
28764
- this.validateColumnIds();
28765
- this.validateColumnSortIndices();
28766
- }
28767
- validateColumnIds() {
28768
- this.tableValidator.validateColumnIds(this.columns.map(x => x.columnId));
28769
- this.canRenderRows = this.checkValidity();
28770
- }
28771
- validateColumnSortIndices() {
28772
- this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.sortIndex));
28773
- this.canRenderRows = this.checkValidity();
28774
28862
  }
28775
28863
  getColumnsParticipatingInSorting() {
28776
28864
  return this.columns.filter(x => x.sortDirection !== TableColumnSortDirection.none
28777
28865
  && typeof x.sortIndex === 'number');
28778
28866
  }
28779
- updateRowGridColumns() {
28780
- this.rowGridColumns = TableLayoutHelper.getGridTemplateColumns(this.columns);
28867
+ childItemsChanged() {
28868
+ void this.updateColumnsFromChildItems();
28781
28869
  }
28782
28870
  async updateColumnsFromChildItems() {
28783
28871
  const definedElements = this.childItems.map(async (item) => (item.matches(':not(:defined)')
@@ -28786,18 +28874,53 @@
28786
28874
  await Promise.all(definedElements);
28787
28875
  this.columns = this.childItems.filter((x) => x instanceof TableColumn);
28788
28876
  }
28877
+ updateTanStack() {
28878
+ const updatedOptions = {
28879
+ state: {}
28880
+ };
28881
+ if (this.updateTracker.updateColumnSort) {
28882
+ updatedOptions.state.sorting = this.calculateTanStackSortState();
28883
+ }
28884
+ if (this.updateTracker.updateColumnDefinition) {
28885
+ updatedOptions.columns = this.calculateTanStackColumns();
28886
+ }
28887
+ if (this.updateTracker.updateRowIds) {
28888
+ updatedOptions.getRowId = this.calculateTanStackRowIdFunction();
28889
+ }
28890
+ if (this.updateTracker.requiresTanStackDataReset) {
28891
+ // Perform a shallow copy of the data to trigger tanstack to regenerate the row models and columns.
28892
+ updatedOptions.data = [...this.table.options.data];
28893
+ }
28894
+ this.updateTableOptions(updatedOptions);
28895
+ }
28896
+ updateActionMenuSlots() {
28897
+ const slots = new Set();
28898
+ for (const column of this.columns) {
28899
+ if (column.actionMenuSlot) {
28900
+ slots.add(column.actionMenuSlot);
28901
+ }
28902
+ }
28903
+ this.actionMenuSlots = Array.from(slots);
28904
+ }
28905
+ updateRowGridColumns() {
28906
+ this.rowGridColumns = TableLayoutHelper.getGridTemplateColumns(this.columns);
28907
+ }
28908
+ validate() {
28909
+ this.tableValidator.validateColumnIds(this.columns.map(x => x.columnId));
28910
+ this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.sortIndex));
28911
+ this.validateWithData(this.table.options.data);
28912
+ }
28913
+ validateWithData(data) {
28914
+ this.tableValidator.validateRecordIds(data, this.idFieldName);
28915
+ this.canRenderRows = this.checkValidity();
28916
+ }
28789
28917
  setTableData(newData) {
28790
28918
  const data = newData.map(record => {
28791
28919
  return { ...record };
28792
28920
  });
28793
- this.tableValidator.validateRecordIds(data, this.idFieldName);
28794
- this.canRenderRows = this.checkValidity();
28795
- const getRowIdFunction = this.idFieldName === null || this.idFieldName === undefined
28796
- ? undefined
28797
- : (record) => record[this.idFieldName];
28921
+ this.validateWithData(data);
28798
28922
  this.updateTableOptions({
28799
- data,
28800
- getRowId: getRowIdFunction
28923
+ data
28801
28924
  });
28802
28925
  }
28803
28926
  refreshRows() {
@@ -28820,27 +28943,26 @@
28820
28943
  this.table.setOptions(this.options);
28821
28944
  this.refreshRows();
28822
28945
  }
28823
- setSortState() {
28946
+ calculateTanStackSortState() {
28824
28947
  const sortedColumns = this.getColumnsParticipatingInSorting().sort((x, y) => x.sortIndex - y.sortIndex);
28825
28948
  this.firstSortedColumn = sortedColumns.length
28826
28949
  ? sortedColumns[0]
28827
28950
  : undefined;
28828
- const tanStackSortingState = sortedColumns.map(column => {
28951
+ return sortedColumns.map(column => {
28829
28952
  return {
28830
28953
  id: column.internalUniqueId,
28831
- desc: column.sortDirection
28832
- === TableColumnSortDirection.descending
28954
+ desc: column.sortDirection === TableColumnSortDirection.descending
28833
28955
  };
28834
28956
  });
28835
- this.updateTableOptions({
28836
- state: {
28837
- sorting: tanStackSortingState
28838
- }
28839
- });
28840
28957
  }
28841
- generateTanStackColumns() {
28842
- const generatedColumns = this.columns.map(column => {
28843
- const columnDef = {
28958
+ calculateTanStackRowIdFunction() {
28959
+ return this.idFieldName === null || this.idFieldName === undefined
28960
+ ? undefined
28961
+ : (record) => record[this.idFieldName];
28962
+ }
28963
+ calculateTanStackColumns() {
28964
+ return this.columns.map(column => {
28965
+ return {
28844
28966
  id: column.internalUniqueId,
28845
28967
  accessorFn: (data) => {
28846
28968
  const fieldName = column.operandDataRecordFieldName;
@@ -28851,13 +28973,6 @@
28851
28973
  },
28852
28974
  sortingFn: getTanStackSortingFunction(column.sortOperation)
28853
28975
  };
28854
- return columnDef;
28855
- });
28856
- this.updateTableOptions({
28857
- // Force TanStack to detect a data update because a columns's accessor is
28858
- // referenced when creating a new row model.
28859
- data: [...this.table.options.data],
28860
- columns: generatedColumns
28861
28976
  });
28862
28977
  }
28863
28978
  }
@@ -29548,10 +29663,10 @@
29548
29663
  delegatesFocus: true
29549
29664
  },
29550
29665
  end: html `
29551
- <${DesignSystem.tagFor(IconExclamationMark)}
29666
+ <${iconExclamationMarkTag}
29552
29667
  severity="error"
29553
29668
  class="error-icon"
29554
- ></${DesignSystem.tagFor(IconExclamationMark)}>
29669
+ ></${iconExclamationMarkTag}>
29555
29670
  <span part="actions">
29556
29671
  <slot name="actions"></slot>
29557
29672
  </span>
@@ -29694,7 +29809,7 @@
29694
29809
  // prettier-ignore
29695
29810
  const template$1 = html `
29696
29811
  ${when(x => x.tooltipVisible, html `
29697
- <${DesignSystem.tagFor(AnchoredRegion)}
29812
+ <${anchoredRegionTag}
29698
29813
  class="anchored-region"
29699
29814
  fixed-placement="true"
29700
29815
  auto-update-mode="${x => x.autoUpdateMode}"
@@ -29712,17 +29827,17 @@
29712
29827
  ${ref('region')}
29713
29828
  >
29714
29829
  <div class="tooltip" part="tooltip" role="tooltip">
29715
- <${DesignSystem.tagFor(IconExclamationMark)}
29830
+ <${iconExclamationMarkTag}
29716
29831
  severity="error"
29717
29832
  class="status-icon"
29718
- ></${DesignSystem.tagFor(IconExclamationMark)}>
29719
- <${DesignSystem.tagFor(IconInfo)}
29833
+ ></${iconExclamationMarkTag}>
29834
+ <${iconInfoTag}
29720
29835
  severity="information"
29721
29836
  class="status-icon"
29722
- ></${DesignSystem.tagFor(IconInfo)}>
29837
+ ></${iconInfoTag}>
29723
29838
  <slot></slot>
29724
29839
  </div>
29725
- </${DesignSystem.tagFor(AnchoredRegion)}>
29840
+ </${anchoredRegionTag}>
29726
29841
  `)}
29727
29842
  `;
29728
29843
 
@@ -29960,12 +30075,6 @@
29960
30075
  height: ${iconSize};
29961
30076
  }
29962
30077
 
29963
- ${
29964
- /*
29965
- Cannot call DesignSystem.tagFor(TreeItem) as this string is evaluated
29966
- before the registration of the element itself; the style is self-referencing.
29967
- Instead styling against the role which is more general and likely a better approach.
29968
- */ ''}
29969
30078
  ::slotted([role='treeitem']) {
29970
30079
  --ni-private-tree-item-nested-width: 1em;
29971
30080
  --ni-private-expand-collapse-button-nested-width: calc(