@ni/nimble-components 19.4.3 → 19.4.5

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 (35) hide show
  1. package/dist/all-components-bundle.js +75 -50
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +519 -526
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/combobox/index.js +4 -0
  6. package/dist/esm/combobox/index.js.map +1 -1
  7. package/dist/esm/src/table-column/anchor/cell-view/index.d.ts +1 -3
  8. package/dist/esm/src/table-column/base/index.d.ts +1 -3
  9. package/dist/esm/src/table-column/text-base/cell-view/index.d.ts +1 -3
  10. package/dist/esm/src/table-column/text-base/group-header-view/index.d.ts +0 -6
  11. package/dist/esm/src/utilities/directive/overflow.d.ts +36 -0
  12. package/dist/esm/table-column/anchor/cell-view/index.d.ts +1 -3
  13. package/dist/esm/table-column/anchor/cell-view/index.js +2 -2
  14. package/dist/esm/table-column/anchor/cell-view/index.js.map +1 -1
  15. package/dist/esm/table-column/anchor/cell-view/template.js +5 -15
  16. package/dist/esm/table-column/anchor/cell-view/template.js.map +1 -1
  17. package/dist/esm/table-column/base/index.d.ts +1 -3
  18. package/dist/esm/table-column/base/index.js +2 -2
  19. package/dist/esm/table-column/base/index.js.map +1 -1
  20. package/dist/esm/table-column/base/template.js +3 -9
  21. package/dist/esm/table-column/base/template.js.map +1 -1
  22. package/dist/esm/table-column/text-base/cell-view/index.d.ts +1 -3
  23. package/dist/esm/table-column/text-base/cell-view/index.js +2 -2
  24. package/dist/esm/table-column/text-base/cell-view/index.js.map +1 -1
  25. package/dist/esm/table-column/text-base/cell-view/template.js +4 -9
  26. package/dist/esm/table-column/text-base/cell-view/template.js.map +1 -1
  27. package/dist/esm/table-column/text-base/group-header-view/index.d.ts +0 -6
  28. package/dist/esm/table-column/text-base/group-header-view/index.js +0 -8
  29. package/dist/esm/table-column/text-base/group-header-view/index.js.map +1 -1
  30. package/dist/esm/table-column/text-base/group-header-view/template.js +3 -4
  31. package/dist/esm/table-column/text-base/group-header-view/template.js.map +1 -1
  32. package/dist/esm/utilities/directive/overflow.d.ts +36 -0
  33. package/dist/esm/utilities/directive/overflow.js +56 -0
  34. package/dist/esm/utilities/directive/overflow.js.map +1 -0
  35. package/package.json +1 -1
@@ -16232,7 +16232,7 @@
16232
16232
 
16233
16233
  /**
16234
16234
  * Do not edit directly
16235
- * Generated on Wed, 28 Jun 2023 22:20:50 GMT
16235
+ * Generated on Thu, 13 Jul 2023 16:36:04 GMT
16236
16236
  */
16237
16237
  const Information100DarkUi = "#a46eff";
16238
16238
  const Information100LightUi = "#804ad9";
@@ -20623,6 +20623,10 @@
20623
20623
  this.valueBeforeTextUpdate = this.value;
20624
20624
  }
20625
20625
  this.valueUpdatedByInput = true;
20626
+ // This is a workaround for this FAST issue: https://github.com/microsoft/fast/issues/6776
20627
+ if (this.value !== this.control.value) {
20628
+ this.focusAndScrollOptionIntoView();
20629
+ }
20626
20630
  this.value = this.control.value;
20627
20631
  return returnValue;
20628
20632
  }
@@ -28253,7 +28257,7 @@
28253
28257
  this.sortDirection = TableColumnSortDirection.none;
28254
28258
  this.sortingDisabled = false;
28255
28259
  /** @internal */
28256
- this.isValidContentAndHasOverflow = false;
28260
+ this.hasOverflow = false;
28257
28261
  }
28258
28262
  checkValidity() {
28259
28263
  return this.columnInternals.validConfiguration;
@@ -28312,7 +28316,7 @@
28312
28316
  ], TableColumn.prototype, "sortingDisabled", void 0);
28313
28317
  __decorate$1([
28314
28318
  observable
28315
- ], TableColumn.prototype, "isValidContentAndHasOverflow", void 0);
28319
+ ], TableColumn.prototype, "hasOverflow", void 0);
28316
28320
 
28317
28321
  /**
28318
28322
  * Helper class for the nimble-table to validate that the table's configuration
@@ -31361,20 +31365,68 @@
31361
31365
  }
31362
31366
  `;
31363
31367
 
31368
+ /**
31369
+ * The runtime behavior for template overflow detection.
31370
+ * @public
31371
+ */
31372
+ class OverflowBehavior {
31373
+ /**
31374
+ * Creates an instance of OverflowBehavior.
31375
+ * @param target - The element to check for overflow.
31376
+ * @param propertyName - The name of the property to assign the overflow state to.
31377
+ */
31378
+ constructor(target, propertyName) {
31379
+ this.target = target;
31380
+ this.propertyName = propertyName;
31381
+ }
31382
+ /**
31383
+ * Bind this behavior to the source.
31384
+ * @param source - The source to bind to.
31385
+ * @param context - The execution context that the binding is operating within.
31386
+ */
31387
+ bind(source) {
31388
+ this.source = source;
31389
+ this.setSourceValue(false);
31390
+ this.mouseOverHandler = () => {
31391
+ const hasOverflow = this.target.offsetWidth < this.target.scrollWidth;
31392
+ this.setSourceValue(hasOverflow);
31393
+ };
31394
+ this.mouseOutHandler = () => {
31395
+ this.setSourceValue(false);
31396
+ };
31397
+ this.target.addEventListener('mouseover', this.mouseOverHandler);
31398
+ this.target.addEventListener('mouseout', this.mouseOutHandler);
31399
+ }
31400
+ /**
31401
+ * Unbinds this behavior from the source.
31402
+ * @param source - The source to unbind from.
31403
+ */
31404
+ unbind() {
31405
+ this.source = undefined;
31406
+ this.target.removeEventListener('mouseover', this.mouseOverHandler);
31407
+ this.target.removeEventListener('mouseout', this.mouseOutHandler);
31408
+ }
31409
+ setSourceValue(value) {
31410
+ // @ts-expect-error set property on source
31411
+ this.source[this.propertyName] = value;
31412
+ }
31413
+ }
31414
+ /**
31415
+ * A directive that observes if an element has overflow and sets a flag.
31416
+ * @param propertyName - The name of the property to assign the overflow flag.
31417
+ * @public
31418
+ */
31419
+ function overflow(propertyName) {
31420
+ return new AttachedBehaviorHTMLDirective('nimble-overflow', OverflowBehavior, propertyName);
31421
+ }
31422
+
31364
31423
  // prettier-ignore
31365
31424
  const template$8 = html `
31366
31425
  <template slot="${x => x.columnInternals.uniqueId}">
31367
31426
  <span
31368
- ${ref('headerSpan')}
31427
+ ${overflow('hasOverflow')}
31369
31428
  class="header-content"
31370
- @mouseover="${x => {
31371
- x.isValidContentAndHasOverflow = !!x.headerTextContent
31372
- && x.headerSpan.offsetWidth < x.headerSpan.scrollWidth;
31373
- }}"
31374
- @mouseout="${x => {
31375
- x.isValidContentAndHasOverflow = false;
31376
- }}"
31377
- title=${x => (x.isValidContentAndHasOverflow ? x.headerTextContent : null)}
31429
+ title=${x => (x.hasOverflow && x.headerTextContent ? x.headerTextContent : null)}
31378
31430
  >
31379
31431
  <slot ${ref('contentSlot')}></slot>
31380
31432
  </span>
@@ -31490,6 +31542,7 @@
31490
31542
  ${when(x => typeof x.cellRecord.href === 'string', html `
31491
31543
  <${anchorTag}
31492
31544
  ${ref('anchor')}
31545
+ ${overflow('hasOverflow')}
31493
31546
  href="${x => x.cellRecord.href}"
31494
31547
  hreflang="${x => x.columnConfig.hreflang}"
31495
31548
  ping="${x => x.columnConfig.ping}"
@@ -31500,27 +31553,15 @@
31500
31553
  download="${x => x.columnConfig.download}"
31501
31554
  underline-hidden="${x => x.columnConfig.underlineHidden}"
31502
31555
  appearance="${x => x.columnConfig.appearance}"
31503
- title=${x => (x.isValidContentAndHasOverflow ? x.content : null)}
31504
- @mouseover="${x => {
31505
- x.isValidContentAndHasOverflow = !!x.content && x.anchor.offsetWidth < x.anchor.scrollWidth;
31506
- }}"
31507
- @mouseout="${x => {
31508
- x.isValidContentAndHasOverflow = false;
31509
- }}"
31556
+ title=${x => (x.hasOverflow && x.content ? x.content : null)}
31510
31557
  >
31511
31558
  ${x => x.content}
31512
31559
  </${anchorTag}>`)}
31513
31560
  ${when(x => typeof x.cellRecord.href !== 'string', html `
31514
31561
  <span
31515
- ${ref('textSpan')}
31562
+ ${overflow('hasOverflow')}
31516
31563
  class="${x => (typeof x.cellRecord.label === 'string' ? '' : 'placeholder')}"
31517
- title=${x => (x.isValidContentAndHasOverflow ? x.content : null)}
31518
- @mouseover="${x => {
31519
- x.isValidContentAndHasOverflow = !!x.content && x.textSpan.offsetWidth < x.textSpan.scrollWidth;
31520
- }}"
31521
- @mouseout="${x => {
31522
- x.isValidContentAndHasOverflow = false;
31523
- }}"
31564
+ title=${x => (x.hasOverflow && x.content ? x.content : null)}
31524
31565
  >
31525
31566
  ${x => x.content}
31526
31567
  </span>`)}
@@ -31534,7 +31575,7 @@
31534
31575
  constructor() {
31535
31576
  super(...arguments);
31536
31577
  /** @internal */
31537
- this.isValidContentAndHasOverflow = false;
31578
+ this.hasOverflow = false;
31538
31579
  }
31539
31580
  get content() {
31540
31581
  if (typeof this.cellRecord.label === 'string') {
@@ -31551,7 +31592,7 @@
31551
31592
  }
31552
31593
  __decorate$1([
31553
31594
  observable
31554
- ], TableColumnAnchorCellView.prototype, "isValidContentAndHasOverflow", void 0);
31595
+ ], TableColumnAnchorCellView.prototype, "hasOverflow", void 0);
31555
31596
  __decorate$1([
31556
31597
  volatile
31557
31598
  ], TableColumnAnchorCellView.prototype, "content", null);
@@ -31587,14 +31628,6 @@
31587
31628
  get content() {
31588
31629
  return this.shouldUsePlaceholder ? this.placeholder : this.text;
31589
31630
  }
31590
- /** @internal */
31591
- updateTitleOverflow() {
31592
- this.hasOverflow = this.textSpan.offsetWidth < this.textSpan.scrollWidth;
31593
- }
31594
- /** @internal */
31595
- clearTitleOverflow() {
31596
- this.hasOverflow = false;
31597
- }
31598
31631
  }
31599
31632
  __decorate$1([
31600
31633
  observable
@@ -31614,10 +31647,8 @@
31614
31647
 
31615
31648
  const template$6 = html `
31616
31649
  <span
31617
- ${ref('textSpan')}
31650
+ ${overflow('hasOverflow')}
31618
31651
  class="${x => (x.shouldUsePlaceholder ? 'placeholder' : '')}"
31619
- @mouseover="${x => x.updateTitleOverflow()}"
31620
- @mouseout="${x => x.clearTitleOverflow()}"
31621
31652
  title="${x => (x.hasOverflow && x.content ? x.content : undefined)}"
31622
31653
  >
31623
31654
  ${x => x.content}
@@ -31810,15 +31841,9 @@
31810
31841
 
31811
31842
  const template$5 = html `
31812
31843
  <span
31813
- ${ref('textSpan')}
31844
+ ${overflow('hasOverflow')}
31814
31845
  class="${x => (x.shouldUsePlaceholder ? 'placeholder' : '')}"
31815
- @mouseover="${x => {
31816
- x.isValidContentAndHasOverflow = !!x.content && x.textSpan.offsetWidth < x.textSpan.scrollWidth;
31817
- }}"
31818
- @mouseout="${x => {
31819
- x.isValidContentAndHasOverflow = false;
31820
- }}"
31821
- title=${x => (x.isValidContentAndHasOverflow ? x.content : null)}
31846
+ title=${x => (x.hasOverflow && x.content ? x.content : null)}
31822
31847
  >
31823
31848
  ${x => x.content}
31824
31849
  </span>
@@ -31845,7 +31870,7 @@
31845
31870
  constructor() {
31846
31871
  super(...arguments);
31847
31872
  /** @internal */
31848
- this.isValidContentAndHasOverflow = false;
31873
+ this.hasOverflow = false;
31849
31874
  /**
31850
31875
  * Text to render in the cell when it contains a valid value (i.e. when shouldUsePlaceholder is false).
31851
31876
  */
@@ -31865,7 +31890,7 @@
31865
31890
  }
31866
31891
  __decorate$1([
31867
31892
  observable
31868
- ], TableColumnTextCellViewBase.prototype, "isValidContentAndHasOverflow", void 0);
31893
+ ], TableColumnTextCellViewBase.prototype, "hasOverflow", void 0);
31869
31894
  __decorate$1([
31870
31895
  observable
31871
31896
  ], TableColumnTextCellViewBase.prototype, "text", void 0);