@ni/nimble-components 18.10.6 → 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 (61) hide show
  1. package/dist/all-components-bundle.js +287 -226
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +1142 -1131
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/icon-base/icon-metadata.js +9 -0
  6. package/dist/esm/icon-base/icon-metadata.js.map +1 -1
  7. package/dist/esm/icons/all-icons.d.ts +3 -0
  8. package/dist/esm/icons/all-icons.js +3 -0
  9. package/dist/esm/icons/all-icons.js.map +1 -1
  10. package/dist/esm/icons/triangle-two-lines-horizontal.d.ts +13 -0
  11. package/dist/esm/icons/triangle-two-lines-horizontal.js +16 -0
  12. package/dist/esm/icons/triangle-two-lines-horizontal.js.map +1 -0
  13. package/dist/esm/icons/two-squares-in-brackets.d.ts +13 -0
  14. package/dist/esm/icons/two-squares-in-brackets.js +16 -0
  15. package/dist/esm/icons/two-squares-in-brackets.js.map +1 -0
  16. package/dist/esm/icons/two-triangles-between-lines.d.ts +13 -0
  17. package/dist/esm/icons/two-triangles-between-lines.js +16 -0
  18. package/dist/esm/icons/two-triangles-between-lines.js.map +1 -0
  19. package/dist/esm/table/components/cell/template.d.ts +1 -3
  20. package/dist/esm/table/components/cell/template.js +0 -5
  21. package/dist/esm/table/components/cell/template.js.map +1 -1
  22. package/dist/esm/table/components/group-row/styles.js +1 -1
  23. package/dist/esm/table/components/group-row/template.js +1 -1
  24. package/dist/esm/table/components/group-row/template.js.map +1 -1
  25. package/dist/esm/table/components/row/index.js +3 -3
  26. package/dist/esm/table/components/row/index.js.map +1 -1
  27. package/dist/esm/table/components/row/template.js +1 -1
  28. package/dist/esm/table/components/row/template.js.map +1 -1
  29. package/dist/esm/table/index.js +17 -11
  30. package/dist/esm/table/index.js.map +1 -1
  31. package/dist/esm/table/models/table-layout-helper.js +9 -13
  32. package/dist/esm/table/models/table-layout-helper.js.map +1 -1
  33. package/dist/esm/table/models/update-tracker.js +12 -3
  34. package/dist/esm/table/models/update-tracker.js.map +1 -1
  35. package/dist/esm/table-column/base/cell-view/template.d.ts +3 -0
  36. package/dist/esm/table-column/base/cell-view/template.js +26 -0
  37. package/dist/esm/table-column/base/cell-view/template.js.map +1 -0
  38. package/dist/esm/table-column/base/group-header-view/template.js +20 -4
  39. package/dist/esm/table-column/base/group-header-view/template.js.map +1 -1
  40. package/dist/esm/table-column/base/index.d.ts +5 -106
  41. package/dist/esm/table-column/base/index.js +7 -110
  42. package/dist/esm/table-column/base/index.js.map +1 -1
  43. package/dist/esm/table-column/base/models/column-internals.d.ts +97 -0
  44. package/dist/esm/table-column/base/models/column-internals.js +88 -0
  45. package/dist/esm/table-column/base/models/column-internals.js.map +1 -0
  46. package/dist/esm/table-column/base/template.d.ts +2 -1
  47. package/dist/esm/table-column/base/template.js +1 -1
  48. package/dist/esm/table-column/base/template.js.map +1 -1
  49. package/dist/esm/table-column/mixins/fractional-width-column.d.ts +2 -3
  50. package/dist/esm/table-column/mixins/fractional-width-column.js +4 -9
  51. package/dist/esm/table-column/mixins/fractional-width-column.js.map +1 -1
  52. package/dist/esm/table-column/mixins/groupable-column.d.ts +2 -3
  53. package/dist/esm/table-column/mixins/groupable-column.js +3 -3
  54. package/dist/esm/table-column/mixins/groupable-column.js.map +1 -1
  55. package/dist/esm/table-column/text/group-header-view/index.d.ts +0 -1
  56. package/dist/esm/table-column/text/group-header-view/index.js +0 -3
  57. package/dist/esm/table-column/text/group-header-view/index.js.map +1 -1
  58. package/dist/esm/table-column/text/index.d.ts +15 -18
  59. package/dist/esm/table-column/text/index.js +15 -20
  60. package/dist/esm/table-column/text/index.js.map +1 -1
  61. package/package.json +2 -2
@@ -19354,10 +19354,22 @@
19354
19354
  name: 'triangle_filled_16_x_16',
19355
19355
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-1" d="M8 2 2 14h12L8 2Z"/></svg>`
19356
19356
  };
19357
+ const triangleTwoLinesHorizontal = {
19358
+ name: 'triangle_two_lines_horizontal',
19359
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-1" d="M3.625 8 8 2l4.375 6h-8.75ZM14 12H2v2h12v-2Zm0-3H2v2h12V9Z"/></svg>`
19360
+ };
19357
19361
  const trueFalseRectangle16X16 = {
19358
19362
  name: 'true_false_rectangle_16_x_16',
19359
19363
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-1" d="M13.4 3.003H2.6a1.6 1.6 0 0 0-1.6 1.6v6.8a1.595 1.595 0 0 0 1.6 1.594h10.8a1.595 1.595 0 0 0 1.6-1.594v-6.8a1.6 1.6 0 0 0-1.6-1.6ZM7.587 6.58H6.141v3.736H4.946V6.58H3.5v-.896h4.087Zm4.913 0h-2.13v.862h1.974v.896H10.37v1.978H9.181V5.684H12.5Z"/></svg>`
19360
19364
  };
19365
+ const twoSquaresInBrackets = {
19366
+ name: 'two_squares_in_brackets',
19367
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-1" d="M4 4h5v5H4V4Zm6 3v3H7v2h5V7h-2ZM5 3V2H2v12h3v-1H3V3h2Zm8-1h-2v1h2v10h-2v1h3V2h-1Z"/></svg>`
19368
+ };
19369
+ const twoTrianglesBetweenLines = {
19370
+ name: 'two_triangles_between_lines',
19371
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-1" d="M1.11 2.11v12h2v-12h-2Zm12 0v12h2v-12h-2Zm-6 8.974-3-3 3-3v6Zm1.925-5.948 3 3-3 3v-6Z"/></svg>`
19372
+ };
19361
19373
  const unlink16X16 = {
19362
19374
  name: 'unlink_16_x_16',
19363
19375
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-1" d="M6.126 8.585c-.581.123-1.117.241-1.362.303a1.547 1.547 0 0 0-1.182 1.51l.01.155.021.193a1.69 1.69 0 0 0 .216.54l.02.038.105.134.127.144.054.047a1.509 1.509 0 0 0 .992.36h.049a1.306 1.306 0 0 0 .224-.034l.03.015.006-.001c.463-.088.925-.186 1.387-.287l.343 1.538c-.488.11-.976.221-1.467.314a3.112 3.112 0 0 1-.571.053 3.148 3.148 0 0 1-2.99-2.258l-.011-.045a3.04 3.04 0 0 1-.076-.35 3.127 3.127 0 0 1-.03-.206l-.004-.089a3.112 3.112 0 0 1-.016-.336A3.164 3.164 0 0 1 4.35 7.356c.272-.068.808-.203.802-.206l.623-.137Zm4.31-1.544-.353 1.575c.737.176 1.38.334 1.413.346a1.514 1.514 0 0 1 .789.768l.029.066.053.185.038.164.002.045a1.667 1.667 0 0 1-.035.58l-.064.185-.056.142a1.546 1.546 0 0 1-1.4.893 1.661 1.661 0 0 1-.313-.03 54.946 54.946 0 0 1-1.15-.24l-.347 1.55.406.097-.013-.017c.276.057.55.118.826.173a3.02 3.02 0 0 0 .578.056 3.188 3.188 0 0 0 2.811-1.74 3.018 3.018 0 0 0 .129-.311l.033-.083.061-.197a3.047 3.047 0 0 0 .082-.351l.008-.044a3.132 3.132 0 0 0-2.281-3.513c-.297-.077-.777-.19-1.245-.299M7.932 2.393 6.875 6.075h.75l.3 3.032 1.2-3.782h-.75Z"/></svg>`
@@ -22914,6 +22926,18 @@
22914
22926
  registerIcon('icon-triangle', IconTriangle);
22915
22927
  DesignSystem.tagFor(IconTriangle);
22916
22928
 
22929
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22930
+ /**
22931
+ * The icon component for the 'triangleTwoLinesHorizontal' icon
22932
+ */
22933
+ class IconTriangleTwoLinesHorizontal extends Icon {
22934
+ constructor() {
22935
+ super(triangleTwoLinesHorizontal);
22936
+ }
22937
+ }
22938
+ registerIcon('icon-triangle-two-lines-horizontal', IconTriangleTwoLinesHorizontal);
22939
+ DesignSystem.tagFor(IconTriangleTwoLinesHorizontal);
22940
+
22917
22941
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22918
22942
  /**
22919
22943
  * The icon component for the 'trueFalseRectangle' icon
@@ -22926,6 +22950,30 @@
22926
22950
  registerIcon('icon-true-false-rectangle', IconTrueFalseRectangle);
22927
22951
  DesignSystem.tagFor(IconTrueFalseRectangle);
22928
22952
 
22953
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22954
+ /**
22955
+ * The icon component for the 'twoSquaresInBrackets' icon
22956
+ */
22957
+ class IconTwoSquaresInBrackets extends Icon {
22958
+ constructor() {
22959
+ super(twoSquaresInBrackets);
22960
+ }
22961
+ }
22962
+ registerIcon('icon-two-squares-in-brackets', IconTwoSquaresInBrackets);
22963
+ DesignSystem.tagFor(IconTwoSquaresInBrackets);
22964
+
22965
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22966
+ /**
22967
+ * The icon component for the 'twoTrianglesBetweenLines' icon
22968
+ */
22969
+ class IconTwoTrianglesBetweenLines extends Icon {
22970
+ constructor() {
22971
+ super(twoTrianglesBetweenLines);
22972
+ }
22973
+ }
22974
+ registerIcon('icon-two-triangles-between-lines', IconTwoTrianglesBetweenLines);
22975
+ DesignSystem.tagFor(IconTwoTrianglesBetweenLines);
22976
+
22929
22977
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22930
22978
  /**
22931
22979
  * The icon component for the 'unlink' icon
@@ -27747,40 +27795,6 @@
27747
27795
  };
27748
27796
  }
27749
27797
 
27750
- const createGroupHeaderViewTemplate = (groupHeaderViewTag) => html `
27751
- <${groupHeaderViewTag}
27752
- :groupHeaderValue="${x => x.groupRowValue}"
27753
- :columnConfig="${x => x.groupColumn?.columnConfig}"
27754
- class="group-header-value"
27755
- >
27756
- </${groupHeaderViewTag}>
27757
- `;
27758
-
27759
- // prettier-ignore
27760
- const template$b = html `
27761
- <template role="cell" style="--ni-private-table-cell-nesting-level: ${x => x.nestingLevel}">
27762
- ${x => x.cellViewTemplate}
27763
- ${when(x => x.hasActionMenu, html `
27764
- <${menuButtonTag} ${ref('actionMenuButton')}
27765
- content-hidden
27766
- appearance="${ButtonAppearance.ghost}"
27767
- @beforetoggle="${(x, c) => x.onActionMenuBeforeToggle(c.event)}"
27768
- @toggle="${(x, c) => x.onActionMenuToggle(c.event)}"
27769
- class="action-menu"
27770
- >
27771
- <${iconThreeDotsLineTag} slot="start"></${iconThreeDotsLineTag}>
27772
- ${x => x.actionMenuLabel}
27773
- <slot name="cellActionMenu" slot="menu"></slot>
27774
- </${menuButtonTag}>
27775
- `)}
27776
- </template>
27777
- `;
27778
- const createCellViewTemplate = (cellViewTag) => html `<${cellViewTag} class="cell-view"
27779
- :cellRecord="${y => y.cellState?.cellRecord}"
27780
- :columnConfig="${y => y.cellState?.columnConfig}"
27781
- >
27782
- </${cellViewTag}>`;
27783
-
27784
27798
  /**
27785
27799
  * The possible directions a table column can be sorted in.
27786
27800
  */
@@ -27824,137 +27838,200 @@
27824
27838
  const defaultFractionalWidth = 1;
27825
27839
 
27826
27840
  /**
27827
- * 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).
27828
27844
  */
27829
- class TableColumn extends FoundationElement {
27830
- constructor() {
27831
- super();
27832
- this.columnHidden = false;
27833
- 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) {
27834
27927
  /**
27835
- * @internal
27836
- * Used by the Table in order to size a column proportionally to the available
27837
- * width of a row.
27928
+ * A unique id used internally in the table to identify specific column instances
27838
27929
  */
27839
- this.currentFractionalWidth = defaultFractionalWidth;
27930
+ this.uniqueId = uniqueId('table-column-slot');
27840
27931
  /**
27841
- * @internal
27842
- * Used by column plugins to size a column proportionally to the available
27843
- * width of a row. Sets currentFractionalWidth when changed.
27932
+ * The operation to use when sorting the table by this column.
27844
27933
  */
27845
- this.internalFractionalWidth = defaultFractionalWidth;
27934
+ this.sortOperation = TableColumnSortOperation.basic;
27846
27935
  /**
27847
- * @internal
27848
- * 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`.
27849
27938
  */
27850
- this.internalMinPixelWidth = defaultMinPixelWidth;
27939
+ this.dataRecordFieldNames = [];
27851
27940
  /**
27852
- * @internal
27853
27941
  * Whether or not this column can be used to group rows by
27854
27942
  */
27855
- this.internalGroupingDisabled = false;
27943
+ this.groupingDisabled = false;
27856
27944
  /**
27857
- * @internal
27858
- *
27859
- * The names of the fields from the row's record that correlate to the data that will be in TCellRecord.
27860
- * 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.
27861
27947
  */
27862
- this.dataRecordFieldNames = [];
27948
+ this.fractionalWidth = defaultFractionalWidth;
27863
27949
  /**
27864
- * @internal
27865
- *
27866
- * The operation to use when sorting the table by this column.
27950
+ * The minimum size in pixels according to the design doc
27867
27951
  */
27868
- this.sortOperation = TableColumnSortOperation.basic;
27869
- this.internalUniqueId = uniqueId('table-column-slot');
27870
- }
27871
- /**
27872
- * @internal
27873
- */
27874
- connectedCallback() {
27875
- super.connectedCallback();
27876
- this.setAttribute('slot', this.internalUniqueId);
27877
- }
27878
- cellViewTagChanged() {
27879
- this.currentCellViewTemplate = this.cellViewTag
27880
- ? createCellViewTemplate(this.cellViewTag)
27881
- : undefined;
27882
- }
27883
- internalFractionalWidthChanged() {
27884
- 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);
27885
27961
  }
27886
- internalPixelWidthChanged() {
27887
- this.currentPixelWidth = this.internalPixelWidth;
27962
+ fractionalWidthChanged() {
27963
+ this.currentFractionalWidth = this.fractionalWidth;
27888
27964
  }
27889
- groupHeaderViewTagChanged() {
27890
- this.internalGroupHeaderViewTemplate = this.groupHeaderViewTag
27891
- ? createGroupHeaderViewTemplate(this.groupHeaderViewTag)
27892
- : undefined;
27965
+ pixelWidthChanged() {
27966
+ this.currentPixelWidth = this.pixelWidth;
27893
27967
  }
27894
27968
  }
27895
- __decorate$1([
27896
- attr({ attribute: 'column-id' })
27897
- ], TableColumn.prototype, "columnId", void 0);
27898
- __decorate$1([
27899
- attr({ attribute: 'action-menu-slot' })
27900
- ], TableColumn.prototype, "actionMenuSlot", void 0);
27901
- __decorate$1([
27902
- attr({ attribute: 'action-menu-label' })
27903
- ], TableColumn.prototype, "actionMenuLabel", void 0);
27904
- __decorate$1([
27905
- attr({ attribute: 'column-hidden', mode: 'boolean' })
27906
- ], TableColumn.prototype, "columnHidden", void 0);
27907
- __decorate$1([
27908
- attr({ attribute: 'sort-index', converter: nullableNumberConverter })
27909
- ], TableColumn.prototype, "sortIndex", void 0);
27910
- __decorate$1([
27911
- attr({ attribute: 'sort-direction' })
27912
- ], TableColumn.prototype, "sortDirection", void 0);
27913
27969
  __decorate$1([
27914
27970
  observable
27915
- ], TableColumn.prototype, "currentPixelWidth", void 0);
27971
+ ], ColumnInternals.prototype, "columnConfig", void 0);
27916
27972
  __decorate$1([
27917
27973
  observable
27918
- ], TableColumn.prototype, "currentFractionalWidth", void 0);
27974
+ ], ColumnInternals.prototype, "operandDataRecordFieldName", void 0);
27919
27975
  __decorate$1([
27920
27976
  observable
27921
- ], TableColumn.prototype, "internalPixelWidth", void 0);
27977
+ ], ColumnInternals.prototype, "sortOperation", void 0);
27922
27978
  __decorate$1([
27923
27979
  observable
27924
- ], TableColumn.prototype, "internalFractionalWidth", void 0);
27980
+ ], ColumnInternals.prototype, "dataRecordFieldNames", void 0);
27925
27981
  __decorate$1([
27926
27982
  observable
27927
- ], TableColumn.prototype, "internalMinPixelWidth", void 0);
27983
+ ], ColumnInternals.prototype, "groupingDisabled", void 0);
27928
27984
  __decorate$1([
27929
27985
  observable
27930
- ], TableColumn.prototype, "internalGroupingDisabled", void 0);
27986
+ ], ColumnInternals.prototype, "groupIndex", void 0);
27931
27987
  __decorate$1([
27932
27988
  observable
27933
- ], TableColumn.prototype, "internalGroupIndex", void 0);
27989
+ ], ColumnInternals.prototype, "pixelWidth", void 0);
27934
27990
  __decorate$1([
27935
27991
  observable
27936
- ], TableColumn.prototype, "groupHeaderViewTag", void 0);
27992
+ ], ColumnInternals.prototype, "fractionalWidth", void 0);
27937
27993
  __decorate$1([
27938
27994
  observable
27939
- ], TableColumn.prototype, "internalGroupHeaderViewTemplate", void 0);
27995
+ ], ColumnInternals.prototype, "minPixelWidth", void 0);
27940
27996
  __decorate$1([
27941
27997
  observable
27942
- ], TableColumn.prototype, "cellViewTag", void 0);
27998
+ ], ColumnInternals.prototype, "currentFractionalWidth", void 0);
27943
27999
  __decorate$1([
27944
28000
  observable
27945
- ], 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
+ }
27946
28017
  __decorate$1([
27947
- observable
27948
- ], TableColumn.prototype, "dataRecordFieldNames", void 0);
28018
+ attr({ attribute: 'column-id' })
28019
+ ], TableColumn.prototype, "columnId", void 0);
27949
28020
  __decorate$1([
27950
- observable
27951
- ], TableColumn.prototype, "columnConfig", void 0);
28021
+ attr({ attribute: 'action-menu-slot' })
28022
+ ], TableColumn.prototype, "actionMenuSlot", void 0);
27952
28023
  __decorate$1([
27953
- observable
27954
- ], TableColumn.prototype, "operandDataRecordFieldName", void 0);
28024
+ attr({ attribute: 'action-menu-label' })
28025
+ ], TableColumn.prototype, "actionMenuLabel", void 0);
27955
28026
  __decorate$1([
27956
- observable
27957
- ], 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);
27958
28035
 
27959
28036
  /**
27960
28037
  * Helper class for the nimble-table to validate that the table's configuration
@@ -28198,7 +28275,7 @@
28198
28275
  `;
28199
28276
 
28200
28277
  // prettier-ignore
28201
- const template$a = html `
28278
+ const template$b = html `
28202
28279
  <template role="columnheader" aria-sort="${x => x.ariaSort}">
28203
28280
  <slot></slot>
28204
28281
 
@@ -28248,7 +28325,7 @@
28248
28325
  ], TableHeader.prototype, "firstSortedColumn", void 0);
28249
28326
  const nimbleTableHeader = TableHeader.compose({
28250
28327
  baseName: 'table-header',
28251
- template: template$a,
28328
+ template: template$b,
28252
28329
  styles: styles$f
28253
28330
  });
28254
28331
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableHeader());
@@ -28315,6 +28392,26 @@
28315
28392
  }
28316
28393
  `;
28317
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
+
28318
28415
  /**
28319
28416
  * A styled cell that is used within the nimble-table-row.
28320
28417
  * @internal
@@ -28354,7 +28451,7 @@
28354
28451
  ], TableCell.prototype, "nestingLevel", void 0);
28355
28452
  const nimbleTableCell = TableCell.compose({
28356
28453
  baseName: 'table-cell',
28357
- template: template$b,
28454
+ template: template$a,
28358
28455
  styles: styles$d
28359
28456
  });
28360
28457
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTableCell());
@@ -28368,7 +28465,7 @@
28368
28465
  <${tableCellTag}
28369
28466
  class="cell"
28370
28467
  :cellState="${x => x.cellState}"
28371
- :cellViewTemplate="${x => x.column.currentCellViewTemplate}"
28468
+ :cellViewTemplate="${x => x.column.columnInternals.cellViewTemplate}"
28372
28469
  ?has-action-menu="${x => !!x.column.actionMenuSlot}"
28373
28470
  action-menu-label="${x => x.column.actionMenuLabel}"
28374
28471
  @cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x.column)}"
@@ -28403,15 +28500,15 @@
28403
28500
  }
28404
28501
  get columnStates() {
28405
28502
  return this.columns.map((column, i) => {
28406
- const fieldNames = column.dataRecordFieldNames;
28503
+ const fieldNames = column.columnInternals.dataRecordFieldNames;
28407
28504
  let cellState;
28408
28505
  if (this.hasValidFieldNames(fieldNames) && this.dataRecord) {
28409
28506
  const cellDataValues = fieldNames.map(field => this.dataRecord[field]);
28410
- const cellRecord = Object.fromEntries(column.cellRecordFieldNames.map((k, j) => [
28507
+ const cellRecord = Object.fromEntries(column.columnInternals.cellRecordFieldNames.map((k, j) => [
28411
28508
  k,
28412
28509
  cellDataValues[j]
28413
28510
  ]));
28414
- const columnConfig = column.columnConfig ?? {};
28511
+ const columnConfig = column.columnInternals.columnConfig ?? {};
28415
28512
  cellState = {
28416
28513
  cellRecord,
28417
28514
  columnConfig
@@ -28540,7 +28637,7 @@
28540
28637
  overflow: hidden;
28541
28638
  }
28542
28639
 
28543
- .group-header-value {
28640
+ .group-header-view {
28544
28641
  padding-left: calc(${standardPadding} / 2);
28545
28642
  user-select: none;
28546
28643
  overflow: hidden;
@@ -28574,7 +28671,7 @@
28574
28671
  <${iconArrowExpanderRightTag} ${ref('expandIcon')} slot="start" class="expander-icon ${x => x.animationClass}"></${iconArrowExpanderRightTag}>
28575
28672
  </${buttonTag}>
28576
28673
  <div class="group-row-header-content">
28577
- ${x => x.groupColumn?.internalGroupHeaderViewTemplate}
28674
+ ${x => x.groupColumn?.columnInternals.groupHeaderViewTemplate}
28578
28675
  <div class="group-row-child-count">(${x => x.leafItemCount})</span>
28579
28676
  </div>
28580
28677
  </template>
@@ -29336,25 +29433,6 @@
29336
29433
  };
29337
29434
  }
29338
29435
 
29339
- /**
29340
- * Base class for table cell views, which are used within the nimble-table-cell.
29341
- * Each TableColumn type has a corresponding TableCellView type (linked via TableColumn.cellViewTag).
29342
- */
29343
- class TableCellView extends FoundationElement {
29344
- /**
29345
- * Called if an element inside this cell view has focus, and this row/cell is being recycled.
29346
- * Expected implementation is to commit changes as needed, and blur the focusable element (or close
29347
- * the menu/popup/etc).
29348
- */
29349
- focusedRecycleCallback() { }
29350
- }
29351
- __decorate$1([
29352
- observable
29353
- ], TableCellView.prototype, "cellRecord", void 0);
29354
- __decorate$1([
29355
- observable
29356
- ], TableCellView.prototype, "columnConfig", void 0);
29357
-
29358
29436
  /**
29359
29437
  * Helper class for the nimble-table for row virtualization.
29360
29438
  *
@@ -29510,6 +29588,14 @@
29510
29588
  }
29511
29589
  return false;
29512
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
+ };
29513
29599
  /**
29514
29600
  * Helper class to track what updates are needed to the table based on configuration
29515
29601
  * changes.
@@ -29574,19 +29660,20 @@
29574
29660
  if (isColumnProperty(changedColumnProperty, 'columnId')) {
29575
29661
  this.requiredUpdates.columnIds = true;
29576
29662
  }
29577
- else if (isColumnProperty(changedColumnProperty, 'operandDataRecordFieldName', 'sortOperation')) {
29663
+ else if (isColumnInternalsProperty(changedColumnProperty, 'operandDataRecordFieldName', 'sortOperation')) {
29578
29664
  this.requiredUpdates.columnDefinition = true;
29579
29665
  }
29580
29666
  else if (isColumnProperty(changedColumnProperty, 'sortIndex', 'sortDirection')) {
29581
29667
  this.requiredUpdates.columnSort = true;
29582
29668
  }
29583
- else if (isColumnProperty(changedColumnProperty, 'currentFractionalWidth', 'currentPixelWidth', 'internalMinPixelWidth', 'columnHidden')) {
29669
+ else if (isColumnProperty(changedColumnProperty, 'columnHidden')
29670
+ || isColumnInternalsProperty(changedColumnProperty, 'currentFractionalWidth', 'currentPixelWidth', 'minPixelWidth')) {
29584
29671
  this.requiredUpdates.columnWidths = true;
29585
29672
  }
29586
29673
  else if (isColumnProperty(changedColumnProperty, 'actionMenuSlot')) {
29587
29674
  this.requiredUpdates.actionMenuSlots = true;
29588
29675
  }
29589
- else if (isColumnProperty(changedColumnProperty, 'internalGroupIndex', 'internalGroupingDisabled')) {
29676
+ else if (isColumnInternalsProperty(changedColumnProperty, 'groupIndex', 'groupingDisabled')) {
29590
29677
  this.requiredUpdates.groupRows = true;
29591
29678
  }
29592
29679
  this.queueUpdate();
@@ -29634,21 +29721,17 @@
29634
29721
  */
29635
29722
  class TableLayoutHelper {
29636
29723
  static getGridTemplateColumns(columns) {
29637
- return (columns
29724
+ return columns
29638
29725
  ?.filter(column => !column.columnHidden)
29639
- .reduce((accumulator, currentValue) => {
29640
- const gap = accumulator === '' ? '' : ' ';
29641
- const minPixelWidth = currentValue.internalMinPixelWidth;
29642
- if (currentValue.currentPixelWidth) {
29643
- const pixelWidth = currentValue.currentPixelWidth;
29644
- const gridPixelWidth = pixelWidth > minPixelWidth
29645
- ? pixelWidth
29646
- : minPixelWidth;
29647
- 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`;
29648
29731
  }
29649
- const fractionalWidth = currentValue.currentFractionalWidth;
29650
- return `${accumulator}${gap}minmax(${minPixelWidth}px, ${fractionalWidth}fr)`;
29651
- }, '') ?? '');
29732
+ return `minmax(${minPixelWidth}px, ${currentFractionalWidth}fr)`;
29733
+ })
29734
+ .join(' ');
29652
29735
  }
29653
29736
  }
29654
29737
 
@@ -29824,7 +29907,9 @@
29824
29907
  * is the string name of the property that changed on that column.
29825
29908
  */
29826
29909
  handleChange(source, args) {
29827
- if (source instanceof TableColumn && typeof args === 'string') {
29910
+ if ((source instanceof TableColumn
29911
+ || source instanceof ColumnInternals)
29912
+ && typeof args === 'string') {
29828
29913
  this.updateTracker.trackColumnPropertyChanged(args);
29829
29914
  }
29830
29915
  }
@@ -29928,6 +30013,9 @@
29928
30013
  const notifier = Observable.getNotifier(column);
29929
30014
  notifier.subscribe(this);
29930
30015
  this.columnNotifiers.push(notifier);
30016
+ const notifierInternals = Observable.getNotifier(column.columnInternals);
30017
+ notifierInternals.subscribe(this);
30018
+ this.columnNotifiers.push(notifier);
29931
30019
  }
29932
30020
  }
29933
30021
  getColumnsParticipatingInSorting() {
@@ -29935,8 +30023,8 @@
29935
30023
  && typeof x.sortIndex === 'number');
29936
30024
  }
29937
30025
  getColumnsParticipatingInGrouping() {
29938
- return this.columns.filter(x => !x.internalGroupingDisabled
29939
- && typeof x.internalGroupIndex === 'number');
30026
+ return this.columns.filter(x => !x.columnInternals.groupingDisabled
30027
+ && typeof x.columnInternals.groupIndex === 'number');
29940
30028
  }
29941
30029
  childItemsChanged() {
29942
30030
  void this.updateColumnsFromChildItems();
@@ -29992,7 +30080,7 @@
29992
30080
  this.tableValidator.validateSelectionMode(this.selectionMode, this.idFieldName);
29993
30081
  this.tableValidator.validateColumnIds(this.columns.map(x => x.columnId));
29994
30082
  this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.sortIndex));
29995
- this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map(x => x.internalGroupIndex));
30083
+ this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map(x => x.columnInternals.groupIndex));
29996
30084
  this.validateWithData(this.table.options.data);
29997
30085
  }
29998
30086
  validateWithData(data) {
@@ -30033,7 +30121,7 @@
30033
30121
  getGroupRowColumn(row) {
30034
30122
  const groupedId = row.groupingColumnId;
30035
30123
  if (groupedId !== undefined) {
30036
- return this.columns.find(c => c.internalUniqueId === groupedId);
30124
+ return this.columns.find(c => c.columnInternals.uniqueId === groupedId);
30037
30125
  }
30038
30126
  return undefined;
30039
30127
  }
@@ -30065,14 +30153,14 @@
30065
30153
  : undefined;
30066
30154
  return sortedColumns.map(column => {
30067
30155
  return {
30068
- id: column.internalUniqueId,
30156
+ id: column.columnInternals.uniqueId,
30069
30157
  desc: column.sortDirection === TableColumnSortDirection.descending
30070
30158
  };
30071
30159
  });
30072
30160
  }
30073
30161
  calculateTanStackGroupingState() {
30074
- const groupedColumns = this.getColumnsParticipatingInGrouping().sort((x, y) => x.internalGroupIndex - y.internalGroupIndex);
30075
- 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);
30076
30164
  }
30077
30165
  calculateTanStackRowIdFunction() {
30078
30166
  return this.idFieldName === null || this.idFieldName === undefined
@@ -30082,15 +30170,15 @@
30082
30170
  calculateTanStackColumns() {
30083
30171
  return this.columns.map(column => {
30084
30172
  return {
30085
- id: column.internalUniqueId,
30173
+ id: column.columnInternals.uniqueId,
30086
30174
  accessorFn: (data) => {
30087
- const fieldName = column.operandDataRecordFieldName;
30175
+ const fieldName = column.columnInternals.operandDataRecordFieldName;
30088
30176
  if (typeof fieldName !== 'string') {
30089
30177
  return undefined;
30090
30178
  }
30091
30179
  return data[fieldName];
30092
30180
  },
30093
- sortingFn: getTanStackSortingFunction(column.sortOperation)
30181
+ sortingFn: getTanStackSortingFunction(column.columnInternals.sortOperation)
30094
30182
  };
30095
30183
  });
30096
30184
  }
@@ -30165,7 +30253,7 @@
30165
30253
  `;
30166
30254
 
30167
30255
  const template$6 = html `
30168
- <template>
30256
+ <template slot="${x => x.columnInternals.uniqueId}">
30169
30257
  <span class="header-content">
30170
30258
  <slot></slot>
30171
30259
  </span>
@@ -30180,25 +30268,20 @@
30180
30268
  * proportionally within a Table.
30181
30269
  */
30182
30270
  class FractionalWidthColumn extends base {
30183
- constructor() {
30184
- super(...arguments);
30185
- this.fractionalWidth = defaultFractionalWidth;
30186
- this.minPixelWidth = defaultMinPixelWidth;
30187
- }
30188
30271
  fractionalWidthChanged() {
30189
30272
  if (typeof this.fractionalWidth === 'number') {
30190
- this.internalFractionalWidth = this.fractionalWidth;
30273
+ this.columnInternals.fractionalWidth = this.fractionalWidth;
30191
30274
  }
30192
30275
  else {
30193
- this.internalFractionalWidth = defaultFractionalWidth;
30276
+ this.columnInternals.fractionalWidth = defaultFractionalWidth;
30194
30277
  }
30195
30278
  }
30196
30279
  minPixelWidthChanged() {
30197
30280
  if (typeof this.minPixelWidth === 'number') {
30198
- this.internalMinPixelWidth = this.minPixelWidth;
30281
+ this.columnInternals.minPixelWidth = this.minPixelWidth;
30199
30282
  }
30200
30283
  else {
30201
- this.internalMinPixelWidth = defaultMinPixelWidth;
30284
+ this.columnInternals.minPixelWidth = defaultMinPixelWidth;
30202
30285
  }
30203
30286
  }
30204
30287
  }
@@ -30225,14 +30308,14 @@
30225
30308
  this.groupIndex = null;
30226
30309
  }
30227
30310
  groupingDisabledChanged() {
30228
- this.internalGroupingDisabled = this.groupingDisabled;
30311
+ this.columnInternals.groupingDisabled = this.groupingDisabled;
30229
30312
  }
30230
30313
  groupIndexChanged() {
30231
30314
  if (typeof this.groupIndex === 'number') {
30232
- this.internalGroupIndex = this.groupIndex;
30315
+ this.columnInternals.groupIndex = this.groupIndex;
30233
30316
  }
30234
30317
  else {
30235
- this.internalGroupIndex = undefined;
30318
+ this.columnInternals.groupIndex = undefined;
30236
30319
  }
30237
30320
  }
30238
30321
  }
@@ -30245,20 +30328,6 @@
30245
30328
  return GroupableColumn;
30246
30329
  }
30247
30330
 
30248
- /**
30249
- * The base class for group header views, which are displayed in a TableGroupRow.
30250
- * A TableColumn that uses the GroupableColumn mixin must provide a TableGroupHeaderView
30251
- * type (linked via TableColumn.groupHeaderViewTag).
30252
- */
30253
- class TableGroupHeaderView extends FoundationElement {
30254
- }
30255
- __decorate$1([
30256
- observable
30257
- ], TableGroupHeaderView.prototype, "groupHeaderValue", void 0);
30258
- __decorate$1([
30259
- observable
30260
- ], TableGroupHeaderView.prototype, "columnConfig", void 0);
30261
-
30262
30331
  const template$5 = html `
30263
30332
  <span
30264
30333
  ${ref('textSpan')}
@@ -30309,9 +30378,6 @@
30309
30378
  this.isValidContentAndHasOverflow = false;
30310
30379
  }
30311
30380
  }
30312
- __decorate$1([
30313
- observable
30314
- ], TableColumnTextGroupHeaderView.prototype, "columnConfig", void 0);
30315
30381
  __decorate$1([
30316
30382
  observable
30317
30383
  ], TableColumnTextGroupHeaderView.prototype, "isValidContentAndHasOverflow", void 0);
@@ -30388,38 +30454,33 @@
30388
30454
  const tableColumnTextCellViewTag = DesignSystem.tagFor(TableColumnTextCellView);
30389
30455
 
30390
30456
  /**
30391
- * The base class for a table column for displaying strings.
30457
+ * The table column for displaying strings.
30392
30458
  */
30393
- class TableColumnTextBase extends TableColumn {
30459
+ class TableColumnText extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI((TableColumn))) {
30394
30460
  constructor() {
30395
- super();
30396
- this.cellRecordFieldNames = ['value'];
30397
- this.cellViewTag = tableColumnTextCellViewTag;
30398
- this.sortOperation = TableColumnSortOperation.localeAwareCaseSensitive;
30461
+ super({
30462
+ cellRecordFieldNames: ['value'],
30463
+ cellViewTag: tableColumnTextCellViewTag,
30464
+ groupHeaderViewTag: tableColumnTextGroupHeaderTag
30465
+ });
30466
+ this.columnInternals.sortOperation = TableColumnSortOperation.localeAwareCaseSensitive;
30399
30467
  }
30400
30468
  fieldNameChanged() {
30401
- this.dataRecordFieldNames = [this.fieldName];
30402
- this.operandDataRecordFieldName = this.fieldName;
30469
+ this.columnInternals.dataRecordFieldNames = [this.fieldName];
30470
+ this.columnInternals.operandDataRecordFieldName = this.fieldName;
30403
30471
  }
30404
30472
  placeholderChanged() {
30405
- this.columnConfig = { placeholder: this.placeholder ?? '' };
30473
+ this.columnInternals.columnConfig = {
30474
+ placeholder: this.placeholder ?? ''
30475
+ };
30406
30476
  }
30407
30477
  }
30408
30478
  __decorate$1([
30409
30479
  attr({ attribute: 'field-name' })
30410
- ], TableColumnTextBase.prototype, "fieldName", void 0);
30480
+ ], TableColumnText.prototype, "fieldName", void 0);
30411
30481
  __decorate$1([
30412
30482
  attr
30413
- ], TableColumnTextBase.prototype, "placeholder", void 0);
30414
- /**
30415
- * The table column for displaying strings.
30416
- */
30417
- class TableColumnText extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI(TableColumnTextBase)) {
30418
- constructor() {
30419
- super(...arguments);
30420
- this.groupHeaderViewTag = tableColumnTextGroupHeaderTag;
30421
- }
30422
- }
30483
+ ], TableColumnText.prototype, "placeholder", void 0);
30423
30484
  const nimbleTableColumnText = TableColumnText.compose({
30424
30485
  baseName: 'table-column-text',
30425
30486
  template: template$6,