@ni/nimble-components 20.4.0 → 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.
Files changed (25) hide show
  1. package/dist/all-components-bundle.js +110 -56
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +462 -464
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/rich-text/editor/styles.js +0 -9
  6. package/dist/esm/rich-text/editor/styles.js.map +1 -1
  7. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.d.ts +0 -2
  8. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js +0 -9
  9. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js.map +1 -1
  10. package/dist/esm/src/rich-text/editor/testing/rich-text-editor.pageobject.d.ts +0 -2
  11. package/dist/esm/src/table/components/row/index.d.ts +29 -6
  12. package/dist/esm/src/table-column/base/models/column-internals.d.ts +1 -0
  13. package/dist/esm/table/components/row/index.d.ts +29 -6
  14. package/dist/esm/table/components/row/index.js +88 -24
  15. package/dist/esm/table/components/row/index.js.map +1 -1
  16. package/dist/esm/table/components/row/template.js +14 -14
  17. package/dist/esm/table/components/row/template.js.map +1 -1
  18. package/dist/esm/table/index.js +1 -1
  19. package/dist/esm/table/index.js.map +1 -1
  20. package/dist/esm/table/models/table-update-tracker.js +1 -8
  21. package/dist/esm/table/models/table-update-tracker.js.map +1 -1
  22. package/dist/esm/table-column/base/models/column-internals.d.ts +1 -0
  23. package/dist/esm/table-column/base/models/column-internals.js +8 -0
  24. package/dist/esm/table-column/base/models/column-internals.js.map +1 -1
  25. package/package.json +1 -1
@@ -16288,7 +16288,7 @@
16288
16288
 
16289
16289
  /**
16290
16290
  * Do not edit directly
16291
- * Generated on Tue, 19 Sep 2023 22:54:28 GMT
16291
+ * Generated on Wed, 20 Sep 2023 15:04:09 GMT
16292
16292
  */
16293
16293
 
16294
16294
  const Information100DarkUi = "#a46eff";
@@ -45316,15 +45316,6 @@ img.ProseMirror-separator {
45316
45316
  gap: ${standardPadding};
45317
45317
  place-items: center;
45318
45318
  }
45319
- ${
45320
- /**
45321
- * Restricting the pointer-events for the slot="start" where the icon is rendered.
45322
- * This can be removed after the below issue is fixed.
45323
- * https://github.com/ni/nimble/issues/1422
45324
- */ ''}
45325
- nimble-toggle-button::part(start) {
45326
- pointer-events: none;
45327
- }
45328
45319
 
45329
45320
  :host([error-visible]) .error-icon {
45330
45321
  display: none;
@@ -63470,6 +63461,14 @@ img.ProseMirror-separator {
63470
63461
  __decorate$1([
63471
63462
  observable
63472
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
+ }
63473
63472
 
63474
63473
  /**
63475
63474
  * The base class for table columns
@@ -64154,31 +64153,31 @@ img.ProseMirror-separator {
64154
64153
  <span class="row-front-spacer"></span>
64155
64154
 
64156
64155
  <span ${ref('cellContainer')} class="cell-container">
64157
- ${repeat(x => x.columnStates, html `
64158
- ${when(x => !x.column.columnHidden, html `
64156
+ ${repeat(x => x.columns, html `
64157
+ ${when(x => !x.columnHidden, html `
64159
64158
  <${tableCellTag}
64160
64159
  class="cell"
64161
- :cellState="${x => x.cellState}"
64162
- :cellViewTemplate="${x => x.column.columnInternals.cellViewTemplate}"
64163
- :column="${x => x.column}"
64164
- 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}"
64165
64164
  :recordId="${(_, c) => c.parent.recordId}"
64166
- ?has-action-menu="${x => !!x.column.actionMenuSlot}"
64167
- action-menu-label="${x => x.column.actionMenuLabel}"
64168
- @cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x.column)}"
64169
- @cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x.column)}"
64170
- :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]};"
64171
64170
  >
64172
64171
 
64173
- ${when((x, c) => (c.parent.currentActionMenuColumn === x.column) && x.column.actionMenuSlot, html `
64172
+ ${when((x, c) => (c.parent.currentActionMenuColumn === x) && x.actionMenuSlot, html `
64174
64173
  <slot
64175
- name="${x => `row-action-menu-${x.column.actionMenuSlot}`}"
64174
+ name="${x => `row-action-menu-${x.actionMenuSlot}`}"
64176
64175
  slot="cellActionMenu"
64177
64176
  ></slot>
64178
64177
  `)}
64179
64178
  </${tableCellTag}>
64180
64179
  `)}
64181
- `)}
64180
+ `, { recycle: false, positioning: true })}
64182
64181
  </span>
64183
64182
  </template>
64184
64183
  `;
@@ -64193,41 +64192,38 @@ img.ProseMirror-separator {
64193
64192
  this.selectable = false;
64194
64193
  this.selected = false;
64195
64194
  this.hideSelection = false;
64195
+ /**
64196
+ * @internal
64197
+ * */
64198
+ this.columnNotifiers = [];
64196
64199
  this.columns = [];
64197
64200
  this.nestingLevel = 0;
64198
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 = [];
64199
64214
  // Programmatically updating the selection state of a checkbox fires the 'change' event.
64200
64215
  // Therefore, selection change events that occur due to programmatically updating
64201
64216
  // the selection checkbox 'checked' value should be ingored.
64202
64217
  // https://github.com/microsoft/fast/issues/5750
64203
64218
  this.ignoreSelectionChangeEvents = false;
64204
64219
  }
64205
- get columnStates() {
64206
- return this.columns.map((column, i) => {
64207
- const fieldNames = column.columnInternals.dataRecordFieldNames;
64208
- let cellState;
64209
- if (this.hasValidFieldNames(fieldNames) && this.dataRecord) {
64210
- const cellDataValues = fieldNames.map(field => this.dataRecord[field]);
64211
- const cellRecord = Object.fromEntries(column.columnInternals.cellRecordFieldNames.map((k, j) => [
64212
- k,
64213
- cellDataValues[j]
64214
- ]));
64215
- const columnConfig = column.columnInternals.columnConfig;
64216
- cellState = {
64217
- cellRecord,
64218
- columnConfig
64219
- };
64220
- }
64221
- const cellIndentLevel = i === 0 && this.nestingLevel > 0 ? this.nestingLevel - 1 : 0;
64222
- return { column, cellState, cellIndentLevel };
64223
- });
64224
- }
64225
64220
  get ariaSelected() {
64226
64221
  if (this.selectable) {
64227
64222
  return this.selected ? 'true' : 'false';
64228
64223
  }
64229
64224
  return null;
64230
64225
  }
64226
+ /** @internal */
64231
64227
  onSelectionChange(event) {
64232
64228
  if (this.ignoreSelectionChangeEvents) {
64233
64229
  return;
@@ -64241,10 +64237,12 @@ img.ProseMirror-separator {
64241
64237
  };
64242
64238
  this.$emit('row-selection-toggle', detail);
64243
64239
  }
64240
+ /** @internal */
64244
64241
  onCellActionMenuBeforeToggle(event, column) {
64245
64242
  this.currentActionMenuColumn = column;
64246
64243
  this.emitActionMenuToggleEvent('row-action-menu-beforetoggle', event.detail, column);
64247
64244
  }
64245
+ /** @internal */
64248
64246
  onCellActionMenuToggle(event, column) {
64249
64247
  this.menuOpen = event.detail.newState;
64250
64248
  this.emitActionMenuToggleEvent('row-action-menu-toggle', event.detail, column);
@@ -64257,6 +64255,15 @@ img.ProseMirror-separator {
64257
64255
  }
64258
64256
  }
64259
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
+ }
64260
64267
  emitActionMenuToggleEvent(eventType, menuButtonEventDetail, column) {
64261
64268
  const detail = {
64262
64269
  newState: menuButtonEventDetail.newState,
@@ -64266,6 +64273,58 @@ img.ProseMirror-separator {
64266
64273
  };
64267
64274
  this.$emit(eventType, detail);
64268
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
+ }
64269
64328
  hasValidFieldNames(keys) {
64270
64329
  return keys.every(key => key !== undefined);
64271
64330
  }
@@ -64312,10 +64371,13 @@ img.ProseMirror-separator {
64312
64371
  ], TableRow.prototype, "menuOpen", void 0);
64313
64372
  __decorate$1([
64314
64373
  observable
64315
- ], TableRow.prototype, "selectionCheckbox", void 0);
64374
+ ], TableRow.prototype, "cellIndentLevels", void 0);
64316
64375
  __decorate$1([
64317
- volatile
64318
- ], TableRow.prototype, "columnStates", null);
64376
+ observable
64377
+ ], TableRow.prototype, "cellStates", void 0);
64378
+ __decorate$1([
64379
+ observable
64380
+ ], TableRow.prototype, "selectionCheckbox", void 0);
64319
64381
  __decorate$1([
64320
64382
  volatile
64321
64383
  ], TableRow.prototype, "ariaSelected", null);
@@ -65775,14 +65837,6 @@ img.ProseMirror-separator {
65775
65837
  }
65776
65838
  return false;
65777
65839
  };
65778
- const isColumnInternalsProperty = (changedProperty, ...args) => {
65779
- for (const arg of args) {
65780
- if (changedProperty === arg) {
65781
- return true;
65782
- }
65783
- }
65784
- return false;
65785
- };
65786
65840
  const trackedItems$1 = [
65787
65841
  'rowIds',
65788
65842
  'groupRows',
@@ -66606,7 +66660,7 @@ img.ProseMirror-separator {
66606
66660
  this.columnNotifiers.push(notifier);
66607
66661
  const notifierInternals = Observable.getNotifier(column.columnInternals);
66608
66662
  notifierInternals.subscribe(this);
66609
- this.columnNotifiers.push(notifier);
66663
+ this.columnNotifiers.push(notifierInternals);
66610
66664
  }
66611
66665
  }
66612
66666
  getColumnsParticipatingInSorting() {