Skip to content

Commit 5006dcc

Browse files
authored
Merge branch 'dotnetcore:main' into main
2 parents 5477f5f + 73f133a commit 5006dcc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+282
-254
lines changed

.github/workflows/pack.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
jobs:
1111
pack:
1212
runs-on: ubuntu-latest
13+
permissions:
14+
id-token: write
15+
contents: read
1316

1417
steps:
1518
- uses: actions/checkout@v4
@@ -19,9 +22,15 @@ jobs:
1922
with:
2023
dotnet-version: 9.0.x
2124

25+
- name: NuGet login
26+
uses: NuGet/login@v1
27+
id: login
28+
with:
29+
user: ${{ secrets.NUGET_USER }}
30+
2231
- name: Publish to Nuget
2332
env:
24-
NUGET_API_KEY: ${{secrets.NUGET_API_KEY}}
33+
NUGET_API_KEY: ${{steps.login.outputs.NUGET_API_KEY}}
2534
Bundle: True
2635

2736
run: |

.gitignore

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,6 @@ src/**/wwwroot/**/uploader
373373
# npm
374374
**/package-lock.json
375375

376-
# sass
377-
**/BootstrapBlazor/wwwroot/css/animate.min.css
378-
**/BootstrapBlazor/wwwroot/css/bootstrapblazor.min.css
379-
**/BootstrapBlazor/wwwroot/css/bootstrap.min.css
380-
**/BootstrapBlazor/wwwroot/css/bootstrap.rtl.min.css
381-
**/BootstrapBlazor/wwwroot/css/sweetalert2.css
382-
**/BootstrapBlazor/wwwroot/css/motronic.min.css
383-
**/BootstrapBlazor/wwwroot/css/nano.min.css
384-
385376
# Bootstrap
386377
**/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js
378+
**/BootstrapBlazor/wwwroot/css/bootstrapblazor.min.css

BootstrapBlazor.slnx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<Solution>
2+
<Folder Name="/actions/">
3+
<File Path=".github/workflows/auto-pull-request-checks.yml" />
4+
<File Path=".github/workflows/build.yml" />
5+
<File Path=".github/workflows/docker.yml" />
6+
<File Path=".github/workflows/pack.yml" />
7+
<File Path=".github/workflows/publish.yml" />
8+
</Folder>
29
<Folder Name="/configuration/">
310
<File Path=".editorconfig" />
411
<File Path=".gitignore" />

src/BootstrapBlazor.Server/Components/Components/FooterCounter.razor.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export function updateFooterCounter(id, totalSeconds) {
3333
const counter = Data.get(id);
3434
if (counter) {
3535
counter.totalSeconds = totalSeconds;
36-
console.log(`FooterCounter updated: ${id}, totalSeconds: ${totalSeconds}`);
3736
}
3837
}
3938

src/BootstrapBlazor.Server/Components/Samples/Logouts.razor.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ private static AttributeItem[] GetAttributes() =>
2121
DefaultValue = " — "
2222
},
2323
new()
24+
{
25+
Name = nameof(Logout.AvatarRadius),
26+
Description = "登出组件当前用户头像圆角半径",
27+
Type = "string",
28+
ValueList = " — ",
29+
DefaultValue = " — "
30+
},
31+
new()
2432
{
2533
Name = nameof(Logout.DisplayName),
2634
Description = "登出组件当前用户显示文字",

src/BootstrapBlazor.Server/Components/Samples/MindMaps.razor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
window.BootstrapBlazor.MindMap = {
66
callbacks: {
77
clickCustom: function (args) {
8-
console.log(this, args);
8+
99
}
1010
}
1111
}

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.10.2</Version>
4+
<Version>9.11.0</Version>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -10,16 +10,18 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<Content Remove="sasscompiler.json" />
14-
<Content Remove="wwwroot\core\**\*.*" />
15-
<Content Remove="wwwroot\lib\**\*.css" />
16-
<Content Remove="wwwroot\scss\**\*.*" />
17-
<Content Remove="wwwroot\src\**\*.*" />
18-
<None Include="sasscompiler.json" />
19-
<None Include="wwwroot\core\**\*.*" />
20-
<None Include="wwwroot\lib\**\*.css" />
21-
<None Include="wwwroot\scss\**\*.*" />
22-
<None Include="wwwroot\src\**\*.*" />
13+
<Content Remove="wwwroot\core\bootstrap\css\bootstrap.css" />
14+
<Content Remove="wwwroot\core\bootstrap\css\bootstrap.rtl.css" />
15+
<Content Remove="wwwroot\core\bootstrap\js\bootstrap.bundle.js" />
16+
<Content Remove="wwwroot\core\bootstrap\js\bootstrap.bundle.min.js" />
17+
<Content Remove="wwwroot\lib\swal\sweetalert2.css" />
18+
<Content Remove="wwwroot\scss\*" />
19+
<None Include="wwwroot\core\bootstrap\css\bootstrap.css" />
20+
<None Include="wwwroot\core\bootstrap\css\bootstrap.rtl.css" />
21+
<None Include="wwwroot\core\bootstrap\js\bootstrap.bundle.js" />
22+
<None Include="wwwroot\core\bootstrap\js\bootstrap.bundle.min.js" />
23+
<None Include="wwwroot\lib\swal\sweetalert2.css" />
24+
<None Include="wwwroot\scss\*" />
2325
</ItemGroup>
2426

2527
<ItemGroup>

src/BootstrapBlazor/Components/Affix/Affix.razor.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// See the LICENSE file in the project root for more information.
44
// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone
55

6+
using System.Globalization;
7+
68
namespace BootstrapBlazor.Components;
79

810
/// <summary>
@@ -40,8 +42,8 @@ public partial class Affix
4042
.Build();
4143

4244
private string? StyleString => CssBuilder.Default("position: sticky;")
43-
.AddStyle("z-index", $"{ZIndex}", ZIndex.HasValue)
44-
.AddStyle(Position.ToDescriptionString(), $"{Offset}px")
45+
.AddClass($"z-index: {ZIndex};", ZIndex.HasValue)
46+
.AddClass($"{Position.ToDescriptionString()}: {Offset.ToString(CultureInfo.InvariantCulture)}px;")
4547
.AddStyleFromAttributes(AdditionalAttributes)
4648
.Build();
4749
}

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public partial class AutoComplete
8585
[NotNull]
8686
private RenderTemplate? _dropdown = null;
8787

88+
private string? _clientValue;
89+
8890
private string? ClassString => CssBuilder.Default("auto-complete")
8991
.AddClass("is-clearable", IsClearable)
9092
.Build();
@@ -130,13 +132,36 @@ protected override void OnParametersSet()
130132
PlaceHolder ??= Localizer[nameof(PlaceHolder)];
131133
Icon ??= IconTheme.GetIconByKey(ComponentIcons.AutoCompleteIcon);
132134
LoadingIcon ??= IconTheme.GetIconByKey(ComponentIcons.LoadingIcon);
135+
136+
_clientValue = Value;
133137
}
134138

135139
/// <summary>
136140
/// <inheritdoc/>
137141
/// </summary>
142+
/// <param name="firstRender"></param>
138143
/// <returns></returns>
139-
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, Value);
144+
protected override async Task OnAfterRenderAsync(bool firstRender)
145+
{
146+
await base.OnAfterRenderAsync(firstRender);
147+
148+
if (!firstRender)
149+
{
150+
if (Value != _clientValue)
151+
{
152+
_clientValue = Value;
153+
await InvokeVoidAsync("setValue", Id, _clientValue);
154+
}
155+
}
156+
}
157+
158+
/// <summary>
159+
/// <inheritdoc/>
160+
/// </summary>
161+
/// <returns></returns>
162+
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, Value, GetChangedEventCallbackName());
163+
164+
private string? GetChangedEventCallbackName() => (OnValueChanged != null || ValueChanged.HasDelegate) ? nameof(TriggerChange) : null;
140165

141166
/// <summary>
142167
/// Gets whether show the clear button.
@@ -199,6 +224,20 @@ public async Task TriggerFilter(string val)
199224
_dropdown.Render();
200225
}
201226

227+
/// <summary>
228+
/// 支持双向绑定 由客户端 JavaScript 触发
229+
/// </summary>
230+
/// <param name="v"></param>
231+
/// <returns></returns>
232+
[JSInvokable]
233+
public Task TriggerChange(string v)
234+
{
235+
_clientValue = v;
236+
CurrentValueAsString = v;
237+
238+
return Task.CompletedTask;
239+
}
240+
202241
private List<string> GetFilterItemsByValue(string val)
203242
{
204243
var comparison = IgnoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import EventHandler from "../../modules/event-handler.js"
55
import Input from "../../modules/input.js"
66
import Popover from "../../modules/base-popover.js"
77

8-
export function init(id, invoke) {
8+
export function init(id, invoke, value, changedEventCallback) {
99
const el = document.getElementById(id)
1010
const menu = el.querySelector('.dropdown-menu')
1111
const input = document.getElementById(`${id}_input`)
1212
const ac = { el, invoke, menu, input }
1313
Data.set(id, ac)
1414

15+
input.value = value;
16+
1517
const isPopover = input.getAttribute('data-bs-toggle') === 'bb.dropdown';
1618
if (isPopover) {
1719
ac.popover = Popover.init(el, { toggleClass: '[data-bs-toggle="bb.dropdown"]' });
@@ -62,6 +64,12 @@ export function init(id, invoke) {
6264
}
6365
});
6466

67+
if (changedEventCallback) {
68+
EventHandler.on(input, 'change', e => {
69+
invoke.invokeMethodAsync(changedEventCallback, e.target.value);
70+
});
71+
}
72+
6573
let filterDuration = duration;
6674
if (filterDuration === 0) {
6775
filterDuration = 200;

0 commit comments

Comments
 (0)