diff --git a/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj b/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj index 620b1174..9c0a32ef 100644 --- a/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj +++ b/src/components/BootstrapBlazor.DockView/BootstrapBlazor.DockView.csproj @@ -1,7 +1,7 @@  - 10.0.4-beta01 + 10.0.4 diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewComponent.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewComponent.cs new file mode 100644 index 00000000..6df36f40 --- /dev/null +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewComponent.cs @@ -0,0 +1,223 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Rendering; +using System.Text.Json.Serialization; + +namespace BootstrapBlazor.Components; + +/// +/// DockContentItem 配置项子项对标 content 配置项内部 content 配置 +/// DockContentItem configuration item sub-item corresponds to the content configuration item inside the content configuration item +/// +public class DockViewComponent : DockViewComponentBase +{ + /// + /// 获得/设置 组件是否显示 Header 默认 true 显示 + /// Gets or sets whether the component header is displayed. Default is true. + /// + [Parameter] + public bool ShowHeader { get; set; } = true; + + /// + /// 获得/设置 组件 Title + /// Gets or sets the component title. + /// + [Parameter] + public string? Title { get; set; } + + /// + /// 获得/设置 组件 Title 宽度 默认 null 未设置 + /// Gets or sets the component title width. Default is null (not set). + /// + [Parameter] + public int? TitleWidth { get; set; } + + /// + /// 获得/设置 组件 Title 样式 默认 null 未设置 + /// Gets or sets the component title style. Default is null (not set). + /// + [Parameter] + public string? TitleClass { get; set; } + + /// + /// 获得/设置 Title 模板 默认 null 未设置 + /// Gets or sets the title template. Default is null (not set). + /// + [Parameter] + [JsonIgnore] + public RenderFragment? TitleTemplate { get; set; } + + /// + /// 获得/设置 组件 Class 默认 null 未设置 + /// Gets or sets the component class. Default is null (not set). + /// + [Parameter] + public string? Class { get; set; } + + /// + /// 获得/设置 组件是否可见 默认 true 可见 + /// Gets or sets whether the component is visible. Default is true. + /// + [Parameter] + public bool Visible { get; set; } = true; + + /// + /// 获得/设置 组件是否允许关闭 默认 null 使用 DockView 的配置 + /// Gets or sets whether the component is allowed to be closed. Default is null (uses DockView configuration). + /// + [Parameter] + public bool? ShowClose { get; set; } + + /// + /// 获得/设置 组件唯一标识值 默认 null 未设置时取 Title 作为唯一标识 + /// Gets or sets the unique identifier for the component. Default is null, uses Title as the identifier if not set. + /// + [Parameter] + public string? Key { get; set; } + + /// + /// 获得/设置 是否锁定 默认 null 未设置时取 DockView 的配置 + /// Gets or sets whether the component is locked. Default is null (uses DockView configuration). + /// + /// 锁定后无法拖动 + [Parameter] + public bool? IsLock { get; set; } + + /// + /// 获得/设置 是否显示锁定按钮 默认 null 未设置时取 DockView 的配置 + /// Gets or sets whether the lock button is displayed. Default is null (uses DockView configuration). + /// + [Parameter] + public bool? ShowLock { get; set; } + + /// + /// 获得/设置 是否悬浮 默认 null 未设置时取 DockView 的配置 + /// Gets or sets whether the component is floating. Default is null (uses DockView configuration). + /// + [Parameter] + public bool? IsFloating { get; set; } + + /// + /// 获得/设置 是否显示可悬浮按钮 默认 null 未设置时取 DockView 的配置 + /// Gets or sets whether the float button is displayed. Default is null (uses DockView configuration). + /// + [Parameter] + public bool? ShowFloat { get; set; } + + /// + /// 获得/设置 是否显示最大化按钮 默认 null 未设置时取 DockView 的配置 + /// Gets or sets whether the maximize button is displayed. Default is null (uses DockView configuration). + /// + [Parameter] + public bool? ShowMaximize { get; set; } + + /// + /// 获得/设置 是否一直显示 默认 null 未设置时取 DockView 的配置 + /// Gets or sets whether the component is always displayed. Default is null (uses DockView configuration). + /// + [Parameter] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Renderer { get; set; } + + /// + /// 获得/设置 是否显示标题前置图标 默认 false 不显示 + /// Gets or sets whether the title bar icon is displayed. Default is false. + /// + [Parameter] + [JsonIgnore] + public bool ShowTitleBar { get; set; } + + /// + /// 获得/设置 标题前置图标 默认 null 未设置使用默认图标 + /// Gets or sets the title bar icon. Default is null, uses the default icon if not set. + /// + [Parameter] + [JsonIgnore] + public string? TitleBarIcon { get; set; } + + /// + /// 获得/设置 标题前置图标 Url 默认 null 未设置使用默认图标 + /// Gets or sets the title bar icon URL. Default is null, uses the default icon if not set. + /// + [Parameter] + [JsonIgnore] + public string? TitleBarIconUrl { get; set; } + + /// + /// 获得/设置 标题前置图标点击回调方法 默认 null + /// Gets or sets the callback method for clicking the title bar icon. Default is null. + /// + [Parameter] + [JsonIgnore] + public Func? OnClickTitleBarCallback { get; set; } + + [CascadingParameter] + [NotNull] + private DockViewV2? DockView { get; set; } + + /// + /// + /// + protected override void OnInitialized() + { + base.OnInitialized(); + + Type = DockViewContentType.Component; + } + + /// + /// + /// + /// + protected override void BuildRenderTree(RenderTreeBuilder builder) + { + builder.OpenElement(0, "div"); + builder.AddAttribute(10, "id", Id); + builder.AddAttribute(20, "class", "bb-dockview-panel"); + builder.AddAttribute(30, "data-bb-key", Key); + builder.AddAttribute(40, "data-bb-title", Title); + + if (TitleTemplate != null) + { + builder.OpenElement(50, "div"); + builder.AddAttribute(51, "class", "bb-dockview-item-title"); + builder.AddContent(53, TitleTemplate); + builder.CloseElement(); + } + else if (ShowTitleBar) + { + builder.OpenComponent(60); + builder.AddAttribute(61, nameof(DockViewTitleBar.BarIcon), TitleBarIcon); + builder.AddAttribute(62, nameof(DockViewTitleBar.BarIconUrl), TitleBarIconUrl); + builder.AddAttribute(63, nameof(DockViewTitleBar.OnClickBarCallback), OnClickBar); + builder.CloseComponent(); + } + + if (DockView.ShowTab(Key)) + { + builder.AddContent(70, ChildContent); + } + builder.CloseElement(); + } + + private async Task OnClickBar() + { + if (OnClickTitleBarCallback != null) + { + await OnClickTitleBarCallback(); + } + } + + /// + /// 设置 Visible 参数方法 + /// Sets the Visible parameter. + /// + /// + public void SetVisible(bool visible) + { + Visible = visible; + } +} diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewComponent.razor b/src/components/BootstrapBlazor.DockView/Components/DockViewComponent.razor deleted file mode 100644 index c6500815..00000000 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewComponent.razor +++ /dev/null @@ -1,18 +0,0 @@ -@inherits DockViewComponentBase - -
- @if (TitleTemplate != null) - { -
- @TitleTemplate -
- } - else if (ShowTitleBar) - { - - } - @if (Visible) - { - @ChildContent - } -
diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewComponent.razor.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewComponent.razor.cs deleted file mode 100644 index bfc7563a..00000000 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewComponent.razor.cs +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// Website: https://www.blazor.zone or https://argozhang.github.io/ - -using Microsoft.AspNetCore.Components; -using System.Text.Json.Serialization; - -namespace BootstrapBlazor.Components; - -/// -/// DockContentItem 配置项子项对标 content 配置项内部 content 配置 -/// -public partial class DockViewComponent -{ - /// - /// 获得/设置 组件是否显示 Header 默认 true 显示 - /// - [Parameter] - public bool ShowHeader { get; set; } = true; - - /// - /// 获得/设置 组件 Title - /// - [Parameter] - public string? Title { get; set; } - - /// - /// 获得/设置 组件 Title 宽度 默认 null 未设置 - /// - [Parameter] - public int? TitleWidth { get; set; } - - /// - /// 获得/设置 组件 Title 样式 默认 null 未设置 - /// - [Parameter] - public string? TitleClass { get; set; } - - /// - /// 获得/设置 Title 模板 默认 null 未设置 - /// - [Parameter] - [JsonIgnore] - public RenderFragment? TitleTemplate { get; set; } - - /// - /// 获得/设置 组件 Class 默认 null 未设置 - /// - [Parameter] - public string? Class { get; set; } - - /// - /// 获得/设置 组件是否可见 默认 true 可见 - /// - [Parameter] - public bool Visible { get; set; } = true; - - /// - /// 获得/设置 组件是否允许关闭 默认 null 使用 DockView 的配置 - /// - [Parameter] - public bool? ShowClose { get; set; } - - /// - /// 获得/设置 组件唯一标识值 默认 null 未设置时取 Title 作为唯一标识 - /// - [Parameter] - public string? Key { get; set; } - - /// - /// 获得/设置 是否锁定 默认 null 未设置时取 DockView 的配置 - /// - /// 锁定后无法拖动 - [Parameter] - public bool? IsLock { get; set; } - - /// - /// 获得/设置 是否显示锁定按钮 默认 null 未设置时取 DockView 的配置 - /// - [Parameter] - public bool? ShowLock { get; set; } - - /// - /// 获得/设置 是否悬浮 默认 null 未设置时取 DockView 的配置 - /// - [Parameter] - public bool? IsFloating { get; set; } - - /// - /// 获得/设置 是否显示可悬浮按钮 默认 null 未设置时取 DockView 的配置 - /// - [Parameter] - public bool? ShowFloat { get; set; } - - /// - /// 获得/设置 是否显示最大化按钮 默认 null 未设置时取 DockView 的配置 - /// - [Parameter] - public bool? ShowMaximize { get; set; } - - /// - /// 获得/设置 是否一直显示 默认 null 未设置时取 DockView 的配置 - /// - [Parameter] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Renderer { get; set; } - - /// - /// 获得/设置 是否显示标题前置图标 默认 false 不显示 - /// - [Parameter] - [JsonIgnore] - public bool ShowTitleBar { get; set; } - - /// - /// 获得/设置 标题前置图标 默认 null 未设置使用默认图标 - /// - [Parameter] - [JsonIgnore] - public string? TitleBarIcon { get; set; } - - /// - /// 获得/设置 标题前置图标 Url 默认 null 未设置使用默认图标 - /// - [Parameter] - [JsonIgnore] - public string? TitleBarIconUrl { get; set; } - - /// - /// 获得/设置 标题前置图标点击回调方法 默认 null - /// - [Parameter] - [JsonIgnore] - public Func? OnClickTitleBarCallback { get; set; } - - /// - /// - /// - protected override void OnInitialized() - { - base.OnInitialized(); - - Type = DockViewContentType.Component; - } - - private async Task OnClickBar() - { - if (OnClickTitleBarCallback != null) - { - await OnClickTitleBarCallback(); - } - } - - /// - /// 设置 Visible 参数方法 - /// - /// - public void SetVisible(bool visible) - { - Visible = visible; - } -} diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewComponentBase.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewComponentBase.cs index 5922ed6d..f98d1e9b 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewComponentBase.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewComponentBase.cs @@ -1,4 +1,4 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ @@ -8,37 +8,43 @@ namespace BootstrapBlazor.Components; /// -/// DockComponent 基类 +/// DockComponent 基类 +/// Base class for DockComponent /// public abstract class DockViewComponentBase : IdComponentBase, IDisposable { /// - /// 获得/设置 渲染类型 默认 Component + /// 获得/设置 渲染类型 默认 Component + /// Gets or sets the render type. Default is Component. /// [Parameter] public DockViewContentType Type { get; set; } /// - /// 获得/设置 组件宽度百分比 默认 null 未设置 + /// 获得/设置 组件宽度百分比 默认 null 未设置 + /// Gets or sets the component width percentage. Default is null (not set). /// [Parameter] public int? Width { get; set; } /// - /// 获得/设置 组件高度百分比 默认 null 未设置 + /// 获得/设置 组件高度百分比 默认 null 未设置 + /// Gets or sets the component height percentage. Default is null (not set). /// [Parameter] public int? Height { get; set; } /// - /// 获得/设置 子组件 + /// 获得/设置 子组件 + /// Gets or sets the child content. /// [Parameter] [JsonIgnore] public RenderFragment? ChildContent { get; set; } /// - /// 获得/设置 DockContent 实例 + /// 获得/设置 DockContent 实例 + /// Gets or sets the DockContent instance. /// [CascadingParameter] private List? Parent { get; set; } @@ -54,7 +60,8 @@ protected override void OnInitialized() } /// - /// 资源销毁方法 + /// 资源销毁方法 + /// Resource disposal method /// /// protected virtual void Dispose(bool disposing) @@ -66,7 +73,8 @@ protected virtual void Dispose(bool disposing) } /// - /// 资源销毁方法 + /// 资源销毁方法 + /// Resource disposal method /// public void Dispose() { diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewConfig.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewConfig.cs index 9c7d5540..963fc419 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewConfig.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewConfig.cs @@ -1,4 +1,4 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ @@ -9,93 +9,116 @@ namespace BootstrapBlazor.Components; class DockViewConfig { /// - /// 获得/设置 是否启用本地布局保持 默认 true + /// 获得/设置 是否启用本地布局保持 默认 true + /// Gets or sets whether to enable local layout persistence. Default is true. /// public bool EnableLocalStorage { get; set; } = true; /// - /// 获得/设置 是否锁定 默认 false + /// 获得/设置 是否锁定 默认 false + /// Gets or sets whether the component is locked. Default is false. /// /// 锁定后无法拖动 [JsonPropertyName("lock")] public bool IsLock { get; set; } /// - /// 获得/设置 是否显示锁定按钮 默认 true 显示 + /// 获得/设置 是否显示锁定按钮 默认 true 显示 + /// Gets or sets whether the lock button is displayed. Default is true. /// public bool ShowLock { get; set; } /// - /// 获得/设置 是否悬浮 默认 false + /// 获得/设置 是否悬浮 默认 false + /// Gets or sets whether the component is floating. Default is false. /// /// 锁定后无法拖动 public bool IsFloating { get; set; } /// - /// 获得/设置 是否显示可悬浮按钮 默认 true + /// 获得/设置 是否显示可悬浮按钮 默认 true + /// Gets or sets whether the float button is displayed. Default is true. /// public bool ShowFloat { get; set; } = true; /// - /// 获得/设置 是否显示关闭按钮 默认 true 显示 + /// 获得/设置 是否显示关闭按钮 默认 true 显示 + /// Gets or sets whether the close button is displayed. Default is true. /// public bool ShowClose { get; set; } /// - /// 获得/设置 是否显示显示图钉按钮 默认 true + /// 获得/设置 是否显示图钉按钮 默认 true + /// Gets or sets whether the pin button is displayed. Default is true. /// public bool ShowPin { get; set; } = true; /// - /// 获得/设置 是否显示最大化按钮 默认 true + /// 获得/设置 是否显示最大化按钮 默认 true + /// Gets or sets whether the maximize button is displayed. Default is true. /// public bool ShowMaximize { get; set; } = true; /// - /// 获得/设置 客户端渲染模式 默认 null 客户端默认使用 always onlyWhenVisible 值 + /// 获得/设置 客户端渲染模式 默认 null 客户端默认使用 always onlyWhenVisible 值 + /// Gets or sets the client render mode. Default is null, the client will use always onlyWhenVisible value. /// [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DockViewRenderMode Renderer { get; set; } /// - /// 获得/设置 标签页可见状态改变事件回调 + /// 获得/设置 标签页可见状态改变事件回调 + /// Gets or sets the callback for when the tab visibility changes. /// public string? PanelVisibleChangedCallback { get; set; } /// - /// 获得/设置 组件初始化完成事件回调 + /// 获得/设置 组件初始化完成事件回调 + /// Gets or sets the callback for when the component is initialized. /// public string? InitializedCallback { get; set; } /// - /// 获得/设置 锁定事件回调 + /// 获得/设置 锁定事件回调 + /// Gets or sets the callback for when the lock state changes. /// public string? LockChangedCallback { get; set; } /// - /// 获得/设置 分割栏调整事件回调 + /// 获得/设置 分割栏调整事件回调 + /// Gets or sets the callback for when the splitter is adjusted. /// public string? SplitterCallback { get; set; } /// - /// 获得/设置 客户端缓存键值 + /// 获得/设置 加载当前激活标签页事件回调 + /// Gets or sets the callback for loading the currently active tab. + /// + public string? LoadTabs { get; set; } + + /// + /// 获得/设置 客户端缓存键值 + /// Gets or sets the client-side cache key. /// public string? LocalStorageKey { get; set; } /// - /// 获得/设置 Golden-Layout 配置项集合 默认 空集合 + /// 获得/设置 配置项集合 默认 空集合 + /// Gets or sets the configuration items. Default is an empty collection. /// [JsonPropertyName("content")] [JsonConverter(typeof(DockViewComponentConverter))] public List Contents { get; set; } = []; /// - /// 获得/设置 组件主题 默认 null 未设置 + /// 获得/设置 组件主题 默认 null 未设置 + /// Gets or sets the component theme. Default is null, not set. /// public string? Theme { get; set; } /// - /// 获得/设置 布局配置 默认 null 未设置 + /// 获得/设置 布局配置 默认 null 未设置 + /// Gets or sets the layout configuration. Default is null, not set. /// public string? LayoutConfig { get; set; } } diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewContent.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewContent.cs index 86ba29ee..a9842c17 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewContent.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewContent.cs @@ -1,4 +1,4 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ @@ -9,12 +9,14 @@ namespace BootstrapBlazor.Components; /// -/// DockContent 类对标 content 配置项 +/// DockContent 类对标 content 配置项 +/// DockContent class corresponds to the content configuration item. /// public class DockViewContent : DockViewComponentBase { /// - /// 获得/设置 子项集合 + /// 获得/设置 子项集合 + /// Gets or sets the collection of child items. /// [JsonConverter(typeof(DockViewComponentConverter))] [JsonPropertyName("content")] diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewContentType.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewContentType.cs index fb7f31d7..965d3742 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewContentType.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewContentType.cs @@ -1,32 +1,37 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ namespace BootstrapBlazor.Components; /// -/// DockContent 类型 +/// DockContent 类型 +/// DockContent type /// [JsonEnumConverter(true)] public enum DockViewContentType { /// - /// 行排列 水平排列 + /// 行排列 水平排列 + /// Row layout, horizontal arrangement /// Row, /// - /// 列排列 垂直排列 + /// 列排列 垂直排列 + /// Column layout, vertical arrangement /// Column, /// - /// 标签排列 + /// 标签排列 + /// Tab layout /// Group, /// - /// 组件 + /// 组件 + /// Component /// - Component, + Component } diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewDropdownIcon.razor b/src/components/BootstrapBlazor.DockView/Components/DockViewDropdownIcon.razor index ab5a5ec9..270ef496 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewDropdownIcon.razor +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewDropdownIcon.razor @@ -1,4 +1,4 @@ -@inherits DockViewIcon +@inherits DockViewIcon
diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewDropdownIcon.razor.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewDropdownIcon.razor.cs index 2ef01e89..25e388ca 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewDropdownIcon.razor.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewDropdownIcon.razor.cs @@ -1,16 +1,18 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ namespace BootstrapBlazor.Components; /// -/// DockViewDropdownIcon 组件 +/// DockViewDropdownIcon 组件 +/// DockViewDropdownIcon component /// public partial class DockViewDropdownIcon { /// - /// 获得 样式字符串 + /// 获得 样式字符串 + /// Gets the CSS class string. /// private string? ClassString => CssBuilder.Default("dropdown dropdown-center bb-dockview-control-icon") .AddClass($"bb-dockview-control-icon-{IconName}") diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewIcon.razor b/src/components/BootstrapBlazor.DockView/Components/DockViewIcon.razor index 8e186053..de353347 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewIcon.razor +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewIcon.razor @@ -1,4 +1,4 @@ -@inherits BootstrapComponentBase +@inherits BootstrapComponentBase
diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewIcon.razor.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewIcon.razor.cs index 10d80201..665c651e 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewIcon.razor.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewIcon.razor.cs @@ -1,4 +1,4 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ @@ -8,32 +8,37 @@ namespace BootstrapBlazor.Components; /// -/// DockViewIcon 组件 +/// DockViewIcon 组件 +/// DockViewIcon component /// public partial class DockViewIcon { /// - /// 获得/设置 资源文件接口实例 + /// 获得/设置 资源文件接口实例 + /// Gets or sets the resource file interface instance. /// [Inject, NotNull] protected IStringLocalizer? Localizer { get; set; } /// - /// 获得/设置 图标名称 + /// 获得/设置 图标名称 + /// Gets or sets the icon name. /// [Parameter, NotNull] [EditorRequired] public string? IconName { get; set; } /// - /// 获得 样式字符串 + /// 获得 样式字符串 + /// Gets the CSS class string. /// private string? ClassString => CssBuilder.Default("bb-dockview-control-icon") .AddClass($"bb-dockview-control-icon-{IconName}") .Build(); /// - /// 获得 图标地址 + /// 获得 图标地址 + /// Gets the icon URL. /// protected string Href => $"./_content/BootstrapBlazor.DockView/icon/dockview.svg#{IconName}"; diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewOptions.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewOptions.cs index e38e601c..191cd049 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewOptions.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewOptions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewRenderMode.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewRenderMode.cs index 76f6b555..6469a958 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewRenderMode.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewRenderMode.cs @@ -1,22 +1,31 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ namespace BootstrapBlazor.Components; /// -/// DockViewRenderMode 渲染模式枚举类型 +/// DockViewRenderMode 渲染模式枚举类型 +/// DockViewRenderMode render mode enumeration type /// [JsonEnumConverter(true)] public enum DockViewRenderMode { /// - /// 可见时渲染 + /// 可见时渲染 + /// Render when visible /// OnlyWhenVisible, /// - /// 始终渲染 + /// 始终渲染 + /// Always render /// - Always + Always, + + /// + /// 部分渲染 可见版面渲染 不可见版面异步渲染 + /// + /// + Partial } diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewTitleBar.razor b/src/components/BootstrapBlazor.DockView/Components/DockViewTitleBar.razor index b25f0e2b..c216a0f0 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewTitleBar.razor +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewTitleBar.razor @@ -1,4 +1,4 @@ -
+
@if (!string.IsNullOrEmpty(BarIconUrl)) { bar-icon diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewTitleBar.razor.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewTitleBar.razor.cs index df3890c9..d6dab5f6 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewTitleBar.razor.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewTitleBar.razor.cs @@ -1,4 +1,4 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor b/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor index 5658d5f6..ab5a2550 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor @@ -1,4 +1,4 @@ -@inherits BootstrapModuleComponentBase +@inherits BootstrapModuleComponentBase @attribute [JSModuleAutoLoader("./_content/BootstrapBlazor.DockView/Components/DockViewV2.razor.js", JSObjectReference = true)]
diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs b/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs index f1a3f025..abbb5afd 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs @@ -1,4 +1,4 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ @@ -13,7 +13,8 @@ namespace BootstrapBlazor.Components; public partial class DockViewV2 : IDisposable { /// - /// 获得/设置 DockView 名称 默认 null 用于本地存储识别 + /// 获得/设置 DockView 名称 默认 null 用于本地存储识别 + /// Gets or sets the DockView name. Default is null, used for local storage identification. /// [Parameter] [EditorRequired] @@ -21,111 +22,129 @@ public partial class DockViewV2 : IDisposable public string? Name { get; set; } /// - /// 获得/设置 布局配置 + /// 获得/设置 布局配置 + /// Gets or sets the layout configuration. /// [Parameter] public string? LayoutConfig { get; set; } /// - /// 获得/设置 是否显示关闭按钮 默认为 true + /// 获得/设置 是否显示关闭按钮 默认为 true + /// Gets or sets whether to show the close button. Default is true. /// [Parameter] public bool ShowClose { get; set; } = true; /// - /// 获得/设置 是否锁定 默认 false + /// 获得/设置 是否锁定 默认 false + /// Gets or sets whether to lock. Default is false. /// /// 锁定后无法拖动 [Parameter] public bool IsLock { get; set; } /// - /// 获得/设置 是否显示锁定按钮 默认 true + /// 获得/设置 是否显示锁定按钮 默认 true + /// Gets or sets whether to show the lock button. Default is true. /// [Parameter] public bool ShowLock { get; set; } = true; /// - /// 获得/设置 是否显示最大化按钮 默认 true + /// 获得/设置 是否显示最大化按钮 默认 true + /// Gets or sets whether to show the maximize button. Default is true. /// [Parameter] public bool ShowMaximize { get; set; } = true; /// - /// 获得/设置 是否悬浮 默认 false + /// 获得/设置 是否悬浮 默认 false + /// Gets or sets whether to float. Default is false. /// [Parameter] public bool IsFloating { get; set; } /// - /// 获得/设置 是否显示可悬浮按钮 默认 true + /// 获得/设置 是否显示可悬浮按钮 默认 true + /// Gets or sets whether to show the float button. Default is true. /// [Parameter] public bool ShowFloat { get; set; } = true; /// - /// 获得/设置 是否显示显示图钉按钮 默认 true + /// 获得/设置 是否显示显示图钉按钮 默认 true + /// Gets or sets whether to show the pin button. Default is true. /// [Parameter] public bool ShowPin { get; set; } = true; /// - /// 获得/设置 客户端渲染模式 默认 客户端默认使用 always onlyWhenVisible 值 + /// 获得/设置 客户端渲染模式 默认 客户端默认使用 always onlyWhenVisible 值 + /// Gets or sets the client render mode. Default is . The client defaults to using always onlyWhenVisible values. /// [Parameter] public DockViewRenderMode Renderer { get; set; } /// - /// 获得/设置 锁定状态回调此方法 + /// 获得/设置 锁定状态回调此方法 + /// Gets or sets the callback method for lock state changes. /// [Parameter] public Func? OnLockChangedCallbackAsync { get; set; } /// - /// 获得/设置 标签关闭时回调此方法 + /// 获得/设置 标签关闭时回调此方法 + /// Gets or sets the callback method for when a tab is closed. /// /// 可用于第三方组件显示标签页状态更新 [Parameter] public Func? OnVisibleStateChangedAsync { get; set; } /// - /// 获得/设置 标签页调整大小完成时回调此方法 + /// 获得/设置 标签页调整大小完成时回调此方法 + /// Gets or sets the callback method for when a tab is resized. /// [Parameter] public Func? OnSplitterCallbackAsync { get; set; } /// - /// 获得/设置 客户端组件脚本初始化完成后回调此方法 + /// 获得/设置 客户端组件脚本初始化完成后回调此方法 + /// Gets or sets the callback method for when the client component script initialization is complete. /// [Parameter] public Func? OnInitializedCallbackAsync { get; set; } /// - /// 获得/设置 子组件 + /// 获得/设置 子组件 + /// Gets or sets the child components. /// [Parameter] public RenderFragment? ChildContent { get; set; } /// - /// 获得/设置 版本设置 默认 null 未设置 用于本地配置 可通过全局统一配置 + /// 获得/设置 版本设置 默认 null 未设置 用于本地配置 可通过全局统一配置 + /// Gets or sets the version. Default is null. Used for local configuration and can be configured globally. /// [Parameter] public string? Version { get; set; } /// - /// 获得/设置 是否启用本地存储布局 默认 null 未设置 + /// 获得/设置 是否启用本地存储布局 默认 null 未设置 + /// Gets or sets whether to enable local storage layout. Default is null. Not set. /// [Parameter] public bool? EnableLocalStorage { get; set; } /// - /// 获得/设置 本地存储前缀 默认 bb-dock + /// 获得/设置 本地存储前缀 默认 bb-dock + /// Gets or sets the local storage prefix. Default is bb-dock. /// [Parameter] public string? LocalStoragePrefix { get; set; } /// - /// 获得/设置 DockView 组件主题 默认 Light + /// 获得/设置 DockView 组件主题 默认 Light + /// Gets or sets the DockView component theme. Default is Light. /// [Parameter] public DockViewTheme Theme { get; set; } = DockViewTheme.Light; @@ -201,7 +220,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender) PanelVisibleChangedCallback = nameof(PanelVisibleChangedCallbackAsync), LockChangedCallback = nameof(LockChangedCallbackAsync), SplitterCallback = nameof(SplitterCallbackAsync), - Contents = _components + Contents = _components, + LoadTabs = nameof(LoadTabs) }; private string GetVersion() => Version ?? _options.Version ?? "v1"; @@ -209,7 +229,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender) private string GetPrefixKey() => LocalStoragePrefix ?? _options.LocalStoragePrefix ?? "bb-dockview"; /// - /// 重置为默认布局 + /// 重置为默认布局 + /// Resets to the default layout. /// /// public async Task Reset(string? layoutConfig = null) @@ -223,7 +244,8 @@ public async Task Reset(string? layoutConfig = null) } /// - /// 获得当前布局 Json 字符串 + /// 获得当前布局 Json 字符串 + /// Gets the current layout JSON string. /// /// public Task SaveLayout() => InvokeAsync("save", Id); @@ -235,7 +257,8 @@ private Task OnThemeChangedAsync(string themeName) } /// - /// 标签页关闭回调方法 由 JavaScript 调用 + /// 标签页关闭回调方法 由 JavaScript 调用 + /// Tab close callback method called by JavaScript /// [JSInvokable] public async Task InitializedCallbackAsync() @@ -247,7 +270,8 @@ public async Task InitializedCallbackAsync() } /// - /// 标签页关闭回调方法 由 JavaScript 调用 + /// 标签页关闭回调方法 由 JavaScript 调用 + /// Tab close callback method called by JavaScript /// [JSInvokable] public async Task PanelVisibleChangedCallbackAsync(string title, bool status) @@ -258,8 +282,45 @@ public async Task PanelVisibleChangedCallbackAsync(string title, bool status) } } + private HashSet _loadTabs = new(); + + /// + /// 加载指定的标签页 由 JavaScript 调用 + /// Loads the specified tabs called by JavaScript + /// + /// + [JSInvokable] + public Task LoadTabs(List tabs) + { + // 客户端请求渲染当前激活的标签 + _loadTabs.Clear(); + foreach (var tab in tabs) + { + _loadTabs.Add(tab); + } + + StateHasChanged(); + return Task.CompletedTask; + } + + /// + /// 检查指定 Key 值 DockviewComponent 是否处于激活状态 + /// Checks whether the DockviewComponent with the specified key is active. + /// + /// + public bool ShowTab(string? key) + { + if (Renderer == DockViewRenderMode.Always) + { + return true; + } + + return _loadTabs.Contains(key ?? string.Empty); + } + /// - /// 锁定回调方法 由 JavaScript 调用 + /// 锁定回调方法 由 JavaScript 调用 + /// Lock callback method called by JavaScript /// [JSInvokable] public async Task LockChangedCallbackAsync(string[] panels, bool state) @@ -271,7 +332,8 @@ public async Task LockChangedCallbackAsync(string[] panels, bool state) } /// - /// 标签页关闭回调方法 由 JavaScript 调用 + /// 分割器回调方法 由 JavaScript 调用 + /// Splitter callback method called by JavaScript /// [JSInvokable] public async Task SplitterCallbackAsync() diff --git a/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.js b/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.js index ab91fbee..eed527ae 100644 --- a/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.js +++ b/src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.js @@ -1,4 +1,4 @@ -import { addLink, getTheme } from '../../BootstrapBlazor/modules/utility.js' +import { addLink, getTheme } from '../../BootstrapBlazor/modules/utility.js' import { cerateDockview } from '../js/dockview-utils.js' import Data from '../../BootstrapBlazor/modules/data.js' import EventHandler from "../../BootstrapBlazor/modules/event-handler.js" @@ -32,6 +32,9 @@ export async function init(id, invoke, options) { dockview.on('groupSizeChanged', () => { invoke.invokeMethodAsync(options.splitterCallback); }); + dockview.on('loadTabs', tabs => { + invoke.invokeMethodAsync(options.loadTabs, tabs); + }); EventHandler.on(document, 'changed.bb.theme', updateTheme); } diff --git a/src/components/BootstrapBlazor.DockView/Components/_Imports.razor b/src/components/BootstrapBlazor.DockView/Components/_Imports.razor index 39e5f820..c08309a2 100644 --- a/src/components/BootstrapBlazor.DockView/Components/_Imports.razor +++ b/src/components/BootstrapBlazor.DockView/Components/_Imports.razor @@ -1,2 +1,2 @@ -@namespace BootstrapBlazor.Components +@namespace BootstrapBlazor.Components @using Microsoft.AspNetCore.Components.Web diff --git a/src/components/BootstrapBlazor.DockView/Converters/DockViewComponentConverter.cs b/src/components/BootstrapBlazor.DockView/Converters/DockViewComponentConverter.cs index 3f974c8f..202b2a31 100644 --- a/src/components/BootstrapBlazor.DockView/Converters/DockViewComponentConverter.cs +++ b/src/components/BootstrapBlazor.DockView/Converters/DockViewComponentConverter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ @@ -8,7 +8,8 @@ namespace BootstrapBlazor.Components; /// -/// DockViewComponent 转化器 +/// DockViewComponent 转化器 +/// DockViewComponent converter /// class DockViewComponentConverter : JsonConverter> { diff --git a/src/components/BootstrapBlazor.DockView/Data/DockViewTheme.cs b/src/components/BootstrapBlazor.DockView/Data/DockViewTheme.cs index a303295f..af3f756b 100644 --- a/src/components/BootstrapBlazor.DockView/Data/DockViewTheme.cs +++ b/src/components/BootstrapBlazor.DockView/Data/DockViewTheme.cs @@ -1,4 +1,4 @@ -// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Website: https://www.blazor.zone or https://argozhang.github.io/ @@ -7,42 +7,49 @@ namespace BootstrapBlazor.Components; /// -/// DockView 组件主题 +/// DockView 组件主题 +/// DockView component theme /// public enum DockViewTheme { /// - /// dockview-theme-light 主题 + /// dockview-theme-light 主题 + /// dockview-theme-light theme /// [Description("dockview-theme-light")] Light, /// - /// dockview-theme-dark 主题 + /// dockview-theme-dark 主题 + /// dockview-theme-dark theme /// [Description("dockview-theme-dark")] Dark, /// - /// dockview-theme-vs 主题 + /// dockview-theme-vs 主题 + /// dockview-theme-vs theme /// [Description("dockview-theme-vs")] VS, /// - /// dockview-theme-abyss 主题 + /// dockview-theme-abyss 主题 + /// dockview-theme-abyss theme /// [Description("dockview-theme-abyss")] Abyss, /// - /// dockview-theme-dracula 主题 + /// dockview-theme-dracula 主题 + /// dockview-theme-dracula theme /// [Description("dockview-theme-dracula")] Dracula, /// - /// dockview-theme-replit 主题 + /// dockview-theme-replit 主题 + /// dockview-theme-replit theme /// [Description("dockview-theme-replit")] Replit diff --git a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-config.js b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-config.js index 2709059b..4c50bc24 100644 --- a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-config.js +++ b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-config.js @@ -278,7 +278,7 @@ const getGroupNode = (contentItem, size, boxSize, parent, panels, getGroupId, op title: item.title, tabComponent: item.componentName, contentComponent: item.componentName, - renderer: item.renderer || options.renderer, + // renderer: item.renderer || options.renderer, params: { ...item, parentId: parent.id } } return item.id @@ -303,7 +303,7 @@ const getLeafNode = (contentItem, size, boxSize, parent, panels, getGroupId, opt panels[contentItem.id] = { id: contentItem.id, title: contentItem.title, - renderer: contentItem.renderer || options.renderer, + // renderer: contentItem.renderer || options.renderer, tabComponent: contentItem.componentName, contentComponent: contentItem.componentName, params: { ...contentItem, parentId: parent.id } diff --git a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js index cfed3dfb..3c67390d 100644 --- a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js +++ b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-panel.js @@ -1,4 +1,4 @@ -import { saveConfig } from "./dockview-config.js"; +import { saveConfig } from "./dockview-config.js"; import { getIcon } from "./dockview-icon.js" import { setDrawerTitle } from "./dockview-group.js" @@ -23,6 +23,13 @@ const observePanelActiveChange = panel => { moveAlwaysRenderPanel(panel) }, 0) }) + panel.api.onDidVisibilityChange(({ isVisible }) => { + const dockview = panel.accessor; + if (dockview.params.options.renderer === 'onlyWhenVisible' && dockview._inited && isVisible) { + const visiblePanels = dockview.groups.map(g => g.panels.find(p => p.params.isActive) || g.panels.find(p => p.api.isVisible)) + dockview._loadTabs?.fire(visiblePanels.filter(p => Boolean(p)).map(p => p.params.key)); + } + }) } const moveAlwaysRenderPanel = panel => { @@ -136,7 +143,7 @@ const getPanels = (contentItem, options, parent = {}, panels = []) => { id: contentItem.id, groupId: contentItem.groupId, title: contentItem.title, - renderer: contentItem.renderer || options.renderer, + // renderer: contentItem.renderer || options.renderer, tabComponent: contentItem.componentName, contentComponent: contentItem.componentName, params: { ...contentItem, parentType: parent.type, parentId: parent.id } diff --git a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js index ed3836ee..60636a52 100644 --- a/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js +++ b/src/components/BootstrapBlazor.DockView/wwwroot/js/dockview-utils.js @@ -1,4 +1,4 @@ -import { DockviewComponent } from "./dockview-core.esm.js" +import { DockviewComponent } from "./dockview-core.esm.js" import { DockviewPanelContent } from "./dockview-content.js" import { onAddGroup, addGroupWithPanel, toggleLock, observeFloatingGroupLocationChange, observeOverlayChange, createDrawerHandle } from "./dockview-group.js" import { onAddPanel, onRemovePanel, getPanelsFromOptions, findContentFromPanels } from "./dockview-panel.js" @@ -8,6 +8,7 @@ import './dockview-extensions.js' const cerateDockview = (el, options) => { const theme = options.theme || "dockview-theme-light"; const template = el.querySelector('template'); + options.renderer ??= 'onlyWhenVisible'; // onlyWhenVisible | partial | always const dockview = new DockviewComponent(el, { parentElement: el, theme: { @@ -86,10 +87,22 @@ const initDockview = (dockview, options, template) => { dockview.onDidLayoutFromJSON(() => { const handler = setTimeout(() => { clearTimeout(handler); - - const panels = dockview.panels - const delPanelsStr = localStorage.getItem(dockview.params.options.localStorageKey + '-panels') - const delPanels = delPanelsStr && JSON.parse(delPanelsStr) || [] + const panels = dockview.panels; + const groups = dockview.groups; + const delPanelsStr = localStorage.getItem(dockview.params.options.localStorageKey + '-panels'); + const delPanels = delPanelsStr && JSON.parse(delPanelsStr) || []; + if (options.renderer === 'always') { + + } + else if (options.renderer === 'partial' || options.renderer === 'onlyWhenVisible') { + const visiblePanels = 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 => Boolean(p)).map(p => p.params.key)); + } + if (options.renderer === 'partial') { + if (dockview.panels.length > 0) { + dockview._loadTabs?.fire(dockview.panels.map(p => p.params.key)); + } + } panels.forEach(panel => { const visible = panel.params.visible if (!visible) { @@ -127,7 +140,7 @@ const initDockview = (dockview, options, template) => { dockview.groups.forEach(group => { observeGroup(group) }) - dockview.element.querySelector('&>.dv-dockview>.dv-branch-node').addEventListener('click', function (e) { + dockview.element.querySelector('&>.dv-dockview>.dv-branch-node').addEventListener('click', function(e) { this.parentElement.querySelectorAll('&>.dv-resize-container-drawer, &>.dv-render-overlay-float-drawer').forEach(item => { item.classList.remove('active') })