@vuu-ui/vuu-utils 0.8.20-debug → 0.8.21-debug

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.
package/esm/index.js CHANGED
@@ -1897,7 +1897,7 @@ var KeySet = class {
1897
1897
  }
1898
1898
  next() {
1899
1899
  if (this.free.length > 0) {
1900
- return this.free.pop();
1900
+ return this.free.shift();
1901
1901
  } else {
1902
1902
  return this.nextKeyValue++;
1903
1903
  }
@@ -1935,7 +1935,7 @@ var KeySet = class {
1935
1935
  return key;
1936
1936
  }
1937
1937
  toDebugString() {
1938
- return Array.from(this.keys.entries()).map((k, v) => `${k}=>${v}`).join(",");
1938
+ return Array.from(this.keys.entries()).map(([k, v]) => `${k}=>${v}`).join(",");
1939
1939
  }
1940
1940
  };
1941
1941
 
@@ -1996,19 +1996,39 @@ function throttle(callback, limit) {
1996
1996
  var { IDX } = metadataKeys;
1997
1997
  var actualRowPositioning = (rowHeight) => [
1998
1998
  (row) => row[IDX] * rowHeight,
1999
- (position) => Math.floor(position / rowHeight)
1999
+ (position) => Math.floor(position / rowHeight),
2000
+ false
2000
2001
  ];
2001
- var virtualRowPositioning = (rowHeight, additionalPixelsNeeded, pctScrollTop) => [
2002
+ var virtualRowPositioning = (rowHeight, virtualisedExtent, pctScrollTop) => [
2002
2003
  (row) => {
2003
- const rowOffset = pctScrollTop.current * additionalPixelsNeeded;
2004
+ const rowOffset = pctScrollTop.current * virtualisedExtent;
2004
2005
  return row[IDX] * rowHeight - rowOffset;
2005
2006
  },
2007
+ /*
2008
+ Return index position of closest row
2009
+ */
2006
2010
  (position) => {
2007
- const rowOffset = pctScrollTop.current * additionalPixelsNeeded;
2008
- const result = Math.floor((position + rowOffset) / rowHeight);
2009
- return result;
2010
- }
2011
+ const rowOffset = pctScrollTop.current * virtualisedExtent;
2012
+ return Math.round((position + rowOffset) / rowHeight);
2013
+ },
2014
+ true
2011
2015
  ];
2016
+ var getRowElementAtIndex = (container, rowIndex) => {
2017
+ if (rowIndex === -1) {
2018
+ return null;
2019
+ } else {
2020
+ const activeRow = container.querySelector(
2021
+ `[aria-rowindex="${rowIndex + 1}"]`
2022
+ );
2023
+ if (activeRow) {
2024
+ return activeRow;
2025
+ } else {
2026
+ throw Error(
2027
+ `getRowElementAtIndex no row found for index index ${rowIndex}`
2028
+ );
2029
+ }
2030
+ }
2031
+ };
2012
2032
  var getIndexFromRowElement = (rowElement) => {
2013
2033
  const rowIndex = rowElement.ariaRowIndex;
2014
2034
  if (rowIndex != null) {
@@ -2538,6 +2558,7 @@ export {
2538
2558
  getMissingItems,
2539
2559
  getMovingValueDirection,
2540
2560
  getRegisteredCellRenderers,
2561
+ getRowElementAtIndex,
2541
2562
  getRowRecord,
2542
2563
  getScrollbarSize,
2543
2564
  getSelectionStatus,