@indielayer/ui
Version:
Indielayer UI Components with Tailwind CSS build for Vue 3
42 lines (41 loc) • 786 B
JavaScript
function o({
isRowLoaded: x,
minimumBatchSize: d,
rowCount: i,
startIndex: I,
stopIndex: a
}) {
const r = [];
let s = -1, e = -1;
for (let t = I; t <= a; t++)
x(t) ? e >= 0 && (r.push({
startIndex: s,
stopIndex: e
}), s = e = -1) : (e = t, s < 0 && (s = t));
if (e >= 0) {
const t = Math.min(
Math.max(e, s + d - 1),
i - 1
);
for (let n = e + 1; n <= t && !x(n); n++)
e = n;
r.push({
startIndex: s,
stopIndex: e
});
}
if (r.length) {
const t = r[0];
for (; t.stopIndex - t.startIndex + 1 < d && t.startIndex > 0; ) {
const n = t.startIndex - 1;
if (!x(n))
t.startIndex = n;
else
break;
}
}
return r;
}
export {
o as scanForUnloadedIndices
};