@lvce-editor/explorer-view 5.25.0 → 5.26.0
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/dist/explorerViewWorkerMain.js +31 -22
- package/package.json +1 -1
|
@@ -2260,21 +2260,6 @@ const copyRelativePath = async state => {
|
|
|
2260
2260
|
return state;
|
|
2261
2261
|
};
|
|
2262
2262
|
|
|
2263
|
-
// TODO optimize this function to return the minimum number
|
|
2264
|
-
// of visible items needed, e.g. when not scrolled 5 items with
|
|
2265
|
-
// 20px fill 100px but when scrolled 6 items are needed
|
|
2266
|
-
const getNumberOfVisibleItems = (listHeight, itemHeight) => {
|
|
2267
|
-
if (listHeight <= 0 || itemHeight <= 0) {
|
|
2268
|
-
return 0;
|
|
2269
|
-
}
|
|
2270
|
-
return Math.ceil(listHeight / itemHeight) + 1;
|
|
2271
|
-
};
|
|
2272
|
-
|
|
2273
|
-
const getExplorerMaxLineY = (minLineY, height, itemHeight, direntsLength) => {
|
|
2274
|
-
const maxLineY = minLineY + Math.min(getNumberOfVisibleItems(height, itemHeight), direntsLength);
|
|
2275
|
-
return maxLineY;
|
|
2276
|
-
};
|
|
2277
|
-
|
|
2278
2263
|
const getIconsCached = (dirents, fileIconCache) => {
|
|
2279
2264
|
return dirents.map(dirent => fileIconCache[dirent]);
|
|
2280
2265
|
};
|
|
@@ -2359,6 +2344,21 @@ const getFileIcons = async (dirents, fileIconCache) => {
|
|
|
2359
2344
|
};
|
|
2360
2345
|
};
|
|
2361
2346
|
|
|
2347
|
+
// TODO optimize this function to return the minimum number
|
|
2348
|
+
// of visible items needed, e.g. when not scrolled 5 items with
|
|
2349
|
+
// 20px fill 100px but when scrolled 6 items are needed
|
|
2350
|
+
const getNumberOfVisibleItems = (listHeight, itemHeight) => {
|
|
2351
|
+
if (listHeight <= 0 || itemHeight <= 0) {
|
|
2352
|
+
return 0;
|
|
2353
|
+
}
|
|
2354
|
+
return Math.ceil(listHeight / itemHeight) + 1;
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
const getExplorerMaxLineY = (minLineY, height, itemHeight, direntsLength) => {
|
|
2358
|
+
const maxLineY = minLineY + Math.min(getNumberOfVisibleItems(height, itemHeight), direntsLength);
|
|
2359
|
+
return maxLineY;
|
|
2360
|
+
};
|
|
2361
|
+
|
|
2362
2362
|
const None$4 = 0;
|
|
2363
2363
|
const Right = 1;
|
|
2364
2364
|
const Down = 2;
|
|
@@ -4354,6 +4354,9 @@ const getNewDropTargets = (state, index) => {
|
|
|
4354
4354
|
return dropTargetFull;
|
|
4355
4355
|
}
|
|
4356
4356
|
const item = items[index];
|
|
4357
|
+
if (!item) {
|
|
4358
|
+
return dropTargetFull;
|
|
4359
|
+
}
|
|
4357
4360
|
if (!canBeDroppedInto(item)) {
|
|
4358
4361
|
const startIndex = getParentStartIndex(items, index);
|
|
4359
4362
|
const endIndex = getParentEndIndex(items, index);
|
|
@@ -5087,6 +5090,9 @@ const handleUpload = async (state, dirents) => {
|
|
|
5087
5090
|
};
|
|
5088
5091
|
|
|
5089
5092
|
const setDeltaY = async (state, deltaY) => {
|
|
5093
|
+
if (!Number.isFinite(deltaY)) {
|
|
5094
|
+
return state;
|
|
5095
|
+
}
|
|
5090
5096
|
const {
|
|
5091
5097
|
height,
|
|
5092
5098
|
itemHeight,
|
|
@@ -5429,14 +5435,11 @@ const getEditingType = direntType => {
|
|
|
5429
5435
|
|
|
5430
5436
|
const getNewDirentsForRename = (items, focusedIndex) => {
|
|
5431
5437
|
const item = items[focusedIndex];
|
|
5432
|
-
const newItems = [...items];
|
|
5433
5438
|
const editingType = getEditingType(item.type);
|
|
5434
|
-
|
|
5435
|
-
newItems[focusedIndex] = {
|
|
5439
|
+
return [...items.slice(0, focusedIndex), {
|
|
5436
5440
|
...item,
|
|
5437
5441
|
type: editingType
|
|
5438
|
-
};
|
|
5439
|
-
return newItems;
|
|
5442
|
+
}, ...items.slice(focusedIndex + 1)];
|
|
5440
5443
|
};
|
|
5441
5444
|
|
|
5442
5445
|
const getRenameSelectionRange = name => {
|
|
@@ -5523,6 +5526,13 @@ const getUnique = items => {
|
|
|
5523
5526
|
return seens;
|
|
5524
5527
|
};
|
|
5525
5528
|
|
|
5529
|
+
const getIndent = item => item.indent;
|
|
5530
|
+
const getUniqueIndents = items => {
|
|
5531
|
+
const indents = items.map(getIndent);
|
|
5532
|
+
const uniqueIndents = getUnique(indents);
|
|
5533
|
+
return uniqueIndents;
|
|
5534
|
+
};
|
|
5535
|
+
|
|
5526
5536
|
const renderCss = (oldState, newState) => {
|
|
5527
5537
|
const {
|
|
5528
5538
|
focusedIndex,
|
|
@@ -5534,8 +5544,7 @@ const renderCss = (oldState, newState) => {
|
|
|
5534
5544
|
visibleExplorerItems,
|
|
5535
5545
|
width
|
|
5536
5546
|
} = newState;
|
|
5537
|
-
const
|
|
5538
|
-
const uniqueIndents = getUnique(indents);
|
|
5547
|
+
const uniqueIndents = getUniqueIndents(visibleExplorerItems);
|
|
5539
5548
|
const indent = 8;
|
|
5540
5549
|
const padding = 10;
|
|
5541
5550
|
const fileIconWidth = 16;
|