|
1 | 1 | <!-- This is a V3 replacement for `BranchFileList.svelte` --> |
2 | 2 | <script lang="ts"> |
3 | | - import ScrollableContainer from '$components/ConfigurableScrollableContainer.svelte'; |
4 | 3 | import LazyloadContainer from '$components/LazyloadContainer.svelte'; |
5 | 4 | import FileListItemWrapper from '$components/v3/FileListItemWrapper.svelte'; |
6 | | - import FileTree from '$components/v3/FileTree.svelte'; |
| 5 | + import FileTreeNode from '$components/v3/FileTreeNode.svelte'; |
7 | 6 | import { abbreviateFolders, changesToFileTree } from '$lib/files/filetreeV3'; |
8 | 7 | import { IdSelection } from '$lib/selection/idSelection.svelte'; |
9 | 8 | import { selectFilesInList, updateSelection } from '$lib/selection/idSelectionUtils'; |
|
80 | 79 | ); |
81 | 80 | </script> |
82 | 81 |
|
83 | | -{#snippet fileWrapper(change: TreeChange, idx: number)} |
| 82 | +{#snippet fileWrapper(change: TreeChange, idx: number, depth: number = 0)} |
84 | 83 | <FileListItemWrapper |
85 | 84 | selectedFile={selectionId} |
86 | 85 | {change} |
87 | 86 | {projectId} |
88 | 87 | {listActive} |
89 | 88 | {listMode} |
| 89 | + {depth} |
| 90 | + isLast={idx === visibleFiles.length - 1} |
90 | 91 | selected={idSelection.has(change.path, selectionId)} |
91 | 92 | onclick={(e) => { |
92 | 93 | stackState?.activeSelectionId.set(selectionId); |
|
96 | 97 | {/snippet} |
97 | 98 |
|
98 | 99 | {#if visibleFiles.length > 0} |
99 | | - <div class="file-list hide-native-scrollbar"> |
100 | | - <ScrollableContainer wide> |
101 | | - <!-- Maximum amount for initial render is 100 files |
102 | | - `minTriggerCount` set to 80 in order to start the loading a bit earlier. --> |
103 | | - <LazyloadContainer |
104 | | - minTriggerCount={80} |
105 | | - ontrigger={() => { |
106 | | - loadMore(); |
| 100 | + <LazyloadContainer |
| 101 | + minTriggerCount={80} |
| 102 | + ontrigger={() => { |
| 103 | + loadMore(); |
| 104 | + }} |
| 105 | + role="listbox" |
| 106 | + onkeydown={handleKeyDown} |
| 107 | + > |
| 108 | + {#if listMode === 'tree'} |
| 109 | + {@const node = abbreviateFolders(changesToFileTree(changes))} |
| 110 | + <FileTreeNode |
| 111 | + isRoot |
| 112 | + {stackId} |
| 113 | + {node} |
| 114 | + {showCheckboxes} |
| 115 | + {changes} |
| 116 | + {fileWrapper} |
| 117 | + onFolderClick={() => { |
| 118 | + console.warn('implement folder click to select all children'); |
107 | 119 | }} |
108 | | - role="listbox" |
109 | | - onkeydown={handleKeyDown} |
110 | | - > |
111 | | - {#if listMode === 'tree'} |
112 | | - {@const node = abbreviateFolders(changesToFileTree(changes))} |
113 | | - <FileTree {stackId} {changes} {node} expanded {showCheckboxes} {fileWrapper} /> |
114 | | - {:else} |
115 | | - {#each visibleFiles as change, idx (change.path)} |
116 | | - {@render fileWrapper(change, idx)} |
117 | | - {/each} |
118 | | - {/if} |
119 | | - </LazyloadContainer> |
120 | | - </ScrollableContainer> |
121 | | - </div> |
| 120 | + /> |
| 121 | + {:else} |
| 122 | + {#each visibleFiles as change, idx (change.path)} |
| 123 | + {@render fileWrapper(change, idx)} |
| 124 | + {/each} |
| 125 | + {/if} |
| 126 | + </LazyloadContainer> |
122 | 127 | {/if} |
123 | | - |
124 | | -<style lang="postcss"> |
125 | | - .file-list { |
126 | | - flex-grow: 1; |
127 | | - overflow: hidden; |
128 | | - } |
129 | | -</style> |
0 commit comments