@adecore/ui 0.49.6 → 0.49.7
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/file-tree/helpers.js +13 -4
- package/dist/workspace/model.js +9 -1
- package/package.json +1 -1
- package/src/file-tree/helpers.ts +17 -4
- package/src/workspace/model.ts +11 -1
|
@@ -150,13 +150,22 @@ function plainKey(rowPath) {
|
|
|
150
150
|
return dirPathOf(rowPath);
|
|
151
151
|
}
|
|
152
152
|
export function collapsedPathsOf(rows, keyOf = plainKey) {
|
|
153
|
-
|
|
153
|
+
const paths = [];
|
|
154
|
+
for (const row of rows) {
|
|
154
155
|
const key = row.kind === 'directory' && !row.isExpanded ? keyOf(row.path) : null;
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
if (key !== null) {
|
|
157
|
+
paths.push(key);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return paths;
|
|
157
161
|
}
|
|
158
162
|
export function mergeCollapsedPaths(current, rows, keyOf = plainKey) {
|
|
159
|
-
const known = new Set(
|
|
163
|
+
const known = new Set();
|
|
164
|
+
for (const row of rows) {
|
|
165
|
+
if (row.kind === 'directory') {
|
|
166
|
+
known.add(keyOf(row.path));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
160
169
|
const folded = new Set(collapsedPathsOf(rows, keyOf));
|
|
161
170
|
const next = current.filter(dir => !known.has(dir) || folded.has(dir));
|
|
162
171
|
const existing = new Set(current);
|
package/dist/workspace/model.js
CHANGED
|
@@ -18,7 +18,15 @@ export function findSplitNode(node, id) {
|
|
|
18
18
|
if (node.id === id) {
|
|
19
19
|
return node;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
if (node.type === 'split') {
|
|
22
|
+
for (const child of node.children) {
|
|
23
|
+
const found = findSplitNode(child, id);
|
|
24
|
+
if (found !== undefined) {
|
|
25
|
+
return found;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
22
30
|
}
|
|
23
31
|
function shares(values, length) {
|
|
24
32
|
const safe = Array.from({
|
package/package.json
CHANGED
package/src/file-tree/helpers.ts
CHANGED
|
@@ -195,15 +195,28 @@ function plainKey(rowPath: string): string | null {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
export function collapsedPathsOf(rows: readonly FileTreeVisibleRow[], keyOf: FoldKeyOf = plainKey): string[] {
|
|
198
|
-
|
|
198
|
+
const paths: string[] = [];
|
|
199
|
+
|
|
200
|
+
for (const row of rows) {
|
|
199
201
|
const key = row.kind === 'directory' && !row.isExpanded ? keyOf(row.path) : null;
|
|
200
202
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
+
if (key !== null) {
|
|
204
|
+
paths.push(key);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return paths;
|
|
203
209
|
}
|
|
204
210
|
|
|
205
211
|
export function mergeCollapsedPaths(current: string[], rows: readonly FileTreeVisibleRow[], keyOf: FoldKeyOf = plainKey): string[] {
|
|
206
|
-
const known = new Set
|
|
212
|
+
const known = new Set<string | null>();
|
|
213
|
+
|
|
214
|
+
for (const row of rows) {
|
|
215
|
+
if (row.kind === 'directory') {
|
|
216
|
+
known.add(keyOf(row.path));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
207
220
|
const folded = new Set(collapsedPathsOf(rows, keyOf));
|
|
208
221
|
const next = current.filter((dir) => !known.has(dir) || folded.has(dir));
|
|
209
222
|
const existing = new Set(current);
|
package/src/workspace/model.ts
CHANGED
|
@@ -53,7 +53,17 @@ export function findSplitNode(node: SplitNode, id: string): SplitNode | undefine
|
|
|
53
53
|
return node;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
if (node.type === 'split') {
|
|
57
|
+
for (const child of node.children) {
|
|
58
|
+
const found = findSplitNode(child, id);
|
|
59
|
+
|
|
60
|
+
if (found !== undefined) {
|
|
61
|
+
return found;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return undefined;
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
function shares(values: number[], length: number): number[] {
|