@ni/nimble-components 18.0.1 → 18.0.3

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.
@@ -22532,7 +22532,7 @@
22532
22532
  recurse(arr);
22533
22533
  return flat;
22534
22534
  }
22535
- function memo(getDeps, fn, opts) {
22535
+ function memo$1(getDeps, fn, opts) {
22536
22536
  let deps = [];
22537
22537
  let result;
22538
22538
  return () => {
@@ -22611,7 +22611,7 @@
22611
22611
  depth,
22612
22612
  columnDef: resolvedColumnDef,
22613
22613
  columns: [],
22614
- getFlatColumns: memo(() => [true], () => {
22614
+ getFlatColumns: memo$1(() => [true], () => {
22615
22615
  var _column$columns;
22616
22616
  return [column, ...((_column$columns = column.columns) == null ? void 0 : _column$columns.flatMap(d => d.getFlatColumns()))];
22617
22617
  }, {
@@ -22621,7 +22621,7 @@
22621
22621
  return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugColumns;
22622
22622
  }
22623
22623
  }),
22624
- getLeafColumns: memo(() => [table._getOrderColumnsFn()], orderColumns => {
22624
+ getLeafColumns: memo$1(() => [table._getOrderColumnsFn()], orderColumns => {
22625
22625
  var _column$columns2;
22626
22626
  if ((_column$columns2 = column.columns) != null && _column$columns2.length) {
22627
22627
  let leafColumns = column.columns.flatMap(column => column.getLeafColumns());
@@ -22687,7 +22687,7 @@
22687
22687
  return {
22688
22688
  // Header Groups
22689
22689
 
22690
- getHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
22690
+ getHeaderGroups: memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
22691
22691
  var _left$map$filter, _right$map$filter;
22692
22692
  const leftColumns = (_left$map$filter = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter : [];
22693
22693
  const rightColumns = (_right$map$filter = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter : [];
@@ -22701,7 +22701,7 @@
22701
22701
  return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugHeaders;
22702
22702
  }
22703
22703
  }),
22704
- getCenterHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
22704
+ getCenterHeaderGroups: memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, leafColumns, left, right) => {
22705
22705
  leafColumns = leafColumns.filter(column => !(left != null && left.includes(column.id)) && !(right != null && right.includes(column.id)));
22706
22706
  return buildHeaderGroups(allColumns, leafColumns, table, 'center');
22707
22707
  }, {
@@ -22711,7 +22711,7 @@
22711
22711
  return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugHeaders;
22712
22712
  }
22713
22713
  }),
22714
- getLeftHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
22714
+ getLeftHeaderGroups: memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.left], (allColumns, leafColumns, left) => {
22715
22715
  var _left$map$filter2;
22716
22716
  const orderedLeafColumns = (_left$map$filter2 = left == null ? void 0 : left.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _left$map$filter2 : [];
22717
22717
  return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'left');
@@ -22722,7 +22722,7 @@
22722
22722
  return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugHeaders;
22723
22723
  }
22724
22724
  }),
22725
- getRightHeaderGroups: memo(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
22725
+ getRightHeaderGroups: memo$1(() => [table.getAllColumns(), table.getVisibleLeafColumns(), table.getState().columnPinning.right], (allColumns, leafColumns, right) => {
22726
22726
  var _right$map$filter2;
22727
22727
  const orderedLeafColumns = (_right$map$filter2 = right == null ? void 0 : right.map(columnId => leafColumns.find(d => d.id === columnId)).filter(Boolean)) != null ? _right$map$filter2 : [];
22728
22728
  return buildHeaderGroups(allColumns, orderedLeafColumns, table, 'right');
@@ -22735,7 +22735,7 @@
22735
22735
  }),
22736
22736
  // Footer Groups
22737
22737
 
22738
- getFooterGroups: memo(() => [table.getHeaderGroups()], headerGroups => {
22738
+ getFooterGroups: memo$1(() => [table.getHeaderGroups()], headerGroups => {
22739
22739
  return [...headerGroups].reverse();
22740
22740
  }, {
22741
22741
  key: 'getFooterGroups',
@@ -22744,7 +22744,7 @@
22744
22744
  return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugHeaders;
22745
22745
  }
22746
22746
  }),
22747
- getLeftFooterGroups: memo(() => [table.getLeftHeaderGroups()], headerGroups => {
22747
+ getLeftFooterGroups: memo$1(() => [table.getLeftHeaderGroups()], headerGroups => {
22748
22748
  return [...headerGroups].reverse();
22749
22749
  }, {
22750
22750
  key: 'getLeftFooterGroups',
@@ -22753,7 +22753,7 @@
22753
22753
  return (_table$options$debugA6 = table.options.debugAll) != null ? _table$options$debugA6 : table.options.debugHeaders;
22754
22754
  }
22755
22755
  }),
22756
- getCenterFooterGroups: memo(() => [table.getCenterHeaderGroups()], headerGroups => {
22756
+ getCenterFooterGroups: memo$1(() => [table.getCenterHeaderGroups()], headerGroups => {
22757
22757
  return [...headerGroups].reverse();
22758
22758
  }, {
22759
22759
  key: 'getCenterFooterGroups',
@@ -22762,7 +22762,7 @@
22762
22762
  return (_table$options$debugA7 = table.options.debugAll) != null ? _table$options$debugA7 : table.options.debugHeaders;
22763
22763
  }
22764
22764
  }),
22765
- getRightFooterGroups: memo(() => [table.getRightHeaderGroups()], headerGroups => {
22765
+ getRightFooterGroups: memo$1(() => [table.getRightHeaderGroups()], headerGroups => {
22766
22766
  return [...headerGroups].reverse();
22767
22767
  }, {
22768
22768
  key: 'getRightFooterGroups',
@@ -22773,7 +22773,7 @@
22773
22773
  }),
22774
22774
  // Flat Headers
22775
22775
 
22776
- getFlatHeaders: memo(() => [table.getHeaderGroups()], headerGroups => {
22776
+ getFlatHeaders: memo$1(() => [table.getHeaderGroups()], headerGroups => {
22777
22777
  return headerGroups.map(headerGroup => {
22778
22778
  return headerGroup.headers;
22779
22779
  }).flat();
@@ -22784,7 +22784,7 @@
22784
22784
  return (_table$options$debugA9 = table.options.debugAll) != null ? _table$options$debugA9 : table.options.debugHeaders;
22785
22785
  }
22786
22786
  }),
22787
- getLeftFlatHeaders: memo(() => [table.getLeftHeaderGroups()], left => {
22787
+ getLeftFlatHeaders: memo$1(() => [table.getLeftHeaderGroups()], left => {
22788
22788
  return left.map(headerGroup => {
22789
22789
  return headerGroup.headers;
22790
22790
  }).flat();
@@ -22795,7 +22795,7 @@
22795
22795
  return (_table$options$debugA10 = table.options.debugAll) != null ? _table$options$debugA10 : table.options.debugHeaders;
22796
22796
  }
22797
22797
  }),
22798
- getCenterFlatHeaders: memo(() => [table.getCenterHeaderGroups()], left => {
22798
+ getCenterFlatHeaders: memo$1(() => [table.getCenterHeaderGroups()], left => {
22799
22799
  return left.map(headerGroup => {
22800
22800
  return headerGroup.headers;
22801
22801
  }).flat();
@@ -22806,7 +22806,7 @@
22806
22806
  return (_table$options$debugA11 = table.options.debugAll) != null ? _table$options$debugA11 : table.options.debugHeaders;
22807
22807
  }
22808
22808
  }),
22809
- getRightFlatHeaders: memo(() => [table.getRightHeaderGroups()], left => {
22809
+ getRightFlatHeaders: memo$1(() => [table.getRightHeaderGroups()], left => {
22810
22810
  return left.map(headerGroup => {
22811
22811
  return headerGroup.headers;
22812
22812
  }).flat();
@@ -22819,7 +22819,7 @@
22819
22819
  }),
22820
22820
  // Leaf Headers
22821
22821
 
22822
- getCenterLeafHeaders: memo(() => [table.getCenterFlatHeaders()], flatHeaders => {
22822
+ getCenterLeafHeaders: memo$1(() => [table.getCenterFlatHeaders()], flatHeaders => {
22823
22823
  return flatHeaders.filter(header => {
22824
22824
  var _header$subHeaders;
22825
22825
  return !((_header$subHeaders = header.subHeaders) != null && _header$subHeaders.length);
@@ -22831,7 +22831,7 @@
22831
22831
  return (_table$options$debugA13 = table.options.debugAll) != null ? _table$options$debugA13 : table.options.debugHeaders;
22832
22832
  }
22833
22833
  }),
22834
- getLeftLeafHeaders: memo(() => [table.getLeftFlatHeaders()], flatHeaders => {
22834
+ getLeftLeafHeaders: memo$1(() => [table.getLeftFlatHeaders()], flatHeaders => {
22835
22835
  return flatHeaders.filter(header => {
22836
22836
  var _header$subHeaders2;
22837
22837
  return !((_header$subHeaders2 = header.subHeaders) != null && _header$subHeaders2.length);
@@ -22843,7 +22843,7 @@
22843
22843
  return (_table$options$debugA14 = table.options.debugAll) != null ? _table$options$debugA14 : table.options.debugHeaders;
22844
22844
  }
22845
22845
  }),
22846
- getRightLeafHeaders: memo(() => [table.getRightFlatHeaders()], flatHeaders => {
22846
+ getRightLeafHeaders: memo$1(() => [table.getRightFlatHeaders()], flatHeaders => {
22847
22847
  return flatHeaders.filter(header => {
22848
22848
  var _header$subHeaders3;
22849
22849
  return !((_header$subHeaders3 = header.subHeaders) != null && _header$subHeaders3.length);
@@ -22855,7 +22855,7 @@
22855
22855
  return (_table$options$debugA15 = table.options.debugAll) != null ? _table$options$debugA15 : table.options.debugHeaders;
22856
22856
  }
22857
22857
  }),
22858
- getLeafHeaders: memo(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
22858
+ getLeafHeaders: memo$1(() => [table.getLeftHeaderGroups(), table.getCenterHeaderGroups(), table.getRightHeaderGroups()], (left, center, right) => {
22859
22859
  var _left$0$headers, _left$, _center$0$headers, _center$, _right$0$headers, _right$;
22860
22860
  return [...((_left$0$headers = (_left$ = left[0]) == null ? void 0 : _left$.headers) != null ? _left$0$headers : []), ...((_center$0$headers = (_center$ = center[0]) == null ? void 0 : _center$.headers) != null ? _center$0$headers : []), ...((_right$0$headers = (_right$ = right[0]) == null ? void 0 : _right$.headers) != null ? _right$0$headers : [])].map(header => {
22861
22861
  return header.getLeafHeaders();
@@ -23935,7 +23935,7 @@
23935
23935
  var _table$initialState$c;
23936
23936
  table.setColumnOrder(defaultState ? [] : (_table$initialState$c = table.initialState.columnOrder) != null ? _table$initialState$c : []);
23937
23937
  },
23938
- _getOrderColumnsFn: memo(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
23938
+ _getOrderColumnsFn: memo$1(() => [table.getState().columnOrder, table.getState().grouping, table.options.groupedColumnMode], (columnOrder, grouping, groupedColumnMode) => columns => {
23939
23939
  // Sort grouped columns to the start of the column list
23940
23940
  // before the headers are built
23941
23941
  let orderedColumns = [];
@@ -24069,7 +24069,7 @@
24069
24069
  pageCount: newPageCount
24070
24070
  };
24071
24071
  }),
24072
- getPageOptions: memo(() => [table.getPageCount()], pageCount => {
24072
+ getPageOptions: memo$1(() => [table.getPageCount()], pageCount => {
24073
24073
  let pageOptions = [];
24074
24074
  if (pageCount && pageCount > 0) {
24075
24075
  pageOptions = [...new Array(pageCount)].fill(null).map((_, i) => i);
@@ -24192,7 +24192,7 @@
24192
24192
  },
24193
24193
  createRow: (row, table) => {
24194
24194
  return {
24195
- getCenterVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
24195
+ getCenterVisibleCells: memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allCells, left, right) => {
24196
24196
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
24197
24197
  return allCells.filter(d => !leftAndRight.includes(d.column.id));
24198
24198
  }, {
@@ -24202,7 +24202,7 @@
24202
24202
  return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
24203
24203
  }
24204
24204
  }),
24205
- getLeftVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
24205
+ getLeftVisibleCells: memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.left,,], (allCells, left) => {
24206
24206
  const cells = (left != null ? left : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
24207
24207
  ...d,
24208
24208
  position: 'left'
@@ -24215,7 +24215,7 @@
24215
24215
  return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugRows;
24216
24216
  }
24217
24217
  }),
24218
- getRightVisibleCells: memo(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
24218
+ getRightVisibleCells: memo$1(() => [row._getAllVisibleCells(), table.getState().columnPinning.right], (allCells, right) => {
24219
24219
  const cells = (right != null ? right : []).map(columnId => allCells.find(cell => cell.column.id === columnId)).filter(Boolean).map(d => ({
24220
24220
  ...d,
24221
24221
  position: 'right'
@@ -24246,7 +24246,7 @@
24246
24246
  }
24247
24247
  return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
24248
24248
  },
24249
- getLeftLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
24249
+ getLeftLeafColumns: memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left], (allColumns, left) => {
24250
24250
  return (left != null ? left : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
24251
24251
  }, {
24252
24252
  key: 'getLeftLeafColumns',
@@ -24255,7 +24255,7 @@
24255
24255
  return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
24256
24256
  }
24257
24257
  }),
24258
- getRightLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
24258
+ getRightLeafColumns: memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.right], (allColumns, right) => {
24259
24259
  return (right != null ? right : []).map(columnId => allColumns.find(column => column.id === columnId)).filter(Boolean);
24260
24260
  }, {
24261
24261
  key: 'getRightLeafColumns',
@@ -24264,7 +24264,7 @@
24264
24264
  return (_table$options$debugA5 = table.options.debugAll) != null ? _table$options$debugA5 : table.options.debugColumns;
24265
24265
  }
24266
24266
  }),
24267
- getCenterLeafColumns: memo(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
24267
+ getCenterLeafColumns: memo$1(() => [table.getAllLeafColumns(), table.getState().columnPinning.left, table.getState().columnPinning.right], (allColumns, left, right) => {
24268
24268
  const leftAndRight = [...(left != null ? left : []), ...(right != null ? right : [])];
24269
24269
  return allColumns.filter(d => !leftAndRight.includes(d.id));
24270
24270
  }, {
@@ -24400,7 +24400,7 @@
24400
24400
  // table.setRowSelection(selectedRowIds)
24401
24401
  // },
24402
24402
  getPreSelectedRowModel: () => table.getCoreRowModel(),
24403
- getSelectedRowModel: memo(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
24403
+ getSelectedRowModel: memo$1(() => [table.getState().rowSelection, table.getCoreRowModel()], (rowSelection, rowModel) => {
24404
24404
  if (!Object.keys(rowSelection).length) {
24405
24405
  return {
24406
24406
  rows: [],
@@ -24416,7 +24416,7 @@
24416
24416
  return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugTable;
24417
24417
  }
24418
24418
  }),
24419
- getFilteredSelectedRowModel: memo(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
24419
+ getFilteredSelectedRowModel: memo$1(() => [table.getState().rowSelection, table.getFilteredRowModel()], (rowSelection, rowModel) => {
24420
24420
  if (!Object.keys(rowSelection).length) {
24421
24421
  return {
24422
24422
  rows: [],
@@ -24432,7 +24432,7 @@
24432
24432
  return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugTable;
24433
24433
  }
24434
24434
  }),
24435
- getGroupedSelectedRowModel: memo(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
24435
+ getGroupedSelectedRowModel: memo$1(() => [table.getState().rowSelection, table.getSortedRowModel()], (rowSelection, rowModel) => {
24436
24436
  if (!Object.keys(rowSelection).length) {
24437
24437
  return {
24438
24438
  rows: [],
@@ -25014,7 +25014,7 @@
25014
25014
  },
25015
25015
  createRow: (row, table) => {
25016
25016
  return {
25017
- _getAllVisibleCells: memo(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
25017
+ _getAllVisibleCells: memo$1(() => [row.getAllCells(), table.getState().columnVisibility], cells => {
25018
25018
  return cells.filter(cell => cell.column.getIsVisible());
25019
25019
  }, {
25020
25020
  key: "development" === 'production' ,
@@ -25023,7 +25023,7 @@
25023
25023
  return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
25024
25024
  }
25025
25025
  }),
25026
- getVisibleCells: memo(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
25026
+ getVisibleCells: memo$1(() => [row.getLeftVisibleCells(), row.getCenterVisibleCells(), row.getRightVisibleCells()], (left, center, right) => [...left, ...center, ...right], {
25027
25027
  key: 'row.getVisibleCells',
25028
25028
  debug: () => {
25029
25029
  var _table$options$debugA2;
@@ -25034,7 +25034,7 @@
25034
25034
  },
25035
25035
  createTable: table => {
25036
25036
  const makeVisibleColumnsMethod = (key, getColumns) => {
25037
- return memo(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
25037
+ return memo$1(() => [getColumns(), getColumns().filter(d => d.getIsVisible()).map(d => d.id).join('_')], columns => {
25038
25038
  return columns.filter(d => d.getIsVisible == null ? void 0 : d.getIsVisible());
25039
25039
  }, {
25040
25040
  key,
@@ -25172,7 +25172,7 @@
25172
25172
  }
25173
25173
  return row;
25174
25174
  },
25175
- _getDefaultColumnDef: memo(() => [table.options.defaultColumn], defaultColumn => {
25175
+ _getDefaultColumnDef: memo$1(() => [table.options.defaultColumn], defaultColumn => {
25176
25176
  var _defaultColumn;
25177
25177
  defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
25178
25178
  return {
@@ -25204,7 +25204,7 @@
25204
25204
  key: 'getDefaultColumnDef'
25205
25205
  }),
25206
25206
  _getColumnDefs: () => table.options.columns,
25207
- getAllColumns: memo(() => [table._getColumnDefs()], columnDefs => {
25207
+ getAllColumns: memo$1(() => [table._getColumnDefs()], columnDefs => {
25208
25208
  const recurseColumns = function (columnDefs, parent, depth) {
25209
25209
  if (depth === void 0) {
25210
25210
  depth = 0;
@@ -25224,7 +25224,7 @@
25224
25224
  return (_table$options$debugA2 = table.options.debugAll) != null ? _table$options$debugA2 : table.options.debugColumns;
25225
25225
  }
25226
25226
  }),
25227
- getAllFlatColumns: memo(() => [table.getAllColumns()], allColumns => {
25227
+ getAllFlatColumns: memo$1(() => [table.getAllColumns()], allColumns => {
25228
25228
  return allColumns.flatMap(column => {
25229
25229
  return column.getFlatColumns();
25230
25230
  });
@@ -25235,7 +25235,7 @@
25235
25235
  return (_table$options$debugA3 = table.options.debugAll) != null ? _table$options$debugA3 : table.options.debugColumns;
25236
25236
  }
25237
25237
  }),
25238
- _getAllFlatColumnsById: memo(() => [table.getAllFlatColumns()], flatColumns => {
25238
+ _getAllFlatColumnsById: memo$1(() => [table.getAllFlatColumns()], flatColumns => {
25239
25239
  return flatColumns.reduce((acc, column) => {
25240
25240
  acc[column.id] = column;
25241
25241
  return acc;
@@ -25247,7 +25247,7 @@
25247
25247
  return (_table$options$debugA4 = table.options.debugAll) != null ? _table$options$debugA4 : table.options.debugColumns;
25248
25248
  }
25249
25249
  }),
25250
- getAllLeafColumns: memo(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {
25250
+ getAllLeafColumns: memo$1(() => [table.getAllColumns(), table._getOrderColumnsFn()], (allColumns, orderColumns) => {
25251
25251
  let leafColumns = allColumns.flatMap(column => column.getLeafColumns());
25252
25252
  return orderColumns(leafColumns);
25253
25253
  }, {
@@ -25286,7 +25286,7 @@
25286
25286
  column,
25287
25287
  getValue: () => row.getValue(columnId),
25288
25288
  renderValue: getRenderValue,
25289
- getContext: memo(() => [table, column, row, cell], (table, column, row, cell) => ({
25289
+ getContext: memo$1(() => [table, column, row, cell], (table, column, row, cell) => ({
25290
25290
  table,
25291
25291
  column,
25292
25292
  row,
@@ -25344,7 +25344,7 @@
25344
25344
  },
25345
25345
  subRows: subRows != null ? subRows : [],
25346
25346
  getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
25347
- getAllCells: memo(() => [table.getAllLeafColumns()], leafColumns => {
25347
+ getAllCells: memo$1(() => [table.getAllLeafColumns()], leafColumns => {
25348
25348
  return leafColumns.map(column => {
25349
25349
  return createCell(table, row, column, column.id);
25350
25350
  });
@@ -25355,7 +25355,7 @@
25355
25355
  return (_table$options$debugA = table.options.debugAll) != null ? _table$options$debugA : table.options.debugRows;
25356
25356
  }
25357
25357
  }),
25358
- _getAllCellsByColumnId: memo(() => [row.getAllCells()], allCells => {
25358
+ _getAllCellsByColumnId: memo$1(() => [row.getAllCells()], allCells => {
25359
25359
  return allCells.reduce((acc, cell) => {
25360
25360
  acc[cell.column.id] = cell;
25361
25361
  return acc;
@@ -25376,7 +25376,7 @@
25376
25376
  };
25377
25377
 
25378
25378
  function getCoreRowModel() {
25379
- return table => memo(() => [table.options.data], data => {
25379
+ return table => memo$1(() => [table.options.data], data => {
25380
25380
  const rowModel = {
25381
25381
  rows: [],
25382
25382
  flatRows: [],
@@ -25485,13 +25485,37 @@
25485
25485
  const styles$d = css `
25486
25486
  ${display('flex')}
25487
25487
 
25488
+ :host {
25489
+ height: 480px;
25490
+ }
25491
+
25488
25492
  .table-container {
25489
25493
  display: flex;
25490
25494
  flex-direction: column;
25491
25495
  width: 100%;
25492
25496
  font: ${bodyFont};
25493
25497
  color: ${bodyFontColor};
25494
- overflow: auto;
25498
+ }
25499
+
25500
+ .table-viewport {
25501
+ overflow-y: auto;
25502
+ display: block;
25503
+ height: 100%;
25504
+ position: relative;
25505
+ }
25506
+
25507
+ .table-scroll {
25508
+ pointer-events: none;
25509
+ position: absolute;
25510
+ top: 0px;
25511
+ width: 100%;
25512
+ }
25513
+
25514
+ .table-row-container {
25515
+ width: 100%;
25516
+ position: sticky;
25517
+ overflow: hidden;
25518
+ top: 0px;
25495
25519
  }
25496
25520
 
25497
25521
  .header-container {
@@ -25659,12 +25683,12 @@
25659
25683
  // prettier-ignore
25660
25684
  const template$5 = html `
25661
25685
  <template role="row">
25662
- ${repeat(x => x.columns, html `
25686
+ ${repeat(x => x.columnStates, html `
25663
25687
  <${DesignSystem.tagFor(TableCell)}
25664
25688
  class="cell"
25665
- :cellTemplate="${x => x.cellTemplate}"
25666
- :cellStyles="${x => x.cellStyles}"
25667
- :cellState="${(x, c) => c.parent.getCellState(x)}"
25689
+ :cellTemplate="${x => x.column.cellTemplate}"
25690
+ :cellStyles="${x => x.column.cellStyles}"
25691
+ :cellState="${x => x.cellState}"
25668
25692
  >
25669
25693
  </${DesignSystem.tagFor(TableCell)}>
25670
25694
  `)}
@@ -25680,22 +25704,27 @@
25680
25704
  super(...arguments);
25681
25705
  this.columns = [];
25682
25706
  }
25683
- getCellState(column) {
25684
- const fieldNames = column.getDataRecordFieldNames();
25685
- if (this.hasValidFieldNames(fieldNames) && this.dataRecord) {
25686
- const cellDataValues = fieldNames.map(field => this.dataRecord[field]);
25687
- const cellRecord = Object.fromEntries(column.cellRecordFieldNames.map((k, i) => [
25688
- k,
25689
- cellDataValues[i]
25690
- ]));
25691
- const columnConfig = column.getColumnConfig?.() ?? {};
25692
- const cellState = {
25693
- cellRecord,
25694
- columnConfig
25695
- };
25696
- return cellState;
25697
- }
25698
- return { cellRecord: {}, columnConfig: {} };
25707
+ get columnStates() {
25708
+ return this.columns.map(column => {
25709
+ const fieldNames = column.getDataRecordFieldNames();
25710
+ let cellState;
25711
+ if (this.hasValidFieldNames(fieldNames) && this.dataRecord) {
25712
+ const cellDataValues = fieldNames.map(field => this.dataRecord[field]);
25713
+ const cellRecord = Object.fromEntries(column.cellRecordFieldNames.map((k, i) => [
25714
+ k,
25715
+ cellDataValues[i]
25716
+ ]));
25717
+ const columnConfig = column.getColumnConfig?.() ?? {};
25718
+ cellState = {
25719
+ cellRecord,
25720
+ columnConfig
25721
+ };
25722
+ }
25723
+ else {
25724
+ cellState = { cellRecord: {}, columnConfig: {} };
25725
+ }
25726
+ return { column, cellState };
25727
+ });
25699
25728
  }
25700
25729
  hasValidFieldNames(keys) {
25701
25730
  return keys.every(key => key !== undefined);
@@ -25710,6 +25739,9 @@
25710
25739
  __decorate$1([
25711
25740
  observable
25712
25741
  ], TableRow.prototype, "columns", void 0);
25742
+ __decorate$1([
25743
+ volatile
25744
+ ], TableRow.prototype, "columnStates", null);
25713
25745
  const nimbleTableRow = TableRow.compose({
25714
25746
  baseName: 'table-row',
25715
25747
  template: template$5,
@@ -25733,7 +25765,7 @@
25733
25765
  const template$4 = html `
25734
25766
  <template role="table">
25735
25767
  <div class="table-container">
25736
- <div role="rowgroup" class="header-container">
25768
+ <div role="rowgroup" class="header-container" style="margin-right: ${x => x.virtualizer.headerContainerMarginRight}px;">
25737
25769
  <div class="header-row" role="row">
25738
25770
  ${repeat(x => x.columns, html `
25739
25771
  <${DesignSystem.tagFor(TableHeader)} class="header">
@@ -25742,37 +25774,708 @@
25742
25774
  `)}
25743
25775
  </div>
25744
25776
  </div>
25745
- <div class="table-viewport" role="rowgroup">
25746
- ${when(x => x.columns.length > 0, html `
25747
- ${repeat(x => x.tableData, html `
25748
- <${DesignSystem.tagFor(TableRow)}
25749
- class="row"
25750
- record-id="${x => x.id}"
25751
- :dataRecord="${x => x.record}"
25752
- :columns="${(_, c) => c.parent.columns}"
25753
- >
25754
- </${DesignSystem.tagFor(TableRow)}>
25755
- `)}
25756
- `)}
25777
+ <div class="table-viewport" ${ref('viewport')}>
25778
+ <div class="table-scroll" style="height: ${x => x.virtualizer.allRowsHeight}px;"></div>
25779
+ <div class="table-row-container" role="rowgroup" style="transform: ${x => (x.virtualizer.rowContainerYOffset === 0 ? 'none' : `translateY(${x.virtualizer.rowContainerYOffset}px)`)};">
25780
+ ${when(x => x.columns.length > 0 && x.canRenderRows, html `
25781
+ ${repeat(x => x.virtualizer.visibleItems, html `
25782
+ <${DesignSystem.tagFor(TableRow)}
25783
+ class="row"
25784
+ record-id="${(x, c) => c.parent.tableData[x.index]?.id}"
25785
+ :dataRecord="${(x, c) => c.parent.tableData[x.index]?.record}"
25786
+ :columns="${(_, c) => c.parent.columns}"
25787
+ style="height: ${x => x.size}px;"
25788
+ >
25789
+ </${DesignSystem.tagFor(TableRow)}>
25790
+ `)}
25791
+ `)}
25792
+ </div>
25757
25793
  </div>
25758
25794
  </div>
25759
25795
  <slot ${slotted({ property: 'columns', filter: isTableColumn() })}></slot>
25760
25796
  </template>
25761
25797
  `;
25762
25798
 
25799
+ /**
25800
+ * virtual-core
25801
+ *
25802
+ * Copyright (c) TanStack
25803
+ *
25804
+ * This source code is licensed under the MIT license found in the
25805
+ * LICENSE.md file in the root directory of this source tree.
25806
+ *
25807
+ * @license MIT
25808
+ */
25809
+ function _extends() {
25810
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
25811
+ for (var i = 1; i < arguments.length; i++) {
25812
+ var source = arguments[i];
25813
+ for (var key in source) {
25814
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
25815
+ target[key] = source[key];
25816
+ }
25817
+ }
25818
+ }
25819
+ return target;
25820
+ };
25821
+ return _extends.apply(this, arguments);
25822
+ }
25823
+
25824
+ /**
25825
+ * virtual-core
25826
+ *
25827
+ * Copyright (c) TanStack
25828
+ *
25829
+ * This source code is licensed under the MIT license found in the
25830
+ * LICENSE.md file in the root directory of this source tree.
25831
+ *
25832
+ * @license MIT
25833
+ */
25834
+ function memo(getDeps, fn, opts) {
25835
+ var deps = [];
25836
+ var result;
25837
+ return function () {
25838
+ var depTime;
25839
+ if (opts.key && opts.debug != null && opts.debug()) depTime = Date.now();
25840
+ var newDeps = getDeps();
25841
+ var depsChanged = newDeps.length !== deps.length || newDeps.some(function (dep, index) {
25842
+ return deps[index] !== dep;
25843
+ });
25844
+ if (!depsChanged) {
25845
+ return result;
25846
+ }
25847
+ deps = newDeps;
25848
+ var resultTime;
25849
+ if (opts.key && opts.debug != null && opts.debug()) resultTime = Date.now();
25850
+ result = fn.apply(void 0, newDeps);
25851
+ opts == null ? void 0 : opts.onChange == null ? void 0 : opts.onChange(result);
25852
+ if (opts.key && opts.debug != null && opts.debug()) {
25853
+ var depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
25854
+ var resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
25855
+ var resultFpsPercentage = resultEndTime / 16;
25856
+ var pad = function pad(str, num) {
25857
+ str = String(str);
25858
+ while (str.length < num) {
25859
+ str = ' ' + str;
25860
+ }
25861
+ return str;
25862
+ };
25863
+ console.info("%c\u23F1 " + pad(resultEndTime, 5) + " /" + pad(depEndTime, 5) + " ms", "\n font-size: .6rem;\n font-weight: bold;\n color: hsl(" + Math.max(0, Math.min(120 - 120 * resultFpsPercentage, 120)) + "deg 100% 31%);", opts == null ? void 0 : opts.key);
25864
+ }
25865
+ return result;
25866
+ };
25867
+ }
25868
+
25869
+ /**
25870
+ * virtual-core
25871
+ *
25872
+ * Copyright (c) TanStack
25873
+ *
25874
+ * This source code is licensed under the MIT license found in the
25875
+ * LICENSE.md file in the root directory of this source tree.
25876
+ *
25877
+ * @license MIT
25878
+ */
25879
+
25880
+ //
25881
+
25882
+ //
25883
+
25884
+ var defaultKeyExtractor = function defaultKeyExtractor(index) {
25885
+ return index;
25886
+ };
25887
+ var defaultRangeExtractor = function defaultRangeExtractor(range) {
25888
+ var start = Math.max(range.startIndex - range.overscan, 0);
25889
+ var end = Math.min(range.endIndex + range.overscan, range.count - 1);
25890
+ var arr = [];
25891
+ for (var _i = start; _i <= end; _i++) {
25892
+ arr.push(_i);
25893
+ }
25894
+ return arr;
25895
+ };
25896
+ var observeElementRect = function observeElementRect(instance, cb) {
25897
+ var observer = new ResizeObserver(function (entries) {
25898
+ var _entries$, _entries$2;
25899
+ cb({
25900
+ width: (_entries$ = entries[0]) == null ? void 0 : _entries$.contentRect.width,
25901
+ height: (_entries$2 = entries[0]) == null ? void 0 : _entries$2.contentRect.height
25902
+ });
25903
+ });
25904
+ if (!instance.scrollElement) {
25905
+ return;
25906
+ }
25907
+ cb(instance.scrollElement.getBoundingClientRect());
25908
+ observer.observe(instance.scrollElement);
25909
+ return function () {
25910
+ observer.unobserve(instance.scrollElement);
25911
+ };
25912
+ };
25913
+ var scrollProps = {
25914
+ element: ['scrollLeft', 'scrollTop'],
25915
+ window: ['scrollX', 'scrollY']
25916
+ };
25917
+ var createOffsetObserver = function createOffsetObserver(mode) {
25918
+ return function (instance, cb) {
25919
+ if (!instance.scrollElement) {
25920
+ return;
25921
+ }
25922
+ var propX = scrollProps[mode][0];
25923
+ var propY = scrollProps[mode][1];
25924
+ var prevX = instance.scrollElement[propX];
25925
+ var prevY = instance.scrollElement[propY];
25926
+ var scroll = function scroll() {
25927
+ var offset = instance.scrollElement[instance.options.horizontal ? propX : propY];
25928
+ cb(offset);
25929
+ };
25930
+ scroll();
25931
+ var onScroll = function onScroll(e) {
25932
+ var target = e.currentTarget;
25933
+ var scrollX = target[propX];
25934
+ var scrollY = target[propY];
25935
+ if (instance.options.horizontal ? prevX - scrollX : prevY - scrollY) {
25936
+ scroll();
25937
+ }
25938
+ prevX = scrollX;
25939
+ prevY = scrollY;
25940
+ };
25941
+ instance.scrollElement.addEventListener('scroll', onScroll, {
25942
+ capture: false,
25943
+ passive: true
25944
+ });
25945
+ return function () {
25946
+ instance.scrollElement.removeEventListener('scroll', onScroll);
25947
+ };
25948
+ };
25949
+ };
25950
+ var observeElementOffset = createOffsetObserver('element');
25951
+ var measureElement = function measureElement(element, instance) {
25952
+ return Math.round(element.getBoundingClientRect()[instance.options.horizontal ? 'width' : 'height']);
25953
+ };
25954
+ var elementScroll = function elementScroll(offset, _ref2, instance) {
25955
+ var _instance$scrollEleme3, _instance$scrollEleme4;
25956
+ var _ref2$adjustments = _ref2.adjustments,
25957
+ adjustments = _ref2$adjustments === void 0 ? 0 : _ref2$adjustments,
25958
+ behavior = _ref2.behavior;
25959
+ var toOffset = offset + adjustments;
25960
+ (_instance$scrollEleme3 = instance.scrollElement) == null ? void 0 : _instance$scrollEleme3.scrollTo == null ? void 0 : _instance$scrollEleme3.scrollTo((_instance$scrollEleme4 = {}, _instance$scrollEleme4[instance.options.horizontal ? 'left' : 'top'] = toOffset, _instance$scrollEleme4.behavior = behavior, _instance$scrollEleme4));
25961
+ };
25962
+ var Virtualizer$1 = function Virtualizer(_opts) {
25963
+ var _this = this;
25964
+ this.unsubs = [];
25965
+ this.scrollElement = null;
25966
+ this.isScrolling = false;
25967
+ this.isScrollingTimeoutId = null;
25968
+ this.measurementsCache = [];
25969
+ this.itemSizeCache = {};
25970
+ this.pendingMeasuredCacheIndexes = [];
25971
+ this.scrollDirection = null;
25972
+ this.scrollAdjustments = 0;
25973
+ this.measureElementCache = {};
25974
+ this.pendingScrollToIndexCallback = null;
25975
+ this.getResizeObserver = function () {
25976
+ var _ro = null;
25977
+ return function () {
25978
+ if (_ro) {
25979
+ return _ro;
25980
+ } else if (typeof ResizeObserver !== 'undefined') {
25981
+ return _ro = new ResizeObserver(function (entries) {
25982
+ entries.forEach(function (entry) {
25983
+ _this._measureElement(entry.target, false);
25984
+ });
25985
+ });
25986
+ } else {
25987
+ return null;
25988
+ }
25989
+ };
25990
+ }();
25991
+ this.range = {
25992
+ startIndex: 0,
25993
+ endIndex: 0
25994
+ };
25995
+ this.setOptions = function (opts) {
25996
+ Object.entries(opts).forEach(function (_ref3) {
25997
+ var key = _ref3[0],
25998
+ value = _ref3[1];
25999
+ if (typeof value === 'undefined') delete opts[key];
26000
+ });
26001
+ _this.options = _extends({
26002
+ debug: false,
26003
+ initialOffset: 0,
26004
+ overscan: 1,
26005
+ paddingStart: 0,
26006
+ paddingEnd: 0,
26007
+ scrollPaddingStart: 0,
26008
+ scrollPaddingEnd: 0,
26009
+ horizontal: false,
26010
+ getItemKey: defaultKeyExtractor,
26011
+ rangeExtractor: defaultRangeExtractor,
26012
+ onChange: function onChange() {},
26013
+ measureElement: measureElement,
26014
+ initialRect: {
26015
+ width: 0,
26016
+ height: 0
26017
+ },
26018
+ scrollMargin: 0,
26019
+ scrollingDelay: 150,
26020
+ indexAttribute: 'data-index',
26021
+ initialMeasurementsCache: []
26022
+ }, opts);
26023
+ };
26024
+ this.notify = function () {
26025
+ _this.options.onChange == null ? void 0 : _this.options.onChange(_this);
26026
+ };
26027
+ this.cleanup = function () {
26028
+ _this.unsubs.filter(Boolean).forEach(function (d) {
26029
+ return d();
26030
+ });
26031
+ _this.unsubs = [];
26032
+ _this.scrollElement = null;
26033
+ };
26034
+ this._didMount = function () {
26035
+ var ro = _this.getResizeObserver();
26036
+ Object.values(_this.measureElementCache).forEach(function (node) {
26037
+ return ro == null ? void 0 : ro.observe(node);
26038
+ });
26039
+ return function () {
26040
+ ro == null ? void 0 : ro.disconnect();
26041
+ _this.cleanup();
26042
+ };
26043
+ };
26044
+ this._willUpdate = function () {
26045
+ _this.pendingScrollToIndexCallback == null ? void 0 : _this.pendingScrollToIndexCallback();
26046
+ var scrollElement = _this.options.getScrollElement();
26047
+ if (_this.scrollElement !== scrollElement) {
26048
+ _this.cleanup();
26049
+ _this.scrollElement = scrollElement;
26050
+ _this._scrollToOffset(_this.scrollOffset, {
26051
+ adjustments: undefined,
26052
+ behavior: undefined
26053
+ });
26054
+ _this.unsubs.push(_this.options.observeElementRect(_this, function (rect) {
26055
+ _this.scrollRect = rect;
26056
+ _this.calculateRange();
26057
+ }));
26058
+ _this.unsubs.push(_this.options.observeElementOffset(_this, function (offset) {
26059
+ _this.scrollAdjustments = 0;
26060
+ if (_this.scrollOffset === offset) {
26061
+ return;
26062
+ }
26063
+ if (_this.isScrollingTimeoutId !== null) {
26064
+ clearTimeout(_this.isScrollingTimeoutId);
26065
+ _this.isScrollingTimeoutId = null;
26066
+ }
26067
+ var onIsScrollingChange = function onIsScrollingChange(isScrolling) {
26068
+ if (_this.isScrolling !== isScrolling) {
26069
+ _this.isScrolling = isScrolling;
26070
+ _this.notify();
26071
+ }
26072
+ };
26073
+ _this.scrollDirection = _this.scrollOffset < offset ? 'forward' : 'backward';
26074
+ _this.scrollOffset = offset;
26075
+ _this.calculateRange();
26076
+ onIsScrollingChange(true);
26077
+ _this.isScrollingTimeoutId = setTimeout(function () {
26078
+ _this.isScrollingTimeoutId = null;
26079
+ _this.scrollDirection = null;
26080
+ onIsScrollingChange(false);
26081
+ }, _this.options.scrollingDelay);
26082
+ }));
26083
+ } else if (!_this.isScrolling) {
26084
+ _this.calculateRange();
26085
+ }
26086
+ };
26087
+ this.getSize = function () {
26088
+ return _this.scrollRect[_this.options.horizontal ? 'width' : 'height'];
26089
+ };
26090
+ this.getMeasurements = memo(function () {
26091
+ return [_this.options.count, _this.options.paddingStart, _this.options.scrollMargin, _this.options.getItemKey, _this.itemSizeCache];
26092
+ }, function (count, paddingStart, scrollMargin, getItemKey, itemSizeCache) {
26093
+ var min = _this.pendingMeasuredCacheIndexes.length > 0 ? Math.min.apply(Math, _this.pendingMeasuredCacheIndexes) : 0;
26094
+ _this.pendingMeasuredCacheIndexes = [];
26095
+ var measurements = _this.measurementsCache.slice(0, min);
26096
+ for (var _i2 = min; _i2 < count; _i2++) {
26097
+ var key = getItemKey(_i2);
26098
+ var measuredSize = itemSizeCache[key];
26099
+ var start = measurements[_i2 - 1] ? measurements[_i2 - 1].end : paddingStart + scrollMargin;
26100
+ var size = typeof measuredSize === 'number' ? measuredSize : _this.options.estimateSize(_i2);
26101
+ var end = start + size;
26102
+ measurements[_i2] = {
26103
+ index: _i2,
26104
+ start: start,
26105
+ size: size,
26106
+ end: end,
26107
+ key: key
26108
+ };
26109
+ }
26110
+ _this.measurementsCache = measurements;
26111
+ return measurements;
26112
+ }, {
26113
+ key: 'getMeasurements',
26114
+ debug: function debug() {
26115
+ return _this.options.debug;
26116
+ }
26117
+ });
26118
+ this.calculateRange = memo(function () {
26119
+ return [_this.getMeasurements(), _this.getSize(), _this.scrollOffset];
26120
+ }, function (measurements, outerSize, scrollOffset) {
26121
+ var range = calculateRange({
26122
+ measurements: measurements,
26123
+ outerSize: outerSize,
26124
+ scrollOffset: scrollOffset
26125
+ });
26126
+ if (range.startIndex !== _this.range.startIndex || range.endIndex !== _this.range.endIndex) {
26127
+ _this.range = range;
26128
+ _this.notify();
26129
+ }
26130
+ return _this.range;
26131
+ }, {
26132
+ key: 'calculateRange',
26133
+ debug: function debug() {
26134
+ return _this.options.debug;
26135
+ }
26136
+ });
26137
+ this.getIndexes = memo(function () {
26138
+ return [_this.options.rangeExtractor, _this.range, _this.options.overscan, _this.options.count];
26139
+ }, function (rangeExtractor, range, overscan, count) {
26140
+ return rangeExtractor(_extends({}, range, {
26141
+ overscan: overscan,
26142
+ count: count
26143
+ }));
26144
+ }, {
26145
+ key: 'getIndexes',
26146
+ debug: function debug() {
26147
+ return _this.options.debug;
26148
+ }
26149
+ });
26150
+ this.indexFromElement = function (node) {
26151
+ var attributeName = _this.options.indexAttribute;
26152
+ var indexStr = node.getAttribute(attributeName);
26153
+ if (!indexStr) {
26154
+ console.warn("Missing attribute name '" + attributeName + "={index}' on measured element.");
26155
+ return -1;
26156
+ }
26157
+ return parseInt(indexStr, 10);
26158
+ };
26159
+ this._measureElement = function (node, _sync) {
26160
+ var _this$itemSizeCache$i;
26161
+ var index = _this.indexFromElement(node);
26162
+ var item = _this.measurementsCache[index];
26163
+ if (!item) {
26164
+ return;
26165
+ }
26166
+ var prevNode = _this.measureElementCache[item.key];
26167
+ var ro = _this.getResizeObserver();
26168
+ if (!node.isConnected) {
26169
+ if (prevNode) {
26170
+ ro == null ? void 0 : ro.unobserve(prevNode);
26171
+ delete _this.measureElementCache[item.key];
26172
+ }
26173
+ return;
26174
+ }
26175
+ if (!prevNode || prevNode !== node) {
26176
+ if (prevNode) {
26177
+ ro == null ? void 0 : ro.unobserve(prevNode);
26178
+ }
26179
+ _this.measureElementCache[item.key] = node;
26180
+ ro == null ? void 0 : ro.observe(node);
26181
+ }
26182
+ var measuredItemSize = _this.options.measureElement(node, _this);
26183
+ var itemSize = (_this$itemSizeCache$i = _this.itemSizeCache[item.key]) != null ? _this$itemSizeCache$i : item.size;
26184
+ var delta = measuredItemSize - itemSize;
26185
+ if (delta !== 0) {
26186
+ var _extends2;
26187
+ if (item.start < _this.scrollOffset && _this.isScrolling && _this.scrollDirection === 'backward') {
26188
+ if (_this.options.debug) {
26189
+ console.info('correction', delta);
26190
+ }
26191
+ _this._scrollToOffset(_this.scrollOffset, {
26192
+ adjustments: _this.scrollAdjustments += delta,
26193
+ behavior: undefined
26194
+ });
26195
+ }
26196
+ _this.pendingMeasuredCacheIndexes.push(index);
26197
+ _this.itemSizeCache = _extends({}, _this.itemSizeCache, (_extends2 = {}, _extends2[item.key] = measuredItemSize, _extends2));
26198
+ _this.notify();
26199
+ }
26200
+ };
26201
+ this.measureElement = function (node) {
26202
+ if (!node) {
26203
+ return;
26204
+ }
26205
+ _this._measureElement(node, true);
26206
+ };
26207
+ this.getVirtualItems = memo(function () {
26208
+ return [_this.getIndexes(), _this.getMeasurements()];
26209
+ }, function (indexes, measurements) {
26210
+ var virtualItems = [];
26211
+ for (var k = 0, len = indexes.length; k < len; k++) {
26212
+ var _i3 = indexes[k];
26213
+ var measurement = measurements[_i3];
26214
+ virtualItems.push(measurement);
26215
+ }
26216
+ return virtualItems;
26217
+ }, {
26218
+ key: 'getIndexes',
26219
+ debug: function debug() {
26220
+ return _this.options.debug;
26221
+ }
26222
+ });
26223
+ this.getOffsetForAlignment = function (toOffset, align) {
26224
+ var offset = _this.scrollOffset;
26225
+ var size = _this.getSize();
26226
+ if (align === 'auto') {
26227
+ if (toOffset <= offset) {
26228
+ align = 'start';
26229
+ } else if (toOffset >= offset + size) {
26230
+ align = 'end';
26231
+ } else {
26232
+ align = 'start';
26233
+ }
26234
+ }
26235
+ if (align === 'start') {
26236
+ return toOffset;
26237
+ } else if (align === 'end') {
26238
+ return toOffset - size;
26239
+ } else if (align === 'center') {
26240
+ return toOffset - size / 2;
26241
+ }
26242
+ return toOffset;
26243
+ };
26244
+ this.scrollToOffset = function (toOffset, _temp) {
26245
+ var _ref4 = _temp === void 0 ? {} : _temp,
26246
+ _ref4$align = _ref4.align,
26247
+ align = _ref4$align === void 0 ? 'start' : _ref4$align,
26248
+ behavior = _ref4.behavior;
26249
+ var options = {
26250
+ adjustments: undefined,
26251
+ behavior: behavior,
26252
+ sync: false
26253
+ };
26254
+ _this._scrollToOffset(_this.getOffsetForAlignment(toOffset, align), options);
26255
+ };
26256
+ this.scrollToIndex = function (index, _temp2) {
26257
+ var _ref5 = _temp2 === void 0 ? {} : _temp2,
26258
+ _ref5$align = _ref5.align,
26259
+ align = _ref5$align === void 0 ? 'auto' : _ref5$align,
26260
+ behavior = _ref5.behavior;
26261
+ _this.pendingScrollToIndexCallback = null;
26262
+ var offset = _this.scrollOffset;
26263
+ var size = _this.getSize();
26264
+ var count = _this.options.count;
26265
+ var measurements = _this.getMeasurements();
26266
+ var measurement = measurements[Math.max(0, Math.min(index, count - 1))];
26267
+ if (!measurement) {
26268
+ throw new Error("VirtualItem not found for index = " + index);
26269
+ }
26270
+ if (align === 'auto') {
26271
+ if (measurement.end >= offset + size - _this.options.scrollPaddingEnd) {
26272
+ align = 'end';
26273
+ } else if (measurement.start <= offset + _this.options.scrollPaddingStart) {
26274
+ align = 'start';
26275
+ } else {
26276
+ return;
26277
+ }
26278
+ }
26279
+ var getOffsetForIndexAndAlignment = function getOffsetForIndexAndAlignment(measurement) {
26280
+ var toOffset = align === 'end' ? measurement.end + _this.options.scrollPaddingEnd : measurement.start - _this.options.scrollPaddingStart;
26281
+ return _this.getOffsetForAlignment(toOffset, align);
26282
+ };
26283
+ var toOffset = getOffsetForIndexAndAlignment(measurement);
26284
+ if (Math.round(toOffset) === Math.round(offset)) {
26285
+ return;
26286
+ }
26287
+ var options = {
26288
+ adjustments: undefined,
26289
+ behavior: behavior
26290
+ };
26291
+ _this._scrollToOffset(toOffset, options);
26292
+ var isDynamic = Object.keys(_this.measureElementCache).length > 0;
26293
+ if (isDynamic) {
26294
+ _this.pendingScrollToIndexCallback = function () {
26295
+ _this.scrollToIndex(index, {
26296
+ align: align,
26297
+ behavior: behavior
26298
+ });
26299
+ };
26300
+ }
26301
+ };
26302
+ this.scrollBy = function (adjustments, options) {
26303
+ _this._scrollToOffset(_this.scrollOffset, {
26304
+ adjustments: adjustments,
26305
+ behavior: options == null ? void 0 : options.behavior
26306
+ });
26307
+ };
26308
+ this.getTotalSize = function () {
26309
+ var _this$getMeasurements;
26310
+ return (((_this$getMeasurements = _this.getMeasurements()[_this.options.count - 1]) == null ? void 0 : _this$getMeasurements.end) || _this.options.paddingStart) - _this.options.scrollMargin + _this.options.paddingEnd;
26311
+ };
26312
+ this._scrollToOffset = function (offset, _ref6) {
26313
+ var adjustments = _ref6.adjustments,
26314
+ behavior = _ref6.behavior;
26315
+ _this.options.scrollToFn(offset, {
26316
+ behavior: behavior,
26317
+ adjustments: adjustments
26318
+ }, _this);
26319
+ };
26320
+ this.measure = function () {
26321
+ _this.itemSizeCache = {};
26322
+ _this.notify();
26323
+ };
26324
+ this.setOptions(_opts);
26325
+ this.scrollRect = this.options.initialRect;
26326
+ this.scrollOffset = this.options.initialOffset;
26327
+ this.measurementsCache = this.options.initialMeasurementsCache;
26328
+ this.measurementsCache.forEach(function (item) {
26329
+ _this.itemSizeCache[item.key] = item.size;
26330
+ });
26331
+ this.calculateRange();
26332
+ };
26333
+ var findNearestBinarySearch = function findNearestBinarySearch(low, high, getCurrentValue, value) {
26334
+ while (low <= high) {
26335
+ var middle = (low + high) / 2 | 0;
26336
+ var currentValue = getCurrentValue(middle);
26337
+ if (currentValue < value) {
26338
+ low = middle + 1;
26339
+ } else if (currentValue > value) {
26340
+ high = middle - 1;
26341
+ } else {
26342
+ return middle;
26343
+ }
26344
+ }
26345
+ if (low > 0) {
26346
+ return low - 1;
26347
+ } else {
26348
+ return 0;
26349
+ }
26350
+ };
26351
+ function calculateRange(_ref7) {
26352
+ var measurements = _ref7.measurements,
26353
+ outerSize = _ref7.outerSize,
26354
+ scrollOffset = _ref7.scrollOffset;
26355
+ var count = measurements.length - 1;
26356
+ var getOffset = function getOffset(index) {
26357
+ return measurements[index].start;
26358
+ };
26359
+ var startIndex = findNearestBinarySearch(0, count, getOffset, scrollOffset);
26360
+ var endIndex = startIndex;
26361
+ while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
26362
+ endIndex++;
26363
+ }
26364
+ return {
26365
+ startIndex: startIndex,
26366
+ endIndex: endIndex
26367
+ };
26368
+ }
26369
+
26370
+ /**
26371
+ * Helper class for the nimble-table for row virtualization.
26372
+ *
26373
+ * @internal
26374
+ */
26375
+ class Virtualizer {
26376
+ constructor(table) {
26377
+ this.visibleItems = [];
26378
+ this.allRowsHeight = 0;
26379
+ this.headerContainerMarginRight = 0;
26380
+ this.rowContainerYOffset = 0;
26381
+ this.table = table;
26382
+ this.viewportResizeObserver = new ResizeObserver(entries => {
26383
+ const borderBoxSize = entries[0]?.borderBoxSize[0];
26384
+ if (borderBoxSize) {
26385
+ // If we have enough rows that a vertical scrollbar is shown, we need to offset the header widths
26386
+ // by the same margin so the column headers align with the corresponding rendered cells
26387
+ const viewportBoundingWidth = borderBoxSize.inlineSize;
26388
+ this.headerContainerMarginRight = viewportBoundingWidth - this.table.viewport.scrollWidth;
26389
+ }
26390
+ });
26391
+ }
26392
+ connectedCallback() {
26393
+ this.viewportResizeObserver.observe(this.table.viewport);
26394
+ this.updateVirtualizer();
26395
+ }
26396
+ disconnectedCallback() {
26397
+ this.viewportResizeObserver.disconnect();
26398
+ }
26399
+ dataChanged() {
26400
+ if (this.table.$fastController.isConnected) {
26401
+ this.updateVirtualizer();
26402
+ }
26403
+ }
26404
+ updateVirtualizer() {
26405
+ const options = this.createVirtualizerOptions();
26406
+ if (this.virtualizer) {
26407
+ this.virtualizer.setOptions(options);
26408
+ }
26409
+ else {
26410
+ this.virtualizer = new Virtualizer$1(options);
26411
+ }
26412
+ this.virtualizer._willUpdate();
26413
+ this.handleVirtualizerChange();
26414
+ }
26415
+ createVirtualizerOptions() {
26416
+ const rowHeight = parseFloat(controlHeight.getValueFor(this.table));
26417
+ return {
26418
+ count: this.table.tableData.length,
26419
+ getScrollElement: () => {
26420
+ return this.table.viewport;
26421
+ },
26422
+ estimateSize: (_) => rowHeight,
26423
+ enableSmoothScroll: true,
26424
+ overscan: 3,
26425
+ scrollingDelay: 5,
26426
+ scrollToFn: elementScroll,
26427
+ observeElementOffset,
26428
+ observeElementRect,
26429
+ onChange: () => this.handleVirtualizerChange()
26430
+ };
26431
+ }
26432
+ handleVirtualizerChange() {
26433
+ const virtualizer = this.virtualizer;
26434
+ this.visibleItems = virtualizer.getVirtualItems();
26435
+ this.allRowsHeight = virtualizer.getTotalSize();
26436
+ // We're using a separate div ('table-scroll') to represent the full height of all rows, and
26437
+ // the row container's height is only big enough to hold the virtualized rows. So we don't
26438
+ // use the TanStackVirtual-provided 'start' offset (which is in terms of the full height)
26439
+ // to translate every individual row, we just translate the row container.
26440
+ let rowContainerYOffset = 0;
26441
+ if (this.visibleItems.length > 0) {
26442
+ const firstItem = this.visibleItems[0];
26443
+ const lastItem = this.visibleItems[this.visibleItems.length - 1];
26444
+ if (lastItem.end < this.allRowsHeight) {
26445
+ rowContainerYOffset = firstItem.start - virtualizer.scrollOffset;
26446
+ }
26447
+ }
26448
+ this.rowContainerYOffset = rowContainerYOffset;
26449
+ }
26450
+ }
26451
+ __decorate$1([
26452
+ observable
26453
+ ], Virtualizer.prototype, "visibleItems", void 0);
26454
+ __decorate$1([
26455
+ observable
26456
+ ], Virtualizer.prototype, "allRowsHeight", void 0);
26457
+ __decorate$1([
26458
+ observable
26459
+ ], Virtualizer.prototype, "headerContainerMarginRight", void 0);
26460
+ __decorate$1([
26461
+ observable
26462
+ ], Virtualizer.prototype, "rowContainerYOffset", void 0);
26463
+
25763
26464
  /**
25764
26465
  * A nimble-styled table.
25765
26466
  */
25766
26467
  class Table extends FoundationElement {
25767
26468
  constructor() {
25768
26469
  super();
25769
- this.data = [];
25770
26470
  /**
25771
26471
  * @internal
25772
26472
  */
25773
26473
  this.tableData = [];
25774
26474
  this.columns = [];
25775
- this.tableInitialized = false;
26475
+ /**
26476
+ * @internal
26477
+ */
26478
+ this.canRenderRows = true;
25776
26479
  this.tableValidator = new TableValidator();
25777
26480
  this.update = (state) => {
25778
26481
  this.table.setOptions(prev => ({
@@ -25797,35 +26500,41 @@
25797
26500
  autoResetAll: false
25798
26501
  };
25799
26502
  this.table = createTable(this.options);
25800
- this.tableInitialized = true;
26503
+ this.virtualizer = new Virtualizer(this);
25801
26504
  }
25802
26505
  get validity() {
25803
26506
  return this.tableValidator.getValidity();
25804
26507
  }
26508
+ setData(newData) {
26509
+ this.generateTanStackColumns(newData);
26510
+ this.setTableData(newData);
26511
+ }
25805
26512
  idFieldNameChanged(_prev, _next) {
25806
26513
  // Force TanStack to detect a data update because a row's ID is only
25807
26514
  // generated when creating a new row model.
25808
- this.trySetData([...this.data]);
26515
+ this.setTableData(this.table.options.data);
25809
26516
  }
25810
- dataChanged(prev, next) {
25811
- if ((!prev || prev.length === 0) && next && next.length > 0) {
25812
- this.generateColumns();
25813
- }
25814
- // Ignore any updates that occur prior to the TanStack table being initialized.
25815
- if (this.tableInitialized) {
25816
- this.trySetData(this.data);
25817
- }
26517
+ connectedCallback() {
26518
+ super.connectedCallback();
26519
+ this.virtualizer.connectedCallback();
26520
+ }
26521
+ disconnectedCallback() {
26522
+ this.virtualizer.disconnectedCallback();
25818
26523
  }
25819
26524
  checkValidity() {
25820
26525
  return this.tableValidator.isValid();
25821
26526
  }
25822
- trySetData(newData) {
25823
- const areIdsValid = this.tableValidator.validateRecordIds(newData, this.idFieldName);
26527
+ setTableData(newData) {
26528
+ const data = newData.map(record => {
26529
+ return { ...record };
26530
+ });
26531
+ this.tableValidator.validateRecordIds(data, this.idFieldName);
26532
+ this.canRenderRows = this.checkValidity();
25824
26533
  const getRowIdFunction = this.idFieldName === null || this.idFieldName === undefined
25825
26534
  ? undefined
25826
26535
  : (record) => record[this.idFieldName];
25827
26536
  this.updateTableOptions({
25828
- data: areIdsValid ? newData : [],
26537
+ data,
25829
26538
  getRowId: getRowIdFunction
25830
26539
  });
25831
26540
  }
@@ -25838,6 +26547,7 @@
25838
26547
  };
25839
26548
  return rowState;
25840
26549
  });
26550
+ this.virtualizer.dataChanged();
25841
26551
  }
25842
26552
  updateTableOptions(updatedOptions) {
25843
26553
  this.options = { ...this.options, ...updatedOptions };
@@ -25846,11 +26556,11 @@
25846
26556
  }
25847
26557
  // Generate columns for TanStack that correspond to all the keys in TData because all operations,
25848
26558
  // such as grouping and sorting, will be performed on the data's records, not the values rendered within a cell.
25849
- generateColumns() {
25850
- if (this.data.length === 0) {
26559
+ generateTanStackColumns(data) {
26560
+ if (data.length === 0) {
25851
26561
  return;
25852
26562
  }
25853
- const firstItem = this.data[0];
26563
+ const firstItem = data[0];
25854
26564
  const keys = Object.keys(firstItem);
25855
26565
  const generatedColumns = keys.map(key => {
25856
26566
  const columnDef = {
@@ -25866,15 +26576,15 @@
25866
26576
  __decorate$1([
25867
26577
  attr({ attribute: 'id-field-name' })
25868
26578
  ], Table.prototype, "idFieldName", void 0);
25869
- __decorate$1([
25870
- observable
25871
- ], Table.prototype, "data", void 0);
25872
26579
  __decorate$1([
25873
26580
  observable
25874
26581
  ], Table.prototype, "tableData", void 0);
25875
26582
  __decorate$1([
25876
26583
  observable
25877
26584
  ], Table.prototype, "columns", void 0);
26585
+ __decorate$1([
26586
+ observable
26587
+ ], Table.prototype, "canRenderRows", void 0);
25878
26588
  const nimbleTable = Table.compose({
25879
26589
  baseName: 'table',
25880
26590
  template: template$4,