-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Dock): add GetLayoutConfig instance method (#2221)
* feat: 增加 Reset 方法 * feat: 增加 Reset 方法 * refactor: 增加 Readonly 关键字 * LayoutConfig and SaveLayoutCallback * Update BootstrapBlazor.Shared.csproj * 分开配置 * 更新复位功能 * GetLayout 获取面板的显示布局 * refactor: 增加销毁逻辑 * fix: 修复 layout 查找逻辑 * doc: 更新资源文件 * refactor: 更新脚本 * doc: 更新注释文档 * refactor: 移除 SaveLayoutCallback 回调方法 * refactor: 更改方法为 getLayoutConfig * revert: 移除 Update 方法参数 * revert: 撤销布局逻辑 * feat: 移除 LayoutConfig * refactor: 更改标题样式 * refactor: 精简代码 * feat: 增加 LayoutConfig 参数 * refactor: 支持服务器端配置 * refactor: 更新示例代码 * doc: 更新示例 --------- Co-authored-by: Argo-AscioTech <argo@live.ca>
- Loading branch information
1 parent
227aba8
commit 9869ee2
Showing
11 changed files
with
185 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
src/BootstrapBlazor.Shared/Samples/DockViews/DockViewLayout.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
@page "/dock-view/layout" | ||
@inherits BaseDockView | ||
|
||
<h4>自定义布局</h4> | ||
<p>通过设置 <code>DockView</code> 的属性 <code>LayoutConfig</code> 初始化控制面板的显示布局, 方法 <code>GetLayoutConfig</code> 获取面板的显示布局</p> | ||
|
||
<GroupBox Title="布局切换"> | ||
<Button OnClick="OnToggleLayout1" Text="布局1"></Button> | ||
<Button OnClick="OnToggleLayout2" Text="布局2"></Button> | ||
<Button OnClick="OnToggleLayout3" Text="布局3"></Button> | ||
<Button OnClick="GetLayout" Text="获取布局"></Button> | ||
<Button OnClick="Reset" Text="复位"></Button> | ||
<code class="config">@LayoutConfigSave</code> | ||
</GroupBox> | ||
|
||
<div class="dock-toggle-demo"> | ||
<DockView @ref="DockView" Name="DockViewLayout" EnableLocalStorage="true" LayoutConfig="@LayoutConfig"> | ||
<DockContent Type="DockContentType.Column"> | ||
<DockComponent Title="标签一"> | ||
<Table TItem="DynamicObject" DynamicContext="DataTableDynamicContext" | ||
IsStriped="true" IsBordered="true" IsExcel="true" ShowRefresh="false" | ||
ShowDefaultButtons="false"> | ||
<DetailRowTemplate> | ||
<div class="p-2 w-100"> | ||
<Table TItem="DynamicObject" DynamicContext="GetDetailDataTableDynamicContext(context)" IsStriped="true" IsBordered="true" IsExcel="true"> | ||
</Table> | ||
</div> | ||
</DetailRowTemplate> | ||
</Table> | ||
</DockComponent> | ||
<DockComponent Title="标签二"> | ||
<Table TItem="Foo" @bind-Items="Items" | ||
IsStriped="true" IsBordered="true" IsMultipleSelect="true" | ||
ShowToolbar="true" ShowExtendButtons="true" ShowSkeleton="true" | ||
OnAddAsync="@OnAddAsync"> | ||
<TableColumns> | ||
<TableColumn @bind-Field="@context.DateTime" Width="180" /> | ||
<TableColumn @bind-Field="@context.Name" /> | ||
<TableColumn @bind-Field="@context.Address" Width="180" TextEllipsis="true" ShowTips="true" /> | ||
<TableColumn @bind-Field="@context.Education" /> | ||
<TableColumn @bind-Field="@context.Count" /> | ||
<TableColumn @bind-Field="@context.Complete" /> | ||
</TableColumns> | ||
</Table> | ||
</DockComponent> | ||
<DockComponent Title="标签三"> | ||
<FetchData></FetchData> | ||
</DockComponent> | ||
</DockContent> | ||
</DockView> | ||
</div> | ||
|
||
@code { | ||
[NotNull] | ||
private DockView? DockView { get; set; } | ||
|
||
private async Task GetLayout() | ||
{ | ||
LayoutConfigSave = await DockView.GetLayoutConfig(); | ||
} | ||
|
||
private Task Reset() => DockView.Reset(); | ||
|
||
private void OnToggleLayout1() | ||
{ | ||
LayoutConfig = LayoutConfig1; | ||
} | ||
|
||
private void OnToggleLayout2() | ||
{ | ||
LayoutConfig = LayoutConfig2; | ||
} | ||
|
||
private void OnToggleLayout3() | ||
{ | ||
LayoutConfig = LayoutConfig3; | ||
} | ||
|
||
string? LayoutConfig; | ||
|
||
string? LayoutConfigSave; | ||
|
||
string LayoutConfig1 = """" | ||
{"root":{"type":"row","content":[{"type":"column","content":[{"type":"stack","content":[{"type":"component","content":[],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_45517422","maximised":false,"isClosable":true,"reorderEnabled":true,"title":"标签三","componentType":"component","componentState":{"id":"bb_45517422","showClose":true,"class":null,"key":"标签三","lock":false}}],"width":50,"minWidth":0,"height":33.460076045627375,"minHeight":0,"id":"","isClosable":true,"maximised":false,"activeItemIndex":0},{"type":"stack","content":[{"type":"component","content":[],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_42425232","maximised":false,"isClosable":true,"reorderEnabled":true,"title":"标签二","componentType":"component","componentState":{"id":"bb_42425232","showClose":true,"class":null,"key":"标签二","lock":false}}],"width":50,"minWidth":0,"height":66.53992395437263,"minHeight":0,"id":"","isClosable":true,"maximised":false,"activeItemIndex":0}],"width":50,"minWidth":50,"height":50,"minHeight":50,"id":"","isClosable":true},{"type":"stack","content":[{"type":"component","content":[],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_21184535","maximised":false,"isClosable":true,"reorderEnabled":true,"title":"标签一","componentType":"component","componentState":{"id":"bb_21184535","showClose":true,"class":null,"key":"标签一","lock":false}}],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_54183781","isClosable":true,"maximised":false,"activeItemIndex":0}],"width":50,"minWidth":50,"height":50,"minHeight":50,"id":"","isClosable":true},"openPopouts":[],"settings":{"constrainDragToContainer":true,"reorderEnabled":true,"popoutWholeStack":false,"blockedPopoutsThrowError":true,"closePopoutsOnUnload":true,"responsiveMode":"none","tabOverlapAllowance":0,"reorderOnTabMenuClick":true,"tabControlOffset":10,"popInOnClose":false},"dimensions":{"borderWidth":5,"borderGrabWidth":5,"minItemHeight":10,"minItemWidth":10,"headerHeight":25,"dragProxyWidth":300,"dragProxyHeight":200},"header":{"show":"top","popout":"lock/unlock","dock":"dock","close":"close","maximise":"maximise","minimise":"minimise","tabDropdown":"additional tabs"},"resolved":true} | ||
""""; | ||
|
||
string LayoutConfig2 = """" | ||
{"root":{"type":"row","content":[{"type":"stack","content":[{"type":"component","content":[],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_24636646","maximised":false,"isClosable":true,"reorderEnabled":true,"title":"标签三","componentType":"component","componentState":{"id":"bb_24636646","showClose":true,"class":null,"key":"标签三","lock":false}}],"width":33.333333333333336,"minWidth":0,"height":50,"minHeight":0,"id":"","isClosable":true,"maximised":false,"activeItemIndex":0},{"type":"stack","content":[{"type":"component","content":[],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_60600063","maximised":false,"isClosable":true,"reorderEnabled":true,"title":"标签一","componentType":"component","componentState":{"id":"bb_60600063","showClose":true,"class":null,"key":"标签一","lock":false}}],"width":33.333333333333336,"minWidth":0,"height":50,"minHeight":0,"id":"bb_54183781","isClosable":true,"maximised":false,"activeItemIndex":0},{"type":"stack","content":[{"type":"component","content":[],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_6744750","maximised":false,"isClosable":true,"reorderEnabled":true,"title":"标签二","componentType":"component","componentState":{"id":"bb_6744750","showClose":true,"class":null,"key":"标签二","lock":false}}],"width":33.33333333333333,"minWidth":0,"height":50,"minHeight":0,"id":"bb_6744750","isClosable":true,"maximised":false,"activeItemIndex":0}],"width":50,"minWidth":50,"height":50,"minHeight":50,"id":"","isClosable":true},"openPopouts":[],"settings":{"constrainDragToContainer":true,"reorderEnabled":true,"popoutWholeStack":false,"blockedPopoutsThrowError":true,"closePopoutsOnUnload":true,"responsiveMode":"none","tabOverlapAllowance":0,"reorderOnTabMenuClick":true,"tabControlOffset":10,"popInOnClose":false},"dimensions":{"borderWidth":5,"borderGrabWidth":5,"minItemHeight":10,"minItemWidth":10,"headerHeight":25,"dragProxyWidth":300,"dragProxyHeight":200},"header":{"show":"top","popout":"lock/unlock","dock":"dock","close":"close","maximise":"maximise","minimise":"minimise","tabDropdown":"additional tabs"},"resolved":true} | ||
""""; | ||
|
||
string LayoutConfig3 = """" | ||
{"root":{"type":"stack","content":[{"type":"component","content":[],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_24636646","maximised":false,"isClosable":true,"reorderEnabled":true,"title":"标签三","componentType":"component","componentState":{"id":"bb_24636646","showClose":true,"class":null,"key":"标签三","lock":false}},{"type":"component","content":[],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_60600063","maximised":false,"isClosable":true,"reorderEnabled":true,"title":"标签一","componentType":"component","componentState":{"id":"bb_60600063","showClose":true,"class":null,"key":"标签一","lock":false}},{"type":"component","content":[],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_6744750","maximised":false,"isClosable":true,"reorderEnabled":true,"title":"标签二","componentType":"component","componentState":{"id":"bb_6744750","showClose":true,"class":null,"key":"标签二","lock":false}}],"width":50,"minWidth":0,"height":50,"minHeight":0,"id":"bb_60600063","isClosable":true,"maximised":false,"activeItemIndex":1},"openPopouts":[],"settings":{"constrainDragToContainer":true,"reorderEnabled":true,"popoutWholeStack":false,"blockedPopoutsThrowError":true,"closePopoutsOnUnload":true,"responsiveMode":"none","tabOverlapAllowance":0,"reorderOnTabMenuClick":true,"tabControlOffset":10,"popInOnClose":false},"dimensions":{"borderWidth":5,"borderGrabWidth":5,"minItemHeight":10,"minItemWidth":10,"headerHeight":25,"dragProxyWidth":300,"dragProxyHeight":200},"header":{"show":"top","popout":"lock/unlock","dock":"dock","close":"close","maximise":"maximise","minimise":"minimise","tabDropdown":"additional tabs"},"resolved":true} | ||
""""; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/BootstrapBlazor.Shared/Samples/DockViews/DockViewLayout.razor.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.config { | ||
display: block; | ||
margin-top: 1rem; | ||
border: 1px solid var(--bs-secondary); | ||
border-radius: var(--bs-border-radius); | ||
padding: 0.5rem; | ||
overflow: auto; | ||
height: 88px; | ||
} | ||
|
||
.dock-toggle-demo { | ||
height: calc(100vh - 424px); | ||
margin-top: 1rem; | ||
} |
6 changes: 3 additions & 3 deletions
6
src/BootstrapBlazor.Shared/Samples/DockViews/DockViewLock.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/BootstrapBlazor.Shared/Samples/DockViews/DockViewVisible.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Extensions/Components/BootstrapBlazor.Dock/BootstrapBlazor.Dock.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters