Rebuild picker bundles with collapsed groups

This commit is contained in:
“Naeel”
2026-09-06 12:37:56 +03:00
parent 5e2c90f8db
commit 2b202795b8
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -501,7 +501,7 @@ function safeEntryParts(entryName) {
return parts; return parts;
} }
function node(kind, name, path, children = [], file = null) { function node(kind, name, path, children = [], file = null) {
return { id: crypto.randomUUID(), kind, name, path, children, file, expanded: true }; return { id: crypto.randomUUID(), kind, name, path, children, file, expanded: kind === "file" };
} }
function addPath(root, parts, fileNode) { function addPath(root, parts, fileNode) {
let current = root; let current = root;
@@ -745,7 +745,7 @@ function onFolderChange(state, cfg, elements) {
name: rootName, name: rootName,
path: rootName, path: rootName,
children: [], children: [],
expanded: true expanded: false
}); });
} }
const root = roots.get(rootName); const root = roots.get(rootName);
@@ -762,7 +762,7 @@ function onFolderChange(state, cfg, elements) {
name: part, name: part,
path: `${rootName}/${nodeParts.slice(0, index + 1).join("/")}`, path: `${rootName}/${nodeParts.slice(0, index + 1).join("/")}`,
children: [], children: [],
expanded: true expanded: false
}; };
current.children.push(child); current.children.push(child);
} }
+3 -3
View File
@@ -529,7 +529,7 @@ var FilePicker = (() => {
return parts; return parts;
} }
function node(kind, name, path, children = [], file = null) { function node(kind, name, path, children = [], file = null) {
return { id: crypto.randomUUID(), kind, name, path, children, file, expanded: true }; return { id: crypto.randomUUID(), kind, name, path, children, file, expanded: kind === "file" };
} }
function addPath(root, parts, fileNode) { function addPath(root, parts, fileNode) {
let current = root; let current = root;
@@ -773,7 +773,7 @@ var FilePicker = (() => {
name: rootName, name: rootName,
path: rootName, path: rootName,
children: [], children: [],
expanded: true expanded: false
}); });
} }
const root = roots.get(rootName); const root = roots.get(rootName);
@@ -790,7 +790,7 @@ var FilePicker = (() => {
name: part, name: part,
path: `${rootName}/${nodeParts.slice(0, index + 1).join("/")}`, path: `${rootName}/${nodeParts.slice(0, index + 1).join("/")}`,
children: [], children: [],
expanded: true expanded: false
}; };
current.children.push(child); current.children.push(child);
} }