From 7053e857c993fe71fbaa7f9e98f9133df43ad77e Mon Sep 17 00:00:00 2001 From: zhaijunlei <276318515@qq.com> Date: Mon, 9 Nov 2026 13:43:32 +0800 Subject: [PATCH 1/3] fix(DockView): persist active panel when renderer is always (#IKGH29) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UniMeta.Device 的 DockView 选 Render=Always 时,激活面板 F5 后丢失。 https://e.gitee.com/shanghai-xuanyi-intelligent/issues/table?issue=IKGH29 --- .../wwwroot/js/dockview-panel.js | 3 +-- .../wwwroot/js/dockview-utils.js | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js index c9eb0f63..e4b5be67 100644 --- a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js +++ b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js @@ -15,8 +15,7 @@ const observePanelActiveChange = panel => { const renderer = dockview.params.options.renderer; if (renderer === 'onlyWhenVisible' && dockview.params.inited) { if (isVisible) { - saveConfig(panel.accessor) - const visiblePanels = dockview.groups.map(g => g.panels.find(p => p.params.isActive) || g.panels.find(p => p.api.isVisible)) + const visiblePanels = dockview.groups.map(g => g.activePanel) dockview._loadTabs?.fire(visiblePanels.filter(p => Boolean(p)).map(p => p.params.key)); } else { diff --git a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js index fb1ed4fc..7b446081 100644 --- a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js +++ b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js @@ -123,8 +123,8 @@ const postLayoutInit = (dockview, options) => { }) if (options.renderer === 'onlyWhenVisible') { - const visiblePanels = dockview.groups.filter(g => g.isVisible).map(g => g.panels.find(p => p.params.isActive) || g.panels.find(p => p.api.isVisible)) - dockview._loadTabs?.fire(visiblePanels.filter(p => p.params.key).map(p => p.params.key)); + const visiblePanels = dockview.groups.filter(g => g.isVisible).map(g => g.activePanel) + dockview._loadTabs?.fire(visiblePanels.filter(p => p && p.params.key).map(p => p.params.key)); } dockview._initialized?.fire(); }) @@ -213,6 +213,22 @@ const initDockview = (dockview, options, template) => { saveConfig(dockview) }) + // 切标签不改 grid 尺寸,always 下也走不到 onlyWhenVisible 分支;不在这里落盘则 F5 后回退 + dockview.onDidActivePanelChange(() => { + saveConfig(dockview) + }) + + // 拖拽期 core 会抑制上一条事件,程序化移动也不经 drop 处理器;0ms 合并掉一次操作的连续 fire + let movePanelTimer = null + dockview.onDidMovePanel(() => { + if (movePanelTimer) return + movePanelTimer = setTimeout(() => { + movePanelTimer = null + if (dockview._isDisposed) return + saveConfig(dockview) + }, 0) + }) + dockview._rootDropTarget.onDrop(() => { saveConfig(dockview) }) From 6f56c66743276dfa847aa01b070803de6617f832 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 10 Nov 2026 10:27:56 +0800 Subject: [PATCH 2/3] chore: bump version 11.0.0-rc.3 --- .../BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj b/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj index a02d9672..3fb70606 100644 --- a/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj +++ b/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj @@ -1,7 +1,7 @@ - 11.0.0-rc.2.1 + 11.0.0-rc.3 From 1cd469be8b7329f75d53b0558827e2410bee2780 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 10 Nov 2026 10:29:31 +0800 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20=E6=B8=85=E7=90=86=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/js/dockview-utils.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js index 7b446081..da5000f2 100644 --- a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js +++ b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js @@ -26,8 +26,6 @@ const cerateDockview = (el, options) => { return dockview; } -// Carry the `maximizing` flag on EVERY exit-maximize, not just the toggle button: the core also exits -// maximize when a group is removed/hidden/moved/added, and without the flag the restored siblings blank. const guardMaximizeExit = dockview => { const gridview = dockview.gridview; if (!gridview) return; @@ -45,15 +43,11 @@ const guardMaximizeExit = dockview => { }; } -// Fix "groups evenly split after refresh": while collapsed (size 0) skip overwriting existing -// proportions, else saveProportions freezes the collapsed equal-minimums as the split. _proportions is -// undefined only on the first deserialize save — let that through. Upstream fix: add `size > 0` to -// dockview-core's Splitview.saveProportions, then drop this patch. const guardCollapsedSaveProportions = dockview => { const splitview = dockview.gridview?.root?.splitview; if (!splitview) return; const proto = Object.getPrototypeOf(splitview); - if (proto.__bbCollapseGuard) return; // Splitview.prototype is shared by all instances; patch once + if (proto.__bbCollapseGuard) return; proto.__bbCollapseGuard = true; const original = proto.saveProportions; proto.saveProportions = function () { @@ -213,12 +207,10 @@ const initDockview = (dockview, options, template) => { saveConfig(dockview) }) - // 切标签不改 grid 尺寸,always 下也走不到 onlyWhenVisible 分支;不在这里落盘则 F5 后回退 dockview.onDidActivePanelChange(() => { saveConfig(dockview) }) - // 拖拽期 core 会抑制上一条事件,程序化移动也不经 drop 处理器;0ms 合并掉一次操作的连续 fire let movePanelTimer = null dockview.onDidMovePanel(() => { if (movePanelTimer) return @@ -265,15 +257,12 @@ const setWidth = (target, dockview) => { let dropdown = header.querySelector('.dv-right-actions-container>.dropdown') if (!dropdown) return let dropMenu = dropdown.querySelector('.dropdown-menu') - // `shrinking` (a strict width drop) gates the active-panel switch below — it must NOT fire during the - // transient expand a group goes through when a hidden view becomes visible (would switch + blank it). const group = dockview.params.inited ? dockview.groups.find(g => g.element === header.parentElement) : null const shrinking = group && group._lastHeaderWidth !== undefined && header.offsetWidth < group._lastHeaderWidth if (group) group._lastHeaderWidth = header.offsetWidth if (voidWidth === 0) { if (tabsContainer.children.length <= 1) return - // On shrink, if the active tab would overflow, switch to the first panel before tucking it away. if (shrinking) { const activeTab = tabsContainer.querySelector('.dv-tab.dv-active-tab') if (activeTab && activeTab.offsetLeft + activeTab.offsetWidth > tabsContainer.offsetWidth) { @@ -304,7 +293,6 @@ const setWidth = (target, dockview) => { } } } - // Fallback: keep an active panel when the group has none (e.g. the active one was closed). if (group && !group.activePanel) { group.panels[0]?.api.setActive() }