@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/cjs/index.js +30 -9
- package/cjs/index.js.map +2 -2
- package/esm/index.js +30 -9
- package/esm/index.js.map +2 -2
- package/package.json +5 -5
- package/types/row-utils.d.ts +19 -4
package/cjs/index.js
CHANGED
|
@@ -129,6 +129,7 @@ __export(src_exports, {
|
|
|
129
129
|
getMissingItems: () => getMissingItems,
|
|
130
130
|
getMovingValueDirection: () => getMovingValueDirection,
|
|
131
131
|
getRegisteredCellRenderers: () => getRegisteredCellRenderers,
|
|
132
|
+
getRowElementAtIndex: () => getRowElementAtIndex,
|
|
132
133
|
getRowRecord: () => getRowRecord,
|
|
133
134
|
getScrollbarSize: () => getScrollbarSize,
|
|
134
135
|
getSelectionStatus: () => getSelectionStatus,
|
|
@@ -2137,7 +2138,7 @@ var KeySet = class {
|
|
|
2137
2138
|
}
|
|
2138
2139
|
next() {
|
|
2139
2140
|
if (this.free.length > 0) {
|
|
2140
|
-
return this.free.
|
|
2141
|
+
return this.free.shift();
|
|
2141
2142
|
} else {
|
|
2142
2143
|
return this.nextKeyValue++;
|
|
2143
2144
|
}
|
|
@@ -2175,7 +2176,7 @@ var KeySet = class {
|
|
|
2175
2176
|
return key;
|
|
2176
2177
|
}
|
|
2177
2178
|
toDebugString() {
|
|
2178
|
-
return Array.from(this.keys.entries()).map((k, v) => `${k}=>${v}`).join(",");
|
|
2179
|
+
return Array.from(this.keys.entries()).map(([k, v]) => `${k}=>${v}`).join(",");
|
|
2179
2180
|
}
|
|
2180
2181
|
};
|
|
2181
2182
|
|
|
@@ -2236,19 +2237,39 @@ function throttle(callback, limit) {
|
|
|
2236
2237
|
var { IDX } = metadataKeys;
|
|
2237
2238
|
var actualRowPositioning = (rowHeight) => [
|
|
2238
2239
|
(row) => row[IDX] * rowHeight,
|
|
2239
|
-
(position) => Math.floor(position / rowHeight)
|
|
2240
|
+
(position) => Math.floor(position / rowHeight),
|
|
2241
|
+
false
|
|
2240
2242
|
];
|
|
2241
|
-
var virtualRowPositioning = (rowHeight,
|
|
2243
|
+
var virtualRowPositioning = (rowHeight, virtualisedExtent, pctScrollTop) => [
|
|
2242
2244
|
(row) => {
|
|
2243
|
-
const rowOffset = pctScrollTop.current *
|
|
2245
|
+
const rowOffset = pctScrollTop.current * virtualisedExtent;
|
|
2244
2246
|
return row[IDX] * rowHeight - rowOffset;
|
|
2245
2247
|
},
|
|
2248
|
+
/*
|
|
2249
|
+
Return index position of closest row
|
|
2250
|
+
*/
|
|
2246
2251
|
(position) => {
|
|
2247
|
-
const rowOffset = pctScrollTop.current *
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2252
|
+
const rowOffset = pctScrollTop.current * virtualisedExtent;
|
|
2253
|
+
return Math.round((position + rowOffset) / rowHeight);
|
|
2254
|
+
},
|
|
2255
|
+
true
|
|
2251
2256
|
];
|
|
2257
|
+
var getRowElementAtIndex = (container, rowIndex) => {
|
|
2258
|
+
if (rowIndex === -1) {
|
|
2259
|
+
return null;
|
|
2260
|
+
} else {
|
|
2261
|
+
const activeRow = container.querySelector(
|
|
2262
|
+
`[aria-rowindex="${rowIndex + 1}"]`
|
|
2263
|
+
);
|
|
2264
|
+
if (activeRow) {
|
|
2265
|
+
return activeRow;
|
|
2266
|
+
} else {
|
|
2267
|
+
throw Error(
|
|
2268
|
+
`getRowElementAtIndex no row found for index index ${rowIndex}`
|
|
2269
|
+
);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
};
|
|
2252
2273
|
var getIndexFromRowElement = (rowElement) => {
|
|
2253
2274
|
const rowIndex = rowElement.ariaRowIndex;
|
|
2254
2275
|
if (rowIndex != null) {
|