@ni/nimble-components 19.0.2 → 19.1.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 (30) hide show
  1. package/dist/all-components-bundle.js +62 -31
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +8 -9
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/table/index.js +7 -1
  6. package/dist/esm/table/index.js.map +1 -1
  7. package/dist/esm/table/models/table-validator.d.ts +3 -0
  8. package/dist/esm/table/models/table-validator.js +7 -1
  9. package/dist/esm/table/models/table-validator.js.map +1 -1
  10. package/dist/esm/table/types.d.ts +5 -1
  11. package/dist/esm/table/types.js.map +1 -1
  12. package/dist/esm/table-column/anchor/index.d.ts +3 -2
  13. package/dist/esm/table-column/anchor/index.js +8 -5
  14. package/dist/esm/table-column/anchor/index.js.map +1 -1
  15. package/dist/esm/table-column/base/index.d.ts +11 -8
  16. package/dist/esm/table-column/base/index.js +21 -18
  17. package/dist/esm/table-column/base/index.js.map +1 -1
  18. package/dist/esm/table-column/base/models/column-internals.d.ts +9 -1
  19. package/dist/esm/table-column/base/models/column-internals.js +14 -0
  20. package/dist/esm/table-column/base/models/column-internals.js.map +1 -1
  21. package/dist/esm/table-column/base/models/column-validator.d.ts +27 -0
  22. package/dist/esm/table-column/base/models/column-validator.js +41 -0
  23. package/dist/esm/table-column/base/models/column-validator.js.map +1 -0
  24. package/dist/esm/table-column/base/types.d.ts +3 -1
  25. package/dist/esm/table-column/base/types.js.map +1 -1
  26. package/dist/esm/table-column/text/index.d.ts +2 -1
  27. package/dist/esm/table-column/text/index.js +5 -5
  28. package/dist/esm/table-column/text/index.js.map +1 -1
  29. package/dist/esm/table-column/text-base/index.d.ts +1 -1
  30. package/package.json +1 -1
@@ -16366,7 +16366,7 @@
16366
16366
 
16367
16367
  /**
16368
16368
  * Do not edit directly
16369
- * Generated on Wed, 17 May 2023 21:20:25 GMT
16369
+ * Generated on Tue, 23 May 2023 15:51:05 GMT
16370
16370
  */
16371
16371
  const Information100DarkUi = "#a46eff";
16372
16372
  const Information100LightUi = "#804ad9";
@@ -28007,6 +28007,10 @@
28007
28007
  * A unique id used internally in the table to identify specific column instances
28008
28008
  */
28009
28009
  this.uniqueId = uniqueId('table-column-slot');
28010
+ /**
28011
+ * Whether this column has a valid configuration.
28012
+ */
28013
+ this.validConfiguration = true;
28010
28014
  /**
28011
28015
  * The operation to use when sorting the table by this column.
28012
28016
  */
@@ -28034,10 +28038,16 @@
28034
28038
  * the resolved value of the fractionalWidth after updates programmatic or interactive updates.
28035
28039
  */
28036
28040
  this.currentFractionalWidth = defaultFractionalWidth;
28041
+ /**
28042
+ * @internal Do not write to this value directly. It is used by the Table in order to store
28043
+ * the resolved value of the sortDirection after programmatic or interactive updates.
28044
+ */
28045
+ this.currentSortDirection = TableColumnSortDirection.none;
28037
28046
  this.cellRecordFieldNames = options.cellRecordFieldNames;
28038
28047
  this.cellViewTemplate = createCellViewTemplate(options.cellViewTag);
28039
28048
  this.groupHeaderViewTemplate = createGroupHeaderViewTemplate(options.groupHeaderViewTag);
28040
28049
  this.delegatedEvents = options.delegatedEvents;
28050
+ this.sortOperation = options.sortOperation ?? TableColumnSortOperation.basic;
28041
28051
  }
28042
28052
  fractionalWidthChanged() {
28043
28053
  this.currentFractionalWidth = this.fractionalWidth;
@@ -28049,6 +28059,9 @@
28049
28059
  __decorate$1([
28050
28060
  observable
28051
28061
  ], ColumnInternals.prototype, "columnConfig", void 0);
28062
+ __decorate$1([
28063
+ observable
28064
+ ], ColumnInternals.prototype, "validConfiguration", void 0);
28052
28065
  __decorate$1([
28053
28066
  observable
28054
28067
  ], ColumnInternals.prototype, "operandDataRecordFieldName", void 0);
@@ -28090,17 +28103,23 @@
28090
28103
  * The base class for table columns
28091
28104
  */
28092
28105
  class TableColumn extends FoundationElement {
28093
- constructor(options) {
28094
- super();
28106
+ constructor() {
28107
+ super(...arguments);
28108
+ /**
28109
+ * @internal
28110
+ *
28111
+ * Column properties configurable by plugin authors
28112
+ */
28113
+ this.columnInternals = new ColumnInternals(this.getColumnInternalsOptions());
28095
28114
  this.columnHidden = false;
28096
28115
  this.sortDirection = TableColumnSortDirection.none;
28097
28116
  this.sortingDisabled = false;
28098
- if (!options) {
28099
- throw new Error('ColumnInternalsOptions must be provided to constructor');
28100
- }
28101
- this.columnInternals = new ColumnInternals(options);
28102
- this.columnInternals.currentSortDirection = this.sortDirection;
28103
- this.columnInternals.currentSortIndex = this.sortIndex;
28117
+ }
28118
+ checkValidity() {
28119
+ return this.columnInternals.validConfiguration;
28120
+ }
28121
+ get validity() {
28122
+ return {};
28104
28123
  }
28105
28124
  sortDirectionChanged() {
28106
28125
  if (!this.sortingDisabled) {
@@ -28113,16 +28132,13 @@
28113
28132
  }
28114
28133
  }
28115
28134
  sortingDisabledChanged() {
28116
- // Ignore the default value sortingDisabled initialization from undefined to false (which runs before columnInternals is initialized)
28117
- if (this.columnInternals) {
28118
- if (this.sortingDisabled) {
28119
- this.columnInternals.currentSortDirection = TableColumnSortDirection.none;
28120
- this.columnInternals.currentSortIndex = undefined;
28121
- }
28122
- else {
28123
- this.columnInternals.currentSortDirection = this.sortDirection;
28124
- this.columnInternals.currentSortIndex = this.sortIndex;
28125
- }
28135
+ if (this.sortingDisabled) {
28136
+ this.columnInternals.currentSortDirection = TableColumnSortDirection.none;
28137
+ this.columnInternals.currentSortIndex = undefined;
28138
+ }
28139
+ else {
28140
+ this.columnInternals.currentSortDirection = this.sortDirection;
28141
+ this.columnInternals.currentSortIndex = this.sortIndex;
28126
28142
  }
28127
28143
  }
28128
28144
  }
@@ -28162,6 +28178,7 @@
28162
28178
  this.duplicateSortIndex = false;
28163
28179
  this.duplicateGroupIndex = false;
28164
28180
  this.idFieldNameNotConfigured = false;
28181
+ this.invalidColumnConfiguration = false;
28165
28182
  this.recordIds = new Set();
28166
28183
  }
28167
28184
  getValidity() {
@@ -28173,7 +28190,8 @@
28173
28190
  missingColumnId: this.missingColumnId,
28174
28191
  duplicateSortIndex: this.duplicateSortIndex,
28175
28192
  duplicateGroupIndex: this.duplicateGroupIndex,
28176
- idFieldNameNotConfigured: this.idFieldNameNotConfigured
28193
+ idFieldNameNotConfigured: this.idFieldNameNotConfigured,
28194
+ invalidColumnConfiguration: this.invalidColumnConfiguration
28177
28195
  };
28178
28196
  }
28179
28197
  isValid() {
@@ -28250,6 +28268,10 @@
28250
28268
  this.duplicateGroupIndex = !this.validateIndicesAreUnique(groupIndices);
28251
28269
  return !this.duplicateGroupIndex;
28252
28270
  }
28271
+ validateColumnConfigurations(columns) {
28272
+ this.invalidColumnConfiguration = columns.some(x => !x.columnInternals.validConfiguration);
28273
+ return !this.invalidColumnConfiguration;
28274
+ }
28253
28275
  getPresentRecordIds(requestedRecordIds) {
28254
28276
  return requestedRecordIds.filter(id => this.recordIds.has(id));
28255
28277
  }
@@ -30598,7 +30620,12 @@
30598
30620
  if ((source instanceof TableColumn
30599
30621
  || source instanceof ColumnInternals)
30600
30622
  && typeof args === 'string') {
30601
- this.updateTracker.trackColumnPropertyChanged(args);
30623
+ if (args === 'validConfiguration') {
30624
+ this.tableValidator.validateColumnConfigurations(this.columns);
30625
+ }
30626
+ else {
30627
+ this.updateTracker.trackColumnPropertyChanged(args);
30628
+ }
30602
30629
  }
30603
30630
  }
30604
30631
  /** @internal */
@@ -30867,6 +30894,7 @@
30867
30894
  this.tableValidator.validateColumnIds(this.columns.map(x => x.columnId));
30868
30895
  this.tableValidator.validateColumnSortIndices(this.getColumnsParticipatingInSorting().map(x => x.columnInternals.currentSortIndex));
30869
30896
  this.tableValidator.validateColumnGroupIndices(this.getColumnsParticipatingInGrouping().map(x => x.columnInternals.groupIndex));
30897
+ this.tableValidator.validateColumnConfigurations(this.columns);
30870
30898
  this.validateWithData(this.table.options.data);
30871
30899
  }
30872
30900
  validateWithData(data) {
@@ -31404,14 +31432,17 @@
31404
31432
  */
31405
31433
  class TableColumnAnchor extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI((TableColumn))) {
31406
31434
  constructor() {
31407
- super({
31435
+ super(...arguments);
31436
+ this.underlineHidden = false;
31437
+ }
31438
+ getColumnInternalsOptions() {
31439
+ return {
31408
31440
  cellRecordFieldNames: ['label', 'href'],
31409
31441
  cellViewTag: tableColumnAnchorCellViewTag,
31410
31442
  groupHeaderViewTag: tableColumnTextGroupHeaderTag,
31411
- delegatedEvents: ['click']
31412
- });
31413
- this.underlineHidden = false;
31414
- this.columnInternals.sortOperation = TableColumnSortOperation.localeAwareCaseSensitive;
31443
+ delegatedEvents: ['click'],
31444
+ sortOperation: TableColumnSortOperation.localeAwareCaseSensitive
31445
+ };
31415
31446
  }
31416
31447
  labelFieldNameChanged() {
31417
31448
  this.columnInternals.dataRecordFieldNames = [
@@ -31614,14 +31645,14 @@
31614
31645
  * The table column for displaying string fields as text.
31615
31646
  */
31616
31647
  class TableColumnText extends TableColumnTextBase {
31617
- constructor() {
31618
- super({
31648
+ getColumnInternalsOptions() {
31649
+ return {
31619
31650
  cellRecordFieldNames: ['value'],
31620
31651
  cellViewTag: tableColumnTextCellViewTag,
31621
31652
  groupHeaderViewTag: tableColumnTextGroupHeaderTag,
31622
- delegatedEvents: []
31623
- });
31624
- this.columnInternals.sortOperation = TableColumnSortOperation.localeAwareCaseSensitive;
31653
+ delegatedEvents: [],
31654
+ sortOperation: TableColumnSortOperation.localeAwareCaseSensitive
31655
+ };
31625
31656
  }
31626
31657
  }
31627
31658
  const nimbleTableColumnText = TableColumnText.compose({