@ni/nimble-components 18.6.0 → 18.6.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.
@@ -28738,7 +28738,13 @@
28738
28738
  const generatedColumns = this.columns.map(column => {
28739
28739
  const columnDef = {
28740
28740
  id: column.internalUniqueId,
28741
- accessorKey: column.operandDataRecordFieldName,
28741
+ accessorFn: (data) => {
28742
+ const fieldName = column.operandDataRecordFieldName;
28743
+ if (typeof fieldName !== 'string') {
28744
+ return undefined;
28745
+ }
28746
+ return data[fieldName];
28747
+ },
28742
28748
  sortingFn: getTanStackSortingFunction(column.sortOperation)
28743
28749
  };
28744
28750
  return columnDef;
@@ -28809,13 +28815,26 @@
28809
28815
  }
28810
28816
  `;
28811
28817
 
28818
+ const getCellContent = (cellState) => {
28819
+ return typeof cellState.cellRecord.value === 'string'
28820
+ ? cellState.cellRecord.value
28821
+ : cellState.columnConfig.placeholder;
28822
+ };
28823
+ const setTitleWhenOverflow = (span, title) => {
28824
+ if (title && span.offsetWidth < span.scrollWidth) {
28825
+ span.setAttribute('title', title);
28826
+ }
28827
+ };
28828
+ const removeTitle = (span) => {
28829
+ span.removeAttribute('title');
28830
+ };
28812
28831
  const cellTemplate = html `
28813
28832
  <span
28814
28833
  class="${x => (typeof x.cellRecord.value === 'string' ? '' : 'placeholder')}"
28834
+ @mouseover="${(x, c) => setTitleWhenOverflow(c.event.target, getCellContent(x))}"
28835
+ @mouseout="${(_x, c) => removeTitle(c.event.target)}"
28815
28836
  >
28816
- ${x => (typeof x.cellRecord.value === 'string'
28817
- ? x.cellRecord.value
28818
- : x.columnConfig.placeholder)}
28837
+ ${x => getCellContent(x)}
28819
28838
  </span>
28820
28839
  `;
28821
28840