@lvce-editor/explorer-view 3.18.0 → 3.20.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 +407 -518
- package/package.json +1 -1
|
@@ -1372,7 +1372,7 @@ const getWebViewSecret = async key => {
|
|
|
1372
1372
|
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1373
1373
|
return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
1374
1374
|
};
|
|
1375
|
-
const setFocus
|
|
1375
|
+
const setFocus = key => {
|
|
1376
1376
|
return invoke$2('Focus.setFocus', key);
|
|
1377
1377
|
};
|
|
1378
1378
|
const getFileIcon = async options => {
|
|
@@ -1632,7 +1632,7 @@ const RendererWorker = {
|
|
|
1632
1632
|
setAdditionalFocus,
|
|
1633
1633
|
setColorTheme,
|
|
1634
1634
|
setExtensionsSearchValue,
|
|
1635
|
-
setFocus
|
|
1635
|
+
setFocus,
|
|
1636
1636
|
setWebViewPort,
|
|
1637
1637
|
setWorkspacePath,
|
|
1638
1638
|
showContextMenu: showContextMenu$1,
|
|
@@ -1798,94 +1798,6 @@ const Rename$1 = 3;
|
|
|
1798
1798
|
const List = 1;
|
|
1799
1799
|
const Input$1 = 2;
|
|
1800
1800
|
|
|
1801
|
-
// TODO optimize this function to return the minimum number
|
|
1802
|
-
// of visible items needed, e.g. when not scrolled 5 items with
|
|
1803
|
-
// 20px fill 100px but when scrolled 6 items are needed
|
|
1804
|
-
const getNumberOfVisibleItems = (listHeight, itemHeight) => {
|
|
1805
|
-
return Math.ceil(listHeight / itemHeight) + 1;
|
|
1806
|
-
};
|
|
1807
|
-
|
|
1808
|
-
const getExplorerMaxLineY = (minLineY, height, itemHeight, direntsLength) => {
|
|
1809
|
-
const maxLineY = minLineY + Math.min(getNumberOfVisibleItems(height, itemHeight), direntsLength);
|
|
1810
|
-
return maxLineY;
|
|
1811
|
-
};
|
|
1812
|
-
|
|
1813
|
-
const getIconsCached = (dirents, fileIconCache) => {
|
|
1814
|
-
return dirents.map(dirent => fileIconCache[dirent]);
|
|
1815
|
-
};
|
|
1816
|
-
|
|
1817
|
-
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
1818
|
-
const missingRequests = [];
|
|
1819
|
-
for (const dirent of dirents) {
|
|
1820
|
-
if (!(dirent.path in fileIconCache)) {
|
|
1821
|
-
missingRequests.push({
|
|
1822
|
-
type: dirent.type,
|
|
1823
|
-
name: dirent.name,
|
|
1824
|
-
path: dirent.path
|
|
1825
|
-
});
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
return missingRequests;
|
|
1829
|
-
};
|
|
1830
|
-
|
|
1831
|
-
const getPath = item => {
|
|
1832
|
-
return item.path;
|
|
1833
|
-
};
|
|
1834
|
-
|
|
1835
|
-
const getPaths = items => {
|
|
1836
|
-
return items.map(getPath);
|
|
1837
|
-
};
|
|
1838
|
-
|
|
1839
|
-
const getSimpleIconRequestType = direntType => {
|
|
1840
|
-
if (direntType === Directory || direntType === DirectoryExpanded || direntType === EditingDirectoryExpanded || direntType === EditingFolder) {
|
|
1841
|
-
return 2;
|
|
1842
|
-
}
|
|
1843
|
-
return 1;
|
|
1844
|
-
};
|
|
1845
|
-
|
|
1846
|
-
const toSimpleIconRequest = request => {
|
|
1847
|
-
return {
|
|
1848
|
-
name: request.name,
|
|
1849
|
-
type: getSimpleIconRequestType(request.type)
|
|
1850
|
-
};
|
|
1851
|
-
};
|
|
1852
|
-
|
|
1853
|
-
const requestFileIcons = async requests => {
|
|
1854
|
-
if (requests.length === 0) {
|
|
1855
|
-
return [];
|
|
1856
|
-
}
|
|
1857
|
-
const simpleRequests = requests.map(toSimpleIconRequest);
|
|
1858
|
-
const icons = await invoke$1('IconTheme.getIcons', simpleRequests);
|
|
1859
|
-
return icons;
|
|
1860
|
-
};
|
|
1861
|
-
|
|
1862
|
-
const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
1863
|
-
if (missingRequests.length === 0) {
|
|
1864
|
-
return iconCache;
|
|
1865
|
-
}
|
|
1866
|
-
const newFileIconCache = {
|
|
1867
|
-
...iconCache
|
|
1868
|
-
};
|
|
1869
|
-
for (let i = 0; i < missingRequests.length; i++) {
|
|
1870
|
-
const request = missingRequests[i];
|
|
1871
|
-
const icon = newIcons[i];
|
|
1872
|
-
newFileIconCache[request.path] = icon;
|
|
1873
|
-
}
|
|
1874
|
-
return newFileIconCache;
|
|
1875
|
-
};
|
|
1876
|
-
|
|
1877
|
-
const getFileIcons = async (dirents, fileIconCache) => {
|
|
1878
|
-
const missingRequests = getMissingIconRequests(dirents, fileIconCache);
|
|
1879
|
-
const newIcons = await requestFileIcons(missingRequests);
|
|
1880
|
-
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
1881
|
-
const paths = getPaths(dirents);
|
|
1882
|
-
const icons = getIconsCached(paths, newFileIconCache);
|
|
1883
|
-
return {
|
|
1884
|
-
icons,
|
|
1885
|
-
newFileIconCache
|
|
1886
|
-
};
|
|
1887
|
-
};
|
|
1888
|
-
|
|
1889
1801
|
const getFileOperationsNestedPath = (path, root, pathSeparator) => {
|
|
1890
1802
|
const parts = path.slice(root.length).split(pathSeparator);
|
|
1891
1803
|
const operations = [];
|
|
@@ -2297,10 +2209,6 @@ const validateFileName2 = name => {
|
|
|
2297
2209
|
const acceptCreate = async (state, newDirentType) => {
|
|
2298
2210
|
const {
|
|
2299
2211
|
editingValue,
|
|
2300
|
-
minLineY,
|
|
2301
|
-
height,
|
|
2302
|
-
itemHeight,
|
|
2303
|
-
fileIconCache,
|
|
2304
2212
|
pathSeparator,
|
|
2305
2213
|
root,
|
|
2306
2214
|
focusedIndex,
|
|
@@ -2332,22 +2240,13 @@ const acceptCreate = async (state, newDirentType) => {
|
|
|
2332
2240
|
const newItems = treeToArray(merged, root);
|
|
2333
2241
|
const dirents = newItems;
|
|
2334
2242
|
const newFocusedIndex = getIndex(newItems, absolutePath);
|
|
2335
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, dirents.length);
|
|
2336
|
-
const visible = dirents.slice(minLineY, maxLineY);
|
|
2337
|
-
const {
|
|
2338
|
-
icons,
|
|
2339
|
-
newFileIconCache
|
|
2340
|
-
} = await getFileIcons(visible, fileIconCache);
|
|
2341
2243
|
return {
|
|
2342
2244
|
...state,
|
|
2343
2245
|
items: dirents,
|
|
2344
2246
|
editingIndex: -1,
|
|
2345
2247
|
focusedIndex: newFocusedIndex,
|
|
2346
2248
|
editingType: None$5,
|
|
2347
|
-
|
|
2348
|
-
focus: List,
|
|
2349
|
-
icons,
|
|
2350
|
-
fileIconCache: newFileIconCache
|
|
2249
|
+
focus: List
|
|
2351
2250
|
};
|
|
2352
2251
|
};
|
|
2353
2252
|
|
|
@@ -2402,11 +2301,7 @@ const acceptRename = async state => {
|
|
|
2402
2301
|
editingIndex,
|
|
2403
2302
|
editingValue,
|
|
2404
2303
|
items,
|
|
2405
|
-
root
|
|
2406
|
-
minLineY,
|
|
2407
|
-
height,
|
|
2408
|
-
itemHeight,
|
|
2409
|
-
fileIconCache
|
|
2304
|
+
root
|
|
2410
2305
|
} = state;
|
|
2411
2306
|
const editingErrorMessage = validateFileName2(editingValue);
|
|
2412
2307
|
if (editingErrorMessage) {
|
|
@@ -2433,12 +2328,6 @@ const acceptRename = async state => {
|
|
|
2433
2328
|
const newTree = updateTree2(tree, update);
|
|
2434
2329
|
const newDirents = treeToArray(newTree, root);
|
|
2435
2330
|
const newFocusedIndex = getIndex(newDirents, newUri);
|
|
2436
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newDirents.length);
|
|
2437
|
-
const visible = newDirents.slice(minLineY, maxLineY);
|
|
2438
|
-
const {
|
|
2439
|
-
icons,
|
|
2440
|
-
newFileIconCache
|
|
2441
|
-
} = await getFileIcons(visible, fileIconCache);
|
|
2442
2331
|
return {
|
|
2443
2332
|
...state,
|
|
2444
2333
|
editingIndex: -1,
|
|
@@ -2449,8 +2338,6 @@ const acceptRename = async state => {
|
|
|
2449
2338
|
focused: true,
|
|
2450
2339
|
focus: List,
|
|
2451
2340
|
items: newDirents,
|
|
2452
|
-
icons,
|
|
2453
|
-
fileIconCache: newFileIconCache,
|
|
2454
2341
|
editingSelectionEnd: 0,
|
|
2455
2342
|
editingSelectionStart: 0
|
|
2456
2343
|
};
|
|
@@ -2479,14 +2366,9 @@ const isNormalItem = item => {
|
|
|
2479
2366
|
const cancelEditCreate = async (state, keepFocus) => {
|
|
2480
2367
|
const {
|
|
2481
2368
|
editingIndex,
|
|
2482
|
-
items
|
|
2483
|
-
fileIconCache
|
|
2369
|
+
items
|
|
2484
2370
|
} = state;
|
|
2485
2371
|
const filteredItems = items.filter(isNormalItem);
|
|
2486
|
-
const {
|
|
2487
|
-
icons,
|
|
2488
|
-
newFileIconCache
|
|
2489
|
-
} = await getFileIcons(filteredItems, fileIconCache);
|
|
2490
2372
|
return {
|
|
2491
2373
|
...state,
|
|
2492
2374
|
items: filteredItems,
|
|
@@ -2496,9 +2378,7 @@ const cancelEditCreate = async (state, keepFocus) => {
|
|
|
2496
2378
|
editingValue: '',
|
|
2497
2379
|
editingErrorMessage: '',
|
|
2498
2380
|
editingType: None$5,
|
|
2499
|
-
focus: List
|
|
2500
|
-
icons,
|
|
2501
|
-
fileIconCache: newFileIconCache
|
|
2381
|
+
focus: List
|
|
2502
2382
|
};
|
|
2503
2383
|
};
|
|
2504
2384
|
|
|
@@ -2573,25 +2453,12 @@ const toCollapsedDirent = dirent => {
|
|
|
2573
2453
|
|
|
2574
2454
|
const collapseAll = async state => {
|
|
2575
2455
|
const {
|
|
2576
|
-
minLineY,
|
|
2577
|
-
height,
|
|
2578
|
-
itemHeight,
|
|
2579
|
-
fileIconCache,
|
|
2580
2456
|
items
|
|
2581
2457
|
} = state;
|
|
2582
2458
|
const newDirents = items.filter(isTopLevel).map(toCollapsedDirent);
|
|
2583
|
-
const dirents = newDirents;
|
|
2584
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, dirents.length);
|
|
2585
|
-
const visible = dirents.slice(minLineY, maxLineY);
|
|
2586
|
-
const {
|
|
2587
|
-
icons,
|
|
2588
|
-
newFileIconCache
|
|
2589
|
-
} = await getFileIcons(visible, fileIconCache);
|
|
2590
2459
|
return {
|
|
2591
2460
|
...state,
|
|
2592
|
-
items: newDirents
|
|
2593
|
-
icons,
|
|
2594
|
-
fileIconCache: newFileIconCache
|
|
2461
|
+
items: newDirents
|
|
2595
2462
|
};
|
|
2596
2463
|
};
|
|
2597
2464
|
|
|
@@ -2641,6 +2508,271 @@ const copyRelativePath = async state => {
|
|
|
2641
2508
|
return state;
|
|
2642
2509
|
};
|
|
2643
2510
|
|
|
2511
|
+
// TODO optimize this function to return the minimum number
|
|
2512
|
+
// of visible items needed, e.g. when not scrolled 5 items with
|
|
2513
|
+
// 20px fill 100px but when scrolled 6 items are needed
|
|
2514
|
+
const getNumberOfVisibleItems = (listHeight, itemHeight) => {
|
|
2515
|
+
return Math.ceil(listHeight / itemHeight) + 1;
|
|
2516
|
+
};
|
|
2517
|
+
|
|
2518
|
+
const getExplorerMaxLineY = (minLineY, height, itemHeight, direntsLength) => {
|
|
2519
|
+
const maxLineY = minLineY + Math.min(getNumberOfVisibleItems(height, itemHeight), direntsLength);
|
|
2520
|
+
return maxLineY;
|
|
2521
|
+
};
|
|
2522
|
+
|
|
2523
|
+
const getIconsCached = (dirents, fileIconCache) => {
|
|
2524
|
+
return dirents.map(dirent => fileIconCache[dirent]);
|
|
2525
|
+
};
|
|
2526
|
+
|
|
2527
|
+
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
2528
|
+
const missingRequests = [];
|
|
2529
|
+
for (const dirent of dirents) {
|
|
2530
|
+
if (!(dirent.path in fileIconCache)) {
|
|
2531
|
+
missingRequests.push({
|
|
2532
|
+
type: dirent.type,
|
|
2533
|
+
name: dirent.name,
|
|
2534
|
+
path: dirent.path
|
|
2535
|
+
});
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
return missingRequests;
|
|
2539
|
+
};
|
|
2540
|
+
|
|
2541
|
+
const getPath = item => {
|
|
2542
|
+
return item.path;
|
|
2543
|
+
};
|
|
2544
|
+
|
|
2545
|
+
const getPaths = items => {
|
|
2546
|
+
return items.map(getPath);
|
|
2547
|
+
};
|
|
2548
|
+
|
|
2549
|
+
const getSimpleIconRequestType = direntType => {
|
|
2550
|
+
if (direntType === Directory || direntType === DirectoryExpanded || direntType === EditingDirectoryExpanded || direntType === EditingFolder) {
|
|
2551
|
+
return 2;
|
|
2552
|
+
}
|
|
2553
|
+
return 1;
|
|
2554
|
+
};
|
|
2555
|
+
|
|
2556
|
+
const toSimpleIconRequest = request => {
|
|
2557
|
+
return {
|
|
2558
|
+
name: request.name,
|
|
2559
|
+
type: getSimpleIconRequestType(request.type)
|
|
2560
|
+
};
|
|
2561
|
+
};
|
|
2562
|
+
|
|
2563
|
+
const requestFileIcons = async requests => {
|
|
2564
|
+
if (requests.length === 0) {
|
|
2565
|
+
return [];
|
|
2566
|
+
}
|
|
2567
|
+
const simpleRequests = requests.map(toSimpleIconRequest);
|
|
2568
|
+
const icons = await invoke$1('IconTheme.getIcons', simpleRequests);
|
|
2569
|
+
return icons;
|
|
2570
|
+
};
|
|
2571
|
+
|
|
2572
|
+
const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
2573
|
+
if (missingRequests.length === 0) {
|
|
2574
|
+
return iconCache;
|
|
2575
|
+
}
|
|
2576
|
+
const newFileIconCache = {
|
|
2577
|
+
...iconCache
|
|
2578
|
+
};
|
|
2579
|
+
for (let i = 0; i < missingRequests.length; i++) {
|
|
2580
|
+
const request = missingRequests[i];
|
|
2581
|
+
const icon = newIcons[i];
|
|
2582
|
+
newFileIconCache[request.path] = icon;
|
|
2583
|
+
}
|
|
2584
|
+
return newFileIconCache;
|
|
2585
|
+
};
|
|
2586
|
+
|
|
2587
|
+
const getFileIcons = async (dirents, fileIconCache) => {
|
|
2588
|
+
const missingRequests = getMissingIconRequests(dirents, fileIconCache);
|
|
2589
|
+
const newIcons = await requestFileIcons(missingRequests);
|
|
2590
|
+
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
2591
|
+
const paths = getPaths(dirents);
|
|
2592
|
+
const icons = getIconsCached(paths, newFileIconCache);
|
|
2593
|
+
return {
|
|
2594
|
+
icons,
|
|
2595
|
+
newFileIconCache
|
|
2596
|
+
};
|
|
2597
|
+
};
|
|
2598
|
+
|
|
2599
|
+
const None$4 = 0;
|
|
2600
|
+
const Right = 1;
|
|
2601
|
+
const Down = 2;
|
|
2602
|
+
|
|
2603
|
+
const getChevronType = (type, useChevrons) => {
|
|
2604
|
+
if (!useChevrons) {
|
|
2605
|
+
return None$4;
|
|
2606
|
+
}
|
|
2607
|
+
switch (type) {
|
|
2608
|
+
case Directory:
|
|
2609
|
+
return Right;
|
|
2610
|
+
case DirectoryExpanded:
|
|
2611
|
+
case DirectoryExpanding:
|
|
2612
|
+
return Down;
|
|
2613
|
+
default:
|
|
2614
|
+
return None$4;
|
|
2615
|
+
}
|
|
2616
|
+
};
|
|
2617
|
+
|
|
2618
|
+
const None$3 = 0;
|
|
2619
|
+
const Expanded = 1;
|
|
2620
|
+
const Collapsed = 2;
|
|
2621
|
+
|
|
2622
|
+
const getExpandedType = type => {
|
|
2623
|
+
switch (type) {
|
|
2624
|
+
case Directory:
|
|
2625
|
+
return Collapsed;
|
|
2626
|
+
case DirectoryExpanding:
|
|
2627
|
+
case DirectoryExpanded:
|
|
2628
|
+
return Expanded;
|
|
2629
|
+
default:
|
|
2630
|
+
return None$3;
|
|
2631
|
+
}
|
|
2632
|
+
};
|
|
2633
|
+
|
|
2634
|
+
// 0 = 'Button'
|
|
2635
|
+
// 1 = 'IconButton'
|
|
2636
|
+
// 2 = 'Button IconButton'
|
|
2637
|
+
// it could make dom diffing faster, since for classname,
|
|
2638
|
+
// once at start, send all classnames to renderer process
|
|
2639
|
+
// only numbers are compared. it could also make rendering faster,
|
|
2640
|
+
// representing the concatenated strings for example
|
|
2641
|
+
// since less data is transferred to renderer process
|
|
2642
|
+
// then, components uses numeric classname
|
|
2643
|
+
// TODO add option to make classnames numeric
|
|
2644
|
+
// when a component uses multiple classnames, it is a new number
|
|
2645
|
+
const Actions = 'Actions';
|
|
2646
|
+
const Button$2 = 'Button';
|
|
2647
|
+
const ButtonNarrow = 'ButtonNarrow';
|
|
2648
|
+
const ButtonPrimary = 'ButtonPrimary';
|
|
2649
|
+
const ButtonWide = 'ButtonWide';
|
|
2650
|
+
const Chevron = 'Chevron';
|
|
2651
|
+
const Empty = '';
|
|
2652
|
+
const Explorer$1 = 'Explorer';
|
|
2653
|
+
const ExplorerDropTarget = 'DropTarget';
|
|
2654
|
+
const ExplorerErrorMessage = 'ExplorerErrorMessage';
|
|
2655
|
+
const ExplorerInputBox = 'ExplorerInputBox';
|
|
2656
|
+
const FileIcon = 'FileIcon';
|
|
2657
|
+
const FocusOutline = 'FocusOutline';
|
|
2658
|
+
const IconButton = 'IconButton';
|
|
2659
|
+
const InputValidationError = 'InputValidationError';
|
|
2660
|
+
const Label = 'Label';
|
|
2661
|
+
const LabelCut = 'LabelCut';
|
|
2662
|
+
const ListItems = 'ListItems';
|
|
2663
|
+
const MaskIconChevronDown = 'MaskIconChevronDown';
|
|
2664
|
+
const MaskIconChevronRight = 'MaskIconChevronRight';
|
|
2665
|
+
const ScrollBar = 'ScrollBar';
|
|
2666
|
+
const ScrollBarSmall = 'ScrollBarSmall';
|
|
2667
|
+
const ScrollBarThumb = 'ScrollBarThumb';
|
|
2668
|
+
const TreeItem$1 = 'TreeItem';
|
|
2669
|
+
const TreeItemActive = 'TreeItemActive';
|
|
2670
|
+
const Viewlet = 'Viewlet';
|
|
2671
|
+
const Welcome = 'Welcome';
|
|
2672
|
+
const WelcomeMessage = 'WelcomeMessage';
|
|
2673
|
+
|
|
2674
|
+
const mergeClassNames = (...classNames) => {
|
|
2675
|
+
return classNames.filter(Boolean).join(' ');
|
|
2676
|
+
};
|
|
2677
|
+
|
|
2678
|
+
const px = value => {
|
|
2679
|
+
return `${value}px`;
|
|
2680
|
+
};
|
|
2681
|
+
const position = (x, y) => {
|
|
2682
|
+
return `${x}px ${y}px`;
|
|
2683
|
+
};
|
|
2684
|
+
|
|
2685
|
+
const text = data => {
|
|
2686
|
+
return {
|
|
2687
|
+
type: Text,
|
|
2688
|
+
text: data,
|
|
2689
|
+
childCount: 0
|
|
2690
|
+
};
|
|
2691
|
+
};
|
|
2692
|
+
|
|
2693
|
+
const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, depth) => {
|
|
2694
|
+
let className = TreeItem$1;
|
|
2695
|
+
className = mergeClassNames(className, `Indent-${depth}`);
|
|
2696
|
+
if (isSelected || isFocused) {
|
|
2697
|
+
className = mergeClassNames(className, TreeItemActive);
|
|
2698
|
+
}
|
|
2699
|
+
if (isDropping) {
|
|
2700
|
+
className = mergeClassNames(className, 'DropTarget');
|
|
2701
|
+
}
|
|
2702
|
+
return className;
|
|
2703
|
+
};
|
|
2704
|
+
|
|
2705
|
+
const defaultIndent$1 = 1;
|
|
2706
|
+
const getTreeItemIndent = depth => {
|
|
2707
|
+
return `${depth * defaultIndent$1}rem`;
|
|
2708
|
+
};
|
|
2709
|
+
|
|
2710
|
+
// TODO make all of these variable configurable
|
|
2711
|
+
const defaultPaddingLeft = 4;
|
|
2712
|
+
const defaultIndent = 8;
|
|
2713
|
+
|
|
2714
|
+
// TODO make chevron size configurable
|
|
2715
|
+
const chevronSize = 22;
|
|
2716
|
+
const getTreeItemIndentWithChevron = (depth, chevron) => {
|
|
2717
|
+
// TODO use numeric value here, convert to string value in renderer process
|
|
2718
|
+
const extraSpace = chevron ? 0 : chevronSize;
|
|
2719
|
+
return `${depth * defaultIndent + extraSpace + defaultPaddingLeft}px`;
|
|
2720
|
+
};
|
|
2721
|
+
|
|
2722
|
+
const ariaExpandedValues = [undefined, 'true', 'false'];
|
|
2723
|
+
const getEditingChevron = direntType => {
|
|
2724
|
+
switch (direntType) {
|
|
2725
|
+
case EditingDirectoryExpanded:
|
|
2726
|
+
return Down;
|
|
2727
|
+
case EditingFolder:
|
|
2728
|
+
return Right;
|
|
2729
|
+
default:
|
|
2730
|
+
return None$4;
|
|
2731
|
+
}
|
|
2732
|
+
};
|
|
2733
|
+
const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris = []) => {
|
|
2734
|
+
const visible = [];
|
|
2735
|
+
const indentFn = useChevrons ? getTreeItemIndentWithChevron : getTreeItemIndent;
|
|
2736
|
+
let iconIndex = 0;
|
|
2737
|
+
for (let i = minLineY; i < Math.min(maxLineY, items.length); i++) {
|
|
2738
|
+
const item = items[i];
|
|
2739
|
+
let chevron = getChevronType(item.type, useChevrons);
|
|
2740
|
+
const isFocused = i === focusedIndex;
|
|
2741
|
+
const id = isFocused ? 'TreeItemActive' : undefined;
|
|
2742
|
+
const isSelected = item.selected;
|
|
2743
|
+
const isCut = cutItems.includes(item.path);
|
|
2744
|
+
const isDropping = dropTargets.includes(i);
|
|
2745
|
+
const isIgnored = sourceControlIgnoredUris.includes(item.path);
|
|
2746
|
+
const className = getTreeItemClassName(isSelected, isFocused, isDropping, useChevrons, item.depth); // TODO compute classname in dom function
|
|
2747
|
+
const expanded = getExpandedType(item.type);
|
|
2748
|
+
const ariaExpanded = ariaExpandedValues[expanded];
|
|
2749
|
+
const isEditing = i === editingIndex;
|
|
2750
|
+
let icon = icons[iconIndex++];
|
|
2751
|
+
if (isEditing) {
|
|
2752
|
+
icon = editingIcon;
|
|
2753
|
+
chevron = getEditingChevron(item.type);
|
|
2754
|
+
}
|
|
2755
|
+
const indent = indentFn(item.depth, chevron);
|
|
2756
|
+
visible.push({
|
|
2757
|
+
...item,
|
|
2758
|
+
posInSet: item.posInSet ?? i + 1,
|
|
2759
|
+
setSize: item.setSize ?? items.length,
|
|
2760
|
+
isEditing: isEditing,
|
|
2761
|
+
hasEditingError: isEditing && Boolean(editingErrorMessage),
|
|
2762
|
+
icon,
|
|
2763
|
+
indent,
|
|
2764
|
+
ariaExpanded,
|
|
2765
|
+
chevron,
|
|
2766
|
+
id,
|
|
2767
|
+
className,
|
|
2768
|
+
isCut,
|
|
2769
|
+
isIgnored,
|
|
2770
|
+
index: i
|
|
2771
|
+
});
|
|
2772
|
+
}
|
|
2773
|
+
return visible;
|
|
2774
|
+
};
|
|
2775
|
+
|
|
2644
2776
|
const {
|
|
2645
2777
|
get,
|
|
2646
2778
|
set,
|
|
@@ -2649,6 +2781,50 @@ const {
|
|
|
2649
2781
|
getCommandIds,
|
|
2650
2782
|
wrapGetter
|
|
2651
2783
|
} = create$2();
|
|
2784
|
+
const wrapListItemCommand = fn => {
|
|
2785
|
+
const wrappedCommand = async (id, ...args) => {
|
|
2786
|
+
const {
|
|
2787
|
+
newState
|
|
2788
|
+
} = get(id);
|
|
2789
|
+
const updatedState = await fn(newState, ...args);
|
|
2790
|
+
const {
|
|
2791
|
+
items,
|
|
2792
|
+
minLineY,
|
|
2793
|
+
focusedIndex,
|
|
2794
|
+
editingIndex,
|
|
2795
|
+
editingType,
|
|
2796
|
+
editingValue,
|
|
2797
|
+
editingErrorMessage,
|
|
2798
|
+
useChevrons,
|
|
2799
|
+
dropTargets,
|
|
2800
|
+
editingIcon,
|
|
2801
|
+
cutItems,
|
|
2802
|
+
sourceControlIgnoredUris,
|
|
2803
|
+
height,
|
|
2804
|
+
itemHeight,
|
|
2805
|
+
fileIconCache
|
|
2806
|
+
} = updatedState;
|
|
2807
|
+
const intermediate = get(id);
|
|
2808
|
+
set(id, intermediate.oldState, updatedState);
|
|
2809
|
+
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, items.length);
|
|
2810
|
+
const visible = items.slice(minLineY, maxLineY);
|
|
2811
|
+
const {
|
|
2812
|
+
icons,
|
|
2813
|
+
newFileIconCache
|
|
2814
|
+
} = await getFileIcons(visible, fileIconCache);
|
|
2815
|
+
const visibleExplorerItems = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris);
|
|
2816
|
+
const finalState = {
|
|
2817
|
+
...updatedState,
|
|
2818
|
+
visibleExplorerItems,
|
|
2819
|
+
fileIconCache: newFileIconCache,
|
|
2820
|
+
icons,
|
|
2821
|
+
maxLineY
|
|
2822
|
+
};
|
|
2823
|
+
const intermediate2 = get(id);
|
|
2824
|
+
set(id, intermediate2.oldState, finalState);
|
|
2825
|
+
};
|
|
2826
|
+
return wrappedCommand;
|
|
2827
|
+
};
|
|
2652
2828
|
|
|
2653
2829
|
const ListItem = 22;
|
|
2654
2830
|
|
|
@@ -2702,7 +2878,10 @@ const create2 = (uid, uri, x, y, width, height, args, parentUid, platform = 0) =
|
|
|
2702
2878
|
isPointerDown: false,
|
|
2703
2879
|
pointerDownIndex: -1,
|
|
2704
2880
|
sourceControlIgnoredUris: [],
|
|
2705
|
-
maxIndent: 0
|
|
2881
|
+
maxIndent: 0,
|
|
2882
|
+
errorMessageLeft: 0,
|
|
2883
|
+
errorMessageTop: 0,
|
|
2884
|
+
visibleExplorerItems: []
|
|
2706
2885
|
};
|
|
2707
2886
|
set(uid, state, state);
|
|
2708
2887
|
};
|
|
@@ -2755,14 +2934,17 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
2755
2934
|
isPointerDown: false,
|
|
2756
2935
|
pointerDownIndex: -1,
|
|
2757
2936
|
sourceControlIgnoredUris: [],
|
|
2758
|
-
maxIndent: 0
|
|
2937
|
+
maxIndent: 0,
|
|
2938
|
+
errorMessageLeft: 0,
|
|
2939
|
+
errorMessageTop: 0,
|
|
2940
|
+
visibleExplorerItems: []
|
|
2759
2941
|
};
|
|
2760
2942
|
set(state.uid, state, state);
|
|
2761
2943
|
return state;
|
|
2762
2944
|
};
|
|
2763
2945
|
|
|
2764
2946
|
const isEqual$6 = (oldState, newState) => {
|
|
2765
|
-
return oldState.scrollBarHeight === newState.scrollBarHeight && oldState.scrollBarActive === newState.scrollBarActive;
|
|
2947
|
+
return oldState.scrollBarHeight === newState.scrollBarHeight && oldState.scrollBarActive === newState.scrollBarActive && oldState.maxIndent === newState.maxIndent;
|
|
2766
2948
|
};
|
|
2767
2949
|
|
|
2768
2950
|
const isEqual$5 = (oldState, newState) => {
|
|
@@ -2774,7 +2956,7 @@ const isEqual$4 = (oldState, newState) => {
|
|
|
2774
2956
|
};
|
|
2775
2957
|
|
|
2776
2958
|
const isEqual$3 = (oldState, newState) => {
|
|
2777
|
-
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex && oldState.editingIndex === newState.editingIndex && oldState.editingType === newState.editingType && oldState.editingValue === newState.editingValue && oldState.editingErrorMessage === newState.editingErrorMessage && oldState.width === newState.width && oldState.focused === newState.focused && oldState.dropTargets === newState.dropTargets && oldState.icons === newState.icons && oldState.cutItems === newState.cutItems;
|
|
2959
|
+
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex && oldState.editingIndex === newState.editingIndex && oldState.editingType === newState.editingType && oldState.editingValue === newState.editingValue && oldState.editingErrorMessage === newState.editingErrorMessage && oldState.width === newState.width && oldState.focused === newState.focused && oldState.dropTargets === newState.dropTargets && oldState.icons === newState.icons && oldState.cutItems === newState.cutItems && oldState.visibleExplorerItems === newState.visibleExplorerItems;
|
|
2778
2960
|
};
|
|
2779
2961
|
|
|
2780
2962
|
const isEqual$2 = (oldState, newState) => {
|
|
@@ -2823,10 +3005,7 @@ const expandAll = async state => {
|
|
|
2823
3005
|
const {
|
|
2824
3006
|
items,
|
|
2825
3007
|
focusedIndex,
|
|
2826
|
-
pathSeparator
|
|
2827
|
-
minLineY,
|
|
2828
|
-
height,
|
|
2829
|
-
itemHeight
|
|
3008
|
+
pathSeparator
|
|
2830
3009
|
} = state;
|
|
2831
3010
|
if (focusedIndex === -1) {
|
|
2832
3011
|
return state;
|
|
@@ -2857,18 +3036,9 @@ const expandAll = async state => {
|
|
|
2857
3036
|
// await expand(state, dirent.index)
|
|
2858
3037
|
}
|
|
2859
3038
|
}
|
|
2860
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newDirents.length);
|
|
2861
|
-
const visible = newDirents.slice(minLineY, maxLineY);
|
|
2862
|
-
const {
|
|
2863
|
-
icons,
|
|
2864
|
-
newFileIconCache
|
|
2865
|
-
} = await getFileIcons(visible, state.fileIconCache);
|
|
2866
3039
|
return {
|
|
2867
3040
|
...state,
|
|
2868
|
-
items: newDirents
|
|
2869
|
-
icons,
|
|
2870
|
-
fileIconCache: newFileIconCache,
|
|
2871
|
-
maxLineY
|
|
3041
|
+
items: newDirents
|
|
2872
3042
|
};
|
|
2873
3043
|
};
|
|
2874
3044
|
|
|
@@ -2916,10 +3086,7 @@ const expandRecursively = async state => {
|
|
|
2916
3086
|
items,
|
|
2917
3087
|
focusedIndex,
|
|
2918
3088
|
pathSeparator,
|
|
2919
|
-
root
|
|
2920
|
-
height,
|
|
2921
|
-
itemHeight,
|
|
2922
|
-
minLineY
|
|
3089
|
+
root
|
|
2923
3090
|
} = state;
|
|
2924
3091
|
const dirent = focusedIndex < 0 ? {
|
|
2925
3092
|
type: Directory,
|
|
@@ -2938,33 +3105,15 @@ const expandRecursively = async state => {
|
|
|
2938
3105
|
if (focusedIndex >= 0) {
|
|
2939
3106
|
const endIndex = getParentEndIndex(items, focusedIndex);
|
|
2940
3107
|
const newDirents = [...items.slice(0, startIndex), ...childDirents, ...items.slice(endIndex)];
|
|
2941
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newDirents.length);
|
|
2942
|
-
const visible = newDirents.slice(minLineY, maxLineY);
|
|
2943
|
-
const {
|
|
2944
|
-
icons,
|
|
2945
|
-
newFileIconCache
|
|
2946
|
-
} = await getFileIcons(visible, state.fileIconCache);
|
|
2947
3108
|
return {
|
|
2948
3109
|
...state,
|
|
2949
|
-
items: newDirents
|
|
2950
|
-
maxLineY,
|
|
2951
|
-
icons,
|
|
2952
|
-
fileIconCache: newFileIconCache
|
|
3110
|
+
items: newDirents
|
|
2953
3111
|
};
|
|
2954
3112
|
}
|
|
2955
3113
|
const newDirents = childDirents.slice(1);
|
|
2956
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newDirents.length);
|
|
2957
|
-
const visible = newDirents.slice(minLineY, maxLineY);
|
|
2958
|
-
const {
|
|
2959
|
-
icons,
|
|
2960
|
-
newFileIconCache
|
|
2961
|
-
} = await getFileIcons(visible, state.fileIconCache);
|
|
2962
3114
|
return {
|
|
2963
3115
|
...state,
|
|
2964
|
-
items: newDirents
|
|
2965
|
-
maxLineY,
|
|
2966
|
-
icons,
|
|
2967
|
-
fileIconCache: newFileIconCache
|
|
3116
|
+
items: newDirents
|
|
2968
3117
|
};
|
|
2969
3118
|
};
|
|
2970
3119
|
|
|
@@ -3091,31 +3240,12 @@ const focusPrevious = state => {
|
|
|
3091
3240
|
if (items.length === 0) {
|
|
3092
3241
|
return state;
|
|
3093
3242
|
}
|
|
3094
|
-
return focusIndex(state, lastIndex(items));
|
|
3095
|
-
case 0:
|
|
3096
|
-
return state;
|
|
3097
|
-
default:
|
|
3098
|
-
return focusIndex(state, focusedIndex - 1);
|
|
3099
|
-
}
|
|
3100
|
-
};
|
|
3101
|
-
|
|
3102
|
-
const mergeClassNames = (...classNames) => {
|
|
3103
|
-
return classNames.filter(Boolean).join(' ');
|
|
3104
|
-
};
|
|
3105
|
-
|
|
3106
|
-
const px = value => {
|
|
3107
|
-
return `${value}px`;
|
|
3108
|
-
};
|
|
3109
|
-
const position = (x, y) => {
|
|
3110
|
-
return `${x}px ${y}px`;
|
|
3111
|
-
};
|
|
3112
|
-
|
|
3113
|
-
const text = data => {
|
|
3114
|
-
return {
|
|
3115
|
-
type: Text,
|
|
3116
|
-
text: data,
|
|
3117
|
-
childCount: 0
|
|
3118
|
-
};
|
|
3243
|
+
return focusIndex(state, lastIndex(items));
|
|
3244
|
+
case 0:
|
|
3245
|
+
return state;
|
|
3246
|
+
default:
|
|
3247
|
+
return focusIndex(state, focusedIndex - 1);
|
|
3248
|
+
}
|
|
3119
3249
|
};
|
|
3120
3250
|
|
|
3121
3251
|
const getKeyBindings = () => {
|
|
@@ -3215,7 +3345,7 @@ const getKeyBindings = () => {
|
|
|
3215
3345
|
};
|
|
3216
3346
|
|
|
3217
3347
|
const Separator = 1;
|
|
3218
|
-
const None$
|
|
3348
|
+
const None$2 = 0;
|
|
3219
3349
|
const RestoreFocus = 6;
|
|
3220
3350
|
|
|
3221
3351
|
const menuEntrySeparator = {
|
|
@@ -3228,13 +3358,13 @@ const menuEntrySeparator = {
|
|
|
3228
3358
|
const menuEntryNewFile = {
|
|
3229
3359
|
id: 'newFile',
|
|
3230
3360
|
label: newFile$1(),
|
|
3231
|
-
flags: None$
|
|
3361
|
+
flags: None$2,
|
|
3232
3362
|
command: 'Explorer.newFile'
|
|
3233
3363
|
};
|
|
3234
3364
|
const menuEntryNewFolder = {
|
|
3235
3365
|
id: 'newFolder',
|
|
3236
3366
|
label: newFolder$1(),
|
|
3237
|
-
flags: None$
|
|
3367
|
+
flags: None$2,
|
|
3238
3368
|
command: 'Explorer.newFolder'
|
|
3239
3369
|
};
|
|
3240
3370
|
const menuEntryOpenContainingFolder = {
|
|
@@ -3246,7 +3376,7 @@ const menuEntryOpenContainingFolder = {
|
|
|
3246
3376
|
const menuEntryOpenInIntegratedTerminal = {
|
|
3247
3377
|
id: 'openInIntegratedTerminal',
|
|
3248
3378
|
label: openInIntegratedTerminal(),
|
|
3249
|
-
flags: None$
|
|
3379
|
+
flags: None$2,
|
|
3250
3380
|
command: /* TODO */'-1'
|
|
3251
3381
|
};
|
|
3252
3382
|
const menuEntryCut = {
|
|
@@ -3264,7 +3394,7 @@ const menuEntryCopy = {
|
|
|
3264
3394
|
const menuEntryPaste = {
|
|
3265
3395
|
id: 'paste',
|
|
3266
3396
|
label: paste(),
|
|
3267
|
-
flags: None$
|
|
3397
|
+
flags: None$2,
|
|
3268
3398
|
command: 'Explorer.handlePaste'
|
|
3269
3399
|
};
|
|
3270
3400
|
const menuEntryCopyPath = {
|
|
@@ -3282,13 +3412,13 @@ const menuEntryCopyRelativePath = {
|
|
|
3282
3412
|
const menuEntryRename = {
|
|
3283
3413
|
id: 'rename',
|
|
3284
3414
|
label: rename(),
|
|
3285
|
-
flags: None$
|
|
3415
|
+
flags: None$2,
|
|
3286
3416
|
command: 'Explorer.renameDirent'
|
|
3287
3417
|
};
|
|
3288
3418
|
const menuEntryDelete = {
|
|
3289
3419
|
id: 'delete',
|
|
3290
3420
|
label: deleteItem(),
|
|
3291
|
-
flags: None$
|
|
3421
|
+
flags: None$2,
|
|
3292
3422
|
command: 'Explorer.removeDirent'
|
|
3293
3423
|
};
|
|
3294
3424
|
const ALL_ENTRIES = [menuEntryNewFile, menuEntryNewFolder, menuEntryOpenContainingFolder, menuEntryOpenInIntegratedTerminal, menuEntrySeparator, menuEntryCut, menuEntryCopy, menuEntryPaste, menuEntrySeparator, menuEntryCopyPath, menuEntryCopyRelativePath, menuEntrySeparator, menuEntryRename, menuEntryDelete];
|
|
@@ -3387,16 +3517,16 @@ const handleClickDirectoryExpanded = async (state, dirent, index, keepFocus) =>
|
|
|
3387
3517
|
minLineY,
|
|
3388
3518
|
maxLineY,
|
|
3389
3519
|
itemHeight,
|
|
3390
|
-
|
|
3520
|
+
items
|
|
3391
3521
|
} = state;
|
|
3392
3522
|
// @ts-ignore
|
|
3393
3523
|
dirent.type = Directory;
|
|
3394
3524
|
// @ts-ignore
|
|
3395
3525
|
dirent.icon = '';
|
|
3396
|
-
const endIndex = getParentEndIndex(
|
|
3526
|
+
const endIndex = getParentEndIndex(items, index);
|
|
3397
3527
|
const removeCount = endIndex - index - 1;
|
|
3398
3528
|
// TODO race conditions and side effects are everywhere
|
|
3399
|
-
const newDirents = [...
|
|
3529
|
+
const newDirents = [...items];
|
|
3400
3530
|
newDirents.splice(index + 1, removeCount);
|
|
3401
3531
|
const newTotal = newDirents.length;
|
|
3402
3532
|
if (newTotal < maxLineY) {
|
|
@@ -3404,35 +3534,21 @@ const handleClickDirectoryExpanded = async (state, dirent, index, keepFocus) =>
|
|
|
3404
3534
|
const newMaxLineY = Math.min(maxLineY, newTotal);
|
|
3405
3535
|
const newMinLineY = newMaxLineY - visibleItems;
|
|
3406
3536
|
const deltaY = newMinLineY * itemHeight;
|
|
3407
|
-
const parts = newDirents.slice(newMinLineY, newMaxLineY);
|
|
3408
|
-
const {
|
|
3409
|
-
icons,
|
|
3410
|
-
newFileIconCache
|
|
3411
|
-
} = await getFileIcons(parts, fileIconCache);
|
|
3412
3537
|
return {
|
|
3413
3538
|
...state,
|
|
3414
|
-
|
|
3415
|
-
icons,
|
|
3416
|
-
fileIconCache: newFileIconCache,
|
|
3417
|
-
focusedIndex: index,
|
|
3539
|
+
deltaY,
|
|
3418
3540
|
focused: keepFocus,
|
|
3419
|
-
|
|
3541
|
+
focusedIndex: index,
|
|
3542
|
+
items: newDirents,
|
|
3420
3543
|
maxLineY: newMaxLineY,
|
|
3421
|
-
|
|
3544
|
+
minLineY: newMinLineY
|
|
3422
3545
|
};
|
|
3423
3546
|
}
|
|
3424
|
-
const parts = newDirents.slice(state.minLineY, state.maxLineY);
|
|
3425
|
-
const {
|
|
3426
|
-
icons,
|
|
3427
|
-
newFileIconCache
|
|
3428
|
-
} = await getFileIcons(parts, fileIconCache);
|
|
3429
3547
|
return {
|
|
3430
3548
|
...state,
|
|
3431
|
-
|
|
3432
|
-
icons,
|
|
3433
|
-
fileIconCache: newFileIconCache,
|
|
3549
|
+
focused: keepFocus,
|
|
3434
3550
|
focusedIndex: index,
|
|
3435
|
-
|
|
3551
|
+
items: newDirents
|
|
3436
3552
|
};
|
|
3437
3553
|
};
|
|
3438
3554
|
|
|
@@ -3473,10 +3589,6 @@ const handleArrowRightDirectoryExpanded = (state, dirent) => {
|
|
|
3473
3589
|
return state;
|
|
3474
3590
|
};
|
|
3475
3591
|
|
|
3476
|
-
const setFocus = key => {
|
|
3477
|
-
return invoke$1('Focus.setFocus', key);
|
|
3478
|
-
};
|
|
3479
|
-
|
|
3480
3592
|
const handleClickDirectory = async (state, dirent, index, keepFocus) => {
|
|
3481
3593
|
// @ts-ignore
|
|
3482
3594
|
dirent.type = DirectoryExpanding;
|
|
@@ -3498,27 +3610,14 @@ const handleClickDirectory = async (state, dirent, index, keepFocus) => {
|
|
|
3498
3610
|
dirent.type = DirectoryExpanded;
|
|
3499
3611
|
// @ts-ignore
|
|
3500
3612
|
dirent.icon = '';
|
|
3501
|
-
const {
|
|
3502
|
-
height,
|
|
3503
|
-
itemHeight,
|
|
3504
|
-
minLineY
|
|
3505
|
-
} = state2;
|
|
3506
3613
|
// TODO when focused index has changed while expanding, don't update it
|
|
3507
|
-
|
|
3508
|
-
const parts = newDirents.slice(minLineY, maxLineY);
|
|
3509
|
-
const {
|
|
3510
|
-
icons,
|
|
3511
|
-
newFileIconCache
|
|
3512
|
-
} = await getFileIcons(parts, state.fileIconCache);
|
|
3513
|
-
await setFocus(FocusExplorer);
|
|
3614
|
+
|
|
3514
3615
|
return {
|
|
3515
3616
|
...state,
|
|
3516
|
-
items: newDirents,
|
|
3517
|
-
icons,
|
|
3518
|
-
fileIconCache: newFileIconCache,
|
|
3519
|
-
focusedIndex: newIndex,
|
|
3520
3617
|
focused: keepFocus,
|
|
3521
|
-
|
|
3618
|
+
focusedIndex: newIndex,
|
|
3619
|
+
items: newDirents,
|
|
3620
|
+
focus: List
|
|
3522
3621
|
};
|
|
3523
3622
|
};
|
|
3524
3623
|
|
|
@@ -3828,7 +3927,7 @@ const show = async (x, y, id, ...args) => {
|
|
|
3828
3927
|
return showContextMenu(x, y, id, ...args);
|
|
3829
3928
|
};
|
|
3830
3929
|
|
|
3831
|
-
const Explorer
|
|
3930
|
+
const Explorer = 4;
|
|
3832
3931
|
|
|
3833
3932
|
const handleContextMenuKeyboard = async state => {
|
|
3834
3933
|
const {
|
|
@@ -3840,7 +3939,7 @@ const handleContextMenuKeyboard = async state => {
|
|
|
3840
3939
|
} = state;
|
|
3841
3940
|
const menuX = x;
|
|
3842
3941
|
const menuY = y + (focusedIndex - minLineY + 1) * itemHeight;
|
|
3843
|
-
await show(menuX, menuY, Explorer
|
|
3942
|
+
await show(menuX, menuY, Explorer);
|
|
3844
3943
|
return state;
|
|
3845
3944
|
};
|
|
3846
3945
|
|
|
@@ -3854,7 +3953,7 @@ const handleContextMenuMouseAt = async (state, x, y) => {
|
|
|
3854
3953
|
focused: false
|
|
3855
3954
|
};
|
|
3856
3955
|
set(state.uid, state, newState);
|
|
3857
|
-
await show(x, y, Explorer
|
|
3956
|
+
await show(x, y, Explorer);
|
|
3858
3957
|
return state;
|
|
3859
3958
|
};
|
|
3860
3959
|
|
|
@@ -4071,12 +4170,8 @@ const sortPathDirentsMap = map => {
|
|
|
4071
4170
|
const refresh = async state => {
|
|
4072
4171
|
const {
|
|
4073
4172
|
root,
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
itemHeight,
|
|
4077
|
-
fileIconCache,
|
|
4078
|
-
items,
|
|
4079
|
-
focusedIndex
|
|
4173
|
+
focusedIndex,
|
|
4174
|
+
items
|
|
4080
4175
|
} = state;
|
|
4081
4176
|
const expandedDirents = getExpandedDirents(items);
|
|
4082
4177
|
const expandedPaths = getPaths(expandedDirents);
|
|
@@ -4084,23 +4179,14 @@ const refresh = async state => {
|
|
|
4084
4179
|
const pathToDirents = await getPathDirentsMap(allPaths);
|
|
4085
4180
|
const sortedPathDirents = sortPathDirentsMap(pathToDirents);
|
|
4086
4181
|
const newItems = getProtoMap(root, sortedPathDirents, expandedPaths);
|
|
4087
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newItems.length);
|
|
4088
|
-
const visible = newItems.slice(minLineY, maxLineY);
|
|
4089
|
-
const {
|
|
4090
|
-
icons,
|
|
4091
|
-
newFileIconCache
|
|
4092
|
-
} = await getFileIcons(visible, fileIconCache);
|
|
4093
4182
|
let newFocusedIndex = focusedIndex;
|
|
4094
4183
|
if (focusedIndex >= newItems.length) {
|
|
4095
4184
|
newFocusedIndex = newItems.length - 1;
|
|
4096
4185
|
}
|
|
4097
4186
|
return {
|
|
4098
4187
|
...state,
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
icons,
|
|
4102
|
-
maxLineY,
|
|
4103
|
-
focusedIndex: newFocusedIndex
|
|
4188
|
+
focusedIndex: newFocusedIndex,
|
|
4189
|
+
items: newItems
|
|
4104
4190
|
};
|
|
4105
4191
|
};
|
|
4106
4192
|
|
|
@@ -4398,8 +4484,10 @@ const handleEscape = async state => {
|
|
|
4398
4484
|
};
|
|
4399
4485
|
|
|
4400
4486
|
const handleFocus = async state => {
|
|
4401
|
-
|
|
4402
|
-
|
|
4487
|
+
return {
|
|
4488
|
+
...state,
|
|
4489
|
+
focus: List
|
|
4490
|
+
};
|
|
4403
4491
|
};
|
|
4404
4492
|
|
|
4405
4493
|
const updateIcons = async state => {
|
|
@@ -4720,7 +4808,7 @@ const handlePasteCut = async (state, nativeFiles) => {
|
|
|
4720
4808
|
};
|
|
4721
4809
|
};
|
|
4722
4810
|
|
|
4723
|
-
const None$
|
|
4811
|
+
const None$1 = 'none';
|
|
4724
4812
|
|
|
4725
4813
|
const handlePaste = async state => {
|
|
4726
4814
|
const nativeFiles = await readNativeFiles();
|
|
@@ -4741,16 +4829,15 @@ const handlePaste = async state => {
|
|
|
4741
4829
|
// TODO handle error gracefully when copy fails
|
|
4742
4830
|
|
|
4743
4831
|
// If no files to paste, return original state unchanged
|
|
4744
|
-
if (nativeFiles.type === None$
|
|
4832
|
+
if (nativeFiles.type === None$1) {
|
|
4745
4833
|
return state;
|
|
4746
4834
|
}
|
|
4747
4835
|
|
|
4748
4836
|
// Use the pasteShouldMove flag to determine whether to cut or copy
|
|
4749
4837
|
if (state.pasteShouldMove) {
|
|
4750
4838
|
return handlePasteCut(state, nativeFiles);
|
|
4751
|
-
} else {
|
|
4752
|
-
return handlePasteCopy(state, nativeFiles);
|
|
4753
4839
|
}
|
|
4840
|
+
return handlePasteCopy(state, nativeFiles);
|
|
4754
4841
|
};
|
|
4755
4842
|
|
|
4756
4843
|
const handlePointerDown = (state, button, x, y) => {
|
|
@@ -4801,18 +4888,11 @@ const setDeltaY = async (state, deltaY) => {
|
|
|
4801
4888
|
}
|
|
4802
4889
|
const minLineY = Math.round(deltaY / itemHeight);
|
|
4803
4890
|
const maxLineY = minLineY + Math.round(height / itemHeight);
|
|
4804
|
-
const visible = items.slice(minLineY, maxLineY);
|
|
4805
|
-
const {
|
|
4806
|
-
icons,
|
|
4807
|
-
newFileIconCache
|
|
4808
|
-
} = await getFileIcons(visible, state.fileIconCache);
|
|
4809
4891
|
return {
|
|
4810
4892
|
...state,
|
|
4811
4893
|
deltaY,
|
|
4812
|
-
minLineY,
|
|
4813
4894
|
maxLineY,
|
|
4814
|
-
|
|
4815
|
-
fileIconCache: newFileIconCache
|
|
4895
|
+
minLineY
|
|
4816
4896
|
};
|
|
4817
4897
|
};
|
|
4818
4898
|
|
|
@@ -4958,9 +5038,6 @@ const getSavedRoot = (savedState, workspacePath) => {
|
|
|
4958
5038
|
return workspacePath;
|
|
4959
5039
|
};
|
|
4960
5040
|
const loadContent = async (state, savedState) => {
|
|
4961
|
-
const {
|
|
4962
|
-
fileIconCache
|
|
4963
|
-
} = state;
|
|
4964
5041
|
const {
|
|
4965
5042
|
useChevrons,
|
|
4966
5043
|
confirmDelete
|
|
@@ -4971,10 +5048,6 @@ const loadContent = async (state, savedState) => {
|
|
|
4971
5048
|
const pathSeparator = await getPathSeparator(root); // TODO only load path separator once
|
|
4972
5049
|
const excluded = getExcluded();
|
|
4973
5050
|
const restoredDirents = await restoreExpandedState(savedState, root, pathSeparator, excluded);
|
|
4974
|
-
const {
|
|
4975
|
-
itemHeight,
|
|
4976
|
-
height
|
|
4977
|
-
} = state;
|
|
4978
5051
|
let minLineY = 0;
|
|
4979
5052
|
if (savedState && typeof savedState.minLineY === 'number') {
|
|
4980
5053
|
minLineY = savedState.minLineY;
|
|
@@ -4983,26 +5056,17 @@ const loadContent = async (state, savedState) => {
|
|
|
4983
5056
|
if (savedState && typeof savedState.deltaY === 'number') {
|
|
4984
5057
|
deltaY = savedState.deltaY;
|
|
4985
5058
|
}
|
|
4986
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, restoredDirents.length);
|
|
4987
|
-
const visible = restoredDirents.slice(minLineY, maxLineY);
|
|
4988
|
-
const {
|
|
4989
|
-
icons,
|
|
4990
|
-
newFileIconCache
|
|
4991
|
-
} = await getFileIcons(visible, fileIconCache);
|
|
4992
5059
|
return {
|
|
4993
5060
|
...state,
|
|
4994
|
-
|
|
5061
|
+
confirmDelete,
|
|
5062
|
+
deltaY,
|
|
5063
|
+
excluded,
|
|
4995
5064
|
items: restoredDirents,
|
|
4996
|
-
|
|
4997
|
-
fileIconCache: newFileIconCache,
|
|
5065
|
+
maxIndent: 10,
|
|
4998
5066
|
minLineY,
|
|
4999
|
-
deltaY,
|
|
5000
|
-
maxLineY,
|
|
5001
5067
|
pathSeparator,
|
|
5002
|
-
|
|
5003
|
-
useChevrons
|
|
5004
|
-
confirmDelete,
|
|
5005
|
-
maxIndent: 10
|
|
5068
|
+
root,
|
|
5069
|
+
useChevrons
|
|
5006
5070
|
};
|
|
5007
5071
|
};
|
|
5008
5072
|
|
|
@@ -5041,8 +5105,6 @@ const initialize = async () => {
|
|
|
5041
5105
|
await initializeFileSystemWorker();
|
|
5042
5106
|
};
|
|
5043
5107
|
|
|
5044
|
-
const ExplorerEditBox = FocusExplorerEditBox;
|
|
5045
|
-
|
|
5046
5108
|
const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntType) => {
|
|
5047
5109
|
// Get existing children or query them if they don't exist
|
|
5048
5110
|
let existingChildren = items.filter(item => item.depth === depth && item.path.startsWith(parentPath));
|
|
@@ -5135,39 +5197,24 @@ const getFittingIndex = (dirents, startIndex) => {
|
|
|
5135
5197
|
return -1;
|
|
5136
5198
|
};
|
|
5137
5199
|
const newDirent = async (state, editingType) => {
|
|
5138
|
-
// TODO make focus functional instead of side effect
|
|
5139
|
-
await setFocus(ExplorerEditBox);
|
|
5140
5200
|
// TODO do it like vscode, select position between folders and files
|
|
5141
5201
|
const {
|
|
5202
|
+
root,
|
|
5142
5203
|
focusedIndex,
|
|
5143
|
-
items
|
|
5144
|
-
minLineY,
|
|
5145
|
-
height,
|
|
5146
|
-
itemHeight,
|
|
5147
|
-
fileIconCache,
|
|
5148
|
-
root
|
|
5204
|
+
items
|
|
5149
5205
|
} = state;
|
|
5150
5206
|
const index = getFittingIndex(items, focusedIndex);
|
|
5151
5207
|
const direntType = getNewDirentType(editingType);
|
|
5152
5208
|
const newDirents = await getNewDirentsForNewDirent(items, index, direntType, root);
|
|
5153
|
-
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newDirents.length);
|
|
5154
|
-
const visible = newDirents.slice(minLineY, maxLineY);
|
|
5155
|
-
const {
|
|
5156
|
-
icons,
|
|
5157
|
-
newFileIconCache
|
|
5158
|
-
} = await getFileIcons(visible, fileIconCache);
|
|
5159
5209
|
const editingIndex = newDirents.findIndex(item => item.type === EditingFile || item.type === EditingFolder);
|
|
5160
5210
|
return {
|
|
5161
5211
|
...state,
|
|
5162
|
-
items: newDirents,
|
|
5163
5212
|
editingIndex,
|
|
5164
5213
|
editingType,
|
|
5165
5214
|
editingValue: '',
|
|
5166
|
-
focusedIndex: editingIndex,
|
|
5167
5215
|
focus: Input$1,
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
maxLineY
|
|
5216
|
+
focusedIndex: editingIndex,
|
|
5217
|
+
items: newDirents
|
|
5171
5218
|
};
|
|
5172
5219
|
};
|
|
5173
5220
|
|
|
@@ -5286,7 +5333,7 @@ const getRenameSelectionRange = name => {
|
|
|
5286
5333
|
const User = 1;
|
|
5287
5334
|
const Script = 2;
|
|
5288
5335
|
|
|
5289
|
-
const renameDirent = state => {
|
|
5336
|
+
const renameDirent = async state => {
|
|
5290
5337
|
const {
|
|
5291
5338
|
focusedIndex,
|
|
5292
5339
|
items,
|
|
@@ -5316,11 +5363,6 @@ const renameDirent = state => {
|
|
|
5316
5363
|
};
|
|
5317
5364
|
};
|
|
5318
5365
|
|
|
5319
|
-
const defaultIndent$1 = 1;
|
|
5320
|
-
const getTreeItemIndent = depth => {
|
|
5321
|
-
return `${depth * defaultIndent$1}rem`;
|
|
5322
|
-
};
|
|
5323
|
-
|
|
5324
5366
|
const renderCss = (oldState, newState) => {
|
|
5325
5367
|
const {
|
|
5326
5368
|
scrollBarHeight,
|
|
@@ -5333,7 +5375,7 @@ const renderCss = (oldState, newState) => {
|
|
|
5333
5375
|
for (let i = 0; i < maxIndent; i++) {
|
|
5334
5376
|
const indent = getTreeItemIndent(i);
|
|
5335
5377
|
rules.push(`.Indent-${i} {
|
|
5336
|
-
padding-left: ${indent}
|
|
5378
|
+
padding-left: ${indent};
|
|
5337
5379
|
}`);
|
|
5338
5380
|
}
|
|
5339
5381
|
const css = rules.join('\n');
|
|
@@ -5425,50 +5467,10 @@ const getErrorMessagePosition = (itemHeight, focusedIndex, minLineY, depth, inde
|
|
|
5425
5467
|
};
|
|
5426
5468
|
};
|
|
5427
5469
|
|
|
5428
|
-
const None
|
|
5470
|
+
const None = 'none';
|
|
5429
5471
|
const ToolBar = 'toolbar';
|
|
5430
5472
|
const Tree = 'tree';
|
|
5431
|
-
const TreeItem
|
|
5432
|
-
|
|
5433
|
-
// 0 = 'Button'
|
|
5434
|
-
// 1 = 'IconButton'
|
|
5435
|
-
// 2 = 'Button IconButton'
|
|
5436
|
-
// it could make dom diffing faster, since for classname,
|
|
5437
|
-
// once at start, send all classnames to renderer process
|
|
5438
|
-
// only numbers are compared. it could also make rendering faster,
|
|
5439
|
-
// representing the concatenated strings for example
|
|
5440
|
-
// since less data is transferred to renderer process
|
|
5441
|
-
// then, components uses numeric classname
|
|
5442
|
-
// TODO add option to make classnames numeric
|
|
5443
|
-
// when a component uses multiple classnames, it is a new number
|
|
5444
|
-
const Actions = 'Actions';
|
|
5445
|
-
const Button$2 = 'Button';
|
|
5446
|
-
const ButtonNarrow = 'ButtonNarrow';
|
|
5447
|
-
const ButtonPrimary = 'ButtonPrimary';
|
|
5448
|
-
const ButtonWide = 'ButtonWide';
|
|
5449
|
-
const Chevron = 'Chevron';
|
|
5450
|
-
const Empty = '';
|
|
5451
|
-
const Explorer = 'Explorer';
|
|
5452
|
-
const ExplorerDropTarget = 'DropTarget';
|
|
5453
|
-
const ExplorerErrorMessage = 'ExplorerErrorMessage';
|
|
5454
|
-
const ExplorerInputBox = 'ExplorerInputBox';
|
|
5455
|
-
const FileIcon = 'FileIcon';
|
|
5456
|
-
const FocusOutline = 'FocusOutline';
|
|
5457
|
-
const IconButton = 'IconButton';
|
|
5458
|
-
const InputValidationError = 'InputValidationError';
|
|
5459
|
-
const Label = 'Label';
|
|
5460
|
-
const LabelCut = 'LabelCut';
|
|
5461
|
-
const ListItems = 'ListItems';
|
|
5462
|
-
const MaskIconChevronDown = 'MaskIconChevronDown';
|
|
5463
|
-
const MaskIconChevronRight = 'MaskIconChevronRight';
|
|
5464
|
-
const ScrollBar = 'ScrollBar';
|
|
5465
|
-
const ScrollBarSmall = 'ScrollBarSmall';
|
|
5466
|
-
const ScrollBarThumb = 'ScrollBarThumb';
|
|
5467
|
-
const TreeItem = 'TreeItem';
|
|
5468
|
-
const TreeItemActive = 'TreeItemActive';
|
|
5469
|
-
const Viewlet = 'Viewlet';
|
|
5470
|
-
const Welcome = 'Welcome';
|
|
5471
|
-
const WelcomeMessage = 'WelcomeMessage';
|
|
5473
|
+
const TreeItem = 'treeitem';
|
|
5472
5474
|
|
|
5473
5475
|
const Button$1 = 1;
|
|
5474
5476
|
const Div = 4;
|
|
@@ -5507,7 +5509,7 @@ const HandleDragStart = 17;
|
|
|
5507
5509
|
const getExplorerWelcomeVirtualDom = isWide => {
|
|
5508
5510
|
return [{
|
|
5509
5511
|
type: Div,
|
|
5510
|
-
className: mergeClassNames(Viewlet, Explorer),
|
|
5512
|
+
className: mergeClassNames(Viewlet, Explorer$1),
|
|
5511
5513
|
tabIndex: 0,
|
|
5512
5514
|
childCount: 1
|
|
5513
5515
|
}, {
|
|
@@ -5549,7 +5551,7 @@ const getFileIconVirtualDom = icon => {
|
|
|
5549
5551
|
type: Img,
|
|
5550
5552
|
className: FileIcon,
|
|
5551
5553
|
src: icon,
|
|
5552
|
-
role: None
|
|
5554
|
+
role: None,
|
|
5553
5555
|
childCount: 0
|
|
5554
5556
|
};
|
|
5555
5557
|
};
|
|
@@ -5623,7 +5625,7 @@ const getExplorerItemVirtualDom = item => {
|
|
|
5623
5625
|
const chevronDom = getChevronVirtualDom(chevron);
|
|
5624
5626
|
return [{
|
|
5625
5627
|
type: Div,
|
|
5626
|
-
role: TreeItem
|
|
5628
|
+
role: TreeItem,
|
|
5627
5629
|
className,
|
|
5628
5630
|
draggable: true,
|
|
5629
5631
|
title: path,
|
|
@@ -5730,126 +5732,13 @@ const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused
|
|
|
5730
5732
|
const parentNode = {
|
|
5731
5733
|
type: Div,
|
|
5732
5734
|
childCount,
|
|
5733
|
-
className: mergeClassNames(Viewlet, Explorer),
|
|
5734
|
-
role: None
|
|
5735
|
+
className: mergeClassNames(Viewlet, Explorer$1),
|
|
5736
|
+
role: None
|
|
5735
5737
|
};
|
|
5736
5738
|
const dom = [parentNode, ...getListItemsVirtualDom(visibleItems, focusedIndex, focused, dropTargets), ...scrollBarDom, ...errorDom];
|
|
5737
5739
|
return dom;
|
|
5738
5740
|
};
|
|
5739
5741
|
|
|
5740
|
-
const None$1 = 0;
|
|
5741
|
-
const Right = 1;
|
|
5742
|
-
const Down = 2;
|
|
5743
|
-
|
|
5744
|
-
const getChevronType = (type, useChevrons) => {
|
|
5745
|
-
if (!useChevrons) {
|
|
5746
|
-
return None$1;
|
|
5747
|
-
}
|
|
5748
|
-
switch (type) {
|
|
5749
|
-
case Directory:
|
|
5750
|
-
return Right;
|
|
5751
|
-
case DirectoryExpanded:
|
|
5752
|
-
case DirectoryExpanding:
|
|
5753
|
-
return Down;
|
|
5754
|
-
default:
|
|
5755
|
-
return None$1;
|
|
5756
|
-
}
|
|
5757
|
-
};
|
|
5758
|
-
|
|
5759
|
-
const None = 0;
|
|
5760
|
-
const Expanded = 1;
|
|
5761
|
-
const Collapsed = 2;
|
|
5762
|
-
|
|
5763
|
-
const getExpandedType = type => {
|
|
5764
|
-
switch (type) {
|
|
5765
|
-
case Directory:
|
|
5766
|
-
return Collapsed;
|
|
5767
|
-
case DirectoryExpanding:
|
|
5768
|
-
case DirectoryExpanded:
|
|
5769
|
-
return Expanded;
|
|
5770
|
-
default:
|
|
5771
|
-
return None;
|
|
5772
|
-
}
|
|
5773
|
-
};
|
|
5774
|
-
|
|
5775
|
-
const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, depth) => {
|
|
5776
|
-
let className = TreeItem;
|
|
5777
|
-
className = mergeClassNames(className, `Indent-${depth}`);
|
|
5778
|
-
if (isSelected || isFocused) {
|
|
5779
|
-
className = mergeClassNames(className, TreeItemActive);
|
|
5780
|
-
}
|
|
5781
|
-
if (isDropping) {
|
|
5782
|
-
className = mergeClassNames(className, 'DropTarget');
|
|
5783
|
-
}
|
|
5784
|
-
return className;
|
|
5785
|
-
};
|
|
5786
|
-
|
|
5787
|
-
// TODO make all of these variable configurable
|
|
5788
|
-
const defaultPaddingLeft = 4;
|
|
5789
|
-
const defaultIndent = 8;
|
|
5790
|
-
|
|
5791
|
-
// TODO make chevron size configurable
|
|
5792
|
-
const chevronSize = 22;
|
|
5793
|
-
const getTreeItemIndentWithChevron = (depth, chevron) => {
|
|
5794
|
-
// TODO use numeric value here, convert to string value in renderer process
|
|
5795
|
-
const extraSpace = chevron ? 0 : chevronSize;
|
|
5796
|
-
return `${depth * defaultIndent + extraSpace + defaultPaddingLeft}px`;
|
|
5797
|
-
};
|
|
5798
|
-
|
|
5799
|
-
const ariaExpandedValues = [undefined, 'true', 'false'];
|
|
5800
|
-
const getEditingChevron = direntType => {
|
|
5801
|
-
switch (direntType) {
|
|
5802
|
-
case EditingDirectoryExpanded:
|
|
5803
|
-
return Down;
|
|
5804
|
-
case EditingFolder:
|
|
5805
|
-
return Right;
|
|
5806
|
-
default:
|
|
5807
|
-
return None$1;
|
|
5808
|
-
}
|
|
5809
|
-
};
|
|
5810
|
-
const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris = []) => {
|
|
5811
|
-
const visible = [];
|
|
5812
|
-
const indentFn = useChevrons ? getTreeItemIndentWithChevron : getTreeItemIndent;
|
|
5813
|
-
let iconIndex = 0;
|
|
5814
|
-
for (let i = minLineY; i < Math.min(maxLineY, items.length); i++) {
|
|
5815
|
-
const item = items[i];
|
|
5816
|
-
let chevron = getChevronType(item.type, useChevrons);
|
|
5817
|
-
const isFocused = i === focusedIndex;
|
|
5818
|
-
const id = isFocused ? 'TreeItemActive' : undefined;
|
|
5819
|
-
const isSelected = item.selected;
|
|
5820
|
-
const isCut = cutItems.includes(item.path);
|
|
5821
|
-
const isDropping = dropTargets.includes(i);
|
|
5822
|
-
const isIgnored = sourceControlIgnoredUris.includes(item.path);
|
|
5823
|
-
const className = getTreeItemClassName(isSelected, isFocused, isDropping, useChevrons, item.depth); // TODO compute classname in dom function
|
|
5824
|
-
const expanded = getExpandedType(item.type);
|
|
5825
|
-
const ariaExpanded = ariaExpandedValues[expanded];
|
|
5826
|
-
const isEditing = i === editingIndex;
|
|
5827
|
-
let icon = icons[iconIndex++];
|
|
5828
|
-
if (isEditing) {
|
|
5829
|
-
icon = editingIcon;
|
|
5830
|
-
chevron = getEditingChevron(item.type);
|
|
5831
|
-
}
|
|
5832
|
-
const indent = indentFn(item.depth, chevron);
|
|
5833
|
-
visible.push({
|
|
5834
|
-
...item,
|
|
5835
|
-
posInSet: item.posInSet ?? i + 1,
|
|
5836
|
-
setSize: item.setSize ?? items.length,
|
|
5837
|
-
isEditing: isEditing,
|
|
5838
|
-
hasEditingError: isEditing && Boolean(editingErrorMessage),
|
|
5839
|
-
icon,
|
|
5840
|
-
indent,
|
|
5841
|
-
ariaExpanded,
|
|
5842
|
-
chevron,
|
|
5843
|
-
id,
|
|
5844
|
-
className,
|
|
5845
|
-
isCut,
|
|
5846
|
-
isIgnored,
|
|
5847
|
-
index: i
|
|
5848
|
-
});
|
|
5849
|
-
}
|
|
5850
|
-
return visible;
|
|
5851
|
-
};
|
|
5852
|
-
|
|
5853
5742
|
const renderItems = (oldState, newState) => {
|
|
5854
5743
|
const {
|
|
5855
5744
|
cutItems,
|
|
@@ -5981,7 +5870,7 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
5981
5870
|
return {
|
|
5982
5871
|
type,
|
|
5983
5872
|
className: `MaskIcon MaskIcon${icon}`,
|
|
5984
|
-
role: None
|
|
5873
|
+
role: None,
|
|
5985
5874
|
childCount: 0
|
|
5986
5875
|
};
|
|
5987
5876
|
};
|
|
@@ -6367,14 +6256,14 @@ const updateEditingValue = async (state, value, inputSource = User) => {
|
|
|
6367
6256
|
};
|
|
6368
6257
|
|
|
6369
6258
|
const commandMap = {
|
|
6370
|
-
'Explorer.acceptEdit':
|
|
6371
|
-
'Explorer.cancelEdit':
|
|
6259
|
+
'Explorer.acceptEdit': wrapListItemCommand(acceptEdit),
|
|
6260
|
+
'Explorer.cancelEdit': wrapListItemCommand(cancelEdit),
|
|
6372
6261
|
'Explorer.cancelTypeAhead': wrapCommand(cancelTypeAhead),
|
|
6373
|
-
'Explorer.collapseAll':
|
|
6262
|
+
'Explorer.collapseAll': wrapListItemCommand(collapseAll),
|
|
6374
6263
|
'Explorer.copyPath': wrapCommand(copyPath),
|
|
6375
6264
|
'Explorer.copyRelativePath': wrapCommand(copyRelativePath),
|
|
6376
|
-
'Explorer.expandAll':
|
|
6377
|
-
'Explorer.expandRecursively':
|
|
6265
|
+
'Explorer.expandAll': wrapListItemCommand(expandAll),
|
|
6266
|
+
'Explorer.expandRecursively': wrapListItemCommand(expandRecursively),
|
|
6378
6267
|
'Explorer.focus': wrapCommand(focus),
|
|
6379
6268
|
'Explorer.focusFirst': wrapCommand(focusFirst),
|
|
6380
6269
|
'Explorer.focusIndex': wrapCommand(focusIndex),
|
|
@@ -6391,7 +6280,7 @@ const commandMap = {
|
|
|
6391
6280
|
'Explorer.handleArrowRight': wrapCommand(handleArrowRight),
|
|
6392
6281
|
'Explorer.handleEscape': wrapCommand(handleEscape),
|
|
6393
6282
|
'Explorer.handleBlur': wrapCommand(handleBlur),
|
|
6394
|
-
'Explorer.handleClick':
|
|
6283
|
+
'Explorer.handleClick': wrapListItemCommand(handleClick),
|
|
6395
6284
|
'Explorer.handleClickAt': wrapCommand(handleClickAt),
|
|
6396
6285
|
'Explorer.handleClickCurrent': wrapCommand(handleClickCurrent),
|
|
6397
6286
|
'Explorer.handleClickCurrentButKeepFocus': wrapCommand(handleClickCurrentButKeepFocus),
|
|
@@ -6409,25 +6298,25 @@ const commandMap = {
|
|
|
6409
6298
|
'Explorer.handleInputClick': wrapCommand(handleInputClick),
|
|
6410
6299
|
'Explorer.handleInputKeyDown': wrapCommand(handleInputKeyDown),
|
|
6411
6300
|
'Explorer.handleKeyDown': wrapCommand(handleKeyDown),
|
|
6412
|
-
'Explorer.handlePaste':
|
|
6301
|
+
'Explorer.handlePaste': wrapListItemCommand(handlePaste),
|
|
6413
6302
|
'Explorer.handlePointerDown': wrapCommand(handlePointerDown),
|
|
6414
6303
|
'Explorer.handleUpload': wrapCommand(handleUpload),
|
|
6415
6304
|
'Explorer.handleWheel': wrapCommand(handleWheel),
|
|
6416
|
-
'Explorer.handleWorkspaceChange':
|
|
6417
|
-
'Explorer.loadContent':
|
|
6418
|
-
'Explorer.newFile':
|
|
6419
|
-
'Explorer.newFolder':
|
|
6305
|
+
'Explorer.handleWorkspaceChange': wrapListItemCommand(handleWorkspaceChange),
|
|
6306
|
+
'Explorer.loadContent': wrapListItemCommand(loadContent),
|
|
6307
|
+
'Explorer.newFile': wrapListItemCommand(newFile),
|
|
6308
|
+
'Explorer.newFolder': wrapListItemCommand(newFolder),
|
|
6420
6309
|
'Explorer.openContainingFolder': wrapCommand(openContainingFolder),
|
|
6421
|
-
'Explorer.refresh':
|
|
6422
|
-
'Explorer.removeDirent':
|
|
6423
|
-
'Explorer.renameDirent':
|
|
6310
|
+
'Explorer.refresh': wrapListItemCommand(refresh),
|
|
6311
|
+
'Explorer.removeDirent': wrapListItemCommand(removeDirent),
|
|
6312
|
+
'Explorer.renameDirent': wrapListItemCommand(renameDirent),
|
|
6424
6313
|
'Explorer.restoreState': restoreState,
|
|
6425
6314
|
'Explorer.revealItem': wrapCommand(revealItem),
|
|
6426
6315
|
'Explorer.selectAll': wrapCommand(selectAll),
|
|
6427
6316
|
'Explorer.selectDown': wrapCommand(selectDown),
|
|
6428
6317
|
'Explorer.selectIndices': wrapCommand(setSelectedIndices),
|
|
6429
6318
|
'Explorer.selectUp': wrapCommand(selectUp),
|
|
6430
|
-
'Explorer.setDeltaY':
|
|
6319
|
+
'Explorer.setDeltaY': wrapListItemCommand(setDeltaY),
|
|
6431
6320
|
'Explorer.setSelectedIndices': wrapCommand(setSelectedIndices),
|
|
6432
6321
|
'Explorer.toggleIndividualSelection': wrapCommand(toggleIndividualSelection),
|
|
6433
6322
|
'Explorer.updateEditingValue': wrapCommand(updateEditingValue),
|