-
-
Notifications
You must be signed in to change notification settings - Fork 374
wip: test pr #7372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: test pr #7372
Changes from all commits
47cbc26
da33062
e7dfe41
1a71e4c
63ad92d
cce713e
c8a6c7c
afa14bd
be72b25
eed08c3
bfc8abb
943e0bb
5260e88
044a84a
77da6d8
924fcb8
ffde92e
9fb4eda
ae0b16f
16782ef
740ebf1
1efed9a
8b0b637
fd7a470
69c80c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,12 @@ public class DynamicElement : BootstrapComponentBase | |
| [Parameter] | ||
| public bool GenerateElement { get; set; } = true; | ||
|
|
||
| /// <summary> | ||
| /// 获得/设置 组件 Key 值 | ||
| /// </summary> | ||
| [Parameter] | ||
| public object? Key { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// BuildRenderTree 方法 | ||
| /// </summary> | ||
|
|
@@ -119,6 +125,11 @@ protected override void BuildRenderTree(RenderTreeBuilder builder) | |
|
|
||
| builder.AddContent(8, ChildContent); | ||
|
|
||
| if (Key != null) | ||
| { | ||
| builder.SetKey(Key); | ||
|
Comment on lines
+128
to
+130
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Key is applied too late in the render sequence and won’t key the intended element. In Blazor, |
||
| } | ||
|
Comment on lines
+128
to
+131
|
||
|
|
||
| if (GenerateElement || IsTriggerClick() || IsTriggerDoubleClick()) | ||
| { | ||
| builder.CloseElement(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,7 @@ const initDrag = el => { | |||||||||||
| let height = 0; | ||||||||||||
| let isVertical = false; | ||||||||||||
| const drawerBody = el.querySelector('.drawer-body'); | ||||||||||||
| const bar = el.querySelector('.drawer-bar'); | ||||||||||||
| const bar = [...drawerBody.children].find(i => i.classList.contains('drawer-bar')); | ||||||||||||
|
||||||||||||
| Drag.drag(bar, | ||||||||||||
| e => { | ||||||||||||
| isVertical = drawerBody.classList.contains("top") || drawerBody.classList.contains("bottom") | ||||||||||||
|
|
@@ -105,7 +105,7 @@ export function execute(id, open) { | |||||||||||
| showDrawer(); | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| const showDrawer = () => { | ||||||||||||
| drawerBody.classList.add('show'); | ||||||||||||
| if (drawerBackdrop) { | ||||||||||||
|
|
@@ -175,7 +175,8 @@ export function dispose(id) { | |||||||||||
| body.classList.remove('overflow-hidden') | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| const bar = el.querySelector('.drawer-bar'); | ||||||||||||
| const drawerBody = el.querySelector('.drawer-body'); | ||||||||||||
|
||||||||||||
| const drawerBody = el.querySelector('.drawer-body'); | |
| const drawerBody = el.querySelector('.drawer-body'); | |
| if (!drawerBody) { | |
| return; | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||
| // Licensed to the .NET Foundation under one or more agreements. | ||||||||
| // Licensed to the .NET Foundation under one or more agreements. | ||||||||
| // The .NET Foundation licenses this file to you under the Apache 2.0 License | ||||||||
| // See the LICENSE file in the project root for more information. | ||||||||
| // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone | ||||||||
|
|
@@ -21,7 +21,7 @@ public partial class IpAddress | |||||||
| /// <summary> | ||||||||
| /// 获得 class 样式集合 | ||||||||
| /// </summary> | ||||||||
| protected string? ClassName => CssBuilder.Default("ipaddress form-control") | ||||||||
| protected string? ClassName => CssBuilder.Default("bb-ip form-control") | ||||||||
| .AddClass("disabled", IsDisabled) | ||||||||
| .AddClass(CssClass).AddClass(ValidCss) | ||||||||
| .Build(); | ||||||||
|
|
@@ -62,7 +62,6 @@ private void ValueChanged1(ChangeEventArgs args) | |||||||
| { | ||||||||
| Value1 = Value1[0..3]; | ||||||||
| } | ||||||||
|
|
||||||||
| UpdateValue(); | ||||||||
| } | ||||||||
|
|
||||||||
|
|
@@ -112,4 +111,22 @@ private void UpdateValue() | |||||||
| { | ||||||||
| CurrentValueAsString = $"{Value1}.{Value2}.{Value3}.{Value4}"; | ||||||||
| } | ||||||||
|
|
||||||||
| /// <summary> | ||||||||
| /// 更新 值方法供 JS 调用 | ||||||||
| /// </summary> | ||||||||
| /// <param name="v1"></param> | ||||||||
| /// <param name="v2"></param> | ||||||||
| /// <param name="v3"></param> | ||||||||
| /// <param name="v4"></param> | ||||||||
| [JSInvokable] | ||||||||
| public void TriggerUpdate(int v1, int v2, int v3, int v4) | ||||||||
| { | ||||||||
| Value1 = v1.ToString(); | ||||||||
| Value2 = v2.ToString(); | ||||||||
| Value3 = v3.ToString(); | ||||||||
| Value4 = v4.ToString(); | ||||||||
|
|
||||||||
| UpdateValue(); | ||||||||
|
||||||||
| UpdateValue(); | |
| UpdateValue(); | |
| InvokeAsync(StateHasChanged); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||||||||||||
| import Data from "../../modules/data.js" | ||||||||||||||||||||||
| import Data from "../../modules/data.js" | ||||||||||||||||||||||
| import EventHandler from "../../modules/event-handler.js" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| const selectCell = (el, index) => { | ||||||||||||||||||||||
|
|
@@ -13,7 +13,7 @@ const selectCell = (el, index) => { | |||||||||||||||||||||
| return c | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
||||||||||||||||||||||
| /** | |
| * Initializes the IPv4 address input component. | |
| * | |
| * @param {string} id The id of the root element that contains the IPv4 input cells. | |
| * @param {*} invoke An interop object that exposes `invokeMethodAsync`, used to notify the host | |
| * (for example, a .NET/Blazor component) when the IP address changes, such as | |
| * after a successful paste operation. | |
| */ |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The preventDefault() call should be placed after validation checks. If the clipboard data is empty or doesn't contain a valid IP address, the default paste behavior is still prevented, which could confuse users. Consider moving preventDefault() to after the validation on line 94 where it's confirmed the data is valid.
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern for IP address validation is duplicated as a magic string. Consider extracting this to a named constant at the module level for better maintainability and potential reuse.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| .ipaddress { | ||
| .bb-ip { | ||
| --bb-ip-cell-max-width: #{$bb-ip-cell-max-width}; | ||
| display: flex; | ||
| flex-wrap: nowrap; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,7 +237,7 @@ | |
| } | ||
| else | ||
| { | ||
| <DynamicElement class="@GetRowClassString(item, "table-row")" @key="item" | ||
|
||
| <DynamicElement class="@GetRowClassString(item, "table-row")" Key="GetKeyByITem(item)" | ||
| TriggerContextMenu="ContextMenuZone != null" OnContextMenu="e => OnContextMenu(e, item)" | ||
| @ontouchstart="e => OnTouchStart(e, item)" | ||
| @ontouchend="OnTouchEnd" | ||
|
|
@@ -675,7 +675,7 @@ | |
| </thead>; | ||
|
|
||
| RenderFragment<TItem> RenderRow => item => | ||
| @<DynamicElement TagName="tr" class="@GetRowClassString(item)" @key="item" | ||
| @<DynamicElement TagName="tr" class="@GetRowClassString(item)" Key="GetKeyByITem(item)" | ||
| TriggerContextMenu="ContextMenuZone != null" OnContextMenu="e => OnContextMenu(e, item)" | ||
| @ontouchstart="e => OnTouchStart(e, item)" @ontouchend="OnTouchEnd" | ||
| TriggerClick="@(ClickToSelect || OnClickRowCallback != null)" OnClick="() => ClickRow(item)" | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| // Licensed to the .NET Foundation under one or more agreements. | ||||||
| // Licensed to the .NET Foundation under one or more agreements. | ||||||
| // The .NET Foundation licenses this file to you under the Apache 2.0 License | ||||||
| // See the LICENSE file in the project root for more information. | ||||||
| // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone | ||||||
|
|
@@ -152,6 +152,12 @@ public partial class TreeView<TItem> : IModelEqualityComparer<TItem> | |||||
| [Parameter] | ||||||
| public Func<TreeViewItem<TItem>, Task>? OnTreeItemClick { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 获得/设置 点击节点前回调方法 | ||||||
| /// </summary> | ||||||
| [Parameter] | ||||||
| public Func<TreeViewItem<TItem>, Task<bool>>? OnBeforeTreeItemClick { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Gets or sets the callback method when a tree item is checked. | ||||||
| /// </summary> | ||||||
|
|
@@ -545,6 +551,15 @@ private async Task<IEnumerable<IExpandableNode<TItem>>> GetChildrenRowAsync(Tree | |||||
|
|
||||||
| private async Task OnClick(TreeViewItem<TItem> item) | ||||||
| { | ||||||
| if (OnBeforeTreeItemClick != null) | ||||||
| { | ||||||
| var ret = await OnBeforeTreeItemClick(item); | ||||||
| if (ret == false) | ||||||
|
||||||
| if (ret == false) | |
| if (!ret) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the Apache 2.0 License | ||
| // See the LICENSE file in the project root for more information. | ||
| // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone | ||
|
|
||
| namespace BootstrapBlazor.Components; | ||
|
|
||
| /// <summary> | ||
| /// PdfOptions 实例用于设置导出 Pdf 相关选项 | ||
| /// </summary> | ||
| public class PdfOptions | ||
| { | ||
| /// <summary> | ||
| /// 获得/设置 是否横向打印 默认 false | ||
| /// </summary> | ||
| public bool Landscape { get; set; } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The InvokeInitAsync method now unconditionally passes the Interop parameter to all JavaScript init functions. This is a breaking change that could cause issues for existing JavaScript modules that don't expect this parameter. Consider making this conditional based on whether Interop is not null, or ensure backward compatibility by checking if the JS module accepts this parameter.