@ni/nimble-components 18.6.0 → 18.6.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.
@@ -28809,13 +28809,26 @@
28809
28809
  }
28810
28810
  `;
28811
28811
 
28812
+ const getCellContent = (cellState) => {
28813
+ return typeof cellState.cellRecord.value === 'string'
28814
+ ? cellState.cellRecord.value
28815
+ : cellState.columnConfig.placeholder;
28816
+ };
28817
+ const setTitleWhenOverflow = (span, title) => {
28818
+ if (title && span.offsetWidth < span.scrollWidth) {
28819
+ span.setAttribute('title', title);
28820
+ }
28821
+ };
28822
+ const removeTitle = (span) => {
28823
+ span.removeAttribute('title');
28824
+ };
28812
28825
  const cellTemplate = html `
28813
28826
  <span
28814
28827
  class="${x => (typeof x.cellRecord.value === 'string' ? '' : 'placeholder')}"
28828
+ @mouseover="${(x, c) => setTitleWhenOverflow(c.event.target, getCellContent(x))}"
28829
+ @mouseout="${(_x, c) => removeTitle(c.event.target)}"
28815
28830
  >
28816
- ${x => (typeof x.cellRecord.value === 'string'
28817
- ? x.cellRecord.value
28818
- : x.columnConfig.placeholder)}
28831
+ ${x => getCellContent(x)}
28819
28832
  </span>
28820
28833
  `;
28821
28834