@ni/nimble-components 20.4.1 → 20.4.2

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.
@@ -16288,7 +16288,7 @@
16288
16288
 
16289
16289
  /**
16290
16290
  * Do not edit directly
16291
- * Generated on Wed, 20 Sep 2023 02:32:58 GMT
16291
+ * Generated on Wed, 20 Sep 2023 15:04:09 GMT
16292
16292
  */
16293
16293
 
16294
16294
  const Information100DarkUi = "#a46eff";
@@ -63461,6 +63461,14 @@ img.ProseMirror-separator {
63461
63461
  __decorate$1([
63462
63462
  observable
63463
63463
  ], ColumnInternals.prototype, "currentSortDirection", void 0);
63464
+ function isColumnInternalsProperty(changedProperty, ...args) {
63465
+ for (const arg of args) {
63466
+ if (changedProperty === arg) {
63467
+ return true;
63468
+ }
63469
+ }
63470
+ return false;
63471
+ }
63464
63472
 
63465
63473
  /**
63466
63474
  * The base class for table columns
@@ -64145,31 +64153,31 @@ img.ProseMirror-separator {
64145
64153
  <span class="row-front-spacer"></span>
64146
64154
 
64147
64155
  <span ${ref('cellContainer')} class="cell-container">
64148
- ${repeat(x => x.columnStates, html `
64149
- ${when(x => !x.column.columnHidden, html `
64156
+ ${repeat(x => x.columns, html `
64157
+ ${when(x => !x.columnHidden, html `
64150
64158
  <${tableCellTag}
64151
64159
  class="cell"
64152
- :cellState="${x => x.cellState}"
64153
- :cellViewTemplate="${x => x.column.columnInternals.cellViewTemplate}"
64154
- :column="${x => x.column}"
64155
- column-id="${x => x.column.columnId}"
64160
+ :cellState="${(_, c) => c.parent.cellStates[c.index]}"
64161
+ :cellViewTemplate="${x => x.columnInternals.cellViewTemplate}"
64162
+ :column="${x => x}"
64163
+ column-id="${x => x.columnId}"
64156
64164
  :recordId="${(_, c) => c.parent.recordId}"
64157
- ?has-action-menu="${x => !!x.column.actionMenuSlot}"
64158
- action-menu-label="${x => x.column.actionMenuLabel}"
64159
- @cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x.column)}"
64160
- @cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x.column)}"
64161
- :nestingLevel="${x => x.cellIndentLevel};"
64165
+ ?has-action-menu="${x => !!x.actionMenuSlot}"
64166
+ action-menu-label="${x => x.actionMenuLabel}"
64167
+ @cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x)}"
64168
+ @cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x)}"
64169
+ :nestingLevel="${(_, c) => c.parent.cellIndentLevels[c.index]};"
64162
64170
  >
64163
64171
 
64164
- ${when((x, c) => (c.parent.currentActionMenuColumn === x.column) && x.column.actionMenuSlot, html `
64172
+ ${when((x, c) => (c.parent.currentActionMenuColumn === x) && x.actionMenuSlot, html `
64165
64173
  <slot
64166
- name="${x => `row-action-menu-${x.column.actionMenuSlot}`}"
64174
+ name="${x => `row-action-menu-${x.actionMenuSlot}`}"
64167
64175
  slot="cellActionMenu"
64168
64176
  ></slot>
64169
64177
  `)}
64170
64178
  </${tableCellTag}>
64171
64179
  `)}
64172
- `)}
64180
+ `, { recycle: false, positioning: true })}
64173
64181
  </span>
64174
64182
  </template>
64175
64183
  `;
@@ -64184,41 +64192,38 @@ img.ProseMirror-separator {
64184
64192
  this.selectable = false;
64185
64193
  this.selected = false;
64186
64194
  this.hideSelection = false;
64195
+ /**
64196
+ * @internal
64197
+ * */
64198
+ this.columnNotifiers = [];
64187
64199
  this.columns = [];
64188
64200
  this.nestingLevel = 0;
64189
64201
  this.menuOpen = false;
64202
+ /**
64203
+ * @internal
64204
+ * An array that parallels the `columns` array and contains the indent
64205
+ * level of each column's cell.
64206
+ * */
64207
+ this.cellIndentLevels = [];
64208
+ /**
64209
+ * @internal
64210
+ * An array that parallels the `columns` array and contains the cell state
64211
+ * of each column's cell.
64212
+ * */
64213
+ this.cellStates = [];
64190
64214
  // Programmatically updating the selection state of a checkbox fires the 'change' event.
64191
64215
  // Therefore, selection change events that occur due to programmatically updating
64192
64216
  // the selection checkbox 'checked' value should be ingored.
64193
64217
  // https://github.com/microsoft/fast/issues/5750
64194
64218
  this.ignoreSelectionChangeEvents = false;
64195
64219
  }
64196
- get columnStates() {
64197
- return this.columns.map((column, i) => {
64198
- const fieldNames = column.columnInternals.dataRecordFieldNames;
64199
- let cellState;
64200
- if (this.hasValidFieldNames(fieldNames) && this.dataRecord) {
64201
- const cellDataValues = fieldNames.map(field => this.dataRecord[field]);
64202
- const cellRecord = Object.fromEntries(column.columnInternals.cellRecordFieldNames.map((k, j) => [
64203
- k,
64204
- cellDataValues[j]
64205
- ]));
64206
- const columnConfig = column.columnInternals.columnConfig;
64207
- cellState = {
64208
- cellRecord,
64209
- columnConfig
64210
- };
64211
- }
64212
- const cellIndentLevel = i === 0 && this.nestingLevel > 0 ? this.nestingLevel - 1 : 0;
64213
- return { column, cellState, cellIndentLevel };
64214
- });
64215
- }
64216
64220
  get ariaSelected() {
64217
64221
  if (this.selectable) {
64218
64222
  return this.selected ? 'true' : 'false';
64219
64223
  }
64220
64224
  return null;
64221
64225
  }
64226
+ /** @internal */
64222
64227
  onSelectionChange(event) {
64223
64228
  if (this.ignoreSelectionChangeEvents) {
64224
64229
  return;
@@ -64232,10 +64237,12 @@ img.ProseMirror-separator {
64232
64237
  };
64233
64238
  this.$emit('row-selection-toggle', detail);
64234
64239
  }
64240
+ /** @internal */
64235
64241
  onCellActionMenuBeforeToggle(event, column) {
64236
64242
  this.currentActionMenuColumn = column;
64237
64243
  this.emitActionMenuToggleEvent('row-action-menu-beforetoggle', event.detail, column);
64238
64244
  }
64245
+ /** @internal */
64239
64246
  onCellActionMenuToggle(event, column) {
64240
64247
  this.menuOpen = event.detail.newState;
64241
64248
  this.emitActionMenuToggleEvent('row-action-menu-toggle', event.detail, column);
@@ -64248,6 +64255,15 @@ img.ProseMirror-separator {
64248
64255
  }
64249
64256
  }
64250
64257
  }
64258
+ /** @internal */
64259
+ handleChange(source, args) {
64260
+ if (source instanceof ColumnInternals
64261
+ && typeof args === 'string'
64262
+ && (isColumnInternalsProperty(args, 'columnConfig')
64263
+ || isColumnInternalsProperty(args, 'dataRecordFieldNames'))) {
64264
+ this.updateCellStates();
64265
+ }
64266
+ }
64251
64267
  emitActionMenuToggleEvent(eventType, menuButtonEventDetail, column) {
64252
64268
  const detail = {
64253
64269
  newState: menuButtonEventDetail.newState,
@@ -64257,6 +64273,58 @@ img.ProseMirror-separator {
64257
64273
  };
64258
64274
  this.$emit(eventType, detail);
64259
64275
  }
64276
+ columnsChanged() {
64277
+ this.updateCellIndentLevels();
64278
+ this.updateCellStates();
64279
+ this.observeColumns();
64280
+ }
64281
+ dataRecordChanged() {
64282
+ this.updateCellStates();
64283
+ }
64284
+ nestingLevelChanged() {
64285
+ this.updateCellIndentLevels();
64286
+ }
64287
+ updateCellIndentLevels() {
64288
+ this.cellIndentLevels = this.columns.map((_, i) => {
64289
+ if (i === 0 && this.nestingLevel > 0) {
64290
+ return this.nestingLevel - 1;
64291
+ }
64292
+ return 0;
64293
+ });
64294
+ }
64295
+ removeColumnObservers() {
64296
+ this.columnNotifiers.forEach(notifier => {
64297
+ notifier.unsubscribe(this);
64298
+ });
64299
+ this.columnNotifiers = [];
64300
+ }
64301
+ observeColumns() {
64302
+ this.removeColumnObservers();
64303
+ this.columnNotifiers = this.columns.map(column => {
64304
+ const notifier = Observable.getNotifier(column.columnInternals);
64305
+ notifier.subscribe(this);
64306
+ return notifier;
64307
+ });
64308
+ }
64309
+ updateCellStates() {
64310
+ this.cellStates = this.columns.map(column => {
64311
+ const fieldNames = column.columnInternals.dataRecordFieldNames;
64312
+ let cellState;
64313
+ if (this.hasValidFieldNames(fieldNames) && this.dataRecord) {
64314
+ const cellDataValues = fieldNames.map(field => this.dataRecord[field]);
64315
+ const cellRecord = Object.fromEntries(column.columnInternals.cellRecordFieldNames.map((k, j) => [
64316
+ k,
64317
+ cellDataValues[j]
64318
+ ]));
64319
+ const columnConfig = column.columnInternals.columnConfig;
64320
+ cellState = {
64321
+ cellRecord,
64322
+ columnConfig
64323
+ };
64324
+ }
64325
+ return cellState;
64326
+ });
64327
+ }
64260
64328
  hasValidFieldNames(keys) {
64261
64329
  return keys.every(key => key !== undefined);
64262
64330
  }
@@ -64303,10 +64371,13 @@ img.ProseMirror-separator {
64303
64371
  ], TableRow.prototype, "menuOpen", void 0);
64304
64372
  __decorate$1([
64305
64373
  observable
64306
- ], TableRow.prototype, "selectionCheckbox", void 0);
64374
+ ], TableRow.prototype, "cellIndentLevels", void 0);
64307
64375
  __decorate$1([
64308
- volatile
64309
- ], TableRow.prototype, "columnStates", null);
64376
+ observable
64377
+ ], TableRow.prototype, "cellStates", void 0);
64378
+ __decorate$1([
64379
+ observable
64380
+ ], TableRow.prototype, "selectionCheckbox", void 0);
64310
64381
  __decorate$1([
64311
64382
  volatile
64312
64383
  ], TableRow.prototype, "ariaSelected", null);
@@ -65766,14 +65837,6 @@ img.ProseMirror-separator {
65766
65837
  }
65767
65838
  return false;
65768
65839
  };
65769
- const isColumnInternalsProperty = (changedProperty, ...args) => {
65770
- for (const arg of args) {
65771
- if (changedProperty === arg) {
65772
- return true;
65773
- }
65774
- }
65775
- return false;
65776
- };
65777
65840
  const trackedItems$1 = [
65778
65841
  'rowIds',
65779
65842
  'groupRows',
@@ -66597,7 +66660,7 @@ img.ProseMirror-separator {
66597
66660
  this.columnNotifiers.push(notifier);
66598
66661
  const notifierInternals = Observable.getNotifier(column.columnInternals);
66599
66662
  notifierInternals.subscribe(this);
66600
- this.columnNotifiers.push(notifier);
66663
+ this.columnNotifiers.push(notifierInternals);
66601
66664
  }
66602
66665
  }
66603
66666
  getColumnsParticipatingInSorting() {