@ni/nimble-components 18.11.0 → 18.11.1

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 (47) hide show
  1. package/dist/all-components-bundle.js +239 -226
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +959 -951
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/table/components/cell/template.d.ts +1 -3
  6. package/dist/esm/table/components/cell/template.js +0 -5
  7. package/dist/esm/table/components/cell/template.js.map +1 -1
  8. package/dist/esm/table/components/group-row/styles.js +1 -1
  9. package/dist/esm/table/components/group-row/template.js +1 -1
  10. package/dist/esm/table/components/group-row/template.js.map +1 -1
  11. package/dist/esm/table/components/row/index.js +3 -3
  12. package/dist/esm/table/components/row/index.js.map +1 -1
  13. package/dist/esm/table/components/row/template.js +1 -1
  14. package/dist/esm/table/components/row/template.js.map +1 -1
  15. package/dist/esm/table/index.js +17 -11
  16. package/dist/esm/table/index.js.map +1 -1
  17. package/dist/esm/table/models/table-layout-helper.js +9 -13
  18. package/dist/esm/table/models/table-layout-helper.js.map +1 -1
  19. package/dist/esm/table/models/update-tracker.js +12 -3
  20. package/dist/esm/table/models/update-tracker.js.map +1 -1
  21. package/dist/esm/table-column/base/cell-view/template.d.ts +3 -0
  22. package/dist/esm/table-column/base/cell-view/template.js +26 -0
  23. package/dist/esm/table-column/base/cell-view/template.js.map +1 -0
  24. package/dist/esm/table-column/base/group-header-view/template.js +20 -4
  25. package/dist/esm/table-column/base/group-header-view/template.js.map +1 -1
  26. package/dist/esm/table-column/base/index.d.ts +5 -106
  27. package/dist/esm/table-column/base/index.js +7 -110
  28. package/dist/esm/table-column/base/index.js.map +1 -1
  29. package/dist/esm/table-column/base/models/column-internals.d.ts +97 -0
  30. package/dist/esm/table-column/base/models/column-internals.js +88 -0
  31. package/dist/esm/table-column/base/models/column-internals.js.map +1 -0
  32. package/dist/esm/table-column/base/template.d.ts +2 -1
  33. package/dist/esm/table-column/base/template.js +1 -1
  34. package/dist/esm/table-column/base/template.js.map +1 -1
  35. package/dist/esm/table-column/mixins/fractional-width-column.d.ts +2 -3
  36. package/dist/esm/table-column/mixins/fractional-width-column.js +4 -9
  37. package/dist/esm/table-column/mixins/fractional-width-column.js.map +1 -1
  38. package/dist/esm/table-column/mixins/groupable-column.d.ts +2 -3
  39. package/dist/esm/table-column/mixins/groupable-column.js +3 -3
  40. package/dist/esm/table-column/mixins/groupable-column.js.map +1 -1
  41. package/dist/esm/table-column/text/group-header-view/index.d.ts +0 -1
  42. package/dist/esm/table-column/text/group-header-view/index.js +0 -3
  43. package/dist/esm/table-column/text/group-header-view/index.js.map +1 -1
  44. package/dist/esm/table-column/text/index.d.ts +15 -18
  45. package/dist/esm/table-column/text/index.js +15 -20
  46. package/dist/esm/table-column/text/index.js.map +1 -1
  47. package/package.json +1 -1
@@ -27795,40 +27795,6 @@
27795
27795
  };
27796
27796
  }
27797
27797
 
27798
- const createGroupHeaderViewTemplate = (groupHeaderViewTag) => html `
27799
- <${groupHeaderViewTag}
27800
- :groupHeaderValue="${x => x.groupRowValue}"
27801
- :columnConfig="${x => x.groupColumn?.columnConfig}"
27802
- class="group-header-value"
27803
- >
27804
- </${groupHeaderViewTag}>
27805
- `;
27806
-
27807
- // prettier-ignore
27808
- const template$b = html `
27809
- <template role="cell" style="--ni-private-table-cell-nesting-level: ${x => x.nestingLevel}">
27810
- ${x => x.cellViewTemplate}
27811
- ${when(x => x.hasActionMenu, html `
27812
- <${menuButtonTag} ${ref('actionMenuButton')}
27813
- content-hidden
27814
- appearance="${ButtonAppearance.ghost}"
27815
- @beforetoggle="${(x, c) => x.onActionMenuBeforeToggle(c.event)}"
27816
- @toggle="${(x, c) => x.onActionMenuToggle(c.event)}"
27817
- class="action-menu"
27818
- >
27819
- <${iconThreeDotsLineTag} slot="start"></${iconThreeDotsLineTag}>
27820
- ${x => x.actionMenuLabel}
27821
- <slot name="cellActionMenu" slot="menu"></slot>
27822
- </${menuButtonTag}>
27823
- `)}
27824
- </template>
27825
- `;
27826
- const createCellViewTemplate = (cellViewTag) => html `<${cellViewTag} class="cell-view"
27827
- :cellRecord="${y => y.cellState?.cellRecord}"
27828
- :columnConfig="${y => y.cellState?.columnConfig}"
27829
- >
27830
- </${cellViewTag}>`;
27831
-
27832
27798
  /**
27833
27799
  * The possible directions a table column can be sorted in.
27834
27800
  */
@@ -27872,137 +27838,200 @@
27872
27838
  const defaultFractionalWidth = 1;
27873
27839
 
27874
27840
  /**
27875
- * The base class for table columns
27841
+ * The base class for group header views, which are displayed in a TableGroupRow.
27842
+ * A TableColumn that uses the GroupableColumn mixin must provide a TableGroupHeaderView
27843
+ * type (linked via TableColumn.groupHeaderViewTag).
27876
27844
  */
27877
- class TableColumn extends FoundationElement {
27878
- constructor() {
27879
- super();
27880
- this.columnHidden = false;
27881
- this.sortDirection = TableColumnSortDirection.none;
27845
+ class TableGroupHeaderView extends FoundationElement {
27846
+ }
27847
+ __decorate$1([
27848
+ observable
27849
+ ], TableGroupHeaderView.prototype, "groupHeaderValue", void 0);
27850
+ __decorate$1([
27851
+ observable
27852
+ ], TableGroupHeaderView.prototype, "columnConfig", void 0);
27853
+
27854
+ const validateGroupHeaderViewTemplate = (groupHeaderViewTag) => {
27855
+ let instance;
27856
+ try {
27857
+ instance = document.createElement(groupHeaderViewTag);
27858
+ }
27859
+ catch (ex) {
27860
+ // Swallow construction error to report a better one
27861
+ }
27862
+ if (!(instance instanceof TableGroupHeaderView)) {
27863
+ throw new Error(`Group header view tag name (${groupHeaderViewTag}) must evaluate to an element extending TableGroupHeaderView`);
27864
+ }
27865
+ };
27866
+ const createGroupHeaderViewTemplate = (groupHeaderViewTag) => {
27867
+ validateGroupHeaderViewTemplate(groupHeaderViewTag);
27868
+ return html `
27869
+ <${groupHeaderViewTag}
27870
+ :groupHeaderValue="${x => x.groupRowValue}"
27871
+ :columnConfig="${x => x.groupColumn?.columnInternals.columnConfig}"
27872
+ class="group-header-view"
27873
+ >
27874
+ </${groupHeaderViewTag}>
27875
+ `;
27876
+ };
27877
+
27878
+ /**
27879
+ * Base class for table cell views, which are used within the nimble-table-cell.
27880
+ * Each TableColumn type has a corresponding TableCellView type (linked via TableColumn.cellViewTag).
27881
+ */
27882
+ class TableCellView extends FoundationElement {
27883
+ /**
27884
+ * Called if an element inside this cell view has focus, and this row/cell is being recycled.
27885
+ * Expected implementation is to commit changes as needed, and blur the focusable element (or close
27886
+ * the menu/popup/etc).
27887
+ */
27888
+ focusedRecycleCallback() { }
27889
+ }
27890
+ __decorate$1([
27891
+ observable
27892
+ ], TableCellView.prototype, "cellRecord", void 0);
27893
+ __decorate$1([
27894
+ observable
27895
+ ], TableCellView.prototype, "columnConfig", void 0);
27896
+
27897
+ const validateCellViewTemplate = (cellViewTag) => {
27898
+ let instance;
27899
+ try {
27900
+ instance = document.createElement(cellViewTag);
27901
+ }
27902
+ catch (ex) {
27903
+ // Swallow construction error to report a better one
27904
+ }
27905
+ if (!(instance instanceof TableCellView)) {
27906
+ throw new Error(`Cell view tag name (${cellViewTag}) must evaluate to an element extending TableCellView`);
27907
+ }
27908
+ };
27909
+ const createCellViewTemplate = (cellViewTag) => {
27910
+ validateCellViewTemplate(cellViewTag);
27911
+ return html `
27912
+ <${cellViewTag}
27913
+ :cellRecord="${y => y.cellState?.cellRecord}"
27914
+ :columnConfig="${y => y.cellState?.columnConfig}"
27915
+ class="cell-view"
27916
+ >
27917
+ </${cellViewTag}>
27918
+ `;
27919
+ };
27920
+
27921
+ /**
27922
+ * Internal column state configured by plugin authors
27923
+ * @internal
27924
+ */
27925
+ class ColumnInternals {
27926
+ constructor(options) {
27882
27927
  /**
27883
- * @internal
27884
- * Used by the Table in order to size a column proportionally to the available
27885
- * width of a row.
27928
+ * A unique id used internally in the table to identify specific column instances
27886
27929
  */
27887
- this.currentFractionalWidth = defaultFractionalWidth;
27930
+ this.uniqueId = uniqueId('table-column-slot');
27888
27931
  /**
27889
- * @internal
27890
- * Used by column plugins to size a column proportionally to the available
27891
- * width of a row. Sets currentFractionalWidth when changed.
27932
+ * The operation to use when sorting the table by this column.
27892
27933
  */
27893
- this.internalFractionalWidth = defaultFractionalWidth;
27934
+ this.sortOperation = TableColumnSortOperation.basic;
27894
27935
  /**
27895
- * @internal
27896
- * The minimum size in pixels according to the design doc
27936
+ * The names of the fields from the row's record that correlate to the data that will be in TCellRecord.
27937
+ * This array is parallel with the field names specified by `cellRecordFieldNames`.
27897
27938
  */
27898
- this.internalMinPixelWidth = defaultMinPixelWidth;
27939
+ this.dataRecordFieldNames = [];
27899
27940
  /**
27900
- * @internal
27901
27941
  * Whether or not this column can be used to group rows by
27902
27942
  */
27903
- this.internalGroupingDisabled = false;
27943
+ this.groupingDisabled = false;
27904
27944
  /**
27905
- * @internal
27906
- *
27907
- * The names of the fields from the row's record that correlate to the data that will be in TCellRecord.
27908
- * This array is parallel with the field names specified by `cellRecordFieldNames`.
27945
+ * Used by column plugins to size a column proportionally to the available
27946
+ * width of a row. Sets currentFractionalWidth when changed.
27909
27947
  */
27910
- this.dataRecordFieldNames = [];
27948
+ this.fractionalWidth = defaultFractionalWidth;
27911
27949
  /**
27912
- * @internal
27913
- *
27914
- * The operation to use when sorting the table by this column.
27950
+ * The minimum size in pixels according to the design doc
27915
27951
  */
27916
- this.sortOperation = TableColumnSortOperation.basic;
27917
- this.internalUniqueId = uniqueId('table-column-slot');
27918
- }
27919
- /**
27920
- * @internal
27921
- */
27922
- connectedCallback() {
27923
- super.connectedCallback();
27924
- this.setAttribute('slot', this.internalUniqueId);
27925
- }
27926
- cellViewTagChanged() {
27927
- this.currentCellViewTemplate = this.cellViewTag
27928
- ? createCellViewTemplate(this.cellViewTag)
27929
- : undefined;
27930
- }
27931
- internalFractionalWidthChanged() {
27932
- this.currentFractionalWidth = this.internalFractionalWidth;
27952
+ this.minPixelWidth = defaultMinPixelWidth;
27953
+ /**
27954
+ * @internal Do not write to this value directly. It is used by the Table in order to store
27955
+ * the resolved value of the fractionalWidth after updates programmatic or interactive updates.
27956
+ */
27957
+ this.currentFractionalWidth = defaultFractionalWidth;
27958
+ this.cellRecordFieldNames = options.cellRecordFieldNames;
27959
+ this.cellViewTemplate = createCellViewTemplate(options.cellViewTag);
27960
+ this.groupHeaderViewTemplate = createGroupHeaderViewTemplate(options.groupHeaderViewTag);
27933
27961
  }
27934
- internalPixelWidthChanged() {
27935
- this.currentPixelWidth = this.internalPixelWidth;
27962
+ fractionalWidthChanged() {
27963
+ this.currentFractionalWidth = this.fractionalWidth;
27936
27964
  }
27937
- groupHeaderViewTagChanged() {
27938
- this.internalGroupHeaderViewTemplate = this.groupHeaderViewTag
27939
- ? createGroupHeaderViewTemplate(this.groupHeaderViewTag)
27940
- : undefined;
27965
+ pixelWidthChanged() {
27966
+ this.currentPixelWidth = this.pixelWidth;
27941
27967
  }
27942
27968
  }
27943
- __decorate$1([
27944
- attr({ attribute: 'column-id' })
27945
- ], TableColumn.prototype, "columnId", void 0);
27946
- __decorate$1([
27947
- attr({ attribute: 'action-menu-slot' })
27948
- ], TableColumn.prototype, "actionMenuSlot", void 0);
27949
- __decorate$1([
27950
- attr({ attribute: 'action-menu-label' })
27951
- ], TableColumn.prototype, "actionMenuLabel", void 0);
27952
- __decorate$1([
27953
- attr({ attribute: 'column-hidden', mode: 'boolean' })
27954
- ], TableColumn.prototype, "columnHidden", void 0);
27955
- __decorate$1([
27956
- attr({ attribute: 'sort-index', converter: nullableNumberConverter })
27957
- ], TableColumn.prototype, "sortIndex", void 0);
27958
- __decorate$1([
27959
- attr({ attribute: 'sort-direction' })
27960
- ], TableColumn.prototype, "sortDirection", void 0);
27961
27969
  __decorate$1([
27962
27970
  observable
27963
- ], TableColumn.prototype, "currentPixelWidth", void 0);
27971
+ ], ColumnInternals.prototype, "columnConfig", void 0);
27964
27972
  __decorate$1([
27965
27973
  observable
27966
- ], TableColumn.prototype, "currentFractionalWidth", void 0);
27974
+ ], ColumnInternals.prototype, "operandDataRecordFieldName", void 0);
27967
27975
  __decorate$1([
27968
27976
  observable
27969
- ], TableColumn.prototype, "internalPixelWidth", void 0);
27977
+ ], ColumnInternals.prototype, "sortOperation", void 0);
27970
27978
  __decorate$1([
27971
27979
  observable
27972
- ], TableColumn.prototype, "internalFractionalWidth", void 0);
27980
+ ], ColumnInternals.prototype, "dataRecordFieldNames", void 0);
27973
27981
  __decorate$1([
27974
27982
  observable
27975
- ], TableColumn.prototype, "internalMinPixelWidth", void 0);
27983
+ ], ColumnInternals.prototype, "groupingDisabled", void 0);
27976
27984
  __decorate$1([
27977
27985
  observable
27978
- ], TableColumn.prototype, "internalGroupingDisabled", void 0);
27986
+ ], ColumnInternals.prototype, "groupIndex", void 0);
27979
27987
  __decorate$1([
27980
27988
  observable
27981
- ], TableColumn.prototype, "internalGroupIndex", void 0);
27989
+ ], ColumnInternals.prototype, "pixelWidth", void 0);
27982
27990
  __decorate$1([
27983
27991
  observable
27984
- ], TableColumn.prototype, "groupHeaderViewTag", void 0);
27992
+ ], ColumnInternals.prototype, "fractionalWidth", void 0);
27985
27993
  __decorate$1([
27986
27994
  observable
27987
- ], TableColumn.prototype, "internalGroupHeaderViewTemplate", void 0);
27995
+ ], ColumnInternals.prototype, "minPixelWidth", void 0);
27988
27996
  __decorate$1([
27989
27997
  observable
27990
- ], TableColumn.prototype, "cellViewTag", void 0);
27998
+ ], ColumnInternals.prototype, "currentFractionalWidth", void 0);
27991
27999
  __decorate$1([
27992
28000
  observable
27993
- ], TableColumn.prototype, "currentCellViewTemplate", void 0);
28001
+ ], ColumnInternals.prototype, "currentPixelWidth", void 0);
28002
+
28003
+ /**
28004
+ * The base class for table columns
28005
+ */
28006
+ class TableColumn extends FoundationElement {
28007
+ constructor(options) {
28008
+ super();
28009
+ this.columnHidden = false;
28010
+ this.sortDirection = TableColumnSortDirection.none;
28011
+ if (!options) {
28012
+ throw new Error('ColumnInternalsOptions must be provided to constructor');
28013
+ }
28014
+ this.columnInternals = new ColumnInternals(options);
28015
+ }
28016
+ }
27994
28017
  __decorate$1([
27995
- observable
27996
- ], TableColumn.prototype, "dataRecordFieldNames", void 0);
28018
+ attr({ attribute: 'column-id' })
28019
+ ], TableColumn.prototype, "columnId", void 0);
27997
28020
  __decorate$1([
27998
- observable
27999
- ], TableColumn.prototype, "columnConfig", void 0);
28021
+ attr({ attribute: 'action-menu-slot' })
28022
+ ], TableColumn.prototype, "actionMenuSlot", void 0);
28000
28023
  __decorate$1([
28001
- observable
28002
- ], TableColumn.prototype, "operandDataRecordFieldName", void 0);
28024
+ attr({ attribute: 'action-menu-label' })
28025
+ ], TableColumn.prototype, "actionMenuLabel", void 0);
28003
28026
  __decorate$1([
28004
- observable
28005
- ], TableColumn.prototype, "sortOperation", void 0);
28027
+ attr({ attribute: 'column-hidden', mode: 'boolean' })
28028
+ ], TableColumn.prototype, "columnHidden", void 0);
28029
+ __decorate$1([
28030
+ attr({ attribute: 'sort-index', converter: nullableNumberConverter })
28031
+ ], TableColumn.prototype, "sortIndex", void 0);
28032
+ __decorate$1([
28033
+ attr({ attribute: 'sort-direction' })
28034
+ ], TableColumn.prototype, "sortDirection", void 0);
28006
28035
 
28007
28036
  /**
28008
28037
  * Helper class for the nimble-table to validate that the table's configuration
@@ -28246,7 +28275,7 @@
28246
28275
  `;
28247
28276
 
28248
28277
  // prettier-ignore
28249
- const template$a = html `
28278
+ const template$b = html `
28250
28279
  <template role="columnheader" aria-sort="${x => x.ariaSort}">
28251
28280
  <slot></slot>
28252
28281
 
@@ -28296,7 +28325,7 @@
28296
28325
  ], TableHeader.prototype, "firstSortedColumn", void 0);
28297
28326
  const nimbleTableHeader = TableHeader.compose({
28298
28327
  baseName: 'table-header',
28299
- template: template$a,
28328
+ template: template$b,
28300
28329
  styles: styles$f
28301
28330
  });
28302
28331
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableHeader());
@@ -28363,6 +28392,26 @@
28363
28392
  }
28364
28393
  `;
28365
28394
 
28395
+ // prettier-ignore
28396
+ const template$a = html `
28397
+ <template role="cell" style="--ni-private-table-cell-nesting-level: ${x => x.nestingLevel}">
28398
+ ${x => x.cellViewTemplate}
28399
+ ${when(x => x.hasActionMenu, html `
28400
+ <${menuButtonTag} ${ref('actionMenuButton')}
28401
+ content-hidden
28402
+ appearance="${ButtonAppearance.ghost}"
28403
+ @beforetoggle="${(x, c) => x.onActionMenuBeforeToggle(c.event)}"
28404
+ @toggle="${(x, c) => x.onActionMenuToggle(c.event)}"
28405
+ class="action-menu"
28406
+ >
28407
+ <${iconThreeDotsLineTag} slot="start"></${iconThreeDotsLineTag}>
28408
+ ${x => x.actionMenuLabel}
28409
+ <slot name="cellActionMenu" slot="menu"></slot>
28410
+ </${menuButtonTag}>
28411
+ `)}
28412
+ </template>
28413
+ `;
28414
+
28366
28415
  /**
28367
28416
  * A styled cell that is used within the nimble-table-row.
28368
28417
  * @internal
@@ -28402,7 +28451,7 @@
28402
28451
  ], TableCell.prototype, "nestingLevel", void 0);
28403
28452
  const nimbleTableCell = TableCell.compose({
28404
28453
  baseName: 'table-cell',
28405
- template: template$b,
28454
+ template: template$a,
28406
28455
  styles: styles$d
28407
28456
  });
28408
28457
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableCell());
@@ -28416,7 +28465,7 @@
28416
28465
  <${tableCellTag}
28417
28466
  class="cell"
28418
28467
  :cellState="${x => x.cellState}"
28419
- :cellViewTemplate="${x => x.column.currentCellViewTemplate}"
28468
+ :cellViewTemplate="${x => x.column.columnInternals.cellViewTemplate}"
28420
28469
  ?has-action-menu="${x => !!x.column.actionMenuSlot}"
28421
28470
  action-menu-label="${x => x.column.actionMenuLabel}"
28422
28471
  @cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x.column)}"
@@ -28451,15 +28500,15 @@
28451
28500
  }
28452
28501
  get columnStates() {
28453
28502
  return this.columns.map((column, i) => {
28454
- const fieldNames = column.dataRecordFieldNames;
28503
+ const fieldNames = column.columnInternals.dataRecordFieldNames;
28455
28504
  let cellState;
28456
28505
  if (this.hasValidFieldNames(fieldNames) && this.dataRecord) {
28457
28506
  const cellDataValues = fieldNames.map(field => this.dataRecord[field]);
28458
- const cellRecord = Object.fromEntries(column.cellRecordFieldNames.map((k, j) => [
28507
+ const cellRecord = Object.fromEntries(column.columnInternals.cellRecordFieldNames.map((k, j) => [
28459
28508
  k,
28460
28509
  cellDataValues[j]
28461
28510
  ]));
28462
- const columnConfig = column.columnConfig ?? {};
28511
+ const columnConfig = column.columnInternals.columnConfig ?? {};
28463
28512
  cellState = {
28464
28513
  cellRecord,
28465
28514
  columnConfig
@@ -28588,7 +28637,7 @@
28588
28637
  overflow: hidden;
28589
28638
  }
28590
28639
 
28591
- .group-header-value {
28640
+ .group-header-view {
28592
28641
  padding-left: calc(${standardPadding} / 2);
28593
28642
  user-select: none;
28594
28643
  overflow: hidden;
@@ -28622,7 +28671,7 @@
28622
28671
  <${iconArrowExpanderRightTag} ${ref('expandIcon')} slot="start" class="expander-icon ${x => x.animationClass}"></${iconArrowExpanderRightTag}>
28623
28672
  </${buttonTag}>
28624
28673
  <div class="group-row-header-content">
28625
- ${x => x.groupColumn?.internalGroupHeaderViewTemplate}
28674
+ ${x => x.groupColumn?.columnInternals.groupHeaderViewTemplate}
28626
28675
  <div class="group-row-child-count">(${x => x.leafItemCount})</span>
28627
28676
  </div>
28628
28677
  </template>
@@ -29384,25 +29433,6 @@
29384
29433
  };
29385
29434
  }
29386
29435
 
29387
- /**
29388
- * Base class for table cell views, which are used within the nimble-table-cell.
29389
- * Each TableColumn type has a corresponding TableCellView type (linked via TableColumn.cellViewTag).
29390
- */
29391
- class TableCellView extends FoundationElement {
29392
- /**
29393
- * Called if an element inside this cell view has focus, and this row/cell is being recycled.
29394
- * Expected implementation is to commit changes as needed, and blur the focusable element (or close
29395
- * the menu/popup/etc).
29396
- */
29397
- focusedRecycleCallback() { }
29398
- }
29399
- __decorate$1([
29400
- observable
29401
- ], TableCellView.prototype, "cellRecord", void 0);
29402
- __decorate$1([
29403
- observable
29404
- ], TableCellView.prototype, "columnConfig", void 0);
29405
-
29406
29436
  /**
29407
29437
  * Helper class for the nimble-table for row virtualization.
29408
29438
  *
@@ -29558,6 +29588,14 @@
29558
29588
  }
29559
29589
  return false;
29560
29590
  };
29591
+ const isColumnInternalsProperty = (changedProperty, ...args) => {
29592
+ for (const arg of args) {
29593
+ if (changedProperty === arg) {
29594
+ return true;
29595
+ }
29596
+ }
29597
+ return false;
29598
+ };
29561
29599
  /**
29562
29600
  * Helper class to track what updates are needed to the table based on configuration
29563
29601
  * changes.
@@ -29622,19 +29660,20 @@
29622
29660
  if (isColumnProperty(changedColumnProperty, 'columnId')) {
29623
29661
  this.requiredUpdates.columnIds = true;
29624
29662
  }
29625
- else if (isColumnProperty(changedColumnProperty, 'operandDataRecordFieldName', 'sortOperation')) {
29663
+ else if (isColumnInternalsProperty(changedColumnProperty, 'operandDataRecordFieldName', 'sortOperation')) {
29626
29664
  this.requiredUpdates.columnDefinition = true;
29627
29665
  }
29628
29666
  else if (isColumnProperty(changedColumnProperty, 'sortIndex', 'sortDirection')) {
29629
29667
  this.requiredUpdates.columnSort = true;
29630
29668
  }
29631
- else if (isColumnProperty(changedColumnProperty, 'currentFractionalWidth', 'currentPixelWidth', 'internalMinPixelWidth', 'columnHidden')) {
29669
+ else if (isColumnProperty(changedColumnProperty, 'columnHidden')
29670
+ || isColumnInternalsProperty(changedColumnProperty, 'currentFractionalWidth', 'currentPixelWidth', 'minPixelWidth')) {
29632
29671
  this.requiredUpdates.columnWidths = true;
29633
29672
  }
29634
29673
  else if (isColumnProperty(changedColumnProperty, 'actionMenuSlot')) {
29635
29674
  this.requiredUpdates.actionMenuSlots = true;
29636
29675
  }
29637
- else if (isColumnProperty(changedColumnProperty, 'internalGroupIndex', 'internalGroupingDisabled')) {
29676
+ else if (isColumnInternalsProperty(changedColumnProperty, 'groupIndex', 'groupingDisabled')) {
29638
29677
  this.requiredUpdates.groupRows = true;
29639
29678
  }
29640
29679
  this.queueUpdate();
@@ -29682,21 +29721,17 @@
29682
29721
  */
29683
29722
  class TableLayoutHelper {
29684
29723
  static getGridTemplateColumns(columns) {
29685
- return (columns
29724
+ return columns
29686
29725
  ?.filter(column => !column.columnHidden)
29687
- .reduce((accumulator, currentValue) => {
29688
- const gap = accumulator === '' ? '' : ' ';
29689
- const minPixelWidth = currentValue.internalMinPixelWidth;
29690
- if (currentValue.currentPixelWidth) {
29691
- const pixelWidth = currentValue.currentPixelWidth;
29692
- const gridPixelWidth = pixelWidth > minPixelWidth
29693
- ? pixelWidth
29694
- : minPixelWidth;
29695
- return `${accumulator}${gap}${gridPixelWidth}px`;
29726
+ .map(column => {
29727
+ const { minPixelWidth, currentPixelWidth, currentFractionalWidth } = column.columnInternals;
29728
+ if (currentPixelWidth) {
29729
+ const coercedPixelWidth = Math.max(minPixelWidth, currentPixelWidth);
29730
+ return `${coercedPixelWidth}px`;
29696
29731
  }
29697
- const fractionalWidth = currentValue.currentFractionalWidth;
29698
- return `${accumulator}${gap}minmax(${minPixelWidth}px, ${fractionalWidth}fr)`;
29699
- }, '') ?? '');
29732
+ return `minmax(${minPixelWidth}px, ${currentFractionalWidth}fr)`;
29733
+ })
29734
+ .join(' ');
29700
29735
  }
29701
29736
  }
29702
29737
 
@@ -29872,7 +29907,9 @@
29872
29907
  * is the string name of the property that changed on that column.
29873
29908
  */
29874
29909
  handleChange(source, args) {
29875
- if (source instanceof TableColumn && typeof args === 'string') {
29910
+ if ((source instanceof TableColumn
29911
+ || source instanceof ColumnInternals)
29912
+ && typeof args === 'string') {
29876
29913
  this.updateTracker.trackColumnPropertyChanged(args);
29877
29914
  }
29878
29915
  }
@@ -29976,6 +30013,9 @@
29976
30013
  const notifier = Observable.getNotifier(column);
29977
30014
  notifier.subscribe(this);
29978
30015
  this.columnNotifiers.push(notifier);
30016
+ const notifierInternals = Observable.getNotifier(column.columnInternals);
30017
+ notifierInternals.subscribe(this);
30018
+ this.columnNotifiers.push(notifier);
29979
30019
  }
29980
30020
  }
29981
30021
  getColumnsParticipatingInSorting() {
@@ -29983,8 +30023,8 @@
29983
30023
  && typeof x.sortIndex === 'number');
29984
30024
  }
29985
30025
  getColumnsParticipatingInGrouping() {
29986
- return this.columns.filter(x => !x.internalGroupingDisabled
29987
- && typeof x.internalGroupIndex === 'number');
30026
+ return this.columns.filter(x => !x.columnInternals.groupingDisabled
30027
+ && typeof x.columnInternals.groupIndex === 'number');
29988
30028
  }
29989
30029
  childItemsChanged() {
29990
30030
  void this.updateColumnsFromChildItems();
@@ -30040,7 +30080,7 @@
30040
30080
  this.tableValidator.validateSelectionMode(this.selectionMode, this.idFieldName);
30041
30081
  this.tableValidator.validateColumnIds(this.columns.map(x => x.columnId));
30042
30082
  this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.sortIndex));
30043
- this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map(x => x.internalGroupIndex));
30083
+ this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map(x => x.columnInternals.groupIndex));
30044
30084
  this.validateWithData(this.table.options.data);
30045
30085
  }
30046
30086
  validateWithData(data) {
@@ -30081,7 +30121,7 @@
30081
30121
  getGroupRowColumn(row) {
30082
30122
  const groupedId = row.groupingColumnId;
30083
30123
  if (groupedId !== undefined) {
30084
- return this.columns.find(c => c.internalUniqueId === groupedId);
30124
+ return this.columns.find(c => c.columnInternals.uniqueId === groupedId);
30085
30125
  }
30086
30126
  return undefined;
30087
30127
  }
@@ -30113,14 +30153,14 @@
30113
30153
  : undefined;
30114
30154
  return sortedColumns.map(column => {
30115
30155
  return {
30116
- id: column.internalUniqueId,
30156
+ id: column.columnInternals.uniqueId,
30117
30157
  desc: column.sortDirection === TableColumnSortDirection.descending
30118
30158
  };
30119
30159
  });
30120
30160
  }
30121
30161
  calculateTanStackGroupingState() {
30122
- const groupedColumns = this.getColumnsParticipatingInGrouping().sort((x, y) => x.internalGroupIndex - y.internalGroupIndex);
30123
- return groupedColumns.map(column => column.internalUniqueId);
30162
+ const groupedColumns = this.getColumnsParticipatingInGrouping().sort((x, y) => x.columnInternals.groupIndex - y.columnInternals.groupIndex);
30163
+ return groupedColumns.map(column => column.columnInternals.uniqueId);
30124
30164
  }
30125
30165
  calculateTanStackRowIdFunction() {
30126
30166
  return this.idFieldName === null || this.idFieldName === undefined
@@ -30130,15 +30170,15 @@
30130
30170
  calculateTanStackColumns() {
30131
30171
  return this.columns.map(column => {
30132
30172
  return {
30133
- id: column.internalUniqueId,
30173
+ id: column.columnInternals.uniqueId,
30134
30174
  accessorFn: (data) => {
30135
- const fieldName = column.operandDataRecordFieldName;
30175
+ const fieldName = column.columnInternals.operandDataRecordFieldName;
30136
30176
  if (typeof fieldName !== 'string') {
30137
30177
  return undefined;
30138
30178
  }
30139
30179
  return data[fieldName];
30140
30180
  },
30141
- sortingFn: getTanStackSortingFunction(column.sortOperation)
30181
+ sortingFn: getTanStackSortingFunction(column.columnInternals.sortOperation)
30142
30182
  };
30143
30183
  });
30144
30184
  }
@@ -30213,7 +30253,7 @@
30213
30253
  `;
30214
30254
 
30215
30255
  const template$6 = html `
30216
- <template>
30256
+ <template slot="${x => x.columnInternals.uniqueId}">
30217
30257
  <span class="header-content">
30218
30258
  <slot></slot>
30219
30259
  </span>
@@ -30228,25 +30268,20 @@
30228
30268
  * proportionally within a Table.
30229
30269
  */
30230
30270
  class FractionalWidthColumn extends base {
30231
- constructor() {
30232
- super(...arguments);
30233
- this.fractionalWidth = defaultFractionalWidth;
30234
- this.minPixelWidth = defaultMinPixelWidth;
30235
- }
30236
30271
  fractionalWidthChanged() {
30237
30272
  if (typeof this.fractionalWidth === 'number') {
30238
- this.internalFractionalWidth = this.fractionalWidth;
30273
+ this.columnInternals.fractionalWidth = this.fractionalWidth;
30239
30274
  }
30240
30275
  else {
30241
- this.internalFractionalWidth = defaultFractionalWidth;
30276
+ this.columnInternals.fractionalWidth = defaultFractionalWidth;
30242
30277
  }
30243
30278
  }
30244
30279
  minPixelWidthChanged() {
30245
30280
  if (typeof this.minPixelWidth === 'number') {
30246
- this.internalMinPixelWidth = this.minPixelWidth;
30281
+ this.columnInternals.minPixelWidth = this.minPixelWidth;
30247
30282
  }
30248
30283
  else {
30249
- this.internalMinPixelWidth = defaultMinPixelWidth;
30284
+ this.columnInternals.minPixelWidth = defaultMinPixelWidth;
30250
30285
  }
30251
30286
  }
30252
30287
  }
@@ -30273,14 +30308,14 @@
30273
30308
  this.groupIndex = null;
30274
30309
  }
30275
30310
  groupingDisabledChanged() {
30276
- this.internalGroupingDisabled = this.groupingDisabled;
30311
+ this.columnInternals.groupingDisabled = this.groupingDisabled;
30277
30312
  }
30278
30313
  groupIndexChanged() {
30279
30314
  if (typeof this.groupIndex === 'number') {
30280
- this.internalGroupIndex = this.groupIndex;
30315
+ this.columnInternals.groupIndex = this.groupIndex;
30281
30316
  }
30282
30317
  else {
30283
- this.internalGroupIndex = undefined;
30318
+ this.columnInternals.groupIndex = undefined;
30284
30319
  }
30285
30320
  }
30286
30321
  }
@@ -30293,20 +30328,6 @@
30293
30328
  return GroupableColumn;
30294
30329
  }
30295
30330
 
30296
- /**
30297
- * The base class for group header views, which are displayed in a TableGroupRow.
30298
- * A TableColumn that uses the GroupableColumn mixin must provide a TableGroupHeaderView
30299
- * type (linked via TableColumn.groupHeaderViewTag).
30300
- */
30301
- class TableGroupHeaderView extends FoundationElement {
30302
- }
30303
- __decorate$1([
30304
- observable
30305
- ], TableGroupHeaderView.prototype, "groupHeaderValue", void 0);
30306
- __decorate$1([
30307
- observable
30308
- ], TableGroupHeaderView.prototype, "columnConfig", void 0);
30309
-
30310
30331
  const template$5 = html `
30311
30332
  <span
30312
30333
  ${ref('textSpan')}
@@ -30357,9 +30378,6 @@
30357
30378
  this.isValidContentAndHasOverflow = false;
30358
30379
  }
30359
30380
  }
30360
- __decorate$1([
30361
- observable
30362
- ], TableColumnTextGroupHeaderView.prototype, "columnConfig", void 0);
30363
30381
  __decorate$1([
30364
30382
  observable
30365
30383
  ], TableColumnTextGroupHeaderView.prototype, "isValidContentAndHasOverflow", void 0);
@@ -30436,38 +30454,33 @@
30436
30454
  const tableColumnTextCellViewTag = DesignSystem.tagFor(TableColumnTextCellView);
30437
30455
 
30438
30456
  /**
30439
- * The base class for a table column for displaying strings.
30457
+ * The table column for displaying strings.
30440
30458
  */
30441
- class TableColumnTextBase extends TableColumn {
30459
+ class TableColumnText extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI((TableColumn))) {
30442
30460
  constructor() {
30443
- super();
30444
- this.cellRecordFieldNames = ['value'];
30445
- this.cellViewTag = tableColumnTextCellViewTag;
30446
- this.sortOperation = TableColumnSortOperation.localeAwareCaseSensitive;
30461
+ super({
30462
+ cellRecordFieldNames: ['value'],
30463
+ cellViewTag: tableColumnTextCellViewTag,
30464
+ groupHeaderViewTag: tableColumnTextGroupHeaderTag
30465
+ });
30466
+ this.columnInternals.sortOperation = TableColumnSortOperation.localeAwareCaseSensitive;
30447
30467
  }
30448
30468
  fieldNameChanged() {
30449
- this.dataRecordFieldNames = [this.fieldName];
30450
- this.operandDataRecordFieldName = this.fieldName;
30469
+ this.columnInternals.dataRecordFieldNames = [this.fieldName];
30470
+ this.columnInternals.operandDataRecordFieldName = this.fieldName;
30451
30471
  }
30452
30472
  placeholderChanged() {
30453
- this.columnConfig = { placeholder: this.placeholder ?? '' };
30473
+ this.columnInternals.columnConfig = {
30474
+ placeholder: this.placeholder ?? ''
30475
+ };
30454
30476
  }
30455
30477
  }
30456
30478
  __decorate$1([
30457
30479
  attr({ attribute: 'field-name' })
30458
- ], TableColumnTextBase.prototype, "fieldName", void 0);
30480
+ ], TableColumnText.prototype, "fieldName", void 0);
30459
30481
  __decorate$1([
30460
30482
  attr
30461
- ], TableColumnTextBase.prototype, "placeholder", void 0);
30462
- /**
30463
- * The table column for displaying strings.
30464
- */
30465
- class TableColumnText extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI(TableColumnTextBase)) {
30466
- constructor() {
30467
- super(...arguments);
30468
- this.groupHeaderViewTag = tableColumnTextGroupHeaderTag;
30469
- }
30470
- }
30483
+ ], TableColumnText.prototype, "placeholder", void 0);
30471
30484
  const nimbleTableColumnText = TableColumnText.compose({
30472
30485
  baseName: 'table-column-text',
30473
30486
  template: template$6,