@ni/nimble-components 19.4.3 → 19.4.4

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 (33) hide show
  1. package/dist/all-components-bundle.js +71 -50
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +518 -525
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/src/table-column/anchor/cell-view/index.d.ts +1 -3
  6. package/dist/esm/src/table-column/base/index.d.ts +1 -3
  7. package/dist/esm/src/table-column/text-base/cell-view/index.d.ts +1 -3
  8. package/dist/esm/src/table-column/text-base/group-header-view/index.d.ts +0 -6
  9. package/dist/esm/src/utilities/directive/overflow.d.ts +36 -0
  10. package/dist/esm/table-column/anchor/cell-view/index.d.ts +1 -3
  11. package/dist/esm/table-column/anchor/cell-view/index.js +2 -2
  12. package/dist/esm/table-column/anchor/cell-view/index.js.map +1 -1
  13. package/dist/esm/table-column/anchor/cell-view/template.js +5 -15
  14. package/dist/esm/table-column/anchor/cell-view/template.js.map +1 -1
  15. package/dist/esm/table-column/base/index.d.ts +1 -3
  16. package/dist/esm/table-column/base/index.js +2 -2
  17. package/dist/esm/table-column/base/index.js.map +1 -1
  18. package/dist/esm/table-column/base/template.js +3 -9
  19. package/dist/esm/table-column/base/template.js.map +1 -1
  20. package/dist/esm/table-column/text-base/cell-view/index.d.ts +1 -3
  21. package/dist/esm/table-column/text-base/cell-view/index.js +2 -2
  22. package/dist/esm/table-column/text-base/cell-view/index.js.map +1 -1
  23. package/dist/esm/table-column/text-base/cell-view/template.js +4 -9
  24. package/dist/esm/table-column/text-base/cell-view/template.js.map +1 -1
  25. package/dist/esm/table-column/text-base/group-header-view/index.d.ts +0 -6
  26. package/dist/esm/table-column/text-base/group-header-view/index.js +0 -8
  27. package/dist/esm/table-column/text-base/group-header-view/index.js.map +1 -1
  28. package/dist/esm/table-column/text-base/group-header-view/template.js +3 -4
  29. package/dist/esm/table-column/text-base/group-header-view/template.js.map +1 -1
  30. package/dist/esm/utilities/directive/overflow.d.ts +36 -0
  31. package/dist/esm/utilities/directive/overflow.js +56 -0
  32. package/dist/esm/utilities/directive/overflow.js.map +1 -0
  33. 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 Fri, 30 Jun 2023 15:45:58 GMT
16236
16236
  */
16237
16237
  const Information100DarkUi = "#a46eff";
16238
16238
  const Information100LightUi = "#804ad9";
@@ -28253,7 +28253,7 @@
28253
28253
  this.sortDirection = TableColumnSortDirection.none;
28254
28254
  this.sortingDisabled = false;
28255
28255
  /** @internal */
28256
- this.isValidContentAndHasOverflow = false;
28256
+ this.hasOverflow = false;
28257
28257
  }
28258
28258
  checkValidity() {
28259
28259
  return this.columnInternals.validConfiguration;
@@ -28312,7 +28312,7 @@
28312
28312
  ], TableColumn.prototype, "sortingDisabled", void 0);
28313
28313
  __decorate$1([
28314
28314
  observable
28315
- ], TableColumn.prototype, "isValidContentAndHasOverflow", void 0);
28315
+ ], TableColumn.prototype, "hasOverflow", void 0);
28316
28316
 
28317
28317
  /**
28318
28318
  * Helper class for the nimble-table to validate that the table's configuration
@@ -31361,20 +31361,68 @@
31361
31361
  }
31362
31362
  `;
31363
31363
 
31364
+ /**
31365
+ * The runtime behavior for template overflow detection.
31366
+ * @public
31367
+ */
31368
+ class OverflowBehavior {
31369
+ /**
31370
+ * Creates an instance of OverflowBehavior.
31371
+ * @param target - The element to check for overflow.
31372
+ * @param propertyName - The name of the property to assign the overflow state to.
31373
+ */
31374
+ constructor(target, propertyName) {
31375
+ this.target = target;
31376
+ this.propertyName = propertyName;
31377
+ }
31378
+ /**
31379
+ * Bind this behavior to the source.
31380
+ * @param source - The source to bind to.
31381
+ * @param context - The execution context that the binding is operating within.
31382
+ */
31383
+ bind(source) {
31384
+ this.source = source;
31385
+ this.setSourceValue(false);
31386
+ this.mouseOverHandler = () => {
31387
+ const hasOverflow = this.target.offsetWidth < this.target.scrollWidth;
31388
+ this.setSourceValue(hasOverflow);
31389
+ };
31390
+ this.mouseOutHandler = () => {
31391
+ this.setSourceValue(false);
31392
+ };
31393
+ this.target.addEventListener('mouseover', this.mouseOverHandler);
31394
+ this.target.addEventListener('mouseout', this.mouseOutHandler);
31395
+ }
31396
+ /**
31397
+ * Unbinds this behavior from the source.
31398
+ * @param source - The source to unbind from.
31399
+ */
31400
+ unbind() {
31401
+ this.source = undefined;
31402
+ this.target.removeEventListener('mouseover', this.mouseOverHandler);
31403
+ this.target.removeEventListener('mouseout', this.mouseOutHandler);
31404
+ }
31405
+ setSourceValue(value) {
31406
+ // @ts-expect-error set property on source
31407
+ this.source[this.propertyName] = value;
31408
+ }
31409
+ }
31410
+ /**
31411
+ * A directive that observes if an element has overflow and sets a flag.
31412
+ * @param propertyName - The name of the property to assign the overflow flag.
31413
+ * @public
31414
+ */
31415
+ function overflow(propertyName) {
31416
+ return new AttachedBehaviorHTMLDirective('nimble-overflow', OverflowBehavior, propertyName);
31417
+ }
31418
+
31364
31419
  // prettier-ignore
31365
31420
  const template$8 = html `
31366
31421
  <template slot="${x => x.columnInternals.uniqueId}">
31367
31422
  <span
31368
- ${ref('headerSpan')}
31423
+ ${overflow('hasOverflow')}
31369
31424
  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)}
31425
+ title=${x => (x.hasOverflow && x.headerTextContent ? x.headerTextContent : null)}
31378
31426
  >
31379
31427
  <slot ${ref('contentSlot')}></slot>
31380
31428
  </span>
@@ -31490,6 +31538,7 @@
31490
31538
  ${when(x => typeof x.cellRecord.href === 'string', html `
31491
31539
  <${anchorTag}
31492
31540
  ${ref('anchor')}
31541
+ ${overflow('hasOverflow')}
31493
31542
  href="${x => x.cellRecord.href}"
31494
31543
  hreflang="${x => x.columnConfig.hreflang}"
31495
31544
  ping="${x => x.columnConfig.ping}"
@@ -31500,27 +31549,15 @@
31500
31549
  download="${x => x.columnConfig.download}"
31501
31550
  underline-hidden="${x => x.columnConfig.underlineHidden}"
31502
31551
  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
- }}"
31552
+ title=${x => (x.hasOverflow && x.content ? x.content : null)}
31510
31553
  >
31511
31554
  ${x => x.content}
31512
31555
  </${anchorTag}>`)}
31513
31556
  ${when(x => typeof x.cellRecord.href !== 'string', html `
31514
31557
  <span
31515
- ${ref('textSpan')}
31558
+ ${overflow('hasOverflow')}
31516
31559
  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
- }}"
31560
+ title=${x => (x.hasOverflow && x.content ? x.content : null)}
31524
31561
  >
31525
31562
  ${x => x.content}
31526
31563
  </span>`)}
@@ -31534,7 +31571,7 @@
31534
31571
  constructor() {
31535
31572
  super(...arguments);
31536
31573
  /** @internal */
31537
- this.isValidContentAndHasOverflow = false;
31574
+ this.hasOverflow = false;
31538
31575
  }
31539
31576
  get content() {
31540
31577
  if (typeof this.cellRecord.label === 'string') {
@@ -31551,7 +31588,7 @@
31551
31588
  }
31552
31589
  __decorate$1([
31553
31590
  observable
31554
- ], TableColumnAnchorCellView.prototype, "isValidContentAndHasOverflow", void 0);
31591
+ ], TableColumnAnchorCellView.prototype, "hasOverflow", void 0);
31555
31592
  __decorate$1([
31556
31593
  volatile
31557
31594
  ], TableColumnAnchorCellView.prototype, "content", null);
@@ -31587,14 +31624,6 @@
31587
31624
  get content() {
31588
31625
  return this.shouldUsePlaceholder ? this.placeholder : this.text;
31589
31626
  }
31590
- /** @internal */
31591
- updateTitleOverflow() {
31592
- this.hasOverflow = this.textSpan.offsetWidth < this.textSpan.scrollWidth;
31593
- }
31594
- /** @internal */
31595
- clearTitleOverflow() {
31596
- this.hasOverflow = false;
31597
- }
31598
31627
  }
31599
31628
  __decorate$1([
31600
31629
  observable
@@ -31614,10 +31643,8 @@
31614
31643
 
31615
31644
  const template$6 = html `
31616
31645
  <span
31617
- ${ref('textSpan')}
31646
+ ${overflow('hasOverflow')}
31618
31647
  class="${x => (x.shouldUsePlaceholder ? 'placeholder' : '')}"
31619
- @mouseover="${x => x.updateTitleOverflow()}"
31620
- @mouseout="${x => x.clearTitleOverflow()}"
31621
31648
  title="${x => (x.hasOverflow && x.content ? x.content : undefined)}"
31622
31649
  >
31623
31650
  ${x => x.content}
@@ -31810,15 +31837,9 @@
31810
31837
 
31811
31838
  const template$5 = html `
31812
31839
  <span
31813
- ${ref('textSpan')}
31840
+ ${overflow('hasOverflow')}
31814
31841
  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)}
31842
+ title=${x => (x.hasOverflow && x.content ? x.content : null)}
31822
31843
  >
31823
31844
  ${x => x.content}
31824
31845
  </span>
@@ -31845,7 +31866,7 @@
31845
31866
  constructor() {
31846
31867
  super(...arguments);
31847
31868
  /** @internal */
31848
- this.isValidContentAndHasOverflow = false;
31869
+ this.hasOverflow = false;
31849
31870
  /**
31850
31871
  * Text to render in the cell when it contains a valid value (i.e. when shouldUsePlaceholder is false).
31851
31872
  */
@@ -31865,7 +31886,7 @@
31865
31886
  }
31866
31887
  __decorate$1([
31867
31888
  observable
31868
- ], TableColumnTextCellViewBase.prototype, "isValidContentAndHasOverflow", void 0);
31889
+ ], TableColumnTextCellViewBase.prototype, "hasOverflow", void 0);
31869
31890
  __decorate$1([
31870
31891
  observable
31871
31892
  ], TableColumnTextCellViewBase.prototype, "text", void 0);