diff --git a/Release/database/XNSim.db b/Release/database/XNSim.db index 0e2cae0..e066432 100644 Binary files a/Release/database/XNSim.db and b/Release/database/XNSim.db differ diff --git a/XNSimHtml/components/data-monitor.js b/XNSimHtml/components/data-monitor.js index 236b996..2105a62 100644 --- a/XNSimHtml/components/data-monitor.js +++ b/XNSimHtml/components/data-monitor.js @@ -161,7 +161,44 @@ class DataMonitor extends HTMLElement { // 设置新的定时器,300ms后执行搜索 this.searchTimeout = setTimeout(() => { this.filteredInterfaces = this.filterInterfaces(this.searchText); - this.render(); + + // 只更新树型控件部分 + const treeView = this.shadowRoot.querySelector('.tree-view'); + if (treeView) { + // 按ModelStructName分组 + const groupedInterfaces = this.filteredInterfaces.reduce((groups, item) => { + const group = groups[item.ModelStructName] || []; + group.push(item); + groups[item.ModelStructName] = group; + return groups; + }, {}); + + // 更新树型控件内容 + treeView.innerHTML = Object.entries(groupedInterfaces).map(([groupName, items]) => ` +
+
+ + ${groupName} +
+
+ ${items.map(item => ` +
+ ${item.InterfaceName} +
+ `).join('')} +
+
+ `).join(''); + + // 重新绑定树节点双击事件 + this.shadowRoot.querySelectorAll('.interface-item').forEach(itemEl => { + itemEl.ondblclick = (e) => { + const name = itemEl.getAttribute('data-interfacename'); + const struct = itemEl.getAttribute('data-modelstructname'); + this.handleTreeItemDblClick({ InterfaceName: name, ModelStructName: struct }); + }; + }); + } // 在下一个事件循环中恢复焦点和光标位置 requestAnimationFrame(() => { @@ -764,6 +801,7 @@ class DataMonitor extends HTMLElement { padding-right: 16px; display: flex; flex-direction: column; + min-width: 300px; } .search-box { @@ -781,10 +819,13 @@ class DataMonitor extends HTMLElement { .tree-view { flex-grow: 1; overflow-y: auto; + min-height: 200px; + width: 100%; } .tree-group { margin-bottom: 8px; + width: 100%; } .group-header { @@ -796,11 +837,14 @@ class DataMonitor extends HTMLElement { display: flex; align-items: center; gap: 8px; + width: 100%; + box-sizing: border-box; } .group-content { margin-left: 20px; display: block; + width: calc(100% - 20px); } .group-content.collapsed { @@ -813,6 +857,8 @@ class DataMonitor extends HTMLElement { border-radius: 4px; margin: 2px 0; user-select: none; + width: 100%; + box-sizing: border-box; } .interface-item:hover {