Tree fixes

This commit is contained in:
2026-03-16 10:23:43 -05:00
parent 8b5f6f173b
commit d92e82cea0
5 changed files with 278 additions and 10 deletions
+23
View File
@@ -115,6 +115,11 @@ function createTreeNode(name, value, path) {
childrenContainer.appendChild(childNode);
});
if (shouldStartCollapsed(name, value)) {
childrenContainer.classList.add('collapsed');
toggle.textContent = '▶';
}
toggle.addEventListener('click', event => {
event.stopPropagation();
childrenContainer.classList.toggle('collapsed');
@@ -138,6 +143,24 @@ function createTreeNode(name, value, path) {
return container;
}
function shouldStartCollapsed(name, value) {
if (!value || typeof value !== 'object') {
return false;
}
const childKeys = Object.keys(value);
if (childKeys.length === 0) {
return false;
}
const hotfixChildren = childKeys.filter(key => {
const match = key.match(/^(.*)-h\d+$/i);
return match && match[1] === name;
});
return hotfixChildren.length > 0;
}
function createCheckbox(path, value) {
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';