Skip to content

Commit af4662a

Browse files
authored
Merge pull request #10086 from bitfoundation/develop
Version 9.5.1 (#10056)
2 parents bb83737 + 240aad9 commit af4662a

File tree

138 files changed

+1057
-493
lines changed

Some content is hidden

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

138 files changed

+1057
-493
lines changed

src/Besql/Bit.Besql/BesqlPooledDbContextFactory.cs

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
using System.Data.Common;
22
using Microsoft.EntityFrameworkCore;
33
using Microsoft.EntityFrameworkCore.Infrastructure;
4+
using Microsoft.AspNetCore.Components.WebAssembly.Services;
45

56
namespace Bit.Besql;
67

78
public class BesqlPooledDbContextFactory<TDbContext> : PooledDbContextFactoryBase<TDbContext>
89
where TDbContext : DbContext
910
{
1011
private readonly string _fileName;
11-
private readonly IBitBesqlStorage _storage;
1212
private readonly string _connectionString;
13+
private readonly IBitBesqlStorage _storage;
14+
private readonly LazyAssemblyLoader _lazyAssemblyLoader;
1315

1416
public BesqlPooledDbContextFactory(
1517
IBitBesqlStorage storage,
1618
DbContextOptions<TDbContext> options,
17-
Func<IServiceProvider, TDbContext, Task> dbContextInitializer)
19+
Func<IServiceProvider, TDbContext, Task> dbContextInitializer,
20+
LazyAssemblyLoader lazyAssemblyLoader)
1821
: base(options, dbContextInitializer)
1922
{
2023
_connectionString = options.Extensions
@@ -27,10 +30,18 @@ public BesqlPooledDbContextFactory(
2730
}["Data Source"].ToString()!.Trim('/');
2831

2932
_storage = storage;
33+
34+
_lazyAssemblyLoader = lazyAssemblyLoader;
3035
}
3136

3237
protected override async Task InitializeDbContext()
3338
{
39+
try
40+
{
41+
await _lazyAssemblyLoader.LoadAssembliesAsync(["System.Private.Xml.wasm"]);
42+
}
43+
catch { }
44+
3445
if (File.Exists(_fileName) is false)
3546
{
3647
await _storage.Load(_fileName).ConfigureAwait(false);

src/Besql/Bit.Besql/Bit.Besql.csproj

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515

1616
<ItemGroup>
1717
<PackageReference Include="Microsoft.JSInterop" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
18-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
18+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
19+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" Condition="'$(TargetFramework)' == 'net8.0'" />
20+
1921
<PackageReference Include="Microsoft.JSInterop" Version="9.0.0" Condition="'$(TargetFramework)' == 'net9.0'" />
20-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" Condition="'$(TargetFramework)' == 'net9.0'" />
22+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" Condition="'$(TargetFramework)' == 'net9.0'" />
23+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" Condition="'$(TargetFramework)' == 'net9.0'" />
2124
</ItemGroup>
2225

2326
</Project>

src/Besql/Bit.Besql/IServiceCollectionBesqlExtentions.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
using Bit.Besql;
22
using Microsoft.EntityFrameworkCore;
33
#if NET9_0_OR_GREATER
4+
using System.Diagnostics.CodeAnalysis;
45
using Microsoft.EntityFrameworkCore.Migrations;
56
#endif
67
using Microsoft.Extensions.DependencyInjection.Extensions;
8+
using Microsoft.AspNetCore.Components.WebAssembly.Services;
79

810
namespace Microsoft.Extensions.DependencyInjection;
911

1012
public static class IServiceCollectionBesqlExtentions
1113
{
14+
#if NET9_0_OR_GREATER
15+
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BesqlHistoryRepository))]
16+
#endif
1217
public static IServiceCollection AddBesqlDbContextFactory<TDbContext>(this IServiceCollection services,
1318
Action<IServiceProvider, DbContextOptionsBuilder>? optionsAction = null,
1419
Func<IServiceProvider, TDbContext, Task>? dbContextInitializer = null)
@@ -17,7 +22,7 @@ public static IServiceCollection AddBesqlDbContextFactory<TDbContext>(this IServ
1722
optionsAction ??= (_, _) => { };
1823
dbContextInitializer ??= async (_, _) => { };
1924

20-
services.AddSingleton(async (IServiceProvider sp, TDbContext dbContext) =>
25+
services.TryAddSingleton(async (IServiceProvider sp, TDbContext dbContext) =>
2126
{
2227
await dbContext.Database.ConfigureSqliteSynchronous();
2328
await dbContextInitializer(sp, dbContext);
@@ -30,7 +35,8 @@ public static IServiceCollection AddBesqlDbContextFactory<TDbContext>(this IServ
3035

3136
if (OperatingSystem.IsBrowser())
3237
{
33-
services.AddSingleton<BesqlDbContextInterceptor>();
38+
services.TryAddScoped<LazyAssemblyLoader>();
39+
services.TryAddSingleton<BesqlDbContextInterceptor>();
3440
services.TryAddSingleton<IBitBesqlStorage, BitBesqlBrowserCacheStorage>();
3541
// To make optimized db context work in blazor wasm: https://github.com/dotnet/efcore/issues/31751
3642
// https://learn.microsoft.com/en-us/ef/core/performance/advanced-performance-topics?tabs=with-di%2Cexpression-api-with-constant#compiled-models

src/Besql/Bit.Besql/wwwroot/bit-besql.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var BitBesql = window.BitBesql || {};
2-
BitBesql.version = window['bit-besql version'] = '9.5.0';
2+
BitBesql.version = window['bit-besql version'] = '9.5.1';
33

44
BitBesql.persist = async function persist(fileName) {
55

src/Besql/Demo/Bit.Besql.Demo.Client/Bit.Besql.Demo.Client.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.2" />
1414
</ItemGroup>
1515

16+
<ItemGroup>
17+
<BlazorWebAssemblyLazyLoad Include="System.Private.Xml.wasm" />
18+
</ItemGroup>
19+
1620
<ItemGroup>
1721
<ProjectReference Include="..\..\Bit.Besql\Bit.Besql.csproj" />
1822
</ItemGroup>

src/Bit.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<PackageProjectUrl>https://github.com/bitfoundation/bitplatform</PackageProjectUrl>
2828

2929
<!-- Version -->
30-
<ReleaseVersion>9.5.0</ReleaseVersion>
30+
<ReleaseVersion>9.5.1</ReleaseVersion>
3131
<PackageVersion>$(ReleaseVersion)</PackageVersion>
3232
<PackageReleaseNotes>https://github.com/bitfoundation/bitplatform/releases/tag/v-$(ReleaseVersion)</PackageReleaseNotes>
3333
<Version Condition=" '$(Configuration)' == 'Release' ">$([System.String]::Copy($(ReleaseVersion)).Replace('-pre-', '.'))</Version>

src/BlazorUI/Bit.BlazorUI.Extras/Components/NavPanel/BitNavPanel.razor

+14-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,20 @@
3333
<div style="@Styles?.Header" class="bit-npn-hdr @Classes?.Header">
3434
@if (IconUrl.HasValue())
3535
{
36-
<img src="@IconUrl"
37-
class="bit-npn-img @Classes?.HeaderIcon"
38-
style="@(isToggled ? "display:none;" : "") @Styles?.HeaderIcon" />
36+
if (IconNavUrl.HasValue())
37+
{
38+
<a href="@IconNavUrl">
39+
<img src="@IconUrl"
40+
class="bit-npn-img @Classes?.HeaderIcon"
41+
style="@(isToggled ? "display:none;" : "") @Styles?.HeaderIcon" />
42+
</a>
43+
}
44+
else
45+
{
46+
<img src="@IconUrl"
47+
class="bit-npn-img @Classes?.HeaderIcon"
48+
style="@(isToggled ? "display:none;" : "") @Styles?.HeaderIcon" />
49+
}
3950
}
4051

4152
<div class="bit-npn-spc" style="@(isToggled ? "display:none;" : "")" />

src/BlazorUI/Bit.BlazorUI.Extras/Components/NavPanel/BitNavPanel.razor.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ public partial class BitNavPanel<TItem> : BitComponentBase where TItem : class
4242
/// </summary>
4343
[Parameter] public RenderFragment? Header { get; set; }
4444

45+
/// <summary>
46+
/// Renders an anchor wrapping the icon to navigate to the specified url.
47+
/// </summary>
48+
[Parameter] public string? IconNavUrl { get; set; }
49+
4550
/// <summary>
4651
/// The icon url to show in the header of the nav panel.
4752
/// </summary>
@@ -142,11 +147,11 @@ private async Task HandleNavItemClick(TItem item)
142147
{
143148
if (_bitNavRef.GetUrl(item).HasNoValue()) return;
144149

145-
await OnItemClick.InvokeAsync(item);
150+
_filteredNavItems = Items;
146151

147152
await _searchBoxRef.Clear();
148153

149-
_filteredNavItems = Items;
154+
await OnItemClick.InvokeAsync(item);
150155

151156
await ClosePanel();
152157
}

src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<InternalsVisibleTo Include="Bit.BlazorUI.Extras, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d726fe8f1bed8ca2a003848640c872c6a5f2191c81eda677b249a6e34bd9134eba9ff7251582a5020cb3eee83a61e7034ce712f5873d60f7c3c61f48592b256c560d7b3384e9889e4f81e4d406bc2b639915a4062d60751193ae66028d7bd4b9a3bf0823f1e38abe5eadc3cd9615c6ff811974a9f6f89297dc2a722bf23d0bb"/>
21-
<InternalsVisibleTo Include="Bit.BlazorUI.Extras, PublicKey=002400000480000094000000060200000024000052534131000400000100010081a58360c43da697fbbc3b729e3565c1e4ef444878d7764f2e187ff0ca054413b6ad2b2eba16f4f1ad6da8e8be445bb410c43930195696e7f2317dd80164fed318366a83af39ab4c135349f75b3f2b9ad5875fad68025c9e1c4e8d16469addd506f3e1ed13461dd17a8f23f3faeb2cbd933cef6ebead4e50197943798f638aa9"/>
20+
<InternalsVisibleTo Include="Bit.BlazorUI.Extras, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d726fe8f1bed8ca2a003848640c872c6a5f2191c81eda677b249a6e34bd9134eba9ff7251582a5020cb3eee83a61e7034ce712f5873d60f7c3c61f48592b256c560d7b3384e9889e4f81e4d406bc2b639915a4062d60751193ae66028d7bd4b9a3bf0823f1e38abe5eadc3cd9615c6ff811974a9f6f89297dc2a722bf23d0bb" />
21+
<InternalsVisibleTo Include="Bit.BlazorUI.Extras, PublicKey=002400000480000094000000060200000024000052534131000400000100010081a58360c43da697fbbc3b729e3565c1e4ef444878d7764f2e187ff0ca054413b6ad2b2eba16f4f1ad6da8e8be445bb410c43930195696e7f2317dd80164fed318366a83af39ab4c135349f75b3f2b9ad5875fad68025c9e1c4e8d16469addd506f3e1ed13461dd17a8f23f3faeb2cbd933cef6ebead4e50197943798f638aa9" />
2222
</ItemGroup>
2323

2424

src/BlazorUI/Bit.BlazorUI/Components/Inputs/_Pickers/TimePicker/BitTimePicker.razor

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
placeholder="@Placeholder"
4141
value="@CurrentValueAsString"
4242
disabled="@(IsEnabled is false)"
43-
readonly="@(AllowTextInput is false)"
43+
readonly="@(AllowTextInput is false || ReadOnly)"
4444
aria-expanded="@(IsOpen ? "true" : "false")"
4545
aria-controls="@(IsOpen ? _calloutId : null)"
4646
aria-labelledby="@(Label.HasValue() ? _labelId : null)"
@@ -98,6 +98,7 @@
9898
max="@(TimeFormat == BitTimeFormat.TwelveHours ? "12" : "23")"
9999
type="number"
100100
inputmode="numeric"
101+
readonly="@ReadOnly"
101102
style="@Styles?.HourInput"
102103
class="bit-tpc-tin @Classes?.HourInput"
103104
autocomplete="@BitAutoCompleteValue.NewPassword"
@@ -131,6 +132,7 @@
131132
max="59"
132133
type="number"
133134
inputmode="numeric"
135+
readonly="@ReadOnly"
134136
style="@Styles?.MinuteInput"
135137
class="bit-tpc-tin @Classes?.MinuteInput"
136138
autocomplete="@BitAutoCompleteValue.NewPassword"

src/BlazorUI/Bit.BlazorUI/Components/Inputs/_Pickers/TimePicker/BitTimePicker.razor.cs

+3
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ private async Task UpdateCurrentValue()
480480

481481
private async Task HandleOnAmClick()
482482
{
483+
if (ReadOnly) return;
483484
if (IsEnabled is false) return;
484485

485486
_hour %= 12; // "12:-- am" is "00:--" in 24h
@@ -488,6 +489,7 @@ private async Task HandleOnAmClick()
488489

489490
private async Task HandleOnPmClick()
490491
{
492+
if (ReadOnly) return;
491493
if (IsEnabled is false) return;
492494

493495
if (_hour <= 12) // "12:-- pm" is "12:--" in 24h
@@ -582,6 +584,7 @@ private async Task ChangeMinute(bool isNext)
582584

583585
private async Task HandleOnPointerDown(bool isNext, bool isHour)
584586
{
587+
if (ReadOnly) return;
585588
if (IsEnabled is false) return;
586589

587590
await ChangeTime(isNext, isHour);

src/BlazorUI/Bit.BlazorUI/Components/Navs/Nav/BitNav.razor.cs

+2
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,8 @@ private void OnSetParameters()
936936

937937
_items = Items?.ToList() ?? [];
938938
_oldItems = Items;
939+
940+
SetSelectedItemByCurrentUrl();
939941
}
940942

941943
private bool ToggleItemAndParents(IList<TItem> items, TItem item, bool isExpanded)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using Microsoft.AspNetCore.Components.CompilerServices;
2+
3+
namespace Bit.BlazorUI;
4+
5+
/// <summary>
6+
/// A component to easily use predefined bit BlazorUI media queries in Blazor components.
7+
/// </summary>
8+
public partial class BitMediaQuery : BitComponentBase
9+
{
10+
/// <summary>
11+
/// The content of the element.
12+
/// </summary>
13+
[Parameter] public RenderFragment? ChildContent { get; set; }
14+
15+
/// <summary>
16+
/// Specifies the media query to match for the child content.
17+
/// </summary>
18+
[Parameter] public BitScreenQuery? Query { get; set; }
19+
20+
21+
22+
protected override string RootElementClass => "bit-mdq";
23+
24+
protected override void RegisterCssClasses()
25+
{
26+
ClassBuilder.Register(() => Query switch
27+
{
28+
BitScreenQuery.Xs => "bit-mdq-xs",
29+
BitScreenQuery.Sm => "bit-mdq-sm",
30+
BitScreenQuery.Md => "bit-mdq-md",
31+
BitScreenQuery.Lg => "bit-mdq-lg",
32+
BitScreenQuery.Xl => "bit-mdq-xl",
33+
BitScreenQuery.Xxl => "bit-mdq-xxl",
34+
BitScreenQuery.LtSm => "bit-mdq-ltsm",
35+
BitScreenQuery.LtMd => "bit-mdq-ltmd",
36+
BitScreenQuery.LtLg => "bit-mdq-ltlg",
37+
BitScreenQuery.LtXl => "bit-mdq-ltxl",
38+
BitScreenQuery.LtXxl => "bit-mdq-ltxxl",
39+
BitScreenQuery.GtXs => "bit-mdq-gtxs",
40+
BitScreenQuery.GtSm => "bit-mdq-gtsm",
41+
BitScreenQuery.GtMd => "bit-mdq-gtmd",
42+
BitScreenQuery.GtLg => "bit-mdq-gtlg",
43+
BitScreenQuery.GtXl => "bit-mdq-gtxl",
44+
_ => string.Empty
45+
});
46+
}
47+
48+
protected override void BuildRenderTree(RenderTreeBuilder builder)
49+
{
50+
builder.OpenElement(0, "div");
51+
builder.AddMultipleAttributes(1, RuntimeHelpers.TypeCheck(HtmlAttributes));
52+
builder.AddAttribute(2, "id", _Id);
53+
builder.AddAttribute(3, "style", StyleBuilder.Value);
54+
builder.AddAttribute(4, "class", ClassBuilder.Value);
55+
builder.AddAttribute(5, "dir", Dir?.ToString().ToLower());
56+
builder.AddAttribute(6, "aria-label", AriaLabel);
57+
builder.AddElementReferenceCapture(7, v => RootElement = v);
58+
builder.AddContent(8, ChildContent);
59+
builder.CloseElement();
60+
61+
base.BuildRenderTree(builder);
62+
}
63+
}

0 commit comments

Comments
 (0)