Skip to content

Commit

Permalink
Merge pull request #6048 from bitfoundation/develop
Browse files Browse the repository at this point in the history
Version 7.3.0 (#6046)
  • Loading branch information
msynk authored Nov 14, 2023
2 parents be99167 + ef02940 commit df15fca
Show file tree
Hide file tree
Showing 99 changed files with 830 additions and 491 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"hostRequirements": {
"cpus": 4
},
"onCreateCommand": "wget https://download.visualstudio.microsoft.com/download/pr/9144f37e-b370-41ee-a86f-2d2a69251652/bc1d544112ec134184a5aec7f7a1eaf9/dotnet-sdk-8.0.100-rc.2.23502.2-linux-x64.tar.gz -O $HOME/dotnet.tar.gz && export DOTNET_ROOT=$HOME/.dotnet && mkdir -p \"$DOTNET_ROOT\" && tar zxf $HOME/dotnet.tar.gz -C \"$DOTNET_ROOT\" && export PATH=$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH && dotnet dev-certs https --trust && dotnet build src/BlazorUI/Demo/Client/Web/Bit.BlazorUI.Demo.Client.Web.csproj && dotnet build src/Websites/Platform/src/Bit.Websites.Platform.Web/Bit.Websites.Platform.Web.csproj -t:BeforeBuildTasks --no-restore && dotnet build src/Websites/Sales/src/Bit.Websites.Sales.Web/Bit.Websites.Sales.Web.csproj -t:BeforeBuildTasks --no-restore && dotnet build src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Core/Boilerplate.Client.Core.csproj -t:BeforeBuildTasks --no-restore",
"onCreateCommand": "wget https://download.visualstudio.microsoft.com/download/pr/9144f37e-b370-41ee-a86f-2d2a69251652/bc1d544112ec134184a5aec7f7a1eaf9/dotnet-sdk-8.0.100-rc.2.23502.2-linux-x64.tar.gz -O $HOME/dotnet.tar.gz && export DOTNET_ROOT=$HOME/.dotnet && mkdir -p \"$DOTNET_ROOT\" && tar zxf $HOME/dotnet.tar.gz -C \"$DOTNET_ROOT\" && export PATH=$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH && dotnet dev-certs https --trust && dotnet build src/BlazorUI/Demo/Client/Web/Bit.BlazorUI.Demo.Client.Web.csproj && dotnet build src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj -t:BeforeBuildTasks --no-restore && dotnet build src/Websites/Sales/src/Bit.Websites.Sales.Web/Bit.Websites.Sales.Web.csproj -t:BeforeBuildTasks --no-restore && dotnet build src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Core/Boilerplate.Client.Core.csproj -t:BeforeBuildTasks --no-restore",
"waitFor": "onCreateCommand",
"customizations": {
"codespaces": {
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/adminpanel.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ jobs:
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name AdminPanel --database SqlServer --sample AdminPanel
- name: Update appsettings.json api server address
uses: microsoft/variable-substitution@v1
with:
files: 'AdminPanel/src/Client/Core/appsettings.json'
env:
ApiServerAddress: ${{ env.API_SERVER_ADDRESS }}

- uses: actions/setup-node@v3
with:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/blazorui.demo.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Update appsettings.json api server address
uses: microsoft/variable-substitution@v1
with:
files: 'src/BlazorUI/Demo/Client/Core/appsettings.json'
env:
ApiServerAddress: ${{ env.API_SERVER_ADDRESS }}

- name: Switch to blazor web assembly
run: sed -i 's/Microsoft.NET.Sdk.Web/Microsoft.NET.Sdk.BlazorWebAssembly/g' src/BlazorUI/Demo/Client/Web/Bit.BlazorUI.Demo.Client.Web.csproj
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/todotemplate.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ jobs:
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoTemplate --database SqlServer --sample Todo
- name: Update appsettings.json api server address
uses: microsoft/variable-substitution@v1
with:
files: 'TodoTemplate/src/Client/Core/appsettings.json'
env:
ApiServerAddress: ${{ env.API_SERVER_ADDRESS }}

- name: Switch to blazor web assembly
run: sed -i 's/Microsoft.NET.Sdk.Web/Microsoft.NET.Sdk.BlazorWebAssembly/g' TodoTemplate/src/Client/Web/TodoTemplate.Client.Web.csproj

Expand Down
2 changes: 1 addition & 1 deletion docs/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Building each bit platform project requires specific steps that are explained pe
<br/>

### bit platform Website
This website only requires the basic requirements and can be simply built by running the following command in the `Bit.Websites.Platform.Web` project folder:
This website only requires the basic requirements and can be simply built by running the following command in the `Bit.Websites.Platform.Server` project folder:

```bash
dotnet build
Expand Down
2 changes: 1 addition & 1 deletion src/Bit.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PackageProjectUrl>https://github.com/bitfoundation/bitplatform</PackageProjectUrl>
<PackageIconUrl>https://avatars.githubusercontent.com/u/22663390</PackageIconUrl>

<ReleaseVersion>7.2.0</ReleaseVersion>
<ReleaseVersion>7.3.0</ReleaseVersion>

<PackageReleaseNotes>https://github.com/bitfoundation/bitplatform/releases/tag/v-$(ReleaseVersion)</PackageReleaseNotes>
<PackageVersion>$(ReleaseVersion)</PackageVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{
<i style="@Styles?.Icon" class="bit-icon bit-icon--@iconName @Classes?.Icon" />
}
<span style="@Styles?.Text" class="bit-tgb-txt @Classes?.Text">@GetText()</span>
<span style="@Styles?.Text" class="bit-tgb-btx @Classes?.Text">@GetText()</span>
}
</span>
</button>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public partial class BitToggleButton
private bool IsCheckedHasBeenSet;

private bool isChecked;
private BitButtonSize? size;
private BitButtonStyle buttonStyle = BitButtonStyle.Primary;

private int? _tabIndex;
Expand Down Expand Up @@ -117,6 +118,22 @@ public bool IsChecked
/// </summary>
[Parameter] public string? OnTitle { get; set; }

/// <summary>
/// The size of button, Possible values: Small | Medium | Large
/// </summary>
[Parameter]
public BitButtonSize? Size
{
get => size;
set
{
if (size == value) return;

size = value;
ClassBuilder.Reset();
}
}

/// <summary>
/// Custom CSS styles for different parts of the BitToggleButton component.
/// </summary>
Expand All @@ -139,11 +156,23 @@ protected override void RegisterCssClasses()
{
ClassBuilder.Register(() => Classes?.Root);

ClassBuilder.Register(() => ButtonStyle == BitButtonStyle.Primary
? $"{RootElementClass}-pri"
: $"{RootElementClass}-std");
ClassBuilder.Register(() => IsChecked ? "bit-tgb-chk" : string.Empty);

ClassBuilder.Register(() => IsChecked ? $"{RootElementClass}-chk" : string.Empty);
ClassBuilder.Register(() => ButtonStyle switch
{
BitButtonStyle.Primary => "bit-tgb-pri",
BitButtonStyle.Standard => "bit-tgb-std",
BitButtonStyle.Text => "bit-tgb-txt",
_ => "bit-tgb-pri"
});

ClassBuilder.Register(() => Size switch
{
BitButtonSize.Small => "bit-tgb-sm",
BitButtonSize.Medium => "bit-tgb-md",
BitButtonSize.Large => "bit-tgb-lg",
_ => string.Empty
});
}

protected override void RegisterCssStyles()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

.bit-tgb {
cursor: pointer;
text-align: center;
position: relative;
display: inline-block;
text-align: center;
align-items: center;
display: inline-flex;
text-decoration: none;
min-width: spacing(10);
min-height: spacing(4);
box-sizing: border-box;
justify-content: center;
font-size: spacing(1.75);
padding: spacing(0.5) spacing(2);
border-width: $shape-border-width;
Expand All @@ -21,74 +23,101 @@
cursor: default;
pointer-events: none;
color: $color-foreground-disabled;
border-color: $color-border-disabled;
background-color: $color-background-disabled;
}
}

.bit-tgb-pri {
color: $color-primary-text;
border-color: $color-primary-main;
background-color: $color-primary-main;
color: var(--bit-tgb-pri-clr);
background-color: var(--bit-tgb-bg-clr);
border-color: var(--bit-tgb-pri-brd-clr);
--bit-tgb-bg-clr: #{$color-primary-main};
--bit-tgb-pri-clr: #{$color-primary-text};
--bit-tgb-pri-brd-clr: #{$color-primary-main};
--bit-tgb-pri-hover-bg-clr: #{$color-action-hover-primary};
--bit-tgb-pri-active-bg-clr: #{$color-action-active-primary};
--bit-tgb-chk-bg-clr: #{$color-primary-dark};
--bit-tgb-chk-brd-clr: #{$color-primary-dark};

@media (hover: hover) {
&:hover {
border-color: $color-action-hover-primary;
background-color: $color-action-hover-primary;
border-color: var(--bit-tgb-pri-hover-bg-clr);
background-color: var(--bit-tgb-pri-hover-bg-clr);
}
}

&:active {
border-color: $color-action-active-primary;
background-color: $color-action-active-primary;
border-color: var(--bit-tgb-pri-active-bg-clr);
background-color: var(--bit-tgb-pri-active-bg-clr);
}

&.bit-tgb-chk {
border-color: $color-primary-dark;
background-color: $color-primary-dark;

@media (hover: hover) {
&:hover {
border-color: $color-primary-dark;
background-color: $color-primary-dark;
}
}

&:active {
border-color: $color-primary-dark;
background-color: $color-primary-dark;
}
&.bit-dis {
border-color: $color-border-disabled;
background-color: $color-background-disabled;
}
}

.bit-tgb-std {
color: $color-secondary-text;
border-color: $color-border-primary;
color: var(--bit-tgb-sec-clr);
background-color: $color-secondary-main;
border-color: var(--bit-tgb-sec-brd-clr);
--bit-tgb-sec-clr: #{$color-secondary-text};
--bit-tgb-sec-brd-clr: #{$color-secondary-text};
--bit-tgb-sec-hover-bg-clr: #{$color-action-hover-secondary};
--bit-tgb-sec-active-bg-clr: #{$color-action-active-secondary};
--bit-tgb-chk-bg-clr: #{$color-secondary-dark};
--bit-tgb-chk-brd-clr: #{$color-secondary-text};

@media (hover: hover) {
&:hover {
background-color: $color-action-hover-secondary;
background-color: var(--bit-tgb-sec-hover-bg-clr);
}
}

&:active {
background-color: $color-action-active-secondary;
background-color: var(--bit-tgb-sec-active-bg-clr);
}

&.bit-tgb-chk {
background-color: $color-secondary-dark;
&.bit-dis {
border-color: $color-border-disabled;
}
}

.bit-tgb-txt {
border-color: transparent;
color: var(--bit-tgb-sec-clr);
background-color: transparent;
--bit-tgb-sec-clr: #{$color-secondary-text};
--bit-tgb-sec-hover-bg-clr: #{$color-action-hover-secondary};
--bit-tgb-sec-active-bg-clr: #{$color-action-active-secondary};
--bit-tgb-chk-bg-clr: #{$color-secondary-dark};
--bit-tgb-chk-brd-clr: transparent;

@media (hover: hover) {
&:hover {
background-color: $color-secondary-dark;
}
@media (hover: hover) {
&:hover {
background-color: var(--bit-tgb-sec-hover-bg-clr);
}
}

&:active {
background-color: var(--bit-tgb-sec-active-bg-clr);
}
}

.bit-tgb-chk {
border-color: var(--bit-tgb-chk-brd-clr);
background-color: var(--bit-tgb-chk-bg-clr);

&:active {
background-color: $color-secondary-dark;
@media (hover: hover) {
&:hover {
border-color: var(--bit-tgb-chk-brd-clr);
background-color: var(--bit-tgb-chk-bg-clr);
}
}

&:active {
border-color: var(--bit-tgb-chk-brd-clr);
background-color: var(--bit-tgb-chk-bg-clr);
}
}

.bit-tgb-con {
Expand All @@ -104,6 +133,20 @@
}
}

.bit-tgb-txt {
.bit-tgb-btx {
display: block;
}

.bit-tgb-sm {
min-width: spacing(6);
min-height: spacing(3);
font-size: spacing(1.5);
padding: spacing(0.3) spacing(1.5);
}

.bit-tgb-lg {
min-width: spacing(10);
min-height: spacing(5);
font-size: spacing(2);
padding: spacing(0.7) spacing(2.5);
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Bit.CodeAnalyzers" Version="7.2.0">
<PackageReference Include="Bit.CodeAnalyzers" Version="7.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions src/BlazorUI/Demo/Client/App/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ public static MauiAppBuilder CreateMauiAppBuilder()
#endif

var builder = MauiApp.CreateBuilder();
var assembly = typeof(MainLayout).GetTypeInfo().Assembly;

builder
.UseMauiApp<App>()
.Configuration.AddJsonFile(new EmbeddedFileProvider(assembly), "appsettings.json", optional: false, false);
.Configuration.AddClientConfigurations();

var services = builder.Services;

Expand All @@ -37,11 +36,12 @@ public static MauiAppBuilder CreateMauiAppBuilder()
services.AddBlazorWebViewDeveloperTools();
#endif

Uri.TryCreate(builder.Configuration.GetApiServerAddress(), UriKind.Absolute, out var apiServerAddress);
services.AddScoped(sp =>
{
HttpClient httpClient = new(sp.GetRequiredService<AppHttpClientHandler>())
{
BaseAddress = new Uri(sp.GetRequiredService<IConfiguration>().GetApiServerAddress())
BaseAddress = apiServerAddress
};

return httpClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
<ProjectReference Include="..\..\..\Bit.BlazorUI.Icons\Bit.BlazorUI.Icons.csproj" />
<ProjectReference Include="..\..\..\Bit.BlazorUI.SourceGenerators\Bit.BlazorUI.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />

<PackageReference Include="Bit.CodeAnalyzers" Version="7.2.0">
<PackageReference Include="Bit.CodeAnalyzers" Version="7.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Condition=" '$(BlazorMode)' == 'BlazorWebAssembly' " Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0-rc.2.23479.6" />

<Using Include="System.Net.Http.Json" />
<Using Include="System.Collections.Concurrent" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Reflection;

namespace Microsoft.Extensions.Configuration;

public static class IConfigurationBuilderExtensions
{
public static void AddClientConfigurations(this IConfigurationBuilder builder)
{
var assembly = Assembly.Load("Bit.BlazorUI.Demo.Client.Core");
builder.AddJsonStream(assembly.GetManifestResourceStream("Bit.BlazorUI.Demo.Client.Core.appsettings.json")!);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
namespace Microsoft.Extensions.Configuration;
//-:cnd:noEmit
namespace Microsoft.Extensions.Configuration;
public static class IConfigurationExtensions
{
public static string GetApiServerAddress(this IConfiguration configuration)
{
#if BlazorWebAssembly
return "api/";
#else
return configuration.GetValue<string?>("ApiServerAddress") ?? throw new InvalidOperationException("Could not find ApiServerAddress config");
#endif
var apiServerAddress = configuration.GetValue("ApiServerAddress", defaultValue: "api/")!;

return Uri.TryCreate(apiServerAddress, UriKind.RelativeOrAbsolute, out _) ? apiServerAddress : throw new InvalidOperationException($"Api server address {apiServerAddress} is invalid");
}
}
Loading

0 comments on commit df15fca

Please sign in to comment.